diff --git a/app/admin/controller/beforehand_order_cart_info/BeforehandOrderCartInfoController.php b/app/admin/controller/beforehand_order_cart_info/BeforehandOrderCartInfoController.php index 68aa3537c..3f43f7acc 100644 --- a/app/admin/controller/beforehand_order_cart_info/BeforehandOrderCartInfoController.php +++ b/app/admin/controller/beforehand_order_cart_info/BeforehandOrderCartInfoController.php @@ -7,6 +7,7 @@ use app\admin\controller\BaseAdminController; use app\admin\lists\beforehand_order_cart_info\BeforehandOrderCartInfoLists; use app\admin\logic\beforehand_order_cart_info\BeforehandOrderCartInfoLogic; use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; +use app\common\model\purchase_product_offer\PurchaseProductOffer; /** * 预订单购物详情表控制器 @@ -61,7 +62,17 @@ class BeforehandOrderCartInfoController extends BaseAdminController */ public function procurement_status(){ $id=$this->request->post('id'); - $res=BeforehandOrderCartInfo::where('id',$id)->update(['is_buyer'=>-1]); + + $res=BeforehandOrderCartInfo::where('id',$id)->find(); + $find=PurchaseProductOffer::where(['product_id'=>$res['product_id'],'order_id'=>$res['bhoid']])->find(); + if($find){ + if($find['buyer_confirm']==1){ + return $this->fail('该商品已采购完成,无法更改状态'); + }else{ + PurchaseProductOffer::where('id',$find['id'])->update(['delete_time'=>time()]); + } + } + $res->save(['is_buyer'=>-1]); if($res){ return $this->success('操作成功',[],1,1); }else{ diff --git a/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php b/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php index 838354948..8ef810926 100644 --- a/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php +++ b/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php @@ -11,6 +11,7 @@ use app\common\model\store_product\StoreProduct; use app\common\model\warehouse_product_storege\WarehouseProductStorege; use app\common\lists\ListsExcelInterface; use app\common\model\beforehand_order\BeforehandOrder; +use app\common\model\store_category\StoreCategory; use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\system_store\SystemStore; @@ -68,6 +69,7 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe $item['image'] = $find['image']; $item['unit'] = $find['unit']; $item['top_cate_id'] = $find['top_cate_id']; + $item['top_cate_name']=StoreCategory::where('id',$item['top_cate_id'])->value('name'); if ($item->bhoid) { $status = PurchaseProductOffer::where('order_id', $item->bhoid)->where('product_id', $item->product_id)->value('status'); if ($status == 1) {