Fix(购物车&订单):修复地址选择之后事件分发错误问题
This commit is contained in:
@@ -465,7 +465,6 @@ export default {
|
||||
mixins: [pageListenMixins],
|
||||
data: function () {
|
||||
return {
|
||||
addressId: null,
|
||||
showExtend: false,
|
||||
delayId: '',
|
||||
showMore: false,
|
||||
@@ -498,47 +497,42 @@ export default {
|
||||
...mapGetters(["userInfo"])
|
||||
},
|
||||
onShow() {
|
||||
this.id = this.$yroute.query.id;
|
||||
this.getDetail();
|
||||
uni.$on('chooseAddress', (res) => {
|
||||
this.addressId = res.id
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
addressId(val) {
|
||||
if(val) {
|
||||
const params = {
|
||||
addressId: this.addressId,
|
||||
orderId: this.orderInfo.orderId
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.showModal({
|
||||
title:'确定修改地址吗?',
|
||||
content: '',
|
||||
showCancel: true,
|
||||
cancelText: '取消',
|
||||
confirmText: '确认',
|
||||
success:(success)=>{
|
||||
if(success.confirm) {
|
||||
uni.showLoading()
|
||||
editAddress(params).then(res => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '修改成功!'
|
||||
})
|
||||
this.getDetail();
|
||||
}).finally(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
},
|
||||
complete:(complete)=>{
|
||||
const _this = this
|
||||
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
|
||||
const addressId = chooseAddress.id || ''
|
||||
// 监听到选择收货地址
|
||||
if (addressId) {
|
||||
uni.setStorageSync('chooseAddress', {})
|
||||
uni.showModal({
|
||||
title:'确定修改地址吗?',
|
||||
content: '',
|
||||
showCancel: true,
|
||||
cancelText: '取消',
|
||||
confirmText: '确认',
|
||||
success:(success)=>{
|
||||
if(success.confirm) {
|
||||
uni.showLoading()
|
||||
editAddress({
|
||||
addressId,
|
||||
orderId: _this.orderInfo.orderId
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '修改成功!'
|
||||
})
|
||||
_this.getDetail()
|
||||
}).finally(() => {
|
||||
uni.hideLoading()
|
||||
this.addressId = ''
|
||||
},
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
complete:(complete)=>{
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_this.id = _this.$yroute.query.id;
|
||||
_this.getDetail();
|
||||
}
|
||||
},
|
||||
// inject: ["app"],
|
||||
|
||||
Reference in New Issue
Block a user