Browse Source

过滤条件展示调整

yangc 8 years ago
parent
commit
825da8d698
2 changed files with 8 additions and 7 deletions
  1. 8 5
      components/search/Kind.vue
  2. 0 2
      pages/search/_keyword.vue

+ 8 - 5
components/search/Kind.vue

@@ -16,7 +16,7 @@
         </span>
         <ul :class="show_kind">
           <li><a class="f14" @click="restore('kind')">全部</a></li>
-          <li v-for="(item, index) in list_kind">
+          <li v-for="(item, index) in list_kind" v-if="item !== ''">
             <a v-text="item.ki_name_cn" class="f14" @click="click_kind(item.ki_id, index)" :title="item.ki_name_cn"></a>
           </li>
         </ul>
@@ -41,7 +41,7 @@
         </span>
         <ul :class="show_brand">
           <li><a class="f14" @click="restore('brand')">全部</a></li>
-          <li v-for="(item, index) in list_brand">
+          <li v-for="(item, index) in list_brand" v-if="item !== ''">
             <a v-text="item.br_name_cn" class="f14" @click="click_brand(item.br_id, index)" :title="item.br_name_cn"></a>
           </li>
         </ul>
@@ -242,7 +242,6 @@
     </div>
     </div>
   </div>
-
 </template>
 <script>
   export default {
@@ -341,13 +340,15 @@
         this.kind_arr.push(id)
         this.$emit('kindFilterEvent', this.kind_arr)
         this.kind_exp_arr.push(this.list_kind[index])
-        this.list_kind.splice(index, index + 1)
+        this.kind_exp_arr[this.kind_exp_arr.length - 1].index = index
+        this.list_kind[index] = ''
       },
       click_brand: function (id, index) {
         this.brand_arr.push(id)
         this.$emit('brandFilterEvent', this.brand_arr)
         this.brand_exp_arr.push(this.list_brand[index])
-        this.list_brand.splice(index, index + 1)
+        this.brand_exp_arr[this.brand_exp_arr.length - 1].index = index
+        this.list_brand[index] = ''
       },
       click_store_type: function (type) {
         this.type_arr.push(type)
@@ -405,12 +406,14 @@
       },
       click_kind_exp: function (id, index) {
         let idx = this.getIndex(this.kind_arr, id)
+        this.list_kind[this.kind_exp_arr[index].index] = this.kind_exp_arr[index]
         this.kind_arr.splice(idx, idx + 1)
         this.$emit('kindFilterEvent', this.kind_arr)
         this.kind_exp_arr.splice(index, index + 1)
       },
       click_brand_exp: function (id, index) {
         let idx = this.getIndex(this.brand_arr, id)
+        this.list_brand[this.brand_exp_arr[index].index] = this.brand_exp_arr[index]
         this.brand_arr.splice(idx, idx + 1)
         this.$emit('brandFilterEvent', this.brand_arr)
         this.brand_exp_arr.splice(index, index + 1)

+ 0 - 2
pages/search/_keyword.vue

@@ -94,7 +94,6 @@
         if (kindarr.length === 0) {
           delete this.filter.goods_kindId
           delete this.paramJSON.goods_kindid
-          this.reloadKind()
           this.reloadBrand()
           this.reloadList()
           this.reloadStoreType()
@@ -113,7 +112,6 @@
           delete this.filter.goods_brandId
           delete this.paramJSON.goods_brandid
           this.reloadKind()
-          this.reloadBrand()
           this.reloadList()
           this.reloadStoreType()
           this.reloadCrname()