feat(order): 修改订单逻辑,调整会员待返回金额计算方式

This commit is contained in:
mkm 2024-07-22 14:30:40 +08:00
parent 5c24c8713e
commit bdd0784d3e

View File

@ -71,7 +71,7 @@ class OrderLogic extends BaseLogic
self::setError('购物车为空');
return false;
}
try {
// try {
self::$total_price = 0;
self::$pay_price = 0;
self::$cost = 0; //成本由采购价替代原成本为门店零售价
@ -138,15 +138,15 @@ class OrderLogic extends BaseLogic
$cart_select[$k]['vip_frozen_price'] = 0;
$cart_select[$k]['store_info'] = $find['store_info'];
//会员待返回金额
if ($user && $off_activity == 0) {
if ($user['user_ship'] == 4) {
//商户
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['store_price'], 2);
} else {
//其他会员
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['vip_price'], 2);
}
}
// if ($user && $off_activity == 0) {
// if ($user['user_ship'] == 4) {
// //商户
// $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['store_price'], 2);
// } else {
// //其他会员
// $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['vip_price'], 2);
// }
// }
// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
$cartInfo = $cart_select[$k];
$cartInfo['name'] = $find['store_name'];
@ -163,7 +163,7 @@ class OrderLogic extends BaseLogic
self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2); //商户价
self::$deduction_price = bcadd(self::$deduction_price, $deduction_price, 2); //抵扣金额
self::$frozen_money = bcadd(self::$frozen_money, $cart_select[$k]['vip_frozen_price'], 2); //返还金额
// self::$frozen_money = bcadd(self::$frozen_money, $cart_select[$k]['vip_frozen_price'], 2); //返还金额
//计算生鲜
if ($createOrder == 1 && $find['top_cate_id'] == 15201) {
self::$fresh_price = bcadd(self::$fresh_price, $cart_select[$k]['pay_price'], 2);
@ -249,10 +249,10 @@ class OrderLogic extends BaseLogic
}
}
}
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
// } catch (\Exception $e) {
// self::setError($e->getMessage());
// return false;
// }
return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store']];
}