feat(OrderLogic): 修改订单逻辑以支持新活动与库存计算
This commit is contained in:
parent
b1e86f9249
commit
214b876c37
@ -41,6 +41,7 @@ class OrderLogic extends BaseLogic
|
|||||||
public static $total;
|
public static $total;
|
||||||
public static $cost;
|
public static $cost;
|
||||||
public static $profit;
|
public static $profit;
|
||||||
|
public static $activity_price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 获取购物车商品信息
|
* @notes 获取购物车商品信息
|
||||||
@ -60,6 +61,7 @@ class OrderLogic extends BaseLogic
|
|||||||
self::$total = 0;
|
self::$total = 0;
|
||||||
self::$cost = 0;//成本
|
self::$cost = 0;//成本
|
||||||
self::$profit = 0;//利润
|
self::$profit = 0;//利润
|
||||||
|
self::$activity_price = 0;//活动减少
|
||||||
|
|
||||||
/** 计算价格 */
|
/** 计算价格 */
|
||||||
$check = DictType::where('type', 'activities')->find();
|
$check = DictType::where('type', 'activities')->find();
|
||||||
@ -68,11 +70,13 @@ class OrderLogic extends BaseLogic
|
|||||||
if (!$find) {
|
if (!$find) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
unset($cart_select[$k]['id']);
|
||||||
|
|
||||||
// $productBase = StoreProduct::where('id', $find['product_id'])->withTrashed()->field('price,ot_price,cost')->find();
|
// $productBase = StoreProduct::where('id', $find['product_id'])->withTrashed()->field('price,ot_price,cost')->find();
|
||||||
if (isset($check) && $check['status'] == 1) {
|
if (isset($check) && $check['status'] == 1) {
|
||||||
|
self::$activity_price = bcadd(self::$activity_price, bcmul($find['price'],$find['cost'],2), 2);
|
||||||
$find['price'] = $find['cost'];
|
$find['price'] = $find['cost'];
|
||||||
}
|
}
|
||||||
unset($cart_select[$k]['id']);
|
|
||||||
//利润
|
//利润
|
||||||
$onePrice = bcsub($find['price'], $find['cost'], 2);
|
$onePrice = bcsub($find['price'], $find['cost'], 2);
|
||||||
$cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2);//利润
|
$cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2);//利润
|
||||||
|
Loading…
x
Reference in New Issue
Block a user