Fix:2742 【商城小程序】购物车页面修改地址后,定位没有相应的修改

This commit is contained in:
linxi
2024-12-04 09:32:12 +08:00
parent 5112f3314b
commit c0a09ad449
+14 -8
View File
@@ -406,15 +406,14 @@ export default {
onShow() { onShow() {
this.isEdit = false this.isEdit = false
uni.$on('chooseAddress', (res) => { uni.$on('chooseAddress', (res) => {
this.addressInfo = res; console.log(res, '地址修改了!!!!!!!!!!!!!!!!!!!!');
this.$forceUpdate() this.getAddress(res)
}) })
if (!this.isLoad) { if (!this.isLoad) {
return return
} }
this.closeAttr() this.closeAttr()
this.getCart() this.getCart()
this.getAddress()
}, },
onHide() { onHide() {
this.pageToHideHandle() this.pageToHideHandle()
@@ -447,11 +446,18 @@ export default {
} }
}); });
}, },
getAddress() { getAddress(details) {
getAddressList({page: 1, limit: 9999}).then(res => { if(details) {
this.addressList = res.data this.addressInfo = details;
this.addressInfo = res.data.find(e => e.isDefault == 1) || res.data[0] && res.data[0] || null this.$forceUpdate()
}); }
if(!details) {
getAddressList({page: 1, limit: 9999}).then(res => {
this.addressList = res.data
this.addressInfo = res.data.find(e => e.isDefault == 1) || res.data[0] && res.data[0] || null
});
}
}, },
clearCart() { clearCart() {
const ids = this.list.map(l => { const ids = this.list.map(l => {