From 5aed6588cb88f9257470baac103a1cb170b9bb5a Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Mon, 18 Mar 2024 23:55:25 +0800 Subject: [PATCH] 1 --- addons/shopro/service/order/OrderCreate.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/shopro/service/order/OrderCreate.php b/addons/shopro/service/order/OrderCreate.php index 319de2f..6ca0b28 100755 --- a/addons/shopro/service/order/OrderCreate.php +++ b/addons/shopro/service/order/OrderCreate.php @@ -40,6 +40,8 @@ class OrderCreate protected $warehouse_id = 0; + protected $dispatch_type; + /** * 选择的收货地址信息 */ @@ -157,6 +159,8 @@ class OrderCreate $this->warehouse_id = $params['warehouse_id'] ?? 0; + $this->dispatch_type = $params['dispatch_type'] ?? 'express'; + $this->money = (isset($params['money']) && $params['money'] > 0) ? $params['money'] : 0; // 获取商品信息 @@ -265,7 +269,8 @@ class OrderCreate } // 判断是否有需要收货地址的商品,新版每个商品需要选择配送方式 - $dispatchTypes = array_column($this->goodsList, 'dispatch_type'); +// $dispatchTypes = array_column($this->goodsList, 'dispatch_type'); + $dispatchTypes = [$this->dispatch_type]; // 配送方式为 快递 必须填写收货地址 if (in_array('express', $dispatchTypes)) { // 用户收货地址 @@ -341,7 +346,8 @@ class OrderCreate $current_dispatch_id = $goods['dispatch_id']; // 获取快递配送数据 - if ($buyInfo['dispatch_type'] == 'express' +// if ($buyInfo['dispatch_type'] == 'express' + if (in_array('express', $buyInfo['dispatch_type']) && (!$this->activity['activity'] // 没有活动 || ( $this->activity['activity'] // 有活动,并且(没有是否包邮字段,或者是不包邮) @@ -1200,7 +1206,8 @@ class OrderCreate $orderItem->pay_fee = $pay_fee; // 平均计算单件商品不算运费,算折扣时候的金额 $orderItem->dispatch_status = 0; $orderItem->dispatch_fee = $buyInfo['dispatch_amount']; // 运费模板中商品自动合并后的加权平均运费,没有扣除包邮优惠 - $orderItem->dispatch_type = $buyInfo['dispatch_type']; +// $orderItem->dispatch_type = $buyInfo['dispatch_type']; + $orderItem->dispatch_type = $this->dispatch_type; $orderItem->dispatch_id = $buyInfo['dispatch_id'] ? $buyInfo['dispatch_id'] : 0; $orderItem->aftersale_status = 0; $orderItem->comment_status = 0;