diff --git a/src/pages/cart/cart.vue b/src/pages/cart/cart.vue index b2329a8..d2cf753 100644 --- a/src/pages/cart/cart.vue +++ b/src/pages/cart/cart.vue @@ -93,8 +93,8 @@ export default { computed: { cartList() { - // console.log('cart-list', this.$store.state.cart.cartList); - return this.$store.state.cart.cartList + // console.log('cart-list', this.$store.state.cart.cartList); + return this.$store.state.cart.cartList }, childIsOpen() { const temp = [] @@ -107,8 +107,8 @@ export default { } }, onLoad: function() { - // store.dispatch('cart/addCart', { - // uid: this.$store.state.user.userInfo.uid, + // store.dispatch('cart/addCart', { + // uid: this.$store.state.user.userInfo.uid, // openid: this.$store.state.user.userInfo.openid, // mp_id: 7, // sk_id: 7, @@ -116,11 +116,10 @@ export default { // pid: 8, // price: 128, // checkedSKU:{}, - // }) + // }) store.dispatch('cart/getCartList', { uid: this.$store.state.user.userInfo.uid // 用户id }) - }, methods: { @@ -181,7 +180,7 @@ export default { } else { this.addDisabled = true // 修改num - if(this.childIsOpen[index]){ + if (this.childIsOpen[index]) { this.totalPrice = this.totalPrice + this.$store.state.cart.cartList[index].nowPrice } store.dispatch('cart/modiCart', { @@ -204,8 +203,8 @@ export default { } else { this.desDisabled = false // post 请求修改相关参数 - if(this.childIsOpen[index]){ - this.totalPrice = this.totalPrice - this.$store.state.cart.cartList[index].nowPrice + if (this.childIsOpen[index]) { + this.totalPrice = this.totalPrice - this.$store.state.cart.cartList[index].nowPrice } store.dispatch('cart/modiCart', { uid: this.$store.state.user.userInfo.uid, @@ -277,7 +276,7 @@ export default { // this.$store.state.cart.cartList.splice(index,1) store.dispatch('cart/delCart', { uid: this.$store.state.user.userInfo.uid, - openid: this.$store.state.user.userInfo.openid, + openid: this.$store.state.user.userInfo.openid, cart_id: cart_id, // 要修改的购物车id arg: index // 由于action 传参是能接收两参数,因此将index放入对象 }) @@ -291,7 +290,7 @@ export default {