MrShi
7 小时以前 41115bb4b6d0161ff6d2c15ef6b3d5386a14ac9c
mini-program/pages/special-zone/special-zone.vue
@@ -6,7 +6,7 @@
            <view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
            <view class="head-bar-nav" :style="{ height: navHeight + 'px' }">
               <image src="/static/icon/nav_ic_bac@2x.png" mode="widthFix" @click="fanhui"></image>
               <text>商品专区</text>
               <text>{{title}}</text>
               <image src="/static/icon/nav_ic_bac@2x.png" style="opacity: 0;" mode="widthFix"></image>
            </view>
         </view>
@@ -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,12 +56,15 @@
   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 {
            title:'商品专区',
            goodsName: '',
            next: true,
            page: 1,
@@ -70,9 +74,13 @@
         };
      },
      onLoad(options) {
         console.log(options)
         this.qualityId = options.qualityId
         this.title = options.title || '商品专区'
         this.getGoodsList()
         this.cardNum()
         if (this.userInfo) {
            this.cardNum()
         }
      },
      onReachBottom() {
         this.getGoodsList()
@@ -84,18 +92,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'
            })