|
|
@@ -784,7 +784,10 @@ class PurchaseClass extends BaseClass
|
|
|
|
|
|
$giveLevel = $ghs['giveLevel'] ?? 0;
|
|
|
$priceMap = CustomClass::$levelPriceKeyMap;
|
|
|
+ //这个参数应该是要作废的,但下面加的参数是有用的,多处要同步修改,关键词 abandon_add_price_map ,ssh 20260116
|
|
|
$addPriceMap = CustomClass::$levelAddPriceKeyMap;
|
|
|
+ //但这边加的参数是有用的,给指定客户涨价的
|
|
|
+ $addPriceMap['risePercent'] = $ghs['risePercent'] ?? 0;
|
|
|
|
|
|
//累计满减
|
|
|
$totalReachDiscount = 0;
|
|
|
@@ -1004,21 +1007,30 @@ class PurchaseClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//如果有设置指定客户涨价百分之几,然后又设置了涨价的幅度。【这个功能主要用于客户不收他运费,门店不赚钱,收他运费客户不乐意,所以把运费加到花材里】,多处同步修改,关键词rise_percent_rang
|
|
|
- if (isset($data['itemPrice']) && $actPrice >= $data['itemPrice']) {
|
|
|
- if (isset($ghs['risePercent']) && $ghs['risePercent'] > 0) {
|
|
|
- if (isset($ghs['riseRange']) && $ghs['riseRange'] > 0) {
|
|
|
- $risePercent = $ghs['risePercent'];
|
|
|
- $riseRange = $ghs['riseRange'];
|
|
|
- // 计算涨价金额:涨价后金额 * (涨价百分比 / (100 + 涨价百分比))
|
|
|
- $riseAmount = bcmul($data['itemPrice'], bcdiv($risePercent, bcadd(100, $risePercent, 0), 4), 2);
|
|
|
- if($riseAmount>$riseRange){
|
|
|
- //应该退回的金额
|
|
|
- $backAmount = bcsub($riseAmount, $riseRange, 2);
|
|
|
- $actPrice = bcsub($actPrice, $backAmount, 2);
|
|
|
- if(isset($data['orderReachDiscountPrice'])){
|
|
|
- $data['orderReachDiscountPrice'] = bcadd($data['orderReachDiscountPrice'], $backAmount, 2);
|
|
|
- }else{
|
|
|
- $data['orderReachDiscountPrice'] = $backAmount;
|
|
|
+ if (isset($data['itemPrice'])) {
|
|
|
+ if(isset($data['orderReachDiscountPrice'])){
|
|
|
+ $myActPrice = bcadd($actPrice, $data['orderReachDiscountPrice'], 2);
|
|
|
+ }else{
|
|
|
+ $myActPrice = $actPrice;
|
|
|
+ }
|
|
|
+ if($myActPrice >= $data['itemPrice']){
|
|
|
+ if (isset($ghs['risePercent']) && $ghs['risePercent'] > 0) {
|
|
|
+ if (isset($ghs['riseRange']) && $ghs['riseRange'] > 0) {
|
|
|
+ $risePercent = $ghs['risePercent'];
|
|
|
+ $riseRange = $ghs['riseRange'];
|
|
|
+ // 计算涨价金额:涨价后金额 * (涨价百分比 / (100 + 涨价百分比))
|
|
|
+ $riseAmount = bcmul($data['itemPrice'], bcdiv($risePercent, bcadd(100, $risePercent, 0), 4), 2);
|
|
|
+ if($riseAmount>$riseRange){
|
|
|
+ //应该退回的金额
|
|
|
+ $backAmount = bcsub($riseAmount, $riseRange, 2);
|
|
|
+ $actPrice = bcsub($actPrice, $backAmount, 2);
|
|
|
+ if(isset($data['orderReachDiscountPrice'])){
|
|
|
+ if($data['orderReachDiscountPrice']<$backAmount){
|
|
|
+ $data['orderReachDiscountPrice'] = $backAmount;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $data['orderReachDiscountPrice'] = $backAmount;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|