Просмотр исходного кода

Merge branch '260902_redesign_fix'

shish 1 день назад
Родитель
Сommit
f68a3ebc35

+ 9 - 8
app-ghs/controllers/ItemController.php

@@ -1011,13 +1011,14 @@ class ItemController extends BaseController
         Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'hd');
 
         $prefix = imgUtil::getPrefix();
-
-        $price = $item->skPrice ?? 0;
-        if ($item->discountPrice > 0) {
-            $skMore = $item->skMore ?? 0;
-            $price = bcadd($item->discountPrice, $skMore, 2);
-        }
-
+        // 零售海报价格与商城散客价一致:走 getFinalPrice(有特价用 skDiscountPrice,否则 skPrice)
+        $product = is_object($item) ? $item->toArray() : (array)$item;
+        $price = ProductClass::getFinalPrice(
+            $product,
+            CustomClass::LEVEL_SK,
+            CustomClass::$levelPriceKeyMap,
+            []
+        );
         $staff = $this->shopAdmin;
         $staffName = $staff->name ?? '';
 
@@ -1423,4 +1424,4 @@ class ItemController extends BaseController
         util::complete('修改成功');
     }
 
-}
+}

+ 6 - 2
app-hd/controllers/CategoryController.php

@@ -32,11 +32,15 @@ class CategoryController extends BaseController
         util::success(['list' => $list]);
     }
 
-    //分类列表
+    /**
+     * 分类列表
+     * onlyEnabled=1:仅启用且未删除(门店首页配置关联分类等场景)
+     */
     public function actionList()
     {
         $get = Yii::$app->request->get();
-        $list = CategoryService::getCategoryList($this->mainId);
+        $onlyEnabled = isset($get['onlyEnabled']) && (int)$get['onlyEnabled'] === 1;
+        $list = CategoryService::getCategoryList($this->mainId, $onlyEnabled);
         util::success($list);
     }
 

+ 10 - 2
biz-hd/goods/services/CategoryService.php

@@ -12,10 +12,18 @@ class CategoryService extends BaseService
 {
     public static $baseFile = '\bizHd\goods\classes\CategoryClass';
 
-    //取所有的分类 ssh 2019.12.7
-    public static function getCategoryList($mainId)
+    /**
+     * 取分类列表(管理端/配置选类用)
+     * @param int $mainId 商家 mainId
+     * @param bool $onlyEnabled true 时只返回启用且未删除分类(首页配置关联分类等)
+     */
+    public static function getCategoryList($mainId, $onlyEnabled = false)
     {
         $where = ['mainId' => $mainId, 'delStatus' => 0];
+        // 首页轮播/金刚区等选分类:排除禁用(status!=1)
+        if ($onlyEnabled) {
+            $where['status'] = 1;
+        }
         $cat = CategoryClass::getAllByCondition($where, 'inTurn DESC', '*');
         if (empty($cat)) {
             return $cat;