|
|
@@ -325,6 +325,7 @@ class OrderController extends BaseController
|
|
|
$addPriceMap = \bizGhs\custom\classes\CustomClass::$levelAddPriceKeyMap;
|
|
|
$totalWeight = 0;
|
|
|
$totalNum = 0;
|
|
|
+ $totalReachDiscount = 0;
|
|
|
foreach ($productList as $eleKey => $element) {
|
|
|
$level = 0;
|
|
|
$productId = $element['productId'];
|
|
|
@@ -337,6 +338,12 @@ class OrderController extends BaseController
|
|
|
$hasBuyNum = Yii::$app->redis->executeCommand('HGET', [$limitKey, $hdCustomId]);
|
|
|
$hasBuyNum = $num + ($hasBuyNum == null ? 0 : $hasBuyNum); // 已购买总数量
|
|
|
$price = \bizGhs\product\classes\ProductClass::getFinalPrice($product, $level, $priceMap, $addPriceMap, 0, $num, $hasBuyNum);
|
|
|
+ $reachNum = $product['reachNum'] ?? 0;
|
|
|
+ $reachNumDiscount = $product['reachNumDiscount'] ?? 0;
|
|
|
+ if ($reachNum > 0 && $num >= $reachNum && $reachNumDiscount > 0) {
|
|
|
+ $currentReachDiscount = bcmul($reachNumDiscount, $num, 2);
|
|
|
+ $totalReachDiscount = bcadd($totalReachDiscount, $currentReachDiscount, 2);
|
|
|
+ }
|
|
|
$currentTotal = bcmul($price, $num, 2);
|
|
|
$modifyPrice = bcadd($modifyPrice, $currentTotal, 2);
|
|
|
$productList[$eleKey]['unitPrice'] = $price;
|
|
|
@@ -351,6 +358,7 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
$post['product'] = $productList;
|
|
|
+ $post['reachDiscountPrice'] = $totalReachDiscount;
|
|
|
|
|
|
//不能前端传运费过来,只能通过跑腿接口计算出来
|
|
|
unset($post['sendCost']);
|