Administrator 7 жил өмнө
parent
commit
c45c183928

+ 1 - 1
components/store/home/CommodityList.vue

@@ -307,7 +307,7 @@
         this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
       },
       KindsNameChange: function (obj) {
-          obj.nameCn += `  (${obj.count})`
+          obj.nameCn += (obj.count ? `  (${obj.count})` : '')
           if (obj.children && obj.children.length) {
             obj.children.forEach((item) => {
               this.KindsNameChange(item)

+ 6 - 10
components/store/home/StoreBanner.vue

@@ -13,10 +13,8 @@
           <p class="shop-name" v-if="storeInfo.storeName">{{storeInfo.storeName | nameFilter}}</p>
           <p class="shop-name" v-else></p>
           <div class="enter-store">
-            <!--<a v-if="isFocus == 'false' || typeof isFocus == 'object'" @click="focus(storeInfo.id, storeInfo.storeName)">关注店铺</a>-->
-            <!--<a v-if="isFocus == 'true'" class="focus">已关注</a>-->
-            <a v-if="isFocus == 'false' || typeof isFocus == 'object'" @click="focusStore(storeInfo, $event)">关注店铺</a>
-            <a v-if="isFocus == 'true'" class="focus" @click="focusStore(storeInfo, $event)">已关注</a>
+            <a v-if="isFocus === 'false'" @click="focusStore(storeInfo, $event)">关注店铺</a>
+            <a v-else class="focus" @click="focusStore(storeInfo, $event)">已关注</a>
             <a @click="goLink()">联系卖家</a>
           </div>
           <div class="share">
@@ -120,19 +118,17 @@ export default {
       this.showShare = flag
       this.showCate = flag
     },
-    focusStore: function (item) {
+    focusStore: function (item, $event) {
+      $event.stopPropagation()
       if (this.user.logged) {
-        if (this.isFocus === 'false' || typeof isFocus === 'object') {
+        if (this.isFocus === 'false') {
           this.dialogVisible = true
           this.$store.dispatch('shop/StoreFocus', {storeName: item.storeName, storeid: item.id})
-          this.isFocus = 'true'
         } else {
           this.$http.post('/trade/storeFocus/delete/storeId', [item.id])
             .then(response => {
               this.dialogInvisible = true
-//              alert(this.isFocus)
-              this.isFocus = 'false'
-//              alert(this.isFocus)
+              this.$store.dispatch('shop/StoreFocusList', {id: item.id})
             })
         }
       } else {