ztt 10 months ago
parent 5b201e60ce
commit 5aed6588cb
  1. 13
      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;

Loading…
Cancel
Save