refactor(OrderLogic): 修改订单逻辑以支持新活动状态与库存计算, 重构利润计算方式

This commit is contained in:
mkm 2024-06-09 16:49:20 +08:00
parent c29ac07abf
commit 1d55d6c5c1

View File

@ -74,7 +74,10 @@ class OrderLogic extends BaseLogic
// $productBase = StoreProduct::where('id', $find['product_id'])->withTrashed()->field('price,ot_price,cost')->find();
if (isset($check) && $check['status'] == 1) {
self::$activity_price = bcadd(self::$activity_price, bcmul($find['price'],0.9,2), 2);
//零售价*折扣率
$activity_price=bcmul($find['price'],0.9,2);
self::$activity_price = bcadd(self::$activity_price, bcsub($find['price'],$activity_price,2), 2);
$find['price'] = $activity_price;
}
//利润
$onePrice = bcsub($find['price'], $find['cost'], 2);