From 54844d161ee455b79d1c889004e4cde58387921f Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 2 Jul 2024 10:43:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=87=E6=8D=A2=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E7=9A=84=E9=80=BB=E8=BE=91=E5=92=8C=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/OrderList.php | 4 ++++ app/api/logic/order/OrderLogic.php | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/api/lists/order/OrderList.php b/app/api/lists/order/OrderList.php index e97c09067..410e066f4 100644 --- a/app/api/lists/order/OrderList.php +++ b/app/api/lists/order/OrderList.php @@ -8,6 +8,7 @@ use app\common\lists\ListsSearchInterface; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; use app\common\model\store_order_cart_info\StoreOrderCartInfo; +use app\common\model\store_product\StoreProduct; use app\common\model\store_product_unit\StoreProductUnit; /** @@ -56,6 +57,9 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface ->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,old_cart_id,cart_info')->limit(3)->select() ->each(function ($v) use ($item) { $find = StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id', $item['store_id'])->withTrashed()->find(); + if(empty($find)){ + $find = StoreProduct::where('id', $v['product_id'])->withTrashed()->find(); + } $v['store_name'] = $find['store_name']; $v['image'] = $find['image']; // $v['price'] = $find['price']; diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index e92ce680a..01059da59 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -82,8 +82,11 @@ class OrderLogic extends BaseLogic foreach ($cart_select as $k => $v) { $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find(); if (!$find) { - unset($cart_select[$k]); - continue; +// unset($cart_select[$k]); +// continue; + $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id'; + $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->withTrashed()->find(); + $cart_select[$k]['status'] = 1;//缺货标识 } unset($cart_select[$k]['id']); $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价