From e35ea1d5c2be92544ae335198e44d40ceaa403af Mon Sep 17 00:00:00 2001 From: linxi Date: Tue, 6 May 2025 17:23:30 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A3256=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=E6=94=B6=E8=B4=A7=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E9=A1=B5=E9=9D=A2=EF=BC=8C=E7=BB=99=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=9A=84=E5=9C=B0=E5=9D=80=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=A0=87=E8=AF=86=EF=BC=8C=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=8F=B3=E4=B8=8B=E8=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/OrderSubmission/index.vue | 4 +- .../user/address/AddressManagement/index.vue | 52 ++++++++++++------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/pages/order/OrderSubmission/index.vue b/pages/order/OrderSubmission/index.vue index f00b3fa..8c28a1e 100644 --- a/pages/order/OrderSubmission/index.vue +++ b/pages/order/OrderSubmission/index.vue @@ -431,7 +431,7 @@ export default { }, complete: () => { uni.hideLoading() - uni.setStorageSync('chooseAddress', {}) + // uni.setStorageSync('chooseAddress', {}) } }) } @@ -526,7 +526,7 @@ export default { if(_this.$yroute.query.address !== undefined ) { _this.addressInfo = JSON.parse(_this.$yroute.query.address) || {} } else { - _this.addressInfo = data.addressInfo || {} + _this.addressInfo = uni.getStorageSync('chooseAddress') ? uni.getStorageSync('chooseAddress') : data.addressInfo || {} } diff --git a/pages/user/address/AddressManagement/index.vue b/pages/user/address/AddressManagement/index.vue index d63457b..c782490 100644 --- a/pages/user/address/AddressManagement/index.vue +++ b/pages/user/address/AddressManagement/index.vue @@ -93,16 +93,22 @@ export default { loading: false, loadend: false, isWechat: isWeixin(), - pageKeyId: Object.freeze('userAddressIndex') - } - }, - computed: { - // 当前地址id - currentId() { - const current = uni.getStorageSync('cartChooseAddress') || {} - return current.id || null + pageKeyId: Object.freeze('userAddressIndex'), + currentId: null } }, + // computed: { + // // 当前地址id + // currentId: { + // set(val) { + + // }, + // get() { + // const current = uni.getStorageSync('cartChooseAddress') || {} + // return current.id || null + // } + // } + // }, mounted() { this.AddressList() }, @@ -126,8 +132,6 @@ export default { }, methods: { tapAddress(item) { - console.log(item); - // 来源订单创建页面 if (this.choosMode === 1) { uni.setStorageSync('chooseAddress', item) @@ -155,19 +159,29 @@ export default { * */ AddressList() { - const that = this // 阻止下次请求(false可以进行请求) - if (that.loading) return + if (this.loading) return // 阻止结束当前请求(false可以进行请求) - if (that.loadend) return - that.loading = true - getAddressList({page: that.page, limit: that.limit}).then(res => { - that.loading = false + if (this.loadend) return + this.loading = true + getAddressList({page: this.page, limit: this.limit}).then(res => { + this.loading = false // apply();js将一个数组插入另一个数组 - that.addressList.push.apply(that.addressList, res.data) + this.addressList.push.apply(this.addressList, res.data) // 判断所有数据是否加载完成 - that.loadend = res.data.length < that.limit - that.page = that.page + 1 + this.loadend = res.data.length < this.limit + this.page = this.page + 1 + if (this.choosMode === 1) { + this.currentId = uni.getStorageSync('chooseAddress') ? uni.getStorageSync('chooseAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null + } + // 来源购物车 + if (this.choosMode === 2) { + this.currentId = uni.getStorageSync('cartChooseAddress') ? uni.getStorageSync('cartChooseAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null + } + // 来源礼物 + if (this.choosMode === 3) { + this.currentId = uni.getStorageSync('giftChooseAddress') ? uni.getStorageSync('giftChooseAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null + } }) }, /**