Fix:5106 【商城小程序】选择地址页面,地址列表默认选中项逻辑错误
This commit is contained in:
@@ -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