diff --git a/app/admin/controller/beforehand_order/BeforehandOrderController.php b/app/admin/controller/beforehand_order/BeforehandOrderController.php index ee50f728f..2da9829bd 100644 --- a/app/admin/controller/beforehand_order/BeforehandOrderController.php +++ b/app/admin/controller/beforehand_order/BeforehandOrderController.php @@ -174,6 +174,16 @@ class BeforehandOrderController extends BaseAdminController return $this->data($result); } + /** + * @notes 确认预订单 + */ + public function confirm() + { + $params = $this->request->post(); + BeforehandOrderLogic::confirm($params); + return $this->success('确认成功', [], 1, 1); + } + /** * 导出标签 */ diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index 48e3abef4..fd8f380c0 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -34,7 +34,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte public function setSearch(): array { return [ - '=' => ['store_id', 'paid', 'status', 'order_type', 'admin_id', 'store_staff_id'], + '=' => ['store_id', 'paid', 'status', 'order_type', 'admin_id'], '%like' => ['order_id','order_sn'], '%like%' => ['mark'], 'between_time' => 'create_time' @@ -75,6 +75,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte default: break; } + if (!empty($this->params['store_staff_id'])) { + $this->searchWhere[] = ['store_staff_id', '>', 0]; + } if ($order_rk!='') { $oid=WarehouseOrder::where('financial_pm',1)->where('code','like','%'.$order_rk)->column('id'); $this->searchWhere[] = ['warehousing_id','in',$oid]; @@ -236,6 +239,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte */ public function count(): int { + if (!empty($this->params['store_staff_id'])) { + $this->searchWhere[] = ['store_staff_id', '>', 0]; + } return BeforehandOrder::where($this->searchWhere)->count(); } /** diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 13c5e4117..59ac59915 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -604,6 +604,20 @@ class BeforehandOrderLogic extends BaseLogic return $res; } + /** + * @notes 确认预订单 + * @param array $params + * @return bool + */ + public static function confirm(array $params): bool + { + $res = BeforehandOrder::find($params['id']); + if (!empty($res) && $res['is_confirm'] == 0) { + BeforehandOrder::where('id', $params['id'])->update(['is_confirm' => 1]); + } + return true; + } + /** * @notes 获取预订单表详情 diff --git a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php index c243543ba..19c2f89ce 100644 --- a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php +++ b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php @@ -59,6 +59,10 @@ class BeforehandOrderCartInfoLogic extends BaseLogic */ public static function appendAdd(array $params): bool { + $order = BeforehandOrder::where('id', $params['id'])->find(); + if (!empty($order) && $order->is_confirm == 1) { + throw new BusinessException('该订单已确认,不能追加商品'); + } Db::startTrans(); try { $datas = [];