Browse Source

店铺和搜索

yangc 8 years ago
parent
commit
75ef7a8866
2 changed files with 25 additions and 4 deletions
  1. 6 1
      components/search/GoodList.vue
  2. 19 3
      components/store/CommodityList.vue

+ 6 - 1
components/search/GoodList.vue

@@ -54,7 +54,7 @@
           </tr>
           </thead>
           <tbody id="productList-content">
-          <tr v-for="item in good_list.components">
+          <tr v-for="item in good_list.components" @click="goUnstandardDetail(item)">
             <!--<td>-->
             <!--<nuxt-link class="component-img-box" :to="item.batchCode?`/store/${item.storeId}/${item.batchCode}`:`/product/component/${item.uuid}`">-->
               <!--&lt;!&ndash;          <img :src="item.img?item.img:item.brand&&item.brand.logoUrl?item.brand.logoUrl:'/images/component/default.png'">&ndash;&gt;-->
@@ -279,6 +279,11 @@
         this.min_price = ''
         this.max_price = ''
         this.$emit('filterPriceEvent', this.filter)
+      },
+      goUnstandardDetail: function (comp) {
+        if (!comp.brand && comp.brandEn) {
+          this.$router.push('/store/' + comp.storeId + '/' + comp.batchCode)
+        }
       }
     }
   }

+ 19 - 3
components/store/CommodityList.vue

@@ -44,11 +44,14 @@
           </tr>
           </thead>
           <tbody id="goodslist-content">
-          <tr v-for="commodity in commodities.content">
+          <tr v-for="commodity in commodities.content" @click="goBatchDetail(storeInfo.uuid, commodity.batchCode)">
             <td class="brand-code">
               <img class="sellout-store-commodity" v-if="commodity.status === 602" src="/images/search/sellout-search.png" alt="">
-              <div class="brand" v-if="commodity.brandNameEn" v-text="commodity.brandNameEn"></div>
-              <div class="brand" v-if="!commodity.brandNameEn">—</div>
+              <div class="brand" v-if="commodity.brandNameEn || commodity.brandEn">
+                <a v-if="commodity.brandNameEn" @click="goBrandDetail('/product/brand/' + commodity.branduuid, $event)" v-text="commodity.brandNameEn"></a>
+                <span v-if="commodity.brandEn">{{commodity.brandEn}}</span>
+              </div>
+              <div class="brand" v-if="!commodity.brandNameEn && !commodity.brandEn">—</div>
               <div class="code" v-if="commodity.code" v-text="commodity.code"></div>
               <div class="code" v-if="!commodity.code">—</div>
             </td>
@@ -204,6 +207,9 @@ export default {
   computed: {
     commodities () {
       return this.$store.state.shop.storeInfo.storeCommodity.data
+    },
+    storeInfo () {
+      return this.$store.state.shop.storeInfo.store.data
     }
   },
   methods: {
@@ -247,6 +253,13 @@ export default {
     handleCurrentChange (page) {
       this.pageParams.page = page
       this.pageCommodity(this.pageParams, this.ids, this.searchCode)
+    },
+    goBatchDetail (storeId, batchCode) {
+      this.$router.push('/store/' + storeId + '/' + batchCode)
+    },
+    goBrandDetail (url, event) {
+      event.stopPropagation()
+      this.$router.push(url)
     }
 //    goBack () {
 //      this.$router.back(-1)
@@ -419,6 +432,9 @@ export default {
 	#goods-list-fragment .brand-code .code {
 		font-weight: 600;
 	}
+#goods-list-fragment .brand-code .brand a:hover {
+  color: #f39801;
+}
 
 	#goods-list-fragment .goodslist th {
 		color: rgb(50,50,50);