| 
									
										
										
										
											2025-07-12 10:15:12 +08:00
										 |  |  | 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 = { | 
					
						
							| 
									
										
										
										
											2025-08-12 15:38:30 +08:00
										 |  |  |         type: 'county', | 
					
						
							| 
									
										
										
										
											2025-07-12 10:15:12 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       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() { | 
					
						
							| 
									
										
										
										
											2025-08-12 15:38:30 +08:00
										 |  |  |       if (!this.gradeValue) { | 
					
						
							| 
									
										
										
										
											2025-07-12 10:15:12 +08:00
										 |  |  |         this.countyList = [] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   onShow() { | 
					
						
							|  |  |  |     // this.getRegionAreaList()
 | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | } |