Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
eae6735c30
@ -47,6 +47,7 @@ class OrderLogic extends BaseLogic
|
||||
public static $pay_price;
|
||||
public static $cost;
|
||||
public static $profit;
|
||||
public static $store_price;//门店零售价
|
||||
public static $activity_price;
|
||||
|
||||
/**
|
||||
@ -69,6 +70,7 @@ class OrderLogic extends BaseLogic
|
||||
self::$cost = 0; //成本由采购价替代原成本为门店零售价
|
||||
self::$profit = 0; //利润
|
||||
self::$activity_price = 0; //活动减少
|
||||
self::$store_price = 0; //门店零售价
|
||||
/** 计算价格 */
|
||||
|
||||
foreach ($cart_select as $k => $v) {
|
||||
@ -77,11 +79,9 @@ class OrderLogic extends BaseLogic
|
||||
continue;
|
||||
}
|
||||
unset($cart_select[$k]['id']);
|
||||
if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){
|
||||
$find['price'] = $find['cost'];
|
||||
}
|
||||
|
||||
$cart_select[$k]['price'] = $find['price'];
|
||||
$cart_select[$k]['cost'] = $find['cost'];
|
||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||
$cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额
|
||||
|
||||
@ -94,6 +94,7 @@ class OrderLogic extends BaseLogic
|
||||
// $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润
|
||||
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
|
||||
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额
|
||||
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价
|
||||
$cart_select[$k]['product_id'] = $find['product_id'];
|
||||
$cart_select[$k]['old_cart_id'] = $v['id'];
|
||||
$cart_select[$k]['cart_num'] = $v['cart_num'];
|
||||
@ -114,9 +115,17 @@ class OrderLogic extends BaseLogic
|
||||
self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2);
|
||||
self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
|
||||
self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
|
||||
self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格
|
||||
// self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
||||
}
|
||||
$preferential_amount = 0;//差价(用户为UserShipEnum::DISCOUNT_ARRAY 的时候的优惠差价)
|
||||
|
||||
$pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||
if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){
|
||||
$pay_price =bcsub(self::$store_price, self::$activity_price, 2); //减去活动优惠金额
|
||||
$preferential_amount = bcsub(self::$pay_price,self::$store_price,2);
|
||||
}
|
||||
|
||||
$vipPrice = 0;
|
||||
//成本价 收益
|
||||
$order = [
|
||||
@ -138,6 +147,7 @@ class OrderLogic extends BaseLogic
|
||||
'activities' => self::$activity_price>0?1:0,
|
||||
'deduction_price' => self::$activity_price,
|
||||
'is_vip' => 0,
|
||||
'preferential_amount' => $preferential_amount,
|
||||
|
||||
];
|
||||
$order['default_delivery'] = 0;
|
||||
|
@ -136,13 +136,15 @@ class StoreOrderController extends BaseAdminController
|
||||
public function checkSms()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->post()->goCheck('check');
|
||||
|
||||
$params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单
|
||||
$user= User::where('id',$params['uid'])->find();
|
||||
if(empty($user)){
|
||||
return $this->fail('无该用户请检查');
|
||||
}
|
||||
$order = StoreOrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params);
|
||||
if(!$order){
|
||||
return $this->fail(StoreOrderLogic::getError());
|
||||
}
|
||||
if($order['order']['pay_price'] > $user['purchase_funds']){
|
||||
return $this->fail('当前用户采购款不足支付');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user