Browse Source

店铺详情页收藏

yangc 8 years ago
parent
commit
e3e4a9bf2e

+ 1 - 1
components/mobile/brand/ComponentDetail.vue

@@ -173,7 +173,7 @@
       },
       collectComponent: function () {
         if (!this.isCollect) {
-          this.$store.dispatch('product/saveEntity', {componentid: this.component.id, kind: this.component.kindid})
+          this.$store.dispatch('product/saveEntity', {componentid: this.component.id, kind: 2})
           this.collectResult = '收藏成功'
           this.timeoutCount++
         } else {

+ 67 - 6
components/mobile/store/StoreDetail.vue

@@ -3,6 +3,7 @@
     <div class="store-logo">
       <div class="store-logo-box">
         <img :src="store.logoUrl || '/images/component/default.png'"/>
+        <i class="iconfont icon-shoucang" :style="isFocus?'color:#ff7800':'color: #ddd'" @click="collectStore"></i>
       </div>
     </div>
     <div class="store-switch-item">
@@ -65,21 +66,27 @@
         </tr>
         </tbody>
       </table>
-      <!--<div v-if="!storeList.content || storeList.content.length == 0" class="no-store">-->
-        <!--<img src="/images/mobile/@2x/car@2x.png" alt="">-->
-        <!--<div>抱歉,暂无商家出售此型号!</div>-->
-        <!--<div>您可前往<strong>www.usoftmall.com</strong>网页版进行<strong>“发布求购”</strong>或<strong>“产品上架”</strong>操作!</div>-->
-      <!--</div>-->
+      <div v-if="!commodities.content || commodities.content.length == 0" class="no-product">
+        <img src="/images/mobile/@2x/car@2x.png" alt="">
+        <div>抱歉,暂无产品信息</div>
+      </div>
     </div>
+    <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
   </div>
 </template>
 <script>
+  import RemindBox from '~components/mobile/common/remindBox.vue'
   export default {
     data () {
       return {
-        activeType: 'product'
+        activeType: 'product',
+        collectResult: '收藏成功',
+        timeoutCount: 0
       }
     },
+    components: {
+      RemindBox
+    },
     filters: {
       currency: function (num) {
         if (typeof num === 'number') {
@@ -112,11 +119,31 @@
       },
       commodities () {
         return this.$store.state.shop.storeInfo.storeCommodity.data
+      },
+      isFocus () {
+        return this.$store.state.shop.storeInfo.focusList.data
       }
     },
     methods: {
       goProductDetail: function (uuid) {
         this.$router.push('/mobile/brand/componentDetail/' + uuid)
+      },
+      collectStore: function () {
+        if (!this.isFocus) {
+          this.$store.dispatch('shop/StoreFocus', {storeName: this.store.storeName, storeid: this.store.uuid})
+            .then(response => {
+              this.$store.dispatch('shop/StoreFocusList', {id: this.store.id})
+              this.collectResult = '收藏成功'
+              this.timeoutCount++
+            })
+        } else {
+          this.$http.post('/trade/storeFocus/delete/storeId', [this.store.id])
+            .then(response => {
+              this.$store.dispatch('shop/StoreFocusList', {id: this.store.id})
+              this.collectResult = '取消成功'
+              this.timeoutCount++
+            })
+        }
       }
     }
   }
@@ -146,10 +173,24 @@
         width: 3.73rem;
         margin: .5rem auto 0;
         background: #fff;
+        position: relative;
         img {
           max-height: 2.13rem;
           max-width: 3.7rem;
         }
+        >i {
+          position: absolute;
+          font-size: .4rem;
+          background: #fff;
+          width: .6rem;
+          height: .6rem;
+          line-height: .6rem;
+          border-radius: 100%;
+          box-shadow: 0 0 5px #aaa;
+          right: -1.44rem;
+          top: .75rem;
+          text-align: center;
+        }
       }
     }
     .store-switch-item {
@@ -263,5 +304,25 @@
         }
       }
     }
+    .no-product {
+      background: #fff;
+      padding-top: 1rem;
+      img {
+        display: block;
+        text-align: center;
+        margin: 0 auto;
+        margin-bottom: .45rem;
+        width: 3.31rem;
+        height: 2.13rem;
+      }
+      div {
+        width: 5.27rem;
+        margin: 0 auto;
+        text-align: center;
+        line-height: .4rem;
+        font-size: .32rem;
+        color: #999;
+      }
+    }
   }
 </style>