|
|
|
@ -2385,6 +2385,38 @@ |
|
|
|
this.exportGoods.pickupAddress = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
isHardtagOrAlphaBu() { |
|
|
|
if (!this.currentRow || !this.currentRow.buNo) { |
|
|
|
return false |
|
|
|
} |
|
|
|
return ['02-Hardtag', '05-Alpha'].includes(this.currentRow.buNo) |
|
|
|
}, |
|
|
|
getPickupKeywordBySourceArea() { |
|
|
|
const detailList = Array.isArray(this.dataList2) ? this.dataList2 : [] |
|
|
|
const sourceArea = detailList |
|
|
|
.map(item => item && item.sourceArea ? String(item.sourceArea).trim() : '') |
|
|
|
.find(text => !!text) |
|
|
|
if (!sourceArea) { |
|
|
|
return '南通' |
|
|
|
} |
|
|
|
if (sourceArea.indexOf('嘉定') > -1) { |
|
|
|
return '嘉定' |
|
|
|
} |
|
|
|
if (sourceArea.indexOf('昆山') > -1) { |
|
|
|
return '昆山' |
|
|
|
} |
|
|
|
return '南通' |
|
|
|
}, |
|
|
|
getMatchedPickupByKeyword(keyword) { |
|
|
|
if (!keyword || !Array.isArray(this.pickupAddressList)) { |
|
|
|
return null |
|
|
|
} |
|
|
|
return this.pickupAddressList.find(item => { |
|
|
|
const company = item && item.company ? String(item.company) : '' |
|
|
|
const address = item && item.address ? String(item.address) : '' |
|
|
|
return company.indexOf(keyword) > -1 || address.indexOf(keyword) > -1 |
|
|
|
}) || null |
|
|
|
}, |
|
|
|
loadPickupAddressList(buNo) { |
|
|
|
this.pickupAddressList = [] |
|
|
|
this.exportGoods.pickupAddressValue = '' |
|
|
|
@ -2417,7 +2449,17 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
this.pickupAddressList = Object.keys(uniqMap).map(key => uniqMap[key]) |
|
|
|
const defaultItem = this.pickupAddressList.find(item => item.defaultOption === 'Y') |
|
|
|
let defaultItem = null |
|
|
|
if (this.isHardtagOrAlphaBu()) { |
|
|
|
const pickupKeyword = this.getPickupKeywordBySourceArea() |
|
|
|
defaultItem = this.getMatchedPickupByKeyword(pickupKeyword) |
|
|
|
} |
|
|
|
if (!defaultItem) { |
|
|
|
defaultItem = this.pickupAddressList.find(item => item.defaultOption === 'Y') |
|
|
|
} |
|
|
|
if (!defaultItem && this.pickupAddressList.length > 0) { |
|
|
|
defaultItem = this.pickupAddressList[0] |
|
|
|
} |
|
|
|
if (defaultItem) { |
|
|
|
this.exportGoods.pickupAddressValue = defaultItem.valueKey |
|
|
|
this.handlePickupAddressChange(defaultItem.valueKey) |
|
|
|
|