Commit 0f7f4ef3 authored by Mac's avatar Mac

修改赞羊的收货地址地区选择方式

parent 57dee5f3
...@@ -61,7 +61,8 @@ ...@@ -61,7 +61,8 @@
provinces: [], provinces: [],
cities: [], cities: [],
areas: [], areas: [],
}, },
allData:null,
province: 0, province: 0,
city: 0, city: 0,
area: 0 area: 0
...@@ -77,54 +78,58 @@ ...@@ -77,54 +78,58 @@
} }
}, },
mounted() { mounted() {
this.loadDistrict() this.getAlllist()
}, },
methods: { methods: {
close() { close() {
this.$emit('input', false); this.$emit('input', false);
}, },
async loadDistrict() { getAlllist(){
this.loadProvinces()
},
loadProvinces() { // 加载省份
this.request2( this.request2(
{ {
url: '/api/Destination/GetChildList', url: '/api/Destination/GetAllList_V2',
data: {Id:1} data: {}
}, },
res => { res => {
let data = res.data this.allData = res.data
this.districtsObj.provinces = data this.loadDistrict()
this.loadCities(data[0].ID)
}, },
); );
}, },
loadCities(Id) { async loadDistrict() {
this.request2( this.loadProvinces()
{ },
url: '/api/Destination/GetChildList', loadProvinces() { // 加载省份
data: {Id:Id} this.districtsObj.provinces = this.allData
}, this.loadCities()
res => { },
let data = res.data loadCities() {//市
this.districtsObj.cities = data if(this.allData[this.province].Children && this.allData[this.province].Children.length>0){
this.loadAreas(data[0].ID) this.districtsObj.cities = this.allData[this.province].Children
}, this.loadAreas()
); }
},
loadAreas() {//区县
if(this.allData[this.province].Children[this.city]){
if(this.allData[this.province].Children[this.city].Children && this.allData[this.province].Children[this.city].Children.length>0){
this.districtsObj.areas = this.allData[this.province].Children[this.city].Children
}
}
}, },
loadAreas(Id) {
this.request2( // loadAreas(Id) {
{ // this.request2(
url: '/api/Destination/GetChildList', // {
data: {Id:Id} // url: '/api/Destination/GetChildList',
}, // data: {Id:Id}
res => { // },
let data = res.data // res => {
this.districtsObj.areas = data // let data = res.data
// this.districtsObj.areas = data
}, // },
); // );
}, // },
bindChange(event) { bindChange(event) {
this.pickVal = event.detail.value; this.pickVal = event.detail.value;
let i = 0; let i = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment