jiangping
2024-07-18 64a6a81753abfc712b1ab384de0f7afb87f4fb23
admin/src/components/business/OperaShopWindow.vue
@@ -167,9 +167,12 @@
        .then(res => {
          this.provinces = res
        })
      if(this.form.provinceCode){
        this.selectProvince(this.form.provinceCode,true)
      }
    },
    // 选择省份
    selectProvince (val) {
    selectProvince (val,isInit) {
      this.provinces.forEach(item => {
        if (item.id == val) {
          this.form.provinceName = item.name
@@ -177,29 +180,35 @@
      })
      this.cities = []
      this.areas = []
      this.form.cityName = ''
      this.form.areaCode = ''
      this.form.cityCode = ''
      this.form.areaName = ''
      if(!isInit){
        this.form.cityName = ''
        this.form.areaCode = ''
        this.form.cityCode = ''
        this.form.areaName = ''
      }
      if(!val || val ==''){
        return
      }
      this.api.areaList({ pid: val })
        .then(res => {
          this.cities = res
          this.selectCity(this.form.cityId)
          if(isInit){
            this.selectCity(this.form.cityCode,isInit)
          }
        })
    },
    // 选择城市
    selectCity (val) {
    selectCity (val,isInit) {
      this.cities.forEach(item => {
        if (item.id == val) {
          this.form.cityName = item.name
        }
      })
      this.areas = []
      this.form.areaCode = ''
      this.form.areaName = ''
      if(!isInit){
        this.form.areaCode = ''
        this.form.areaName = ''
      }
      if(!val || val ==''){
        return
      }