|
|
@@ -734,7 +734,8 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//输出价格 ssh 20211009
|
|
|
- public static function getFinalPrice($product, $level, $priceMap, $addPriceMap, $changePrice = 0, $buyNum = 0)
|
|
|
+ //$params 原来是 $addPriceMap,现在 $addPriceMap 值没用了,把它改成 $params ,用作传别的参数
|
|
|
+ public static function getFinalPrice($product, $level, $priceMap, $params, $changePrice = 0, $buyNum = 0)
|
|
|
{
|
|
|
//开单改价优先级最高
|
|
|
if ($changePrice > 0) {
|
|
|
@@ -769,6 +770,20 @@ class ProductClass extends BaseClass
|
|
|
$price = bcsub($price, $reachNumDiscount, 2);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //这个 $risePercent 可能是正整数,也可能是负整数,如果是10表示$price涨价10%,如果是-10表示降价10%,同时$prce降价后,不能小于0.01
|
|
|
+ $risePercent = $param['risePercent'] ?? 0;
|
|
|
+ if ($risePercent != 0) {
|
|
|
+ // risePercent为正数表示涨价百分比,负数表示降价百分比
|
|
|
+ $priceAdjustment = bcmul($price, bcdiv($risePercent, 100, 4), 2);
|
|
|
+ $price = bcadd($price, $priceAdjustment, 2);
|
|
|
+
|
|
|
+ // 降价后不能小于0.01
|
|
|
+ if ($price < 0.01) {
|
|
|
+ $price = 0.01;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return $price;
|
|
|
}
|
|
|
|