Merge pull request 'fix(warehouse): 修复库存商品采购价小于等于0时的总价计算问题' (#343) from dev into main
Reviewed-on: #343
This commit is contained in:
commit
703403947f
@ -48,10 +48,10 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
if (!$storeProduct) {
|
if (!$storeProduct) {
|
||||||
throw new BusinessException('商品不存在');
|
throw new BusinessException('商品不存在');
|
||||||
}
|
}
|
||||||
if($storeProduct['purchase']<=0){
|
|
||||||
throw new BusinessException('采购价必须大于0,'.$params['product_id']);
|
|
||||||
}
|
|
||||||
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
|
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
|
||||||
|
if($storeProduct['purchase']<=0){
|
||||||
|
$total_price=0;
|
||||||
|
}
|
||||||
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
|
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
|
||||||
}
|
}
|
||||||
$before_nums = $storege['nums'];
|
$before_nums = $storege['nums'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user