|
@@ -353,37 +353,37 @@ class StoreOrderComputedServices extends BaseServices
|
|
|
$deductionPrice = 0;
|
|
|
$usedIntegral = 0;
|
|
|
if ($userInfo && $useIntegral && $userInfo['integral'] > 0 && $payPrice) {
|
|
|
- $integralMaxType = sys_config('integral_max_type', 1);//积分抵用上限类型1:积分、2:订单金额比例
|
|
|
- if ($integralMaxType == 1) {//最多抵用积分
|
|
|
- $integralMaxNum = sys_config('integral_max_num', 200);
|
|
|
- if ($integralMaxNum > 0 && $userInfo['integral'] > $integralMaxNum) {
|
|
|
- $integral = $integralMaxNum;
|
|
|
- } else {
|
|
|
- $integral = $userInfo['integral'];
|
|
|
- }
|
|
|
- $deductionPrice = (float)bcmul((string)$integral, (string)$other['integralRatio'], 2);
|
|
|
- if ($deductionPrice < $payPrice) {
|
|
|
- $payPrice = bcsub((string)$payPrice, (string)$deductionPrice, 2);
|
|
|
- $usedIntegral = $integral;
|
|
|
- } else {
|
|
|
- if ($other['integralRatio']) {
|
|
|
- $deductionPrice = $payPrice;
|
|
|
- $usedIntegral = (int)ceil(bcdiv((string)$payPrice, (string)$other['integralRatio'], 2));
|
|
|
- }
|
|
|
- $payPrice = 0;
|
|
|
- }
|
|
|
- } else {//最高抵用比率
|
|
|
- $integralMaxRate = sys_config('integral_max_rate', 0);
|
|
|
- $deductionPrice = (float)bcmul((string)$userInfo['integral'], (string)$other['integralRatio'], 2);
|
|
|
- if ($integralMaxRate > 0 && $integralMaxRate <= 100) {
|
|
|
- $integralMaxPrice = (float)bcmul((string)$payPrice, (string)bcdiv((string)$integralMaxRate, '100', 2), 2);
|
|
|
- } else {
|
|
|
- $integralMaxPrice = $payPrice;
|
|
|
- }
|
|
|
- $deductionPrice = min($deductionPrice, $integralMaxPrice);
|
|
|
- $payPrice = bcsub((string)$payPrice, (string)$deductionPrice, 2);
|
|
|
- $usedIntegral = ceil(bcdiv((string)$deductionPrice, (string)$other['integralRatio'], 2));
|
|
|
- }
|
|
|
+ $integralMaxType = sys_config('integral_max_type', 1);//积分抵用上限类型1:积分、2:订单金额比例
|
|
|
+ if ($integralMaxType == 1) {//最多抵用积分
|
|
|
+ $integralMaxNum = sys_config('integral_max_num', 200);
|
|
|
+ if ($integralMaxNum > 0 && $userInfo['integral'] > $integralMaxNum) {
|
|
|
+ $integral = $integralMaxNum;
|
|
|
+ } else {
|
|
|
+ $integral = $userInfo['integral'];
|
|
|
+ }
|
|
|
+ $deductionPrice = (float)bcmul((string)$integral, (string)$other['integralRatio'], 2);
|
|
|
+ if ($deductionPrice < $payPrice) {
|
|
|
+ $payPrice = bcsub((string)$payPrice, (string)$deductionPrice, 2);
|
|
|
+ $usedIntegral = $integral;
|
|
|
+ } else {
|
|
|
+ if ($other['integralRatio']) {
|
|
|
+ $deductionPrice = $payPrice;
|
|
|
+ $usedIntegral = (int)ceil(bcdiv((string)$payPrice, (string)$other['integralRatio'], 2));
|
|
|
+ }
|
|
|
+ $payPrice = 0;
|
|
|
+ }
|
|
|
+ } else {//最高抵用比率
|
|
|
+ $integralMaxRate = sys_config('integral_max_rate', 0);
|
|
|
+ $deductionPrice = (float)bcmul((string)$userInfo['integral'], (string)$other['integralRatio'], 2);
|
|
|
+ if ($integralMaxRate > 0 && $integralMaxRate <= 100) {
|
|
|
+ $integralMaxPrice = (float)bcmul((string)$payPrice, (string)bcdiv((string)$integralMaxRate, '100', 2), 2);
|
|
|
+ } else {
|
|
|
+ $integralMaxPrice = $payPrice;
|
|
|
+ }
|
|
|
+ $deductionPrice = min($deductionPrice, $integralMaxPrice);
|
|
|
+ $payPrice = bcsub((string)$payPrice, (string)$deductionPrice, 2);
|
|
|
+ $usedIntegral = ceil(bcdiv((string)$deductionPrice, (string)$other['integralRatio'], 2));
|
|
|
+ }
|
|
|
if ($payPrice <= 0) $payPrice = 0;
|
|
|
}
|
|
|
$SurplusIntegral = (int)bcsub((string)$userInfo['integral'], (string)$usedIntegral, 0);
|
|
@@ -457,6 +457,7 @@ class StoreOrderComputedServices extends BaseServices
|
|
|
$sumPrice = $this->getOrderSumPrice($cartInfo, 'sum_price');//获取订单原总金额
|
|
|
$totalPrice = $this->getOrderSumPrice($cartInfo, 'truePrice');//获取订单svip、用户等级优惠之后总金额
|
|
|
$costPrice = $this->getOrderSumPrice($cartInfo, 'costPrice');//获取订单成本价
|
|
|
+ $awardPrice = $this->getOrderSumPrice($cartInfo, 'awardPrice');//获取订单成本价
|
|
|
$vipPrice = $this->getOrderSumPrice($cartInfo, 'vip_truePrice');//获取订单会员优惠金额
|
|
|
|
|
|
//如果满额包邮等于0
|
|
@@ -679,7 +680,7 @@ class StoreOrderComputedServices extends BaseServices
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- return compact('storePostage', 'storeFreePostage', 'isStoreFreePostage', 'sumPrice', 'totalPrice', 'costPrice', 'vipPrice', 'storePostageDiscount', 'cartInfo');
|
|
|
+ return compact('storePostage', 'awardPrice', 'storeFreePostage', 'isStoreFreePostage', 'sumPrice', 'totalPrice', 'costPrice', 'vipPrice', 'storePostageDiscount', 'cartInfo');
|
|
|
}
|
|
|
|
|
|
/**
|