Переглянути джерело

Merge branch '调整商城' into 莱斯奥/2.5.0

xiaohaizhao 10 місяців тому
батько
коміт
424860aa06

+ 12 - 6
pages/index/market/index.js

@@ -77,6 +77,13 @@ Component({
           this.setData({
             itemClasss: [res.data[0].ttemclass]
           });
+          try {
+            this.selectAllComponents('#class0').filter(v => {
+              v.setData({
+                active: 0
+              })
+            })
+          } catch {}
         }
         this.getList(true);
       })
@@ -87,7 +94,7 @@ Component({
       let itemClasss = this.data.itemClasss,
         subdep = detail.item.subdep;
       itemClasss = itemClasss.slice(0, detail.rowIndex + 1);
-      if (subdep.length) {
+      /* if (subdep.length) {
         subdep.unshift({
           itemclassid: detail.item.itemclassid,
           itemclassfullname: "全部",
@@ -98,14 +105,13 @@ Component({
         this.selectAllComponents('#class' + (detail.rowIndex - 0 + 1)).filter(v => v.setData({
           active: 0
         }))
-      }
+      } */
       this.setData({
         itemClasss
       })
-      this.selectAllComponents('#' + e.target.id).filter(v => {
-        v.setData({
-          active: detail.index
-        })
+      itemClasss.push(subdep)
+      this.setData({
+        itemClasss
       })
       this.getList(true);
     },

+ 1 - 1
pages/index/market/index.wxml

@@ -1,7 +1,7 @@
 <van-search use-action-slot placeholder='请输入搜索关键词' shape='round' bind:search="onSearch" bind:clear="onSearch">
 	<view style="padding: 0 10rpx;" slot="action" bind:tap="openPopup">筛选</view>
 </van-search>
-<Tabs id="tradefieList" list="{{tradefieList}}" wx:if="{{tradefieList.length>1}}" box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' name='tradefield' bind:onChange="tradefieChange" />
+<Tabs active='0' id="tradefieList" list="{{tradefieList}}" wx:if="{{tradefieList.length>1}}" box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' name='tradefield' bind:onChange="tradefieChange" />
 <Tabs wx:for="{{itemClasss}}" id='class{{index}}' rowIndex='{{index}}' wx:key="{{item.rowindex}}" list="{{item}}" box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' name='itemclassname' bind:onChange="itemClasssChange" />
 <view class="division" style="height: 10rpx;" />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>

+ 11 - 10
pages/index/market/modules/tabs/index.js

@@ -9,7 +9,7 @@ Component({
     },
     active: {
       type: String,
-      value: 0
+      value: -1
     },
     rowIndex: {
       type: Number,
@@ -32,16 +32,17 @@ Component({
         item
       } = e.currentTarget.dataset;
       if (this.data.active != index) {
-        this.setData({
-          active: index
-        });
-        this.triggerEvent("onChange", {
-          item,
-          index,
-          rowIndex: this.data.rowIndex
-        })
-        this.setActive(index);
+
       }
+      this.setData({
+        active: index
+      });
+      this.triggerEvent("onChange", {
+        item,
+        index,
+        rowIndex: this.data.rowIndex
+      })
+      this.setActive(index);
     },
     setActive(active) {
       const that = this,