分类页面加入购物车数量变化
parent
bdbc2b4a19
commit
f3fa995d7d
|
@ -9,8 +9,8 @@
|
||||||
:style="{ transform: 'translate3d(' + item.slide_x + 'px, 0, 0)' }">
|
:style="{ transform: 'translate3d(' + item.slide_x + 'px, 0, 0)' }">
|
||||||
<view class="now-message-info" :style="{ width: windowWidth + 'px' }" @click="clickItemMethod(item)">
|
<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> -->
|
<!-- <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>
|
<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.stop="chooseEv(index)">
|
<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>
|
<image class="shopp-img imgH width100" :src="item.image" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="imgH disjb fc fon24 width100">
|
<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) {
|
focusEv(num) {
|
||||||
// 储存当前商品的原始数值
|
// 储存当前商品的原始数值
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
import swiperTabJl from '@/components/swiper-tab/swiper-tab-jl.vue';
|
import swiperTabJl from '@/components/swiper-tab/swiper-tab-jl.vue';
|
||||||
// 底部组件
|
// 底部组件
|
||||||
import footTab from '@/components/foot-tabs/foot-tab.vue';
|
import footTab from '@/components/foot-tabs/foot-tab.vue';
|
||||||
|
import {getCartNum} from '@/jsFile/public-api.js';
|
||||||
import { mapState } from 'vuex'//引入mapState
|
import { mapState } from 'vuex'//引入mapState
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
|
@ -181,6 +182,7 @@
|
||||||
this.$requst.post('/api/order/shopping-cart-add',{sku_id:id,num:1}).then(res=>{
|
this.$requst.post('/api/order/shopping-cart-add',{sku_id:id,num:1}).then(res=>{
|
||||||
if(res.code==0) {
|
if(res.code==0) {
|
||||||
this.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');
|
this.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');
|
||||||
|
getCartNum();
|
||||||
} else {
|
} else {
|
||||||
this.$toolAll.tools.showToast(res.msg)
|
this.$toolAll.tools.showToast(res.msg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue