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 + } }) }, /**