Fix(购物车&订单):修复地址选择之后事件分发错误问题

This commit is contained in:
lifizer
2024-12-04 12:03:32 +08:00
parent c0a09ad449
commit c5c9c9146b
6 changed files with 223 additions and 274 deletions
+18 -2
View File
@@ -91,6 +91,8 @@ export default {
return {
district: [],
id: 0,
// 是否选择地址模式:0-不是,1-来源订单创建页面,2-来源购物车
choosMode: 0,
userAddress: {
realName: '',
phone: '',
@@ -104,6 +106,15 @@ export default {
addressInput: ''
};
},
onLoad(e) {
// 是否选择模式
const choosMode = this.$yroute.query.choosMode || 0
if (choosMode) {
this.choosMode = parseInt(choosMode)
} else {
this.choosMode = 0
}
},
mounted: function () {
const id = this.$yroute.query.id
this.id = id
@@ -382,7 +393,7 @@ export default {
duration: 2000
});
}
if(that.$yroute.query.choosMode == 1) {
if (that.choosMode) {
const item = {
id: res.data.id,
realName: name,
@@ -394,7 +405,12 @@ export default {
is_default: isDefault ? true : false,
post_code: ""
}
uni.$emit('chooseAddress', item)
if(that.choosMode === 1) {
uni.setStorageSync('chooseAddress', item)
}
if(that.choosMode === 2) {
uni.setStorageSync('cartChooseAddress', item)
}
}
that.$yrouter.back();
});