更新委托商品生成订单处理

This commit is contained in:
yaooo 2023-09-07 14:44:18 +08:00
parent cfd47d436a
commit 79fdbef9d3
3 changed files with 15 additions and 3 deletions

View File

@ -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'];

View File

@ -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_type0普通订单 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();

View File

@ -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 */