MrShi
7 小时以前 ef46d13d5fa70d1c94f25de294f5ed177b751234
mini-program/pages/special-zone/special-zone.vue
@@ -48,6 +48,7 @@
            <view class="cart-num" v-if="cardObj && cardObj.cartTypeNum > 0">{{cardObj.cartTypeNum}}</view>
         </view>
      </view>
      <Login ref="login" />
   </view>
</template>
@@ -55,9 +56,11 @@
   import {
      mapState
   } from 'vuex'
   import Login from '@/components/login/login.vue'
   export default {
      components: {Login},
      computed: {
         ...mapState(['navHeight', 'statusbarHeight'])
         ...mapState(['navHeight', 'statusbarHeight', 'userInfo'])
      },
      data() {
         return {
@@ -72,7 +75,9 @@
      onLoad(options) {
         this.qualityId = options.qualityId
         this.getGoodsList()
         this.cardNum()
         if (this.userInfo) {
            this.cardNum()
         }
      },
      onReachBottom() {
         this.getGoodsList()
@@ -84,18 +89,26 @@
            })
         },
         addCard(e) {
            if (!this.userInfo) {
               this.$refs.login.open()
               return;
            }
            this.$u.api.addCart({
               goodsId: e.id,
               goodsSkuId: e.skuResponsesList[0].id,
               goodsSkuId: e.goodsSkuResponseList[0].id,
               num: 1
            }).then(res => {
               if (res.code === 200) {
                  this.cardNum()
                  uni.showToast({ title: '添加成功', icon: 'none' })
                  uni.showToast({ title: '添加成功', icon: 'success', mask: true })
               }
            })
         },
         jumpCard() {
            if (!this.userInfo) {
               this.$refs.login.open()
               return;
            }
            uni.navigateTo({
               url: '/pages/shopping-cart/shopping-cart'
            })