From 637a02b07932dead77c556937018bc994178414e Mon Sep 17 00:00:00 2001 From: yr <1308291615@qq.com> Date: Tue, 26 May 2020 19:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/cart.vue | 21 +++++++-------- src/pages/frameDetail/frameDetail.vue | 44 ++++++++++++++++++++++++++++--- src/pages/myOrderPaying/myOrderPaying.vue | 1 - src/store/modules/cart.js | 4 +-- 4 files changed, 52 insertions(+), 18 deletions(-) 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 {