shish 3 tahun lalu
induk
melakukan
a35248f71e

+ 1 - 1
app-ghs/controllers/ProductController.php

@@ -217,7 +217,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         } elseif ($requestType == 'changePrice') {
             //修改价格列表
-            $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,presell,frontHide';
+            $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,presell,frontHide';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::changePriceGroup($itemInfoData, $level);
         } elseif ($requestType == 'changeStock') {

+ 6 - 38
biz-ghs/product/classes/ProductClass.php

@@ -424,23 +424,8 @@ class ProductClass extends BaseClass
             }
             if (isset($v['discountPrice']) && $v['discountPrice'] > 0) {
                 //做特价花材时,花材列表和改价列表显示的会员价和零售价,不能删除
-                $addPrice = $v['addPrice'] ?? 0;
-                $hjAddPrice = $v['hjAddPrice'] ?? 0;
-                $diff = bcsub($addPrice, $hjAddPrice, 2);
-                if ($diff > 0 && $v['discountPrice'] > $diff) {
-                    $hjPrice = bcsub($v['discountPrice'], $diff, 2);
-                } else {
-                    $hjPrice = $v['discountPrice'];
-                }
-                $list[$k]['hjPrice'] = floatval($hjPrice);
-                $skMore = $v['skMore'] ?? 0;
-                $diff = bcsub($skMore, $addPrice, 2);
-                if ($diff > 0) {
-                    $skPrice = bcadd($v['discountPrice'], $diff, 2);
-                } else {
-                    $skPrice = $v['discountPrice'];
-                }
-                $list[$k]['skPrice'] = floatval($skPrice);
+                $list[$k]['hjPrice'] = floatval($v['hjDiscountPrice']);
+                $list[$k]['skPrice'] = floatval($v['skDiscountPrice']);
             }
             $list[$k]['price'] = $price;
 
@@ -664,35 +649,18 @@ class ProductClass extends BaseClass
         }
         $currentPriceField = $priceMap[$level] ?? 'price';
         $price = $product[$currentPriceField] ?? 0;
-        //今日特价
         $discountPrice = $product['discountPrice'] ?? 0;
+        $hjDiscountPrice = $product['hjDiscountPrice'] ?? 0;
+        $skDiscountPrice = $product['skDiscountPrice'] ?? 0;
         if ($discountPrice > 0) {
             if ($level == 0) {
-                $skMore = $product['skMore'] ?? 0;
-                $addPrice = $product['addPrice'] ?? 0;
-                $diff = bcsub($skMore, $addPrice, 2);
-                if ($diff > 0) {
-                    $price = bcadd($discountPrice, $diff, 2);
-                } else {
-                    $price = $discountPrice;
-                }
+                $price = $skDiscountPrice;
             }
             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 = $discountPrice;
-                    }
-                } else {
-                    $price = $discountPrice;
-                }
+                $price = $hjDiscountPrice;
             }
         }
         return $price;