Fix:3815 【商城小程序】购买流程出现异常页面

This commit is contained in:
LinCyJang
2025-06-02 12:21:23 +08:00
parent 00ba2a3239
commit 375b5b1978
4 changed files with 39 additions and 32 deletions
+1
View File
@@ -280,6 +280,7 @@ export default {
icon: 'success', icon: 'success',
title: '修改成功!' title: '修改成功!'
}) })
uni.setStorageSync('sourceAddress', chooseAddress)
_this.changeType() _this.changeType()
}).finally(() => { }).finally(() => {
uni.hideLoading() uni.hideLoading()
+7 -5
View File
@@ -502,9 +502,10 @@ export default {
...mapGetters(["userInfo"]) ...mapGetters(["userInfo"])
}, },
onShow() { onShow() {
const _this = this
const chooseAddress = uni.getStorageSync('chooseAddress') || {} const chooseAddress = uni.getStorageSync('chooseAddress') || {}
const addressId = chooseAddress.id || '' const addressId = chooseAddress.id || ''
console.log(addressId, 'addressId');
// 监听到选择收货地址 // 监听到选择收货地址
if (addressId) { if (addressId) {
uni.setStorageSync('chooseAddress', {}) uni.setStorageSync('chooseAddress', {})
@@ -519,13 +520,14 @@ export default {
uni.showLoading() uni.showLoading()
editAddress({ editAddress({
addressId, addressId,
orderId: _this.orderInfo.orderId orderId: this.orderInfo.orderId
}).then(res => { }).then(res => {
uni.showToast({ uni.showToast({
icon: 'success', icon: 'success',
title: '修改成功!' title: '修改成功!'
}) })
_this.getDetail() uni.setStorageSync('sourceAddress', chooseAddress)
this.getDetail()
}).finally(() => { }).finally(() => {
uni.hideLoading() uni.hideLoading()
}) })
@@ -536,8 +538,8 @@ export default {
} }
}) })
} else { } else {
_this.id = _this.$yroute.query.id; this.id = this.$yroute.query.id;
_this.getDetail(); this.getDetail();
} }
}, },
// inject: ["app"], // inject: ["app"],
+30 -26
View File
@@ -414,6 +414,31 @@ export default {
_this.getCartInfo() _this.getCartInfo()
//获取用户信息 //获取用户信息
_this.$store.dispatch("getUser", true) _this.$store.dispatch("getUser", true)
// 监听到选择收货地址
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
const sourceAddress = uni.getStorageSync('sourceAddress') || uni.getStorageSync('chooseAddress')
// 监听到选择收货地址
if (chooseAddress.id && (chooseAddress.id !== sourceAddress.id)) {
uni.showModal({
title:'确定修改地址吗?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: (res) => {
if(res.confirm) {
_this.addressInfo = chooseAddress
// 地址切换也要重新计算一下
uni.setStorageSync('sourceAddress', _this.addressInfo || '')
_this.computedPrice('onLoad chooseAddress')
}
},
complete: () => {
uni.hideLoading()
uni.setStorageSync('chooseAddress', {})
}
})
}
}, },
methods: { methods: {
@@ -505,32 +530,11 @@ export default {
if(_this.$yroute.query.address !== undefined ) { if(_this.$yroute.query.address !== undefined ) {
_this.addressInfo = JSON.parse(_this.$yroute.query.address) || {} _this.addressInfo = JSON.parse(_this.$yroute.query.address) || {}
} else { } else {
_this.addressInfo = uni.getStorageSync('chooseAddress') ? uni.getStorageSync('chooseAddress') : data.addressInfo || {} _this.addressInfo = uni.getStorageSync('sourceAddress') || data.addressInfo || {}
} console.log(data.addressInfo);
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
const sourceAddress = uni.getStorageSync('sourceAddress') || data.addressInfo || uni.getStorageSync('chooseAddress')
// 监听到选择收货地址
if (chooseAddress.id && (chooseAddress.id !== sourceAddress.id)) {
uni.showModal({
title:'确定修改地址吗?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: (res) => {
if(res.confirm) {
_this.addressInfo = chooseAddress
// 地址切换也要重新计算一下
uni.setStorageSync('sourceAddress', _this.addressInfo || '')
_this.computedPrice('onLoad chooseAddress')
}
},
complete: () => {
uni.hideLoading()
// uni.setStorageSync('chooseAddress', {})
}
})
} }
_this.systemStore = data.systemStore || {} _this.systemStore = data.systemStore || {}
_this.storeSelfMention = data.storeSelfMention _this.storeSelfMention = data.storeSelfMention
_this.computedPrice() _this.computedPrice()
@@ -684,7 +688,7 @@ export default {
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id, storeId: this.storeItems ? this.storeItems.id : this.systemStore.id,
...from ...from
} }
uni.setStorageSync('chooseAddress', {})
//余额支付的支付密码 //余额支付的支付密码
if (this.active == 'yue') { if (this.active == 'yue') {
params.passwordPay = this.payPassword; params.passwordPay = this.payPassword;
@@ -172,7 +172,7 @@ export default {
this.loadend = res.data.length < this.limit this.loadend = res.data.length < this.limit
this.page = this.page + 1 this.page = this.page + 1
if (this.choosMode === 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 this.currentId = uni.getStorageSync('sourceAddress') ? uni.getStorageSync('sourceAddress').id : this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null
} }
// 来源购物车 // 来源购物车
if (this.choosMode === 2) { if (this.choosMode === 2) {