|
@@ -425,12 +425,15 @@
|
|
|
:size="'mini'"
|
|
|
:style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
>
|
|
|
- <select-area
|
|
|
- :value="scope.row.addr_code"
|
|
|
+ <search-area
|
|
|
+ :value="scope.row.code"
|
|
|
+ :is-detail="scope.row.edit"
|
|
|
:disabled="!scope.row.edit"
|
|
|
+ size="mini"
|
|
|
+ :names="scope.row.label"
|
|
|
placeholder="收货省市区"
|
|
|
- :size="'mini'"
|
|
|
- @selectChange="select_area_change($event, scope.$index)"
|
|
|
+ :level="3"
|
|
|
+ @searchChange="areaChange($event,scope.$index)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<span v-if="!scope.row.edit">{{ scope.row.addr_code_name }}</span>
|
|
@@ -872,7 +875,11 @@ export default {
|
|
|
this.loading = false
|
|
|
},
|
|
|
addrRefresh(e) {
|
|
|
- const { list } = e
|
|
|
+ const list = JSON.parse(JSON.stringify(e.list))
|
|
|
+ list.forEach(item => {
|
|
|
+ item.label = [item.label]
|
|
|
+ item.code = [item.areaCode]
|
|
|
+ })
|
|
|
this.addrForm.order_addr.push(...list)
|
|
|
},
|
|
|
|
|
@@ -929,41 +936,52 @@ export default {
|
|
|
contactor: '',
|
|
|
mobile: '',
|
|
|
addr_code: [],
|
|
|
- addr: ''
|
|
|
+ addr: '',
|
|
|
+ code: [],
|
|
|
+ label: []
|
|
|
})
|
|
|
} else {
|
|
|
this.addrForm.order_addr[index].edit = true
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 省市区选择
|
|
|
- async select_area_change(e, index) {
|
|
|
- this.addrForm.order_addr[index].addr_code = e
|
|
|
- const { addr_code } = this.addrForm.order_addr[index]
|
|
|
- if (addr_code && addr_code.length === 3) {
|
|
|
- const arrCode = addr_code[addr_code.length - 1]
|
|
|
- // console.log(model);
|
|
|
- const { code, data, message } = await asyncRequest.addrall({
|
|
|
- code: arrCode
|
|
|
- })
|
|
|
- if (code === 0) {
|
|
|
- const { province, city, area } = data
|
|
|
- const province_name = province && province.name ? province.name : ''
|
|
|
- const city_name = city && city.name ? city.name : ''
|
|
|
- const area_name = area && area.name ? area.name : ''
|
|
|
- this.addrForm.order_addr[index].addr_code_name =
|
|
|
- province_name && city_name && area_name
|
|
|
- ? `${province_name}/${city_name}/${area_name}`
|
|
|
- : ''
|
|
|
- } else if (code >= 100 && code <= 104) {
|
|
|
- await this.logout()
|
|
|
- } else {
|
|
|
- this.$message.warning(message)
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.addrForm.order_addr[index].addr_code_name = ''
|
|
|
- }
|
|
|
+ async areaChange(e, index) {
|
|
|
+ const { code, area_code, label, splitLabel } = e
|
|
|
+ // this.addrForm.order_addr[index] = e
|
|
|
+ this.addrForm.order_addr[index].addr_code_name = splitLabel ? splitLabel.split(',').join('/') : ''
|
|
|
+ this.addrForm.order_addr[index].addr_code = code ? code.split(',') : []
|
|
|
+ this.addrForm.order_addr[index].code = area_code ? [area_code] : []
|
|
|
+ this.addrForm.order_addr[index].label = label ? [label] : []
|
|
|
+ // this.$refs.ruleForm.validateField('addr_code')
|
|
|
},
|
|
|
+ // 省市区选择
|
|
|
+ // async select_area_change(e, index) {
|
|
|
+ // this.addrForm.order_addr[index].addr_code = e
|
|
|
+ // const { addr_code } = this.addrForm.order_addr[index]
|
|
|
+ // if (addr_code && addr_code.length === 3) {
|
|
|
+ // const arrCode = addr_code[addr_code.length - 1]
|
|
|
+ // // console.log(model);
|
|
|
+ // const { code, data, message } = await asyncRequest.addrall({
|
|
|
+ // code: arrCode
|
|
|
+ // })
|
|
|
+ // if (code === 0) {
|
|
|
+ // const { province, city, area } = data
|
|
|
+ // const province_name = province && province.name ? province.name : ''
|
|
|
+ // const city_name = city && city.name ? city.name : ''
|
|
|
+ // const area_name = area && area.name ? area.name : ''
|
|
|
+ // this.addrForm.order_addr[index].addr_code_name =
|
|
|
+ // province_name && city_name && area_name
|
|
|
+ // ? `${province_name}/${city_name}/${area_name}`
|
|
|
+ // : ''
|
|
|
+ // } else if (code >= 100 && code <= 104) {
|
|
|
+ // await this.logout()
|
|
|
+ // } else {
|
|
|
+ // this.$message.warning(message)
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.addrForm.order_addr[index].addr_code_name = ''
|
|
|
+ // }
|
|
|
+ // },
|
|
|
// 省市区保存某一行
|
|
|
checkRow(rowIndex) {
|
|
|
this.$refs.addrForm.validate((valid) => {
|