Browse Source

自动匹配

master
han\hanst 2 days ago
parent
commit
8ec96f7111
  1. 16
      src/views/modules/ecss/createDeclaration.vue
  2. 44
      src/views/modules/ecss/declaration.vue

16
src/views/modules/ecss/createDeclaration.vue

@ -471,7 +471,11 @@
label="境内货源地"
min-width="100">
<template slot-scope="scope">
<el-input v-model="scope.row.sourceArea" style="height: 11px;width:98%"></el-input>
<el-input
v-model="scope.row.sourceArea"
@input="syncSourceAreaFromFirst(scope.$index, $event)"
style="height: 11px;width:98%">
</el-input>
</template>
</el-table-column>
<el-table-column
@ -1438,6 +1442,16 @@
changeToalPrice(row){
row.totalPrice=row.unitPrice*row.qty
},
syncSourceAreaFromFirst(index, value) {
if (index !== 0 || !Array.isArray(this.detailList) || this.detailList.length <= 1) {
return
}
this.detailList.forEach((item, rowIndex) => {
if (rowIndex > 0) {
this.$set(item, 'sourceArea', value)
}
})
},
declarationModel(row){
let indata=JSON.parse(JSON.stringify(row));
if (row.notifyDate==='发货日期不确定') {

44
src/views/modules/ecss/declaration.vue

@ -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)

Loading…
Cancel
Save