shish 3 лет назад
Родитель
Сommit
96a6b4e9f5
1 измененных файлов с 27 добавлено и 27 удалено
  1. 27 27
      biz-ghs/product/classes/ProductClass.php

+ 27 - 27
biz-ghs/product/classes/ProductClass.php

@@ -369,30 +369,12 @@ class ProductClass extends BaseClass
             $price = self::getFinalPrice($v, $level, $priceMap, $addPriceMap);
             //零售做特价时的原价
             if ($level == 0) {
-                //零售做特价时显示的原价,不能删除
-                if(isset($v['skPrice'])){
-                    $list[$k]['prePrice'] = $v['skPrice'];
-                }
+                $currentAddPrice = $v['skMore'] ?? 0;
+                $list[$k]['prePrice'] = bcadd($v['price'], $currentAddPrice, 2);
             }
             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);
+                $currentAddPrice = $v['skMore'] ?? 0;
+                $list[$k]['skPrice'] = bcadd($v['discountPrice'], $currentAddPrice, 2);
             }
             $list[$k]['price'] = $price;
 
@@ -434,16 +416,34 @@ class ProductClass extends BaseClass
             $list[$k]['prePrice'] = $v['price'] ?? 0;
             //今日特价、会员价
             $price = self::getFinalPrice($v, $level, $priceMap, $addPriceMap);
-            //零售做特价时的原价
             if ($level == 0) {
-                $currentAddPrice = $v['skMore'] ?? 0;
-                $list[$k]['prePrice'] = bcadd($v['price'], $currentAddPrice, 2);
+                //零售做特价时显示的原价,不能删除
+                if(isset($v['skPrice'])){
+                    $list[$k]['prePrice'] = $v['skPrice'];
+                }
             }
             if (isset($v['discountPrice']) && $v['discountPrice'] > 0) {
-                $currentAddPrice = $v['skMore'] ?? 0;
-                $list[$k]['skPrice'] = bcadd($v['discountPrice'], $currentAddPrice, 2);
+                //做特价花材时,花材列表和改价列表显示的会员价和零售价,不能删除
+                $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]['price'] = $price;
+
             $cost = $v['cost'] ?? 0;
             $ml = 0;
             if ($price > 0) {