|
@@ -185,19 +185,31 @@
|
|
|
this.getCartList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 计算购物车数量
|
|
|
+ getCarCount(){
|
|
|
+ let arr = this.$store.state.vuex_cartList || []
|
|
|
+ let count = 0
|
|
|
+ arr.map(item=>{
|
|
|
+ count = count + item.shoppingCartGoodsList.length
|
|
|
+ })
|
|
|
+ this.$u.vuex('vuex_cartNums', count)
|
|
|
+ },
|
|
|
// 查询购物车
|
|
|
getCartList(){
|
|
|
getCartList({}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
this.$u.vuex('vuex_cartList', res.data)
|
|
|
this.cartList = JSON.parse(JSON.stringify(res.data))
|
|
|
- uni.$emit('getCarCount')
|
|
|
+ this.getCarCount()
|
|
|
// 默认全选
|
|
|
if(!this.isEdit){
|
|
|
this.checkAllChange()
|
|
|
}
|
|
|
}
|
|
|
this.loading = false
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.hideLoading()
|
|
|
+ },500)
|
|
|
})
|
|
|
},
|
|
|
// 去选商品
|
|
@@ -357,14 +369,11 @@
|
|
|
})
|
|
|
deleteGoodsFormCart({idList:ids}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
- uni.showToast({
|
|
|
- title:"删除成功",
|
|
|
- icon:"none"
|
|
|
- })
|
|
|
// 刷新购物车
|
|
|
this.getCartList()
|
|
|
+ }else{
|
|
|
+ uni.hideLoading()
|
|
|
}
|
|
|
- uni.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
// 删除商品
|