diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index e5121912e..c8c213e8d 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -7,6 +7,7 @@ use app\admin\lists\BaseAdminDataLists; use app\common\model\beforehand_order\BeforehandOrder; use app\common\lists\ListsSearchInterface; use app\common\model\auth\Admin; +use app\common\model\purchase_product_offer\PurchaseProductOffer; /** * 预订单表列表 @@ -43,7 +44,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte public function lists(): array { return BeforehandOrder::where($this->searchWhere) - ->field(['id','order_id', 'uid','order_type','total_num','total_price','outbound_id','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark']) + ->field(['id','order_id', 'uid','order_type','total_num','total_price','outbound_id','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark','warehousing_id']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item){ @@ -63,6 +64,16 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte }elseif($item->order_type==5){ $item->order_type_name='仓库补货'; } + $item->msg=''; + $count1=PurchaseProductOffer::where('order_id',$item->id)->where('buyer_confirm',0)->count('id'); + if($count1>0){ + $item->msg='有'.$count1.'个商品采购中'; + }else{ + $count2=PurchaseProductOffer::where('order_id',$item->id)->where('buyer_confirm',1)->count('id'); + if($count2>0 &&$item['warehousing_id']==0){ + $item->msg='商品没有入库'; + } + } }) ->toArray(); } diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index fa2c7bfb1..03456ae17 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -9,6 +9,7 @@ use app\api\logic\order\OrderLogic; use app\common\model\beforehand_order\BeforehandOrder; use app\common\logic\BaseLogic; use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; +use app\common\model\purchase_product_offer\PurchaseProductOffer; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; use app\common\model\store_order_cart_info\StoreOrderCartInfo; @@ -400,7 +401,12 @@ class BeforehandOrderLogic extends BaseLogic */ public static function delete(array $params): bool { - return BeforehandOrder::destroy($params['id']); + $res= BeforehandOrder::destroy($params['id']); + if($res){ + BeforehandOrderCartInfo::where('bhoid',$params['id'])->update(['delete_time'=>time()]); + PurchaseProductOffer::where('order_id',$params['id'])->update(['delete_time'=>time()]); + } + return $res; }