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 = []