Fix:5106 【商城小程序】选择地址页面,地址列表默认选中项逻辑错误
This commit is contained in:
@@ -975,6 +975,12 @@ export default {
|
||||
},
|
||||
addressTap(order) {
|
||||
this._orderId = order.orderId
|
||||
uni.setStorageSync('updateOrderSourceAddress', {
|
||||
id: order.addressId || order.userAddressId || '',
|
||||
realName: order.realName || '',
|
||||
phone: order.userPhone || '',
|
||||
userAddress: order.userAddress || ''
|
||||
})
|
||||
this.$yrouter.push({
|
||||
path: "/pages/user/address/AddressManagement/index",
|
||||
query: {
|
||||
|
||||
@@ -801,6 +801,12 @@ export default {
|
||||
},
|
||||
goAddress() {
|
||||
this.addressEditOrderId = this.orderInfo.orderId
|
||||
uni.setStorageSync('updateOrderSourceAddress', {
|
||||
id: this.orderInfo.addressId || this.orderInfo.userAddressId || '',
|
||||
realName: this.orderInfo.realName || this.orderInfo.oldRealName || '',
|
||||
phone: this.orderInfo.userPhone || this.orderInfo.oldUserPhone || '',
|
||||
userAddress: this.orderInfo.userAddress || this.orderInfo.oldUserAddress || ''
|
||||
})
|
||||
this.$yrouter.push({
|
||||
path:'/pages/user/address/AddressManagement/index',
|
||||
query: {
|
||||
|
||||
@@ -190,6 +190,24 @@ export default {
|
||||
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
|
||||
}
|
||||
// 来源修改订单地址
|
||||
if (this.choosMode === 4) {
|
||||
const sourceAddress = uni.getStorageSync('updateOrderSourceAddress') || {}
|
||||
let currentId = sourceAddress.id || null
|
||||
if (!currentId && sourceAddress.userAddress) {
|
||||
const sourceAddressText = String(sourceAddress.userAddress).replace(/\s+/g, '')
|
||||
const sourceRealName = String(sourceAddress.realName || '').trim()
|
||||
const sourcePhone = String(sourceAddress.phone || '').trim()
|
||||
const matched = this.addressList.find(e => {
|
||||
const addressText = `${e.province || ''}${e.city || ''}${e.district || ''}${e.detail || ''}`.replace(/\s+/g, '')
|
||||
const sameAddress = sourceAddressText && addressText === sourceAddressText
|
||||
const samePerson = sourceRealName && sourcePhone && String(e.realName || '').trim() === sourceRealName && String(e.phone || '').trim() === sourcePhone
|
||||
return sameAddress || samePerson
|
||||
})
|
||||
currentId = matched ? matched.id : null
|
||||
}
|
||||
this.currentId = currentId || (this.addressList.find(e => e.isDefault === 1) ? this.addressList.find(e => e.isDefault === 1).id : null)
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user