feat : order

This commit is contained in:
2025-03-06 16:25:25 +08:00
parent 5ad53e55be
commit 88fdd218b3
10 changed files with 82 additions and 57 deletions

View File

@@ -64,8 +64,8 @@ class OrderListService extends BaseService
'order_sno',
'user_id',
'site_id',
'meal_copies',
'optional_copies',
'copies',
'type',
'actual_price',
'total_price',
'status',
@@ -91,7 +91,6 @@ class OrderListService extends BaseService
private function buildData(array &$orderList): void
{
$orderIds = array_column($orderList, 'id');
$siteIds = array_column($orderList, 'site_id');
$orderSkuList = $this->orderGoodModel->whereIn('order_id', $orderIds)->get()->toArray();
$skuIds = [];
@@ -123,7 +122,7 @@ class OrderListService extends BaseService
foreach ($orderList as &$order) {
$orderCopiesList = [];
for ($i = 1; $i <= ($order['meal_copies'] + $order['optional_copies']); $i++) {
for ($i = 1; $i <= ($order['copies'] ?? 0); $i++) {
$oneCopiesInfo = [
'total_price' => '0.00',
@@ -131,7 +130,7 @@ class OrderListService extends BaseService
// 'sku_list' => [],
'image_list' => [],
'take_food_code' => [], //todo 取餐码
'copies_type' => 0,
// 'copies_type' => 0,
];
foreach ($newOrderSkuList[$order['id']][$i] as $item) {
@@ -144,7 +143,7 @@ class OrderListService extends BaseService
// $oneCopiesInfo['sku_list'][] = [];
$oneCopiesInfo['image_list'][] = $imageList[$imageId]['url'] ?? [];
if ($oneCopiesInfo['copies_type'] == 0) $oneCopiesInfo['copies_type'] = $item['type'];
// if ($oneCopiesInfo['copies_type'] == 0) $oneCopiesInfo['copies_type'] = $item['type'];
}
// foreach ($newOrderSkuList as $item) {
// if ($item['order_id'] != $order['id'] || $item['copies'] != $i) continue;