From 9103d26df933264ec7e4312e6934d557411908f4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 12 Oct 2024 20:53:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A2=84=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=80=BB=E8=BE=91=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在生成预订单时增加订单类型的判断,避免生成支付订单 - 优化预订单列表展示,增加出库单ID字段 - 完善从商城订单转换为预订单的逻辑,防止重复转换 - 修复了一些潜在的逻辑错误和数据一致性问题 --- .../lists/beforehand_order/BeforehandOrderLists.php | 2 +- .../logic/beforehand_order/BeforehandOrderLogic.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index b113dcf3c..0a8258efe 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -43,7 +43,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','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']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item){ diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 0119b3e34..fa2c7bfb1 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -92,9 +92,12 @@ class BeforehandOrderLogic extends BaseLogic */ public static function generateOrder(array $params): bool { + $order = BeforehandOrder::where('id', $params['id'])->find(); + if ($order['order_type']==4) { + throw new BusinessException('该订单类型不能生成支付订单'); + } Db::startTrans(); try { - $order = BeforehandOrder::where('id', $params['id'])->find(); $cart_info = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray(); $cart_select = []; @@ -225,7 +228,6 @@ class BeforehandOrderLogic extends BaseLogic return true; } catch (\Throwable $e) { Db::rollback(); - d($e); throw new BusinessException($e->getMessage()); } } @@ -345,6 +347,10 @@ class BeforehandOrderLogic extends BaseLogic $datas = []; $order = StoreOrder::where('id', $params['id'])->find(); + $find=BeforehandOrder::where('order_sn',$order['order_id'])->find(); + if($find){ + throw new BusinessException('该订单已转成预定单,请勿重新转'); + } $info = StoreOrderCartInfo::where('oid', $params['id'])->select(); $total_num = $order['total_num']; $total_price = $order['total_price']; @@ -369,6 +375,7 @@ class BeforehandOrderLogic extends BaseLogic 'total_price' => $total_price, 'pay_price' => 0, 'pay_type' => 0, + 'order_type' => 4, 'deduction_price' => 0, 'paid' => 0, 'mark' => $params['mark'] ?? ''