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

处理选中的地区

上级 c6b441d6
......@@ -60,7 +60,7 @@
>
<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">【指定】{{ 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>
</template>
</el-table-column>
......@@ -149,7 +149,7 @@
prop="dis_dispatching"
>
<template slot-scope="scope">
{{ scope.row.a }}
{{ scope.row.value }}
</template>
</el-table-column>
<!-- 样式占位 -->
......@@ -238,7 +238,7 @@
deliveryTableData: [
{
a: [0],
name: [],
value: '',
f: '',
fp: '',
n: '',
......@@ -280,6 +280,7 @@
this.deliveryTableData = [
{
a: [0],
value: '',
f: '',
fp: '',
n: '',
......@@ -302,7 +303,8 @@
item.np = Number(item.np / 100)
})
this.noDeliveryTableData[0] = {
a: this.option.dis_dispatching
a: this.option.dis_dispatching,
value: ''
}
}
},
......@@ -356,6 +358,7 @@
this.deliveryTableData.push(
{
a: [],
value: '',
f: '',
fp: '',
n: '',
......@@ -400,15 +403,11 @@
saveAddress() {
if (this.addType == 1) {
this.rowItem.a = this.selectAddress
console.log(this.selectAddress)
console.log(this.addressOptions)
this.getAddressName()
this.rowItem.value = this.getAddressName()
} else {
this.noDeliveryTableData.push({
a: this.selectAddress
a: this.selectAddress,
value: this.getAddressName(),
})
}
this.dialogAddress = false
......@@ -425,20 +424,19 @@
for(let i = 0; i < b.length; i++) {
c[i] = []
for(let j = 0; j < this.selectAddress.length; j++) {
console.log('---',b[i] ,this.selectAddress[j][0])
if (b[i] == this.selectAddress[j][0]) {
c[i].push(this.selectAddress[j])
}
}
}
console.log(c)
debugger
let addressName = []
for(let i = 0; i < c.length; i++) {
let name1 = []
let name2 = []
let name3 = []
let str = ''
for(let j = 0; j < this.addressOptions.length; j++) {
if (c[i][0][0] == this.addressOptions[j].id) {
name1.push(this.addressOptions[j].name)
......@@ -449,57 +447,63 @@
d.push(item[1])
})
e = Array.from(new Set(d))
if ('children' in this.addressOptions[j]) {
if (e.length == this.addressOptions[j].children.length) {
debugger
name2.push('(全部地区)')
} else {
debugger
if (e.length == this.addressOptions[j].children.length) {
name2.push('全部地区')
} else {
if ('children' in this.addressOptions[j]) {
for(let k = 0; k < e.length; k++) {
for(let l = 0; l < this.addressOptions[j].children.length; l++) {
if (e[k] == this.addressOptions[j].children[l].id) {
name2.push(this.addressOptions[j].children[l].name)
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++) {
if (e[k] == this.addressOptions[j].children[l].id) {
data += (this.addressOptions[j].children[l].name)
let f = []
let g = []
c[i].map(item => {
if (e[k] == item[1]) {
g.push(item[2])
}
})
if ('children' in this.addressOptions[j].children[l]) {
if (c[i].length == this.addressOptions[j].children[l].children.length) {
debugger
name3.push('全部地区')
} else {
debugger
for(let m = 0; m < g.length; m++) {
for(let n = 0; n < this.addressOptions[j].children[l].children.length; n++) {
if (g[m] == this.addressOptions[j].children[l].children[n].id) {
name3.push(this.addressOptions[j].children[l].children[n].name)
let f = []
let g = []
c[i].map(item => {
if (e[k] == item[1]) {
g.push(item[2])
}
})
if ('children' in this.addressOptions[j].children[l]) {
if (h.length == this.addressOptions[j].children[l].children.length) {
name3.push('全部地区')
} else {
for(let m = 0; m < g.length; m++) {
for(let n = 0; n < this.addressOptions[j].children[l].children.length; n++) {
if (g[m] == this.addressOptions[j].children[l].children[n].id) {
name3.push(this.addressOptions[j].children[l].children[n].name)
}
}
}
}
}
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()})`
// addressName.push(name2)
// addressName.push(name3)
str = name1.join() + `【${name2.join()}】`
addressName.push(str)
name2 = []
name3 = []
}
console.log('-------------')
console.log(addressName)
return addressName.join()
},
// 提交
handleSubmit() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论