chuweiqiang пре 1 година
родитељ
комит
7bd955f6aa
2 измењених фајлова са 9 додато и 2 уклоњено
  1. 8 1
      app/data/controller/shop/Goods.php
  2. 1 1
      app/data/model/ShopGoodsCate.php

+ 8 - 1
app/data/controller/shop/Goods.php

@@ -217,7 +217,14 @@ class Goods extends Controller
             $data['cateids'] = str2arr($data['cateids'] ?? '');
             // 其他表单数据
             $this->marks = ShopGoodsMark::items();
-            $this->cates = ShopGoodsCate::treeTable(true);
+//            $this->cates = ShopGoodsCate::treeTable(true);
+            $cates = ShopGoodsCate::treeTable(true);
+            foreach ($cates as $k => $v){
+                if($v['id'] == $v['ids'][0]){
+                    unset($cates[$k]);
+                }
+            }
+            $this->cates = $cates;
             $this->trucks = ExpressService::templates();
             $this->upgrades = BaseUserUpgrade::items();
             $this->payments = BaseUserPayment::mk()->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->column('type,code,name', 'code');

+ 1 - 1
app/data/model/ShopGoodsCate.php

@@ -85,4 +85,4 @@ class ShopGoodsCate extends Model
     {
         return format_datetime($value);
     }
-}
+}