修复:酒道馆进货 批量进货时价格和数量计算错误

This commit is contained in:
wuhui_zzw 2024-06-04 13:32:37 +08:00
parent 7923620413
commit 234a9b084b
1 changed files with 6 additions and 0 deletions

View File

@ -82,6 +82,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
//检查商品类型, 活动商品只能单独购买
foreach($merchantCartList as $merchantCart){
foreach($merchantCart['list'] as $cart){
// 判断:是否按照批量购买 批量购买修改购买数量
if($cart['is_batch'] == 1){
$batch_num = $cart['batch_num'] ?? 1;
$cart['cart_num'] = (float)sprintf("%.2f", $batch_num * $cart['cart_num']);
}
if($cart['product_type'] == 0){
if($cart['product']['once_min_count'] > 0 && $cart['product']['once_min_count'] > $cart['cart_num']) throw new ValidateException('[低于起购数:'.$cart['product']['once_min_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...');
if($cart['product']['pay_limit'] == 1 && $cart['product']['once_max_count'] < $cart['cart_num']) throw new ValidateException('[超出单次限购数:'.$cart['product']['once_max_count'].']'.mb_substr($cart['product']['store_name'],0,10).'...');