diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 443f98b4..8d7d1976 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -247,7 +247,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository } $svip_discount = 0; $realPrice = $this->cartByPrice($cart); - if ($cart['product_type'] == 98) { + if ($cart['product_type'] == 98 || $cart['product_type'] == 99) { $cart['product']['price'] = $realPrice; $cart['productAttr']['price'] = $realPrice; $cart['productAttr']['stock'] = $cart['cart_num']; diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index b2a69935..a9747710 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -539,6 +539,18 @@ class StoreOrderRepository extends BaseRepository } else { return $cart['productAttr']['price']; } + // 更新委托价格 + } else if ($cart['product_type'] == '99') { + if ($cart['source_id'] > 0) { + $price = Db::name('entrust')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price'); + if ($price) { + return $price; + } else { + throw new ValidateException('委托商品数据异常'); + } + } else { + return $cart['productAttr']['price']; + } } else { return $cart['productAttr']['price']; } @@ -588,7 +600,7 @@ class StoreOrderRepository extends BaseRepository //activity_type:0普通订单 98采购订单 99委托商品 //$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type); $isUser = 1; - if ($product_type == 98) { + if ($product_type == 98 || $product_type == 99) { $isUser = 0; } $noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); diff --git a/app/listener/OrderCreate.php b/app/listener/OrderCreate.php index 11eff96c..6377f29b 100644 --- a/app/listener/OrderCreate.php +++ b/app/listener/OrderCreate.php @@ -18,7 +18,7 @@ class OrderCreate { $groupOrder = $event['groupOrder']; $order = $groupOrder->orderList[0]; - if ($order['pay_type'] != StoreGroupOrder::PAY_TYPE_CREDIT_BUY || $order['activity_type'] != 98) { + if ($order['pay_type'] != StoreGroupOrder::PAY_TYPE_CREDIT_BUY || !in_array($order['activity_type'], [98, 99])) { return true; } /** @var StoreOrderInterestRepository $storeOrderInterestRepository */