分类页面加入购物车数量变化

static-project
chen 2022-06-06 13:49:21 +08:00
parent bdbc2b4a19
commit f3fa995d7d
3 changed files with 12 additions and 3 deletions

View File

@ -9,8 +9,8 @@
:style="{ transform: 'translate3d(' + item.slide_x + 'px, 0, 0)' }">
<view class="now-message-info" :style="{ width: windowWidth + 'px' }" @click="clickItemMethod(item)">
<!-- <view class="mo-item flexs" @tap.stop="chooseEv(index)" :class="item.ifcheck ? 'active-item' : ''"></view> -->
<label class="radio"><radio :checked="item.ifcheck" color="#ff3673" style="transform: scale(.8);"/></label>
<view class="shopp-img imgH mar-y20 mar-z10" @tap.stop="chooseEv(index)">
<label class="radio"><radio :checked="item.ifcheck" @tap.stop="chooseEv(index)" color="#ff3673" style="transform: scale(.8);"/></label>
<view class="shopp-img imgH mar-y20 mar-z10" @tap="goDetail(item.spuId)">
<image class="shopp-img imgH width100" :src="item.image" mode="aspectFill"></image>
</view>
<view class="imgH disjb fc fon24 width100">
@ -268,6 +268,13 @@
})
}
},
//
goDetail(id) {
uni.navigateTo({
url:'/pagesB/shop-detail/shop-detail?id='+id
})
},
//
focusEv(num) {
//

View File

@ -52,6 +52,7 @@
import swiperTabJl from '@/components/swiper-tab/swiper-tab-jl.vue';
//
import footTab from '@/components/foot-tabs/foot-tab.vue';
import {getCartNum} from '@/jsFile/public-api.js';
import { mapState } from 'vuex'//mapState
export default {
components:{
@ -181,6 +182,7 @@
this.$requst.post('/api/order/shopping-cart-add',{sku_id:id,num:1}).then(res=>{
if(res.code==0) {
this.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');
getCartNum();
} else {
this.$toolAll.tools.showToast(res.msg)
}