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); //订单总价