地址选择问题

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() { multiCity() {
let vm = this let vm = this
vm.provinces.forEach((item, index) => { vm.provinces.forEach((item, index) => {
if (item.name == vm.address.country) { if (item.Name == vm.address.country) {
vm.multiIndex = [index, 0, 0] vm.multiIndex = [index, 0, 0]
item.son.forEach((res, indexA) => { item.Children.forEach((res, indexA) => {
if (res.name == vm.address.province) { if (res.Name == vm.address.province) {
vm.multiIndex = [index, indexA, 0] vm.multiIndex = [index, indexA, 0]
res.son.forEach((data, indexB) => { res.Children.forEach((data, indexB) => {
if (data.name == vm.address.city) { if (data.Name == vm.address.city) {
vm.multiIndex = [index, indexA, indexB] vm.multiIndex = [index, indexA, indexB]
} }
}) })

View File

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