瀏覽代碼

超级会员 特价管理

shish 3 年之前
父節點
當前提交
54bfd72c8c
共有 1 個文件被更改,包括 18 次插入4 次删除
  1. 18 4
      biz-ghs/product/classes/ProductClass.php

+ 18 - 4
biz-ghs/product/classes/ProductClass.php

@@ -622,11 +622,25 @@ class ProductClass extends BaseClass
         $discountPrice = $product['discountPrice'] ?? 0;
         if ($discountPrice > 0) {
             if ($level == 0) {
-                $currentAddPrice = $product['skMore'] ?? 0;
-                $price = bcadd($discountPrice, $currentAddPrice, 2);
-            } else {
                 $price = $discountPrice;
             }
+            if ($level == 1) {
+                $price = $discountPrice;
+            }
+            if ($level == 2) {
+                $hjAddPrice = $product['hjAddPrice'] ?? 0;
+                $addPrice = $product['addPrice'] ?? 0;
+                $diff = bcsub($addPrice, $hjAddPrice, 2);
+                if ($diff > 0) {
+                    if ($discountPrice > $diff) {
+                        $price = bcsub($discountPrice, $diff, 2);
+                    } else {
+                        $price = 0.01;
+                    }
+                } else {
+                    $price = $discountPrice;
+                }
+            }
         }
         return $price;
     }
@@ -1032,7 +1046,7 @@ class ProductClass extends BaseClass
         if (empty($productInfo)) {
             return false;
         }
-        if(empty($price)){
+        if (empty($price)) {
             util::fail('没有批发价');
         }
         $productInfo->price = $price;