| | |
| | | <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> |
| | |
| | | <view class="cart-num" v-if="cardObj && cardObj.cartTypeNum > 0">{{cardObj.cartTypeNum}}</view> |
| | | </view> |
| | | </view> |
| | | <Login ref="login" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | 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, |
| | |
| | | }; |
| | | }, |
| | | 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() |
| | |
| | | }) |
| | | }, |
| | | 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' |
| | | }) |