更新委托商品处理
This commit is contained in:
parent
aef33c660c
commit
01cfd79803
@ -155,7 +155,7 @@ class StoreCart extends BaseModel
|
|||||||
'activity_id' => $this->source_id,
|
'activity_id' => $this->source_id,
|
||||||
'product_type' => $this->product_type,
|
'product_type' => $this->product_type,
|
||||||
];
|
];
|
||||||
if ($this->product_type == 98) {
|
if ($this->product_type == 98 || $this->product_type == 99) {
|
||||||
$where['product_id'] = $this->product_id;
|
$where['product_id'] = $this->product_id;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,11 +97,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($order_type == 98 && count($merchantCartList) > 1) {
|
if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) {
|
||||||
throw new ValidateException('采购商品不支持跨店购买');
|
throw new ValidateException('采购、委托商品不支持跨店购买');
|
||||||
}
|
}
|
||||||
$community = [];
|
$community = [];
|
||||||
// 99 委托商品是否设置收货方式 ?
|
|
||||||
if ($order_type == 98) {
|
if ($order_type == 98) {
|
||||||
$sourceIdArray = [];
|
$sourceIdArray = [];
|
||||||
foreach($merchantCart['list'] as $prod){
|
foreach($merchantCart['list'] as $prod){
|
||||||
@ -120,6 +119,24 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($order_type == 99) {
|
||||||
|
$sourceIdArray = [];
|
||||||
|
foreach($merchantCart['list'] as $prod){
|
||||||
|
if ($prod['source_id'] > 0) {
|
||||||
|
$sourceIdArray[] = $prod['source_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($sourceIdArray)) {
|
||||||
|
if (count(array_unique($sourceIdArray)) > 1) {
|
||||||
|
throw new ValidateException('委托商品数据异常');
|
||||||
|
}
|
||||||
|
$community = Db::name('Community')->where('community_id', $sourceIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find();
|
||||||
|
if ($community) {
|
||||||
|
$deliverMethod = Db::name('entrust')->where('community_id', $sourceIdArray[0] ?? 0)->value('deliver_method');
|
||||||
|
$deliverMethodArray = explode(',', $deliverMethod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
unset($merchantCart, $cart);
|
unset($merchantCart, $cart);
|
||||||
$order_price = 0;
|
$order_price = 0;
|
||||||
$total_true_price = 0;
|
$total_true_price = 0;
|
||||||
@ -141,7 +158,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$order_svip_discount = 0;
|
$order_svip_discount = 0;
|
||||||
// 循环计算每个店铺的订单数据 委托商品是否设置收货方式 ?
|
// 循环计算每个店铺的订单数据 委托商品是否设置收货方式 ?
|
||||||
foreach ($merchantCartList as &$merchantCart) {
|
foreach ($merchantCartList as &$merchantCart) {
|
||||||
if ($order_type == 98 && !empty($deliverMethodArray)) {
|
if (($order_type == 98 || $order_type == 99) && !empty($deliverMethodArray)) {
|
||||||
$merchantCart['delivery_way'] = $deliverMethodArray;
|
$merchantCart['delivery_way'] = $deliverMethodArray;
|
||||||
}
|
}
|
||||||
$postageRule = [];
|
$postageRule = [];
|
||||||
@ -173,8 +190,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$product_cart = [];
|
$product_cart = [];
|
||||||
|
|
||||||
foreach ($merchantCart['list'] as $k => $cart) {
|
foreach ($merchantCart['list'] as $k => $cart) {
|
||||||
//处理转售送货方式 委托商品是否设置收货方式 ?
|
if ($order_type == 98 || $order_type == 99) {
|
||||||
if ($order_type == 98) {
|
|
||||||
$merchantCart['list'][$k]['product']['delivery_way'] = $cart['product']['delivery_way'] = $deliverMethod ?? '';
|
$merchantCart['list'][$k]['product']['delivery_way'] = $cart['product']['delivery_way'] = $deliverMethod ?? '';
|
||||||
}
|
}
|
||||||
//获取订单类型, 活动商品单次只能购买一个
|
//获取订单类型, 活动商品单次只能购买一个
|
||||||
@ -962,7 +978,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
if ($orderType == 0 && $pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
if ($orderType == 0 && $pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
throw new ValidateException('该商品不支持先货后款');
|
throw new ValidateException('该商品不支持先货后款');
|
||||||
}
|
}
|
||||||
if (!in_array($orderType, [0, 98]) && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) {
|
if (!in_array($orderType, [0, 98, 99]) && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) {
|
||||||
throw new ValidateException('活动商品请单独购买');
|
throw new ValidateException('活动商品请单独购买');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,8 +1003,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($orderType == 98 && count($merchantCartList) > 1) {
|
if (($orderType == 98 || $orderType == 99) && count($merchantCartList) > 1) {
|
||||||
throw new ValidateException('采购商品不支持跨店购买');
|
throw new ValidateException('采购、委托商品不支持跨店购买');
|
||||||
}
|
}
|
||||||
if ($hasTake) {
|
if ($hasTake) {
|
||||||
app()->make(UserAddressValidate::class)->scene('take')->check($post);
|
app()->make(UserAddressValidate::class)->scene('take')->check($post);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user