From cce18cfcd5156daad0a24fa868931b0f03457b4d Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Mon, 13 Jan 2025 11:14:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E9=A2=84=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beforehand_order/BeforehandOrderController.php | 10 ++++++++++ .../beforehand_order/BeforehandOrderLists.php | 8 +++++++- .../beforehand_order/BeforehandOrderLogic.php | 14 ++++++++++++++ .../BeforehandOrderCartInfoLogic.php | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) 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 = []; From c12ef1cd298c00d296a642b57dfdc789d45075e5 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 13 Jan 2025 15:52:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(admin):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=95=86=E5=93=81=E9=87=87=E8=B4=AD=E4=BB=B7=E4=B8=BA=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将商品采购价计算逻辑修改为直接使用会员价 - 注释掉原有的通过 StoreProductGroupPrice 模型计算采购价的代码 - 此修改可能影响订单总价计算和后台利润显示 --- app/admin/logic/beforehand_order/BeforehandOrderLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 59ac59915..2590ec6a3 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -901,7 +901,7 @@ class BeforehandOrderLogic extends BaseLogic $v['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); $v['store_name'] = $find['store_name']; $v['mark'] = $find['after_sales']; - $v['purchase'] = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', $user_ship)->value('price'); + $v['purchase'] = $v['vip_price'];//StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', $user_ship)->value('price'); if ($v['purchase']) { $v['pay_price'] = bcmul($v['purchase'], $v['nums'], 2); } else {