|
@@ -809,30 +809,34 @@ class ProductClass extends BaseClass
|
|
|
$hjDiscountPrice = $product['hjDiscountPrice'] ?? 0;
|
|
$hjDiscountPrice = $product['hjDiscountPrice'] ?? 0;
|
|
|
$skDiscountPrice = $product['skDiscountPrice'] ?? 0;
|
|
$skDiscountPrice = $product['skDiscountPrice'] ?? 0;
|
|
|
$limitBuy = $product['limitBuy'];
|
|
$limitBuy = $product['limitBuy'];
|
|
|
- if ($discountPrice > 0) {
|
|
|
|
|
- $oldPrice = $price;
|
|
|
|
|
- if ($level == 0) {
|
|
|
|
|
- $price = $skDiscountPrice;
|
|
|
|
|
- }
|
|
|
|
|
- if ($level == 1) {
|
|
|
|
|
- $price = $discountPrice;
|
|
|
|
|
- }
|
|
|
|
|
- if ($level == 2) {
|
|
|
|
|
- $price = $hjDiscountPrice;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //后台开单,如果花材限购的,则不考虑特价,只取原价
|
|
|
|
|
+ $couldDiscount = $param['couldDiscount'] ?? 1;
|
|
|
|
|
+ if($couldDiscount == 1){
|
|
|
|
|
+ if ($discountPrice > 0) {
|
|
|
|
|
+ $oldPrice = $price;
|
|
|
|
|
+ if ($level == 0) {
|
|
|
|
|
+ $price = $skDiscountPrice;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($level == 1) {
|
|
|
|
|
+ $price = $discountPrice;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($level == 2) {
|
|
|
|
|
+ $price = $hjDiscountPrice;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- //超出限购情况的价格计算
|
|
|
|
|
- if ($limitBuy > 0 && $totalBuyNum > $limitBuy) {
|
|
|
|
|
- $hasBuyNum = $totalBuyNum - $buyNum;
|
|
|
|
|
- if ($hasBuyNum >= $limitBuy) {
|
|
|
|
|
- $price = $oldPrice;
|
|
|
|
|
- } else {
|
|
|
|
|
- $overBuyNum = $totalBuyNum - $limitBuy;
|
|
|
|
|
- $overBuyPrice = bcmul($overBuyNum, $oldPrice, 2); // 超出限购部分的价格
|
|
|
|
|
|
|
+ //超出限购情况的价格计算
|
|
|
|
|
+ if ($limitBuy > 0 && $totalBuyNum > $limitBuy) {
|
|
|
|
|
+ $hasBuyNum = $totalBuyNum - $buyNum;
|
|
|
|
|
+ if ($hasBuyNum >= $limitBuy) {
|
|
|
|
|
+ $price = $oldPrice;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $overBuyNum = $totalBuyNum - $limitBuy;
|
|
|
|
|
+ $overBuyPrice = bcmul($overBuyNum, $oldPrice, 2); // 超出限购部分的价格
|
|
|
|
|
|
|
|
- $leftBuyNum = $buyNum - $overBuyNum;
|
|
|
|
|
- $leftBuyPrice = bcmul($leftBuyNum, $price, 2); // 未超出限购部分的价格
|
|
|
|
|
- $price = bcdiv($overBuyPrice + $leftBuyPrice, $buyNum, 2); // 最终价格
|
|
|
|
|
|
|
+ $leftBuyNum = $buyNum - $overBuyNum;
|
|
|
|
|
+ $leftBuyPrice = bcmul($leftBuyNum, $price, 2); // 未超出限购部分的价格
|
|
|
|
|
+ $price = bcdiv($overBuyPrice + $leftBuyPrice, $buyNum, 2); // 最终价格
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|