| | |
| | | <view class="cart-box"> |
| | | <image src="/static/icon/ic_cart@2x.png" mode="widthFix"></image> |
| | | <text>购物车</text> |
| | | <view class="cart-num">{{cardTotal}}</view> |
| | | <view class="cart-num" v-if="cardTotal>0">{{cardTotal}}</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', 'userInfo']) |
| | | }, |
| | |
| | | }, |
| | | methods: { |
| | | jumpCart() { |
| | | if (!this.userInfo) { |
| | | this.$refs.login.open() |
| | | return; |
| | | } |
| | | uni.navigateTo({ |
| | | url: '/pages/shopping-cart/shopping-cart' |
| | | }) |
| | |
| | | this.getGoodsList() |
| | | }, |
| | | addCard(e) { |
| | | if (!this.userInfo) { |
| | | this.$refs.login.open() |
| | | return; |
| | | } |
| | | this.$u.api.addCart({ |
| | | goodsId: e.id, |
| | | goodsSkuId: e.skuResponsesList[0].id, |