shish 21 часов назад
Родитель
Сommit
0e16f54ca1
2 измененных файлов с 35 добавлено и 27 удалено
  1. 9 5
      app-ghs/controllers/OrderController.php
  2. 26 22
      biz-ghs/product/classes/ProductClass.php

+ 9 - 5
app-ghs/controllers/OrderController.php

@@ -1626,15 +1626,19 @@ class OrderController extends BaseController
                 $bigNum = $currentProduct['bigNum'] ?? 0;
                 if ($limitBuy == 1) {
                     if ($bigNum > 0) {
+
+                        $addPriceMap['couldDiscount'] = 0;
+                        $orgPrice = ProductClass::getFinalPrice($systemInfo, $level, $priceMap, $addPriceMap);
+
                         //限购在这里开发,关键词 xg_develop
-                        $productList[$ptKey]['price'] = $systemPrice;
-                        if ($currentPrice > $systemPrice) {
-                            $diffPrice = bcsub($currentPrice, $systemPrice, 2);
+                        $productList[$ptKey]['price'] = $orgPrice;
+                        if ($currentPrice > $orgPrice) {
+                            $diffPrice = bcsub($currentPrice, $orgPrice, 2);
                             $calcPrice = bcmul($diffPrice, $bigNum, 2);
                             $post['modifyPrice'] = bcsub($post['modifyPrice'], $calcPrice, 2);
                         }
-                        if ($currentPrice < $systemPrice) {
-                            $diffPrice = bcsub($systemPrice, $currentPrice, 2);
+                        if ($currentPrice < $orgPrice) {
+                            $diffPrice = bcsub($orgPrice, $currentPrice, 2);
                             $calcPrice = bcmul($diffPrice, $bigNum, 2);
                             $post['modifyPrice'] = bcadd($post['modifyPrice'], $calcPrice, 2);
                         }

+ 26 - 22
biz-ghs/product/classes/ProductClass.php

@@ -809,30 +809,34 @@ class ProductClass extends BaseClass
         $hjDiscountPrice = $product['hjDiscountPrice'] ?? 0;
         $skDiscountPrice = $product['skDiscountPrice'] ?? 0;
         $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); // 最终价格
+                    }
                 }
             }
         }