fix(warehouse): 修复库存商品总价计算逻辑
- 在更新库存商品数量时,增加了对商品采购价的判断 - 当采购价小于等于 0 时,将总价设置为 0,否则正常计算总价
This commit is contained in:
parent
e3ad6207f5
commit
eb0bcc33c9
@ -48,9 +48,10 @@ class WarehouseProductLogic extends BaseLogic
|
||||
if (!$storeProduct) {
|
||||
throw new BusinessException('商品不存在');
|
||||
}
|
||||
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
|
||||
if($storeProduct['purchase']<=0){
|
||||
$total_price=0;
|
||||
}else{
|
||||
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
|
||||
}
|
||||
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user