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'] ?? ''