更新采购商品结算

This commit is contained in:
yaooo 2023-08-23 16:05:26 +08:00
parent 20e0f50e54
commit faa2e16f7a
2 changed files with 21 additions and 13 deletions

View File

@ -102,11 +102,14 @@ class StoreOrderCreateRepository extends StoreOrderRepository
} }
$community = []; $community = [];
if ($order_type == 98) { if ($order_type == 98) {
$communityIdArray = []; $sourceIdArray = [];
foreach($merchantCart['list'] as $prod){ foreach($merchantCart['list'] as $prod){
$communityIdArray[] = $prod['source_id'] ?? 0; if ($prod['source_id'] > 0) {
$sourceIdArray[] = $prod['source_id'];
} }
if (count(array_unique($communityIdArray)) > 1) { }
if (count($sourceIdArray)) {
if (count(array_unique($sourceIdArray)) > 1) {
throw new ValidateException('转售商品数据异常'); throw new ValidateException('转售商品数据异常');
} }
$community = Db::name('Community')->where('community_id', $communityIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find(); $community = Db::name('Community')->where('community_id', $communityIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find();
@ -115,6 +118,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$deliverMethodArray = explode(',', $deliverMethod); $deliverMethodArray = explode(',', $deliverMethod);
} }
} }
}
unset($merchantCart, $cart); unset($merchantCart, $cart);
$order_price = 0; $order_price = 0;
$total_true_price = 0; $total_true_price = 0;

View File

@ -527,6 +527,7 @@ class StoreOrderRepository extends BaseRepository
return $cart['activeSku']['active_price']; return $cart['activeSku']['active_price'];
// 更新调货价格 // 更新调货价格
} else if ($cart['product_type'] == '98') { } else if ($cart['product_type'] == '98') {
if ($cart['source_id'] > 0) {
$price = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price'); $price = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price');
if ($price) { if ($price) {
return $price; return $price;
@ -536,6 +537,9 @@ class StoreOrderRepository extends BaseRepository
} else { } else {
return $cart['productAttr']['price']; return $cart['productAttr']['price'];
} }
} else {
return $cart['productAttr']['price'];
}
} }
public function cartByCouponPrice($cart) public function cartByCouponPrice($cart)