From a2ff24f9434f5fd033fc487a9a2088cc2a921c75 Mon Sep 17 00:00:00 2001 From: BigBoss <2280520255@qq.com> Date: Thu, 18 Jun 2020 18:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=BA=BA=E4=B8=8D=E6=8F=90=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BottomSheet/BottomSheet.vue | 73 +++++++++++++++++------------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/src/components/BottomSheet/BottomSheet.vue b/src/components/BottomSheet/BottomSheet.vue index c3e818c..ca118b5 100644 --- a/src/components/BottomSheet/BottomSheet.vue +++ b/src/components/BottomSheet/BottomSheet.vue @@ -493,35 +493,45 @@ import store from '@/store' }, updateMylove(){ const loveItem = this.loveList[this.loveCurrent] - const glassWidth = this.glassInfo.glassWidth - const norseWidth = this.glassInfo.norseWidth - const legWidth = this.glassInfo.legWidth - if(loveItem.glassWidth !== glassWidth){ - store.dispatch('myLoveList/updateMylove', { - uid: this.$store.state.user.userInfo.uid, - openid: this.$store.state.user.userInfo.openid, - mp_id: this.mp_id, - keyname: 'glassWidth', - keyvalue: glassWidth - }); - } - if(loveItem.norseWidth !== norseWidth){ - store.dispatch('myLoveList/updateMylove', { - uid: this.$store.state.user.userInfo.uid, - openid: this.$store.state.user.userInfo.openid, - mp_id: this.mp_id, - keyname: 'norseWidth', - keyvalue: norseWidth - }); - } - if(loveItem.legWidth !== legWidth){ - store.dispatch('myLoveList/updateMylove', { - uid: this.$store.state.user.userInfo.uid, - openid: this.$store.state.user.userInfo.openid, - mp_id: this.mp_id, - keyname: 'legWidth', - keyvalue: legWidth - }); + // console.log(this.loveList) + // console.log(this.loveCurrent) + // console.log(loveItem) + if(loveItem != undefined){ + const glassWidth = this.glassInfo.glassWidth + const norseWidth = this.glassInfo.norseWidth + const legWidth = this.glassInfo.legWidth + if(loveItem.glassWidth !== glassWidth){ + store.dispatch('myLoveList/updateMylove', { + uid: this.$store.state.user.userInfo.uid, + openid: this.$store.state.user.userInfo.openid, + mp_id: this.mp_id, + keyname: 'glassWidth', + keyvalue: glassWidth + }); + } + if(loveItem.norseWidth !== norseWidth){ + store.dispatch('myLoveList/updateMylove', { + uid: this.$store.state.user.userInfo.uid, + openid: this.$store.state.user.userInfo.openid, + mp_id: this.mp_id, + keyname: 'norseWidth', + keyvalue: norseWidth + }); + } + if(loveItem.legWidth !== legWidth){ + store.dispatch('myLoveList/updateMylove', { + uid: this.$store.state.user.userInfo.uid, + openid: this.$store.state.user.userInfo.openid, + mp_id: this.mp_id, + keyname: 'legWidth', + keyvalue: legWidth + }); + } + }else{ + uni.showToast({ + title:'请选择使用人', + icon:'none' + }) } }, glassInfoInput(e,type){ @@ -564,8 +574,9 @@ import store from '@/store' }, addCart(){ this.checkGlassInfo() - if(this.glassInfoRight){ - this.updateMylove() + // console.log(this.glassInfoRight) + this.updateMylove() + if(this.glassInfoRight&&this.mp_id!==''){ const that = this const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name] const checkedSKU = [] -- 2.0.0