From dcfcfaf91ff4adefa27f4c97629f0a2d29e752db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Thu, 9 Oct 2025 09:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=8F=90=E4=BA=A4=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=85=8D=E9=80=81=20-=20=E5=88=87=E6=8D=A2=E6=94=B6?= =?UTF-8?q?=E8=B4=A7=E5=9C=B0=E5=9D=80=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/shop/address/index.vue | 10 +++++++++- packages/shop/goodsSubmit/index.vue | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/shop/address/index.vue b/packages/shop/address/index.vue index 6fd9c1e3..b40c5267 100644 --- a/packages/shop/address/index.vue +++ b/packages/shop/address/index.vue @@ -3,7 +3,7 @@ - + {{item.name}} {{item.phone}} 默认 @@ -102,6 +102,14 @@ export default { } }); }, + + // 选择地址 + selectAddress(item) { + // 存储选中的地址信息 + uni.setStorageSync('selectedAddress', item); + // 返回上一页 + uni.navigateBack(); + }, async init() { const res = await request(apiArr.addAddressList, 'POST', {}); diff --git a/packages/shop/goodsSubmit/index.vue b/packages/shop/goodsSubmit/index.vue index c39d459e..3bfa0859 100644 --- a/packages/shop/goodsSubmit/index.vue +++ b/packages/shop/goodsSubmit/index.vue @@ -192,7 +192,16 @@ export default { this.carList = JSON.parse(options.shopCarList) }, onShow() { - this.getUserAddress() + // 检查是否有选中的地址 + const selectedAddress = uni.getStorageSync('selectedAddress'); + if (selectedAddress && Object.keys(selectedAddress).length > 0) { + this.defAddress = selectedAddress; + // 清除选中状态,避免重复应用 + uni.removeStorageSync('selectedAddress'); + } else { + // 如果没有选中的地址,则获取默认地址 + this.getUserAddress(); + } this.getGoodsList() }, onUnload() {