import { getRegionAreaList } from '@/config/order.js' export default { data() { return { regionList: [], provinceList: [], cityList: [], countyList: [], regionCity: '', regionProvince: '', regionCounty: '', gradeValue: null, defaultRegionSelectCode: [], } }, computed: {}, methods: { getRegionAreaList(gradeValue) { if (!gradeValue) return this.gradeValue = gradeValue const params = { type: 'county', } getRegionAreaList(params).then(res => { this.provinceList = res.data.filter(item => item.parent === 0) this.cityList = res.data.filter(item => this.provinceList.find(province => province.pkId === item.parent) ) this.countyList = res.data.filter(item => this.cityList.find(city => city.pkId === item.parent) ) this.getProvinceFilterList() this.getCityFilterList() this.getCountyFilterList() }) }, getProvinceFilterList() { if (!this.cityList.length) { this.provinceList = [] } this.provinceList = this.provinceList.filter( item => !!this.cityList.find(city => city.parent === item.pkId) ) }, getCityFilterList() { if (!this.countyList.length) { this.cityList = [] } this.cityList = this.cityList.filter( item => !!this.countyList.find(county => county.parent === item.pkId) ) }, getCountyFilterList() { if (!this.gradeValue) { this.countyList = [] } }, }, onShow() { // this.getRegionAreaList() }, }