地址选择问题

This commit is contained in:
lanzhihui 2024-10-12 14:09:56 +08:00
parent 4417971698
commit 774fbaaa79
2 changed files with 21 additions and 17 deletions

View File

@ -126,13 +126,13 @@
multiCity() {
let vm = this
vm.provinces.forEach((item, index) => {
if (item.name == vm.address.country) {
if (item.Name == vm.address.country) {
vm.multiIndex = [index, 0, 0]
item.son.forEach((res, indexA) => {
if (res.name == vm.address.province) {
item.Children.forEach((res, indexA) => {
if (res.Name == vm.address.province) {
vm.multiIndex = [index, indexA, 0]
res.son.forEach((data, indexB) => {
if (data.name == vm.address.city) {
res.Children.forEach((data, indexB) => {
if (data.Name == vm.address.city) {
vm.multiIndex = [index, indexA, indexB]
}
})

View File

@ -261,8 +261,8 @@
multiIndexA: [0, 18, 2],
modalName: '',
otherOccupation: '',
selectCity: '',
selectCityV1: ''
selectCity: null,
selectCityV1: null
},
@ -447,21 +447,22 @@
let multiIndex = [0, 0, 0]
try {
this.provinces.forEach((item, index) => {
if (item.name == '中国') {
if (item.Name == '中国') {
multiIndex = [index, 0, 0]
console.log('=-==')
this.$refs.selectCity.MultiPickerColumnChange({$wx: {detail: {
value: index,
column: 0
}}})
item.son.forEach((res, indexA) => {
if (res.name == province) {
item.Children.forEach((res, indexA) => {
if (res.Name == province) {
this.$refs.selectCity.MultiPickerColumnChange({$wx: {detail: {
value: indexA,
column: 1
}}})
multiIndex = [multiIndex[0], indexA, 0]
res.son.forEach((data, indexB) => {
if (data.name == city) {
res.Children.forEach((data, indexB) => {
if (data.Name == city) {
this.$refs.selectCity.MultiPickerColumnChange({$wx: {detail: {
value: indexB,
column: 2
@ -473,6 +474,7 @@
})
}
})
console.log(multiIndex, '22=')
this.multiIndex = multiIndex
} catch (e) {}
},
@ -480,22 +482,23 @@
multiCity1(country, province, city, type) {
let multiIndex = [0, 0, 0]
try {
console.log(this.provinces, '333====')
this.provinces.forEach((item, index) => {
if (item.name == '中国') {
if (item.Name == '中国') {
multiIndex = [index, 0, 0]
this.$refs.selectCityV1.MultiPickerColumnChange({$wx: {detail: {
value: index,
column: 0
}}})
item.son.forEach((res, indexA) => {
if (res.name == province) {
item.Children.forEach((res, indexA) => {
if (res.Name == province) {
this.$refs.selectCityV1.MultiPickerColumnChange({$wx: {detail: {
value: indexA,
column: 1
}}})
multiIndex = [multiIndex[0], indexA, 0]
res.son.forEach((data, indexB) => {
if (data.name == city) {
res.item.Children.forEach((data, indexB) => {
if (data.Name == city) {
this.$refs.selectCityV1.MultiPickerColumnChange({$wx: {detail: {
value: indexB,
column: 2
@ -630,6 +633,7 @@
},
getProvinces (value) {
this.provinces = value
console.log(this.provinces, 'pp')
}
}
})