提交 52f250f1 authored 作者: 郑伟娜's avatar 郑伟娜

处理选中的地区

上级 c6b441d6
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.a.length && scope.row.a[0] == 0">【默认】全国</span> <span v-if="scope.row.a.length && scope.row.a[0] == 0">【默认】全国</span>
<span v-if="scope.row.a.length && scope.row.a[0] != 0">【指定】{{ scope.row.a }}</span> <span v-if="scope.row.a.length && scope.row.a[0] != 0">【指定】{{ scope.row.value }}</span>
<span v-if="!scope.row.a.length" style="color: #1890ff; cursor: pointer;" @click="editAddress(scope.row, scope.$index)">【点击选择配送地区】</span> <span v-if="!scope.row.a.length" style="color: #1890ff; cursor: pointer;" @click="editAddress(scope.row, scope.$index)">【点击选择配送地区】</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
prop="dis_dispatching" prop="dis_dispatching"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.a }} {{ scope.row.value }}
</template> </template>
</el-table-column> </el-table-column>
<!-- 样式占位 --> <!-- 样式占位 -->
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
deliveryTableData: [ deliveryTableData: [
{ {
a: [0], a: [0],
name: [], value: '',
f: '', f: '',
fp: '', fp: '',
n: '', n: '',
...@@ -280,6 +280,7 @@ ...@@ -280,6 +280,7 @@
this.deliveryTableData = [ this.deliveryTableData = [
{ {
a: [0], a: [0],
value: '',
f: '', f: '',
fp: '', fp: '',
n: '', n: '',
...@@ -302,7 +303,8 @@ ...@@ -302,7 +303,8 @@
item.np = Number(item.np / 100) item.np = Number(item.np / 100)
}) })
this.noDeliveryTableData[0] = { this.noDeliveryTableData[0] = {
a: this.option.dis_dispatching a: this.option.dis_dispatching,
value: ''
} }
} }
}, },
...@@ -356,6 +358,7 @@ ...@@ -356,6 +358,7 @@
this.deliveryTableData.push( this.deliveryTableData.push(
{ {
a: [], a: [],
value: '',
f: '', f: '',
fp: '', fp: '',
n: '', n: '',
...@@ -400,15 +403,11 @@ ...@@ -400,15 +403,11 @@
saveAddress() { saveAddress() {
if (this.addType == 1) { if (this.addType == 1) {
this.rowItem.a = this.selectAddress this.rowItem.a = this.selectAddress
console.log(this.selectAddress) this.rowItem.value = this.getAddressName()
console.log(this.addressOptions)
this.getAddressName()
} else { } else {
this.noDeliveryTableData.push({ this.noDeliveryTableData.push({
a: this.selectAddress a: this.selectAddress,
value: this.getAddressName(),
}) })
} }
this.dialogAddress = false this.dialogAddress = false
...@@ -425,20 +424,19 @@ ...@@ -425,20 +424,19 @@
for(let i = 0; i < b.length; i++) { for(let i = 0; i < b.length; i++) {
c[i] = [] c[i] = []
for(let j = 0; j < this.selectAddress.length; j++) { for(let j = 0; j < this.selectAddress.length; j++) {
console.log('---',b[i] ,this.selectAddress[j][0])
if (b[i] == this.selectAddress[j][0]) { if (b[i] == this.selectAddress[j][0]) {
c[i].push(this.selectAddress[j]) c[i].push(this.selectAddress[j])
} }
} }
} }
console.log(c)
debugger
let addressName = [] let addressName = []
for(let i = 0; i < c.length; i++) { for(let i = 0; i < c.length; i++) {
let name1 = [] let name1 = []
let name2 = [] let name2 = []
let name3 = [] let name3 = []
let str = '' let str = ''
for(let j = 0; j < this.addressOptions.length; j++) { for(let j = 0; j < this.addressOptions.length; j++) {
if (c[i][0][0] == this.addressOptions[j].id) { if (c[i][0][0] == this.addressOptions[j].id) {
name1.push(this.addressOptions[j].name) name1.push(this.addressOptions[j].name)
...@@ -450,16 +448,22 @@ ...@@ -450,16 +448,22 @@
}) })
e = Array.from(new Set(d)) e = Array.from(new Set(d))
if ('children' in this.addressOptions[j]) {
if (e.length == this.addressOptions[j].children.length) { if (e.length == this.addressOptions[j].children.length) {
debugger name2.push('全部地区')
name2.push('(全部地区)')
} else { } else {
debugger if ('children' in this.addressOptions[j]) {
for(let k = 0; k < e.length; k++) { for(let k = 0; k < e.length; k++) {
let data = ''
let h = []
for(let p = 0; p < d.length; p++) {
if (e[k] == d[p]) {
h.push(d[p])
}
}
for(let l = 0; l < this.addressOptions[j].children.length; l++) { for(let l = 0; l < this.addressOptions[j].children.length; l++) {
if (e[k] == this.addressOptions[j].children[l].id) { if (e[k] == this.addressOptions[j].children[l].id) {
name2.push(this.addressOptions[j].children[l].name) data += (this.addressOptions[j].children[l].name)
let f = [] let f = []
let g = [] let g = []
...@@ -469,11 +473,9 @@ ...@@ -469,11 +473,9 @@
} }
}) })
if ('children' in this.addressOptions[j].children[l]) { if ('children' in this.addressOptions[j].children[l]) {
if (c[i].length == this.addressOptions[j].children[l].children.length) { if (h.length == this.addressOptions[j].children[l].children.length) {
debugger
name3.push('全部地区') name3.push('全部地区')
} else { } else {
debugger
for(let m = 0; m < g.length; m++) { for(let m = 0; m < g.length; m++) {
for(let n = 0; n < this.addressOptions[j].children[l].children.length; n++) { for(let n = 0; n < this.addressOptions[j].children[l].children.length; n++) {
if (g[m] == this.addressOptions[j].children[l].children[n].id) { if (g[m] == this.addressOptions[j].children[l].children[n].id) {
...@@ -482,24 +484,26 @@ ...@@ -482,24 +484,26 @@
} }
} }
} }
str = name1.join() + `【${name2.join()}】` + `(${name3.join()})`
addressName.push(str)
name2 = []
name3 = []
} }
} }
} }
data += `(${name3.join()})`
name2.push(data)
data = []
name3 = []
} }
} }
} }
} }
} }
// let str = name1.join() + `【${name2.join()}】` + `(${name3.join()})` str = name1.join() + `【${name2.join()}】`
// addressName.push(name2) addressName.push(str)
// addressName.push(name3) name2 = []
name3 = []
} }
console.log('-------------') console.log('-------------')
console.log(addressName) console.log(addressName)
return addressName.join()
}, },
// 提交 // 提交
handleSubmit() { handleSubmit() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论