更新采购商品结算

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,17 +102,21 @@ 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)) {
throw new ValidateException('转售商品数据异常'); if (count(array_unique($sourceIdArray)) > 1) {
} throw new ValidateException('转售商品数据异常');
$community = Db::name('Community')->where('community_id', $communityIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find(); }
if ($community) { $community = Db::name('Community')->where('community_id', $communityIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find();
$deliverMethod = Db::name('resale')->where('community_id', $communityIdArray[0] ?? 0)->value('deliver_method'); if ($community) {
$deliverMethodArray = explode(',', $deliverMethod); $deliverMethod = Db::name('resale')->where('community_id', $communityIdArray[0] ?? 0)->value('deliver_method');
$deliverMethodArray = explode(',', $deliverMethod);
}
} }
} }
unset($merchantCart, $cart); unset($merchantCart, $cart);

View File

@ -527,11 +527,15 @@ 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') {
$price = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price'); if ($cart['source_id'] > 0) {
if ($price) { $price = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price');
return $price; if ($price) {
return $price;
} else {
throw new ValidateException('转售商品数据异常');
}
} else { } else {
throw new ValidateException('转售商品数据异常'); return $cart['productAttr']['price'];
} }
} else { } else {
return $cart['productAttr']['price']; return $cart['productAttr']['price'];