From c0a09ad449122185839383befe631c5ebc44d4e2 Mon Sep 17 00:00:00 2001 From: linxi Date: Wed, 4 Dec 2024 09:32:12 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A2742=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9=E5=9C=B0=E5=9D=80=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=AE=9A=E4=BD=8D=E6=B2=A1=E6=9C=89=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/cart.vue | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pages/cart.vue b/pages/cart.vue index 3c5fa8b..f6f0ba8 100644 --- a/pages/cart.vue +++ b/pages/cart.vue @@ -406,15 +406,14 @@ export default { onShow() { this.isEdit = false uni.$on('chooseAddress', (res) => { - this.addressInfo = res; - this.$forceUpdate() + console.log(res, '地址修改了!!!!!!!!!!!!!!!!!!!!'); + this.getAddress(res) }) if (!this.isLoad) { return } this.closeAttr() this.getCart() - this.getAddress() }, onHide() { this.pageToHideHandle() @@ -447,11 +446,18 @@ export default { } }); }, - getAddress() { - 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 - }); + getAddress(details) { + if(details) { + this.addressInfo = details; + 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() { const ids = this.list.map(l => {