<template>
  <el-dialog
    v-model="dialogFormVisible"
    :title="title"
    width="500px"
    @close="close"
  >
    <el-form ref="formRef" label-width="80px" :model="form" :rules="rules">
      <el-form-item :label="t('联系人')" prop="ss_name">
        <el-input
          v-model="form.ss_name"
          clearable
          :placeholder="t('请输入联系人')"
          :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-row>
        <el-col :span="10">
          <el-form-item :label="t('手机号码')" prop="ss_intl">
            <el-select v-model="form.ss_intl" :style="{ width: '100%' }">
              <el-option
                v-for="(item, index) in intlOptions"
                :key="index"
                :disabled="item.disabled"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="14">
          <el-form-item label-width="0" prop="ss_mobile">
            <el-input
              v-model="form.ss_mobile"
              clearable
              :placeholder="t('请输入手机号码')"
              :style="{ width: '100%' }"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item :label="t('邮编')" prop="ss_postalcode">
        <el-input
          v-model="form.ss_postalcode"
          clearable
          :placeholder="t('请输入邮编')"
          :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item :label="t('发货地址')">
        <Area
          v-model="selectArea"
          :placeholder="t('请选择发货地址')"
          width="500"
        />
      </el-form-item>
      <el-form-item :label="t('详细地址')" prop="ss_address">
        <el-input
          v-model="form.ss_address"
          clearable
          :placeholder="t('详细地址-不必重复填写地区')"
          :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item label="默认地址" prop="ss_is_default">
        <el-radio-group v-model="form.ss_is_default" size="medium">
          <el-radio
            v-for="(item, index) in ss_is_defaultOptions"
            :key="index"
            :disabled="item.disabled"
            :label="item.value"
          >
            {{ item.label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>

    </el-form>
    <template #footer>
      <el-button @click="close">{{ t('取 消')}}</el-button>
      <el-button type="primary" @click="save">{{ t('确 定')}}</el-button>
    </template>
  </el-dialog>
</template>

<script>
import { translate as t } from '@/i18n'
import {doEdit, doAdd} from '@/api/shop/storeShippingAddress'
import Area from "@sslib/components/MsArea/Area";
import {isPhone} from "vue-plugin-utils";

export default defineComponent({
  name: 'StoreShippingAddressEdit',
  components: { Area },
  props:{
  },
  emits: ['fetch-data'],
  setup(props, {emit}) {
    const $message = inject('$message')

    const state = reactive({
      formRef: null,
      form: {},
      title: '',
      dialogFormVisible: false,
      // 提交状态
      loading: false,
      // 是否是修改
      isUpdate: false,
      ss_is_defaultOptions: [
        {
          label: t('默认'),
          value: true,
        },
        {
          label: t('非默认'),
          value: false,
        },
      ],
      intlOptions: [
        {
          label: t('简中（+86）'),
          value: '+86',
        },
        {
          label: 'U.S.A(+1)',
          value: '+1',
        },
        {
          label: 'عربي ، (+966)',
          value: '966+',
        },
        {
          label: t('日本語(+81)'),
          value: '+81',
        },
      ],
      selectArea: {
        province: {},
        city: {},
        district: {},
      },

      areaOptions: [{"district_id":110000,"district_name":"北京","children":[{"district_id":110100,"district_name":"北京市","children":[{"district_id":110101,"district_name":"东城区","children":null},{"district_id":110102,"district_name":"西城区","children":null},{"district_id":110105,"district_name":"朝阳区","children":null},{"district_id":110106,"district_name":"丰台区","children":null},{"district_id":110107,"district_name":"石景山区","children":null},{"district_id":110108,"district_name":"海淀区","children":null},{"district_id":110109,"district_name":"门头沟区","children":null},{"district_id":110111,"district_name":"房山区","children":null},{"district_id":110112,"district_name":"通州区","children":null},{"district_id":110113,"district_name":"顺义区","children":null},{"district_id":110114,"district_name":"昌平区","children":null},{"district_id":110115,"district_name":"大兴区","children":null},{"district_id":110116,"district_name":"怀柔区","children":null},{"district_id":110117,"district_name":"平谷区","children":null},{"district_id":110118,"district_name":"密云区","children":null},{"district_id":110119,"district_name":"延庆区","children":null}]}]},{"district_id":120000,"district_name":"天津","children":[{"district_id":120100,"district_name":"天津市","children":[{"district_id":120101,"district_name":"和平区","children":null},{"district_id":120102,"district_name":"河东区","children":null},{"district_id":120103,"district_name":"河西区","children":null},{"district_id":120104,"district_name":"南开区","children":null},{"district_id":120105,"district_name":"河北区","children":null},{"district_id":120106,"district_name":"红桥区","children":null},{"district_id":120110,"district_name":"东丽区","children":null},{"district_id":120111,"district_name":"西青区","children":null},{"district_id":120112,"district_name":"津南区","children":null},{"district_id":120113,"district_name":"北辰区","children":null},{"district_id":120114,"district_name":"武清区","children":null},{"district_id":120115,"district_name":"宝坻区","children":null},{"district_id":120116,"district_name":"滨海新区","children":null},{"district_id":120117,"district_name":"宁河区","children":null},{"district_id":120118,"district_name":"静海区","children":null},{"district_id":120119,"district_name":"蓟州区","children":null}]}]},{"district_id":130000,"district_name":"河北省","children":[{"district_id":130100,"district_name":"石家庄市","children":[{"district_id":130102,"district_name":"长安区","children":null},{"district_id":130104,"district_name":"桥西区","children":null},{"district_id":130105,"district_name":"新华区","children":null},{"district_id":130107,"district_name":"井陉矿区","children":null},{"district_id":130108,"district_name":"裕华区","children":null},{"district_id":130109,"district_name":"藁城区","children":null},{"district_id":130110,"district_name":"鹿泉区","children":null},{"district_id":130111,"district_name":"栾城区","children":null},{"district_id":130121,"district_name":"井陉县","children":null},{"district_id":130123,"district_name":"正定县","children":null},{"district_id":130125,"district_name":"行唐县","children":null},{"district_id":130126,"district_name":"灵寿县","children":null},{"district_id":130127,"district_name":"高邑县","children":null},{"district_id":130128,"district_name":"深泽县","children":null},{"district_id":130129,"district_name":"赞皇县","children":null},{"district_id":130130,"district_name":"无极县","children":null},{"district_id":130131,"district_name":"平山县","children":null},{"district_id":130132,"district_name":"元氏县","children":null},{"district_id":130133,"district_name":"赵县","children":null},{"district_id":130171,"district_name":"石家庄高新技术产业开发区","children":null},{"district_id":130172,"district_name":"石家庄循环化工园区","children":null},{"district_id":130181,"district_name":"辛集市","children":null},{"district_id":130183,"district_name":"晋州市","children":null},{"district_id":130184,"district_name":"新乐市","children":null}]},{"district_id":130200,"district_name":"唐山市","children":[{"district_id":130202,"district_name":"路南区","children":null},{"district_id":130203,"district_name":"路北区","children":null},{"district_id":130204,"district_name":"古冶区","children":null},{"district_id":130205,"district_name":"开平区","children":null},{"district_id":130207,"district_name":"丰南区","children":null},{"district_id":130208,"district_name":"丰润区","children":null},{"district_id":130209,"district_name":"曹妃甸区","children":null},{"district_id":130224,"district_name":"滦南县","children":null},{"district_id":130225,"district_name":"乐亭县","children":null},{"district_id":130227,"district_name":"迁西县","children":null},{"district_id":130229,"district_name":"玉田县","children":null},{"district_id":130271,"district_name":"河北唐山芦台经济开发区","children":null},{"district_id":130272,"district_name":"唐山市汉沽管理区","children":null},{"district_id":130273,"district_name":"唐山高新技术产业开发区","children":null},{"district_id":130274,"district_name":"河北唐山海港经济开发区","children":null},{"district_id":130281,"district_name":"遵化市","children":null},{"district_id":130283,"district_name":"迁安市","children":null},{"district_id":130284,"district_name":"滦州市","children":null}]},{"district_id":130300,"district_name":"秦皇岛市","children":[{"district_id":130302,"district_name":"海港区","children":null},{"district_id":130303,"district_name":"山海关区","children":null},{"district_id":130304,"district_name":"北戴河区","children":null},{"district_id":130306,"district_name":"抚宁区","children":null},{"district_id":130321,"district_name":"青龙满族自治县","children":null},{"district_id":130322,"district_name":"昌黎县","children":null},{"district_id":130324,"district_name":"卢龙县","children":null},{"district_id":130371,"district_name":"秦皇岛市经济技术开发区","children":null},{"district_id":130372,"district_name":"北戴河新区","children":null}]},{"district_id":130400,"district_name":"邯郸市","children":[{"district_id":130402,"district_name":"邯山区","children":null},{"district_id":130403,"district_name":"丛台区","children":null},{"district_id":130404,"district_name":"复兴区","children":null},{"district_id":130406,"district_name":"峰峰矿区","children":null},{"district_id":130407,"district_name":"肥乡区","children":null},{"district_id":130408,"district_name":"永年区","children":null},{"district_id":130423,"district_name":"临漳县","children":null},{"district_id":130424,"district_name":"成安县","children":null},{"district_id":130425,"district_name":"大名县","children":null},{"district_id":130426,"district_name":"涉县","children":null},{"district_id":130427,"district_name":"磁县","children":null},{"district_id":130430,"district_name":"邱县","children":null},{"district_id":130431,"district_name":"鸡泽县","children":null},{"district_id":130432,"district_name":"广平县","children":null},{"district_id":130433,"district_name":"馆陶县","children":null},{"district_id":130434,"district_name":"魏县","children":null},{"district_id":130435,"district_name":"曲周县","children":null},{"district_id":130471,"district_name":"邯郸经济技术开发区","children":null},{"district_id":130473,"district_name":"邯郸冀南新区","children":null},{"district_id":130481,"district_name":"武安市","children":null}]},{"district_id":130500,"district_name":"邢台市","children":[{"district_id":130502,"district_name":"桥东区","children":null},{"district_id":130503,"district_name":"桥西区","children":null},{"district_id":130521,"district_name":"邢台县","children":null},{"district_id":130522,"district_name":"临城县","children":null},{"district_id":130523,"district_name":"内丘县","children":null},{"district_id":130524,"district_name":"柏乡县","children":null},{"district_id":130525,"district_name":"隆尧县","children":null},{"district_id":130526,"district_name":"任县","children":null},{"district_id":130527,"district_name":"南和县","children":null},{"district_id":130528,"district_name":"宁晋县","children":null},{"district_id":130529,"district_name":"巨鹿县","children":null},{"district_id":130530,"district_name":"新河县","children":null},{"district_id":130531,"district_name":"广宗县","children":null},{"district_id":130532,"district_name":"平乡县","children":null},{"district_id":130533,"district_name":"威县","children":null},{"district_id":130534,"district_name":"清河县","children":null},{"district_id":130535,"district_name":"临西县","children":null},{"district_id":130571,"district_name":"河北邢台经济开发区","children":null},{"district_id":130581,"district_name":"南宫市","children":null},{"district_id":130582,"district_name":"沙河市","children":null}]},{"district_id":130600,"district_name":"保定市","children":[{"district_id":130602,"district_name":"竞秀区","children":null},{"district_id":130606,"district_name":"莲池区","children":null},{"district_id":130607,"district_name":"满城区","children":null},{"district_id":130608,"district_name":"清苑区","children":null},{"district_id":130609,"district_name":"徐水区","children":null},{"district_id":130623,"district_name":"涞水县","children":null},{"district_id":130624,"district_name":"阜平县","children":null},{"district_id":130626,"district_name":"定兴县","children":null},{"district_id":130627,"district_name":"唐县","children":null},{"district_id":130628,"district_name":"高阳县","children":null},{"district_id":130629,"district_name":"容城县","children":null},{"district_id":130630,"district_name":"涞源县","children":null},{"district_id":130631,"district_name":"望都县","children":null},{"district_id":130632,"district_name":"安新县","children":null},{"district_id":130633,"district_name":"易县","children":null},{"district_id":130634,"district_name":"曲阳县","children":null},{"district_id":130635,"district_name":"蠡县","children":null},{"district_id":130636,"district_name":"顺平县","children":null},{"district_id":130637,"district_name":"博野县","children":null},{"district_id":130638,"district_name":"雄县","children":null},{"district_id":130671,"district_name":"保定高新技术产业开发区","children":null},{"district_id":130672,"district_name":"保定白沟新城","children":null},{"district_id":130681,"district_name":"涿州市","children":null},{"district_id":130682,"district_name":"定州市","children":null},{"district_id":130683,"district_name":"安国市","children":null},{"district_id":130684,"district_name":"高碑店市","children":null}]},{"district_id":130700,"district_name":"张家口市","children":[{"district_id":130702,"district_name":"桥东区","children":null},{"district_id":130703,"district_name":"桥西区","children":null},{"district_id":130705,"district_name":"宣化区","children":null},{"district_id":130706,"district_name":"下花园区","children":null},{"district_id":130708,"district_name":"万全区","children":null},{"district_id":130709,"district_name":"崇礼区","children":null},{"district_id":130722,"district_name":"张北县","children":null},{"district_id":130723,"district_name":"康保县","children":null},{"district_id":130724,"district_name":"沽源县","children":null},{"district_id":130725,"district_name":"尚义县","children":null},{"district_id":130726,"district_name":"蔚县","children":null},{"district_id":130727,"district_name":"阳原县","children":null},{"district_id":130728,"district_name":"怀安县","children":null},{"district_id":130730,"district_name":"怀来县","children":null},{"district_id":130731,"district_name":"涿鹿县","children":null},{"district_id":130732,"district_name":"赤城县","children":null},{"district_id":130771,"district_name":"张家口经济开发区","children":null},{"district_id":130772,"district_name":"张家口市察北管理区","children":null},{"district_id":130773,"district_name":"张家口市塞北管理区","children":null}]},{"district_id":130800,"district_name":"承德市","children":[{"district_id":130802,"district_name":"双桥区","children":null},{"district_id":130803,"district_name":"双滦区","children":null},{"district_id":130804,"district_name":"鹰手营子矿区","children":null},{"district_id":130821,"district_name":"承德县","children":null},{"district_id":130822,"district_name":"兴隆县","children":null},{"district_id":130824,"district_name":"滦平县","children":null},{"district_id":130825,"district_name":"隆化县","children":null},{"district_id":130826,"district_name":"丰宁满族自治县","children":null},{"district_id":130827,"district_name":"宽城满族自治县","children":null},{"district_id":130828,"district_name":"围场满族蒙古族自治县","children":null},{"district_id":130871,"district_name":"承德高新技术产业开发区","children":null},{"district_id":130881,"district_name":"平泉市","children":null}]},{"district_id":130900,"district_name":"沧州市","children":[{"district_id":130902,"district_name":"新华区","children":null},{"district_id":130903,"district_name":"运河区","children":null},{"district_id":130921,"district_name":"沧县","children":null},{"district_id":130922,"district_name":"青县","children":null},{"district_id":130923,"district_name":"东光县","children":null},{"district_id":130924,"district_name":"海兴县","children":null},{"district_id":130925,"district_name":"盐山县","children":null},{"district_id":130926,"district_name":"肃宁县","children":null},{"district_id":130927,"district_name":"南皮县","children":null},{"district_id":130928,"district_name":"吴桥县","children":null},{"district_id":130929,"district_name":"献县","children":null},{"district_id":130930,"district_name":"孟村回族自治县","children":null},{"district_id":130971,"district_name":"河北沧州经济开发区","children":null},{"district_id":130972,"district_name":"沧州高新技术产业开发区","children":null},{"district_id":130973,"district_name":"沧州渤海新区","children":null},{"district_id":130981,"district_name":"泊头市","children":null},{"district_id":130982,"district_name":"任丘市","children":null},{"district_id":130983,"district_name":"黄骅市","children":null},{"district_id":130984,"district_name":"河间市","children":null}]},{"district_id":131000,"district_name":"廊坊市","children":[{"district_id":131002,"district_name":"安次区","children":null},{"district_id":131003,"district_name":"广阳区","children":null},{"district_id":131022,"district_name":"固安县","children":null},{"district_id":131023,"district_name":"永清县","children":null},{"district_id":131024,"district_name":"香河县","children":null},{"district_id":131025,"district_name":"大城县","children":null},{"district_id":131026,"district_name":"文安县","children":null},{"district_id":131028,"district_name":"大厂回族自治县","children":null},{"district_id":131071,"district_name":"廊坊经济技术开发区","children":null},{"district_id":131081,"district_name":"霸州市","children":null},{"district_id":131082,"district_name":"三河市","children":null}]},{"district_id":131100,"district_name":"衡水市","children":[{"district_id":131102,"district_name":"桃城区","children":null},{"district_id":131103,"district_name":"冀州区","children":null},{"district_id":131121,"district_name":"枣强县","children":null},{"district_id":131122,"district_name":"武邑县","children":null},{"district_id":131123,"district_name":"武强县","children":null},{"district_id":131124,"district_name":"饶阳县","children":null},{"district_id":131125,"district_name":"安平县","children":null},{"district_id":131126,"district_name":"故城县","children":null},{"district_id":131127,"district_name":"景县","children":null},{"district_id":131128,"district_name":"阜城县","children":null},{"district_id":131171,"district_name":"河北衡水高新技术产业开发区","children":null},{"district_id":131172,"district_name":"衡水滨湖新区","children":null},{"district_id":131182,"district_name":"深州市","children":null}]}]},{"district_id":140000,"district_name":"山西省","children":[{"district_id":140100,"district_name":"太原市","children":[{"district_id":140105,"district_name":"小店区","children":null},{"district_id":140106,"district_name":"迎泽区","children":null},{"district_id":140107,"district_name":"杏花岭区","children":null},{"district_id":140108,"district_name":"尖草坪区","children":null},{"district_id":140109,"district_name":"万柏林区","children":null},{"district_id":140110,"district_name":"晋源区","children":null},{"district_id":140121,"district_name":"清徐县","children":null},{"district_id":140122,"district_name":"阳曲县","children":null},{"district_id":140123,"district_name":"娄烦县","children":null},{"district_id":140171,"district_name":"山西转型综合改革示范区","children":null},{"district_id":140181,"district_name":"古交市","children":null}]},{"district_id":140200,"district_name":"大同市","children":[{"district_id":140212,"district_name":"新荣区","children":null},{"district_id":140213,"district_name":"平城区","children":null},{"district_id":140214,"district_name":"云冈区","children":null},{"district_id":140215,"district_name":"云州区","children":null},{"district_id":140221,"district_name":"阳高县","children":null},{"district_id":140222,"district_name":"天镇县","children":null},{"district_id":140223,"district_name":"广灵县","children":null},{"district_id":140224,"district_name":"灵丘县","children":null},{"district_id":140225,"district_name":"浑源县","children":null},{"district_id":140226,"district_name":"左云县","children":null},{"district_id":140271,"district_name":"山西大同经济开发区","children":null}]},{"district_id":140300,"district_name":"阳泉市","children":[{"district_id":140302,"district_name":"城区","children":null},{"district_id":140303,"district_name":"矿区","children":null},{"district_id":140311,"district_name":"郊区","children":null},{"district_id":140321,"district_name":"平定县","children":null},{"district_id":140322,"district_name":"盂县","children":null}]},{"district_id":140400,"district_name":"长治市","children":[{"district_id":140403,"district_name":"潞州区","children":null},{"district_id":140404,"district_name":"上党区","children":null},{"district_id":140405,"district_name":"屯留区","children":null},{"district_id":140406,"district_name":"潞城区","children":null},{"district_id":140423,"district_name":"襄垣县","children":null},{"district_id":140425,"district_name":"平顺县","children":null},{"district_id":140426,"district_name":"黎城县","children":null},{"district_id":140427,"district_name":"壶关县","children":null},{"district_id":140428,"district_name":"长子县","children":null},{"district_id":140429,"district_name":"武乡县","children":null},{"district_id":140430,"district_name":"沁县","children":null},{"district_id":140431,"district_name":"沁源县","children":null},{"district_id":140471,"district_name":"山西长治高新技术产业园区","children":null}]},{"district_id":140500,"district_name":"晋城市","children":[{"district_id":140502,"district_name":"城区","children":null},{"district_id":140521,"district_name":"沁水县","children":null},{"district_id":140522,"district_name":"阳城县","children":null},{"district_id":140524,"district_name":"陵川县","children":null},{"district_id":140525,"district_name":"泽州县","children":null},{"district_id":140581,"district_name":"高平市","children":null}]},{"district_id":140600,"district_name":"朔州市","children":[{"district_id":140602,"district_name":"朔城区","children":null},{"district_id":140603,"district_name":"平鲁区","children":null},{"district_id":140621,"district_name":"山阴县","children":null},{"district_id":140622,"district_name":"应县","children":null},{"district_id":140623,"district_name":"右玉县","children":null},{"district_id":140671,"district_name":"山西朔州经济开发区","children":null},{"district_id":140681,"district_name":"怀仁市","children":null}]},{"district_id":140700,"district_name":"晋中市","children":[{"district_id":140702,"district_name":"榆次区","children":null},{"district_id":140721,"district_name":"榆社县","children":null},{"district_id":140722,"district_name":"左权县","children":null},{"district_id":140723,"district_name":"和顺县","children":null},{"district_id":140724,"district_name":"昔阳县","children":null},{"district_id":140725,"district_name":"寿阳县","children":null},{"district_id":140726,"district_name":"太谷县","children":null},{"district_id":140727,"district_name":"祁县","children":null},{"district_id":140728,"district_name":"平遥县","children":null},{"district_id":140729,"district_name":"灵石县","children":null},{"district_id":140781,"district_name":"介休市","children":null}]},{"district_id":140800,"district_name":"运城市","children":[{"district_id":140802,"district_name":"盐湖区","children":null},{"district_id":140821,"district_name":"临猗县","children":null},{"district_id":140822,"district_name":"万荣县","children":null},{"district_id":140823,"district_name":"闻喜县","children":null},{"district_id":140824,"district_name":"稷山县","children":null},{"district_id":140825,"district_name":"新绛县","children":null},{"district_id":140826,"district_name":"绛县","children":null},{"district_id":140827,"district_name":"垣曲县","children":null},{"district_id":140828,"district_name":"夏县","children":null},{"district_id":140829,"district_name":"平陆县","children":null},{"district_id":140830,"district_name":"芮城县","children":null},{"district_id":140881,"district_name":"永济市","children":null},{"district_id":140882,"district_name":"河津市","children":null}]},{"district_id":140900,"district_name":"忻州市","children":[{"district_id":140902,"district_name":"忻府区","children":null},{"district_id":140921,"district_name":"定襄县","children":null},{"district_id":140922,"district_name":"五台县","children":null},{"district_id":140923,"district_name":"代县","children":null},{"district_id":140924,"district_name":"繁峙县","children":null},{"district_id":140925,"district_name":"宁武县","children":null},{"district_id":140926,"district_name":"静乐县","children":null},{"district_id":140927,"district_name":"神池县","children":null},{"district_id":140928,"district_name":"五寨县","children":null},{"district_id":140929,"district_name":"岢岚县","children":null},{"district_id":140930,"district_name":"河曲县","children":null},{"district_id":140931,"district_name":"保德县","children":null},{"district_id":140932,"district_name":"偏关县","children":null},{"district_id":140971,"district_name":"五台山风景名胜区","children":null},{"district_id":140981,"district_name":"原平市","children":null}]},{"district_id":141000,"district_name":"临汾市","children":[{"district_id":141002,"district_name":"尧都区","children":null},{"district_id":141021,"district_name":"曲沃县","children":null},{"district_id":141022,"district_name":"翼城县","children":null},{"district_id":141023,"district_name":"襄汾县","children":null},{"district_id":141024,"district_name":"洪洞县","children":null},{"district_id":141025,"district_name":"古县","children":null},{"district_id":141026,"district_name":"安泽县","children":null},{"district_id":141027,"district_name":"浮山县","children":null},{"district_id":141028,"district_name":"吉县","children":null},{"district_id":141029,"district_name":"乡宁县","children":null},{"district_id":141030,"district_name":"大宁县","children":null},{"district_id":141031,"district_name":"隰县","children":null},{"district_id":141032,"district_name":"永和县","children":null},{"district_id":141033,"district_name":"蒲县","children":null},{"district_id":141034,"district_name":"汾西县","children":null},{"district_id":141081,"district_name":"侯马市","children":null},{"district_id":141082,"district_name":"霍州市","children":null}]},{"district_id":141100,"district_name":"吕梁市","children":[{"district_id":141102,"district_name":"离石区","children":null},{"district_id":141121,"district_name":"文水县","children":null},{"district_id":141122,"district_name":"交城县","children":null},{"district_id":141123,"district_name":"兴县","children":null},{"district_id":141124,"district_name":"临县","children":null},{"district_id":141125,"district_name":"柳林县","children":null},{"district_id":141126,"district_name":"石楼县","children":null},{"district_id":141127,"district_name":"岚县","children":null},{"district_id":141128,"district_name":"方山县","children":null},{"district_id":141129,"district_name":"中阳县","children":null},{"district_id":141130,"district_name":"交口县","children":null},{"district_id":141181,"district_name":"孝义市","children":null},{"district_id":141182,"district_name":"汾阳市","children":null}]}]},{"district_id":150000,"district_name":"内蒙古自治区","children":[{"district_id":150100,"district_name":"呼和浩特市","children":[{"district_id":150102,"district_name":"新城区","children":null},{"district_id":150103,"district_name":"回民区","children":null},{"district_id":150104,"district_name":"玉泉区","children":null},{"district_id":150105,"district_name":"赛罕区","children":null},{"district_id":150121,"district_name":"土默特左旗","children":null},{"district_id":150122,"district_name":"托克托县","children":null},{"district_id":150123,"district_name":"和林格尔县","children":null},{"district_id":150124,"district_name":"清水河县","children":null},{"district_id":150125,"district_name":"武川县","children":null},{"district_id":150171,"district_name":"呼和浩特金海工业园区","children":null},{"district_id":150172,"district_name":"呼和浩特经济技术开发区","children":null}]},{"district_id":150200,"district_name":"包头市","children":[{"district_id":150202,"district_name":"东河区","children":null},{"district_id":150203,"district_name":"昆都仑区","children":null},{"district_id":150204,"district_name":"青山区","children":null},{"district_id":150205,"district_name":"石拐区","children":null},{"district_id":150206,"district_name":"白云鄂博矿区","children":null},{"district_id":150207,"district_name":"九原区","children":null},{"district_id":150221,"district_name":"土默特右旗","children":null},{"district_id":150222,"district_name":"固阳县","children":null},{"district_id":150223,"district_name":"达尔罕茂明安联合旗","children":null},{"district_id":150271,"district_name":"包头稀土高新技术产业开发区","children":null}]},{"district_id":150300,"district_name":"乌海市","children":[{"district_id":150302,"district_name":"海勃湾区","children":null},{"district_id":150303,"district_name":"海南区","children":null},{"district_id":150304,"district_name":"乌达区","children":null}]},{"district_id":150400,"district_name":"赤峰市","children":[{"district_id":150402,"district_name":"红山区","children":null},{"district_id":150403,"district_name":"元宝山区","children":null},{"district_id":150404,"district_name":"松山区","children":null},{"district_id":150421,"district_name":"阿鲁科尔沁旗","children":null},{"district_id":150422,"district_name":"巴林左旗","children":null},{"district_id":150423,"district_name":"巴林右旗","children":null},{"district_id":150424,"district_name":"林西县","children":null},{"district_id":150425,"district_name":"克什克腾旗","children":null},{"district_id":150426,"district_name":"翁牛特旗","children":null},{"district_id":150428,"district_name":"喀喇沁旗","children":null},{"district_id":150429,"district_name":"宁城县","children":null},{"district_id":150430,"district_name":"敖汉旗","children":null}]},{"district_id":150500,"district_name":"通辽市","children":[{"district_id":150502,"district_name":"科尔沁区","children":null},{"district_id":150521,"district_name":"科尔沁左翼中旗","children":null},{"district_id":150522,"district_name":"科尔沁左翼后旗","children":null},{"district_id":150523,"district_name":"开鲁县","children":null},{"district_id":150524,"district_name":"库伦旗","children":null},{"district_id":150525,"district_name":"奈曼旗","children":null},{"district_id":150526,"district_name":"扎鲁特旗","children":null},{"district_id":150571,"district_name":"通辽经济技术开发区","children":null},{"district_id":150581,"district_name":"霍林郭勒市","children":null}]},{"district_id":150600,"district_name":"鄂尔多斯市","children":[{"district_id":150602,"district_name":"东胜区","children":null},{"district_id":150603,"district_name":"康巴什区","children":null},{"district_id":150621,"district_name":"达拉特旗","children":null},{"district_id":150622,"district_name":"准格尔旗","children":null},{"district_id":150623,"district_name":"鄂托克前旗","children":null},{"district_id":150624,"district_name":"鄂托克旗","children":null},{"district_id":150625,"district_name":"杭锦旗","children":null},{"district_id":150626,"district_name":"乌审旗","children":null},{"district_id":150627,"district_name":"伊金霍洛旗","children":null}]},{"district_id":150700,"district_name":"呼伦贝尔市","children":[{"district_id":150702,"district_name":"海拉尔区","children":null},{"district_id":150703,"district_name":"扎赉诺尔区","children":null},{"district_id":150721,"district_name":"阿荣旗","children":null},{"district_id":150722,"district_name":"莫力达瓦达斡尔族自治旗","children":null},{"district_id":150723,"district_name":"鄂伦春自治旗","children":null},{"district_id":150724,"district_name":"鄂温克族自治旗","children":null},{"district_id":150725,"district_name":"陈巴尔虎旗","children":null},{"district_id":150726,"district_name":"新巴尔虎左旗","children":null},{"district_id":150727,"district_name":"新巴尔虎右旗","children":null},{"district_id":150781,"district_name":"满洲里市","children":null},{"district_id":150782,"district_name":"牙克石市","children":null},{"district_id":150783,"district_name":"扎兰屯市","children":null},{"district_id":150784,"district_name":"额尔古纳市","children":null},{"district_id":150785,"district_name":"根河市","children":null}]},{"district_id":150800,"district_name":"巴彦淖尔市","children":[{"district_id":150802,"district_name":"临河区","children":null},{"district_id":150821,"district_name":"五原县","children":null},{"district_id":150822,"district_name":"磴口县","children":null},{"district_id":150823,"district_name":"乌拉特前旗","children":null},{"district_id":150824,"district_name":"乌拉特中旗","children":null},{"district_id":150825,"district_name":"乌拉特后旗","children":null},{"district_id":150826,"district_name":"杭锦后旗","children":null}]},{"district_id":150900,"district_name":"乌兰察布市","children":[{"district_id":150902,"district_name":"集宁区","children":null},{"district_id":150921,"district_name":"卓资县","children":null},{"district_id":150922,"district_name":"化德县","children":null},{"district_id":150923,"district_name":"商都县","children":null},{"district_id":150924,"district_name":"兴和县","children":null},{"district_id":150925,"district_name":"凉城县","children":null},{"district_id":150926,"district_name":"察哈尔右翼前旗","children":null},{"district_id":150927,"district_name":"察哈尔右翼中旗","children":null},{"district_id":150928,"district_name":"察哈尔右翼后旗","children":null},{"district_id":150929,"district_name":"四子王旗","children":null},{"district_id":150981,"district_name":"丰镇市","children":null}]},{"district_id":152200,"district_name":"兴安盟","children":[{"district_id":152201,"district_name":"乌兰浩特市","children":null},{"district_id":152202,"district_name":"阿尔山市","children":null},{"district_id":152221,"district_name":"科尔沁右翼前旗","children":null},{"district_id":152222,"district_name":"科尔沁右翼中旗","children":null},{"district_id":152223,"district_name":"扎赉特旗","children":null},{"district_id":152224,"district_name":"突泉县","children":null}]},{"district_id":152500,"district_name":"锡林郭勒盟","children":[{"district_id":152501,"district_name":"二连浩特市","children":null},{"district_id":152502,"district_name":"锡林浩特市","children":null},{"district_id":152522,"district_name":"阿巴嘎旗","children":null},{"district_id":152523,"district_name":"苏尼特左旗","children":null},{"district_id":152524,"district_name":"苏尼特右旗","children":null},{"district_id":152525,"district_name":"东乌珠穆沁旗","children":null},{"district_id":152526,"district_name":"西乌珠穆沁旗","children":null},{"district_id":152527,"district_name":"太仆寺旗","children":null},{"district_id":152528,"district_name":"镶黄旗","children":null},{"district_id":152529,"district_name":"正镶白旗","children":null},{"district_id":152530,"district_name":"正蓝旗","children":null},{"district_id":152531,"district_name":"多伦县","children":null},{"district_id":152571,"district_name":"乌拉盖管委会","children":null}]},{"district_id":152900,"district_name":"阿拉善盟","children":[{"district_id":152921,"district_name":"阿拉善左旗","children":null},{"district_id":152922,"district_name":"阿拉善右旗","children":null},{"district_id":152923,"district_name":"额济纳旗","children":null},{"district_id":152971,"district_name":"内蒙古阿拉善经济开发区","children":null}]}]},{"district_id":210000,"district_name":"辽宁省","children":[{"district_id":210100,"district_name":"沈阳市","children":[{"district_id":210102,"district_name":"和平区","children":null},{"district_id":210103,"district_name":"沈河区","children":null},{"district_id":210104,"district_name":"大东区","children":null},{"district_id":210105,"district_name":"皇姑区","children":null},{"district_id":210106,"district_name":"铁西区","children":null},{"district_id":210111,"district_name":"苏家屯区","children":null},{"district_id":210112,"district_name":"浑南区","children":null},{"district_id":210113,"district_name":"沈北新区","children":null},{"district_id":210114,"district_name":"于洪区","children":null},{"district_id":210115,"district_name":"辽中区","children":null},{"district_id":210123,"district_name":"康平县","children":null},{"district_id":210124,"district_name":"法库县","children":null},{"district_id":210181,"district_name":"新民市","children":null}]},{"district_id":210200,"district_name":"大连市","children":[{"district_id":210202,"district_name":"中山区","children":null},{"district_id":210203,"district_name":"西岗区","children":null},{"district_id":210204,"district_name":"沙河口区","children":null},{"district_id":210211,"district_name":"甘井子区","children":null},{"district_id":210212,"district_name":"旅顺口区","children":null},{"district_id":210213,"district_name":"金州区","children":null},{"district_id":210214,"district_name":"普兰店区","children":null},{"district_id":210224,"district_name":"长海县","children":null},{"district_id":210281,"district_name":"瓦房店市","children":null},{"district_id":210283,"district_name":"庄河市","children":null}]},{"district_id":210300,"district_name":"鞍山市","children":[{"district_id":210302,"district_name":"铁东区","children":null},{"district_id":210303,"district_name":"铁西区","children":null},{"district_id":210304,"district_name":"立山区","children":null},{"district_id":210311,"district_name":"千山区","children":null},{"district_id":210321,"district_name":"台安县","children":null},{"district_id":210323,"district_name":"岫岩满族自治县","children":null},{"district_id":210381,"district_name":"海城市","children":null}]},{"district_id":210400,"district_name":"抚顺市","children":[{"district_id":210402,"district_name":"新抚区","children":null},{"district_id":210403,"district_name":"东洲区","children":null},{"district_id":210404,"district_name":"望花区","children":null},{"district_id":210411,"district_name":"顺城区","children":null},{"district_id":210421,"district_name":"抚顺县","children":null},{"district_id":210422,"district_name":"新宾满族自治县","children":null},{"district_id":210423,"district_name":"清原满族自治县","children":null}]},{"district_id":210500,"district_name":"本溪市","children":[{"district_id":210502,"district_name":"平山区","children":null},{"district_id":210503,"district_name":"溪湖区","children":null},{"district_id":210504,"district_name":"明山区","children":null},{"district_id":210505,"district_name":"南芬区","children":null},{"district_id":210521,"district_name":"本溪满族自治县","children":null},{"district_id":210522,"district_name":"桓仁满族自治县","children":null}]},{"district_id":210600,"district_name":"丹东市","children":[{"district_id":210602,"district_name":"元宝区","children":null},{"district_id":210603,"district_name":"振兴区","children":null},{"district_id":210604,"district_name":"振安区","children":null},{"district_id":210624,"district_name":"宽甸满族自治县","children":null},{"district_id":210681,"district_name":"东港市","children":null},{"district_id":210682,"district_name":"凤城市","children":null}]},{"district_id":210700,"district_name":"锦州市","children":[{"district_id":210702,"district_name":"古塔区","children":null},{"district_id":210703,"district_name":"凌河区","children":null},{"district_id":210711,"district_name":"太和区","children":null},{"district_id":210726,"district_name":"黑山县","children":null},{"district_id":210727,"district_name":"义县","children":null},{"district_id":210781,"district_name":"凌海市","children":null},{"district_id":210782,"district_name":"北镇市","children":null}]},{"district_id":210800,"district_name":"营口市","children":[{"district_id":210802,"district_name":"站前区","children":null},{"district_id":210803,"district_name":"西市区","children":null},{"district_id":210804,"district_name":"鲅鱼圈区","children":null},{"district_id":210811,"district_name":"老边区","children":null},{"district_id":210881,"district_name":"盖州市","children":null},{"district_id":210882,"district_name":"大石桥市","children":null}]},{"district_id":210900,"district_name":"阜新市","children":[{"district_id":210902,"district_name":"海州区","children":null},{"district_id":210903,"district_name":"新邱区","children":null},{"district_id":210904,"district_name":"太平区","children":null},{"district_id":210905,"district_name":"清河门区","children":null},{"district_id":210911,"district_name":"细河区","children":null},{"district_id":210921,"district_name":"阜新蒙古族自治县","children":null},{"district_id":210922,"district_name":"彰武县","children":null}]},{"district_id":211000,"district_name":"辽阳市","children":[{"district_id":211002,"district_name":"白塔区","children":null},{"district_id":211003,"district_name":"文圣区","children":null},{"district_id":211004,"district_name":"宏伟区","children":null},{"district_id":211005,"district_name":"弓长岭区","children":null},{"district_id":211011,"district_name":"太子河区","children":null},{"district_id":211021,"district_name":"辽阳县","children":null},{"district_id":211081,"district_name":"灯塔市","children":null}]},{"district_id":211100,"district_name":"盘锦市","children":[{"district_id":211102,"district_name":"双台子区","children":null},{"district_id":211103,"district_name":"兴隆台区","children":null},{"district_id":211104,"district_name":"大洼区","children":null},{"district_id":211122,"district_name":"盘山县","children":null}]},{"district_id":211200,"district_name":"铁岭市","children":[{"district_id":211202,"district_name":"银州区","children":null},{"district_id":211204,"district_name":"清河区","children":null},{"district_id":211221,"district_name":"铁岭县","children":null},{"district_id":211223,"district_name":"西丰县","children":null},{"district_id":211224,"district_name":"昌图县","children":null},{"district_id":211281,"district_name":"调兵山市","children":null},{"district_id":211282,"district_name":"开原市","children":null}]},{"district_id":211300,"district_name":"朝阳市","children":[{"district_id":211302,"district_name":"双塔区","children":null},{"district_id":211303,"district_name":"龙城区","children":null},{"district_id":211321,"district_name":"朝阳县","children":null},{"district_id":211322,"district_name":"建平县","children":null},{"district_id":211324,"district_name":"喀喇沁左翼蒙古族自治县","children":null},{"district_id":211381,"district_name":"北票市","children":null},{"district_id":211382,"district_name":"凌源市","children":null}]},{"district_id":211400,"district_name":"葫芦岛市","children":[{"district_id":211402,"district_name":"连山区","children":null},{"district_id":211403,"district_name":"龙港区","children":null},{"district_id":211404,"district_name":"南票区","children":null},{"district_id":211421,"district_name":"绥中县","children":null},{"district_id":211422,"district_name":"建昌县","children":null},{"district_id":211481,"district_name":"兴城市","children":null}]}]},{"district_id":220000,"district_name":"吉林省","children":[{"district_id":220100,"district_name":"长春市","children":[{"district_id":220102,"district_name":"南关区","children":null},{"district_id":220103,"district_name":"宽城区","children":null},{"district_id":220104,"district_name":"朝阳区","children":null},{"district_id":220105,"district_name":"二道区","children":null},{"district_id":220106,"district_name":"绿园区","children":null},{"district_id":220112,"district_name":"双阳区","children":null},{"district_id":220113,"district_name":"九台区","children":null},{"district_id":220122,"district_name":"农安县","children":null},{"district_id":220171,"district_name":"长春经济技术开发区","children":null},{"district_id":220172,"district_name":"长春净月高新技术产业开发区","children":null},{"district_id":220173,"district_name":"长春高新技术产业开发区","children":null},{"district_id":220174,"district_name":"长春汽车经济技术开发区","children":null},{"district_id":220182,"district_name":"榆树市","children":null},{"district_id":220183,"district_name":"德惠市","children":null}]},{"district_id":220200,"district_name":"吉林市","children":[{"district_id":220202,"district_name":"昌邑区","children":null},{"district_id":220203,"district_name":"龙潭区","children":null},{"district_id":220204,"district_name":"船营区","children":null},{"district_id":220211,"district_name":"丰满区","children":null},{"district_id":220221,"district_name":"永吉县","children":null},{"district_id":220271,"district_name":"吉林经济开发区","children":null},{"district_id":220272,"district_name":"吉林高新技术产业开发区","children":null},{"district_id":220273,"district_name":"吉林中国新加坡食品区","children":null},{"district_id":220281,"district_name":"蛟河市","children":null},{"district_id":220282,"district_name":"桦甸市","children":null},{"district_id":220283,"district_name":"舒兰市","children":null},{"district_id":220284,"district_name":"磐石市","children":null}]},{"district_id":220300,"district_name":"四平市","children":[{"district_id":220302,"district_name":"铁西区","children":null},{"district_id":220303,"district_name":"铁东区","children":null},{"district_id":220322,"district_name":"梨树县","children":null},{"district_id":220323,"district_name":"伊通满族自治县","children":null},{"district_id":220381,"district_name":"公主岭市","children":null},{"district_id":220382,"district_name":"双辽市","children":null}]},{"district_id":220400,"district_name":"辽源市","children":[{"district_id":220402,"district_name":"龙山区","children":null},{"district_id":220403,"district_name":"西安区","children":null},{"district_id":220421,"district_name":"东丰县","children":null},{"district_id":220422,"district_name":"东辽县","children":null}]},{"district_id":220500,"district_name":"通化市","children":[{"district_id":220502,"district_name":"东昌区","children":null},{"district_id":220503,"district_name":"二道江区","children":null},{"district_id":220521,"district_name":"通化县","children":null},{"district_id":220523,"district_name":"辉南县","children":null},{"district_id":220524,"district_name":"柳河县","children":null},{"district_id":220581,"district_name":"梅河口市","children":null},{"district_id":220582,"district_name":"集安市","children":null}]},{"district_id":220600,"district_name":"白山市","children":[{"district_id":220602,"district_name":"浑江区","children":null},{"district_id":220605,"district_name":"江源区","children":null},{"district_id":220621,"district_name":"抚松县","children":null},{"district_id":220622,"district_name":"靖宇县","children":null},{"district_id":220623,"district_name":"长白朝鲜族自治县","children":null},{"district_id":220681,"district_name":"临江市","children":null}]},{"district_id":220700,"district_name":"松原市","children":[{"district_id":220702,"district_name":"宁江区","children":null},{"district_id":220721,"district_name":"前郭尔罗斯蒙古族自治县","children":null},{"district_id":220722,"district_name":"长岭县","children":null},{"district_id":220723,"district_name":"乾安县","children":null},{"district_id":220771,"district_name":"吉林松原经济开发区","children":null},{"district_id":220781,"district_name":"扶余市","children":null}]},{"district_id":220800,"district_name":"白城市","children":[{"district_id":220802,"district_name":"洮北区","children":null},{"district_id":220821,"district_name":"镇赉县","children":null},{"district_id":220822,"district_name":"通榆县","children":null},{"district_id":220871,"district_name":"吉林白城经济开发区","children":null},{"district_id":220881,"district_name":"洮南市","children":null},{"district_id":220882,"district_name":"大安市","children":null}]},{"district_id":222400,"district_name":"延边朝鲜族自治州","children":[{"district_id":222401,"district_name":"延吉市","children":null},{"district_id":222402,"district_name":"图们市","children":null},{"district_id":222403,"district_name":"敦化市","children":null},{"district_id":222404,"district_name":"珲春市","children":null},{"district_id":222405,"district_name":"龙井市","children":null},{"district_id":222406,"district_name":"和龙市","children":null},{"district_id":222424,"district_name":"汪清县","children":null},{"district_id":222426,"district_name":"安图县","children":null}]}]},{"district_id":230000,"district_name":"黑龙江省","children":[{"district_id":230100,"district_name":"哈尔滨市","children":[{"district_id":230102,"district_name":"道里区","children":null},{"district_id":230103,"district_name":"南岗区","children":null},{"district_id":230104,"district_name":"道外区","children":null},{"district_id":230108,"district_name":"平房区","children":null},{"district_id":230109,"district_name":"松北区","children":null},{"district_id":230110,"district_name":"香坊区","children":null},{"district_id":230111,"district_name":"呼兰区","children":null},{"district_id":230112,"district_name":"阿城区","children":null},{"district_id":230113,"district_name":"双城区","children":null},{"district_id":230123,"district_name":"依兰县","children":null},{"district_id":230124,"district_name":"方正县","children":null},{"district_id":230125,"district_name":"宾县","children":null},{"district_id":230126,"district_name":"巴彦县","children":null},{"district_id":230127,"district_name":"木兰县","children":null},{"district_id":230128,"district_name":"通河县","children":null},{"district_id":230129,"district_name":"延寿县","children":null},{"district_id":230183,"district_name":"尚志市","children":null},{"district_id":230184,"district_name":"五常市","children":null}]},{"district_id":230200,"district_name":"齐齐哈尔市","children":[{"district_id":230202,"district_name":"龙沙区","children":null},{"district_id":230203,"district_name":"建华区","children":null},{"district_id":230204,"district_name":"铁锋区","children":null},{"district_id":230205,"district_name":"昂昂溪区","children":null},{"district_id":230206,"district_name":"富拉尔基区","children":null},{"district_id":230207,"district_name":"碾子山区","children":null},{"district_id":230208,"district_name":"梅里斯达斡尔族区","children":null},{"district_id":230221,"district_name":"龙江县","children":null},{"district_id":230223,"district_name":"依安县","children":null},{"district_id":230224,"district_name":"泰来县","children":null},{"district_id":230225,"district_name":"甘南县","children":null},{"district_id":230227,"district_name":"富裕县","children":null},{"district_id":230229,"district_name":"克山县","children":null},{"district_id":230230,"district_name":"克东县","children":null},{"district_id":230231,"district_name":"拜泉县","children":null},{"district_id":230281,"district_name":"讷河市","children":null}]},{"district_id":230300,"district_name":"鸡西市","children":[{"district_id":230302,"district_name":"鸡冠区","children":null},{"district_id":230303,"district_name":"恒山区","children":null},{"district_id":230304,"district_name":"滴道区","children":null},{"district_id":230305,"district_name":"梨树区","children":null},{"district_id":230306,"district_name":"城子河区","children":null},{"district_id":230307,"district_name":"麻山区","children":null},{"district_id":230321,"district_name":"鸡东县","children":null},{"district_id":230381,"district_name":"虎林市","children":null},{"district_id":230382,"district_name":"密山市","children":null}]},{"district_id":230400,"district_name":"鹤岗市","children":[{"district_id":230402,"district_name":"向阳区","children":null},{"district_id":230403,"district_name":"工农区","children":null},{"district_id":230404,"district_name":"南山区","children":null},{"district_id":230405,"district_name":"兴安区","children":null},{"district_id":230406,"district_name":"东山区","children":null},{"district_id":230407,"district_name":"兴山区","children":null},{"district_id":230421,"district_name":"萝北县","children":null},{"district_id":230422,"district_name":"绥滨县","children":null}]},{"district_id":230500,"district_name":"双鸭山市","children":[{"district_id":230502,"district_name":"尖山区","children":null},{"district_id":230503,"district_name":"岭东区","children":null},{"district_id":230505,"district_name":"四方台区","children":null},{"district_id":230506,"district_name":"宝山区","children":null},{"district_id":230521,"district_name":"集贤县","children":null},{"district_id":230522,"district_name":"友谊县","children":null},{"district_id":230523,"district_name":"宝清县","children":null},{"district_id":230524,"district_name":"饶河县","children":null}]},{"district_id":230600,"district_name":"大庆市","children":[{"district_id":230602,"district_name":"萨尔图区","children":null},{"district_id":230603,"district_name":"龙凤区","children":null},{"district_id":230604,"district_name":"让胡路区","children":null},{"district_id":230605,"district_name":"红岗区","children":null},{"district_id":230606,"district_name":"大同区","children":null},{"district_id":230621,"district_name":"肇州县","children":null},{"district_id":230622,"district_name":"肇源县","children":null},{"district_id":230623,"district_name":"林甸县","children":null},{"district_id":230624,"district_name":"杜尔伯特蒙古族自治县","children":null},{"district_id":230671,"district_name":"大庆高新技术产业开发区","children":null}]},{"district_id":230700,"district_name":"伊春市","children":[{"district_id":230717,"district_name":"伊美区","children":null},{"district_id":230718,"district_name":"乌翠区","children":null},{"district_id":230719,"district_name":"友好区","children":null},{"district_id":230722,"district_name":"嘉荫县","children":null},{"district_id":230723,"district_name":"汤旺县","children":null},{"district_id":230724,"district_name":"丰林县","children":null},{"district_id":230725,"district_name":"大箐山县","children":null},{"district_id":230726,"district_name":"南岔县","children":null},{"district_id":230751,"district_name":"金林区","children":null},{"district_id":230781,"district_name":"铁力市","children":null}]},{"district_id":230800,"district_name":"佳木斯市","children":[{"district_id":230803,"district_name":"向阳区","children":null},{"district_id":230804,"district_name":"前进区","children":null},{"district_id":230805,"district_name":"东风区","children":null},{"district_id":230811,"district_name":"郊区","children":null},{"district_id":230822,"district_name":"桦南县","children":null},{"district_id":230826,"district_name":"桦川县","children":null},{"district_id":230828,"district_name":"汤原县","children":null},{"district_id":230881,"district_name":"同江市","children":null},{"district_id":230882,"district_name":"富锦市","children":null},{"district_id":230883,"district_name":"抚远市","children":null}]},{"district_id":230900,"district_name":"七台河市","children":[{"district_id":230902,"district_name":"新兴区","children":null},{"district_id":230903,"district_name":"桃山区","children":null},{"district_id":230904,"district_name":"茄子河区","children":null},{"district_id":230921,"district_name":"勃利县","children":null}]},{"district_id":231000,"district_name":"牡丹江市","children":[{"district_id":231002,"district_name":"东安区","children":null},{"district_id":231003,"district_name":"阳明区","children":null},{"district_id":231004,"district_name":"爱民区","children":null},{"district_id":231005,"district_name":"西安区","children":null},{"district_id":231025,"district_name":"林口县","children":null},{"district_id":231071,"district_name":"牡丹江经济技术开发区","children":null},{"district_id":231081,"district_name":"绥芬河市","children":null},{"district_id":231083,"district_name":"海林市","children":null},{"district_id":231084,"district_name":"宁安市","children":null},{"district_id":231085,"district_name":"穆棱市","children":null},{"district_id":231086,"district_name":"东宁市","children":null}]},{"district_id":231100,"district_name":"黑河市","children":[{"district_id":231102,"district_name":"爱辉区","children":null},{"district_id":231123,"district_name":"逊克县","children":null},{"district_id":231124,"district_name":"孙吴县","children":null},{"district_id":231181,"district_name":"北安市","children":null},{"district_id":231182,"district_name":"五大连池市","children":null},{"district_id":231183,"district_name":"嫩江市","children":null}]},{"district_id":231200,"district_name":"绥化市","children":[{"district_id":231202,"district_name":"北林区","children":null},{"district_id":231221,"district_name":"望奎县","children":null},{"district_id":231222,"district_name":"兰西县","children":null},{"district_id":231223,"district_name":"青冈县","children":null},{"district_id":231224,"district_name":"庆安县","children":null},{"district_id":231225,"district_name":"明水县","children":null},{"district_id":231226,"district_name":"绥棱县","children":null},{"district_id":231281,"district_name":"安达市","children":null},{"district_id":231282,"district_name":"肇东市","children":null},{"district_id":231283,"district_name":"海伦市","children":null}]},{"district_id":232700,"district_name":"大兴安岭地区","children":[{"district_id":232701,"district_name":"漠河市","children":null},{"district_id":232721,"district_name":"呼玛县","children":null},{"district_id":232722,"district_name":"塔河县","children":null},{"district_id":232761,"district_name":"加格达奇区","children":null},{"district_id":232762,"district_name":"松岭区","children":null},{"district_id":232763,"district_name":"新林区","children":null},{"district_id":232764,"district_name":"呼中区","children":null}]}]},{"district_id":310000,"district_name":"上海","children":[{"district_id":310100,"district_name":"上海市","children":[{"district_id":310101,"district_name":"黄浦区","children":null},{"district_id":310104,"district_name":"徐汇区","children":null},{"district_id":310105,"district_name":"长宁区","children":null},{"district_id":310106,"district_name":"静安区","children":null},{"district_id":310107,"district_name":"普陀区","children":null},{"district_id":310109,"district_name":"虹口区","children":null},{"district_id":310110,"district_name":"杨浦区","children":null},{"district_id":310112,"district_name":"闵行区","children":null},{"district_id":310113,"district_name":"宝山区","children":null},{"district_id":310114,"district_name":"嘉定区","children":null},{"district_id":310115,"district_name":"浦东新区","children":null},{"district_id":310116,"district_name":"金山区","children":null},{"district_id":310117,"district_name":"松江区","children":null},{"district_id":310118,"district_name":"青浦区","children":null},{"district_id":310120,"district_name":"奉贤区","children":null},{"district_id":310151,"district_name":"崇明区","children":null}]}]},{"district_id":320000,"district_name":"江苏省","children":[{"district_id":320100,"district_name":"南京市","children":[{"district_id":320102,"district_name":"玄武区","children":null},{"district_id":320104,"district_name":"秦淮区","children":null},{"district_id":320105,"district_name":"建邺区","children":null},{"district_id":320106,"district_name":"鼓楼区","children":null},{"district_id":320111,"district_name":"浦口区","children":null},{"district_id":320113,"district_name":"栖霞区","children":null},{"district_id":320114,"district_name":"雨花台区","children":null},{"district_id":320115,"district_name":"江宁区","children":null},{"district_id":320116,"district_name":"六合区","children":null},{"district_id":320117,"district_name":"溧水区","children":null},{"district_id":320118,"district_name":"高淳区","children":null}]},{"district_id":320200,"district_name":"无锡市","children":[{"district_id":320205,"district_name":"锡山区","children":null},{"district_id":320206,"district_name":"惠山区","children":null},{"district_id":320211,"district_name":"滨湖区","children":null},{"district_id":320213,"district_name":"梁溪区","children":null},{"district_id":320214,"district_name":"新吴区","children":null},{"district_id":320281,"district_name":"江阴市","children":null},{"district_id":320282,"district_name":"宜兴市","children":null}]},{"district_id":320300,"district_name":"徐州市","children":[{"district_id":320302,"district_name":"鼓楼区","children":null},{"district_id":320303,"district_name":"云龙区","children":null},{"district_id":320305,"district_name":"贾汪区","children":null},{"district_id":320311,"district_name":"泉山区","children":null},{"district_id":320312,"district_name":"铜山区","children":null},{"district_id":320321,"district_name":"丰县","children":null},{"district_id":320322,"district_name":"沛县","children":null},{"district_id":320324,"district_name":"睢宁县","children":null},{"district_id":320371,"district_name":"徐州经济技术开发区","children":null},{"district_id":320381,"district_name":"新沂市","children":null},{"district_id":320382,"district_name":"邳州市","children":null}]},{"district_id":320400,"district_name":"常州市","children":[{"district_id":320402,"district_name":"天宁区","children":null},{"district_id":320404,"district_name":"钟楼区","children":null},{"district_id":320411,"district_name":"新北区","children":null},{"district_id":320412,"district_name":"武进区","children":null},{"district_id":320413,"district_name":"金坛区","children":null},{"district_id":320481,"district_name":"溧阳市","children":null}]},{"district_id":320500,"district_name":"苏州市","children":[{"district_id":320505,"district_name":"虎丘区","children":null},{"district_id":320506,"district_name":"吴中区","children":null},{"district_id":320507,"district_name":"相城区","children":null},{"district_id":320508,"district_name":"姑苏区","children":null},{"district_id":320509,"district_name":"吴江区","children":null},{"district_id":320571,"district_name":"苏州工业园区","children":null},{"district_id":320581,"district_name":"常熟市","children":null},{"district_id":320582,"district_name":"张家港市","children":null},{"district_id":320583,"district_name":"昆山市","children":null},{"district_id":320585,"district_name":"太仓市","children":null}]},{"district_id":320600,"district_name":"南通市","children":[{"district_id":320602,"district_name":"崇川区","children":null},{"district_id":320611,"district_name":"港闸区","children":null},{"district_id":320612,"district_name":"通州区","children":null},{"district_id":320623,"district_name":"如东县","children":null},{"district_id":320671,"district_name":"南通经济技术开发区","children":null},{"district_id":320681,"district_name":"启东市","children":null},{"district_id":320682,"district_name":"如皋市","children":null},{"district_id":320684,"district_name":"海门市","children":null},{"district_id":320685,"district_name":"海安市","children":null}]},{"district_id":320700,"district_name":"连云港市","children":[{"district_id":320703,"district_name":"连云区","children":null},{"district_id":320706,"district_name":"海州区","children":null},{"district_id":320707,"district_name":"赣榆区","children":null},{"district_id":320722,"district_name":"东海县","children":null},{"district_id":320723,"district_name":"灌云县","children":null},{"district_id":320724,"district_name":"灌南县","children":null},{"district_id":320771,"district_name":"连云港经济技术开发区","children":null},{"district_id":320772,"district_name":"连云港高新技术产业开发区","children":null}]},{"district_id":320800,"district_name":"淮安市","children":[{"district_id":320803,"district_name":"淮安区","children":null},{"district_id":320804,"district_name":"淮阴区","children":null},{"district_id":320812,"district_name":"清江浦区","children":null},{"district_id":320813,"district_name":"洪泽区","children":null},{"district_id":320826,"district_name":"涟水县","children":null},{"district_id":320830,"district_name":"盱眙县","children":null},{"district_id":320831,"district_name":"金湖县","children":null},{"district_id":320871,"district_name":"淮安经济技术开发区","children":null}]},{"district_id":320900,"district_name":"盐城市","children":[{"district_id":320902,"district_name":"亭湖区","children":null},{"district_id":320903,"district_name":"盐都区","children":null},{"district_id":320904,"district_name":"大丰区","children":null},{"district_id":320921,"district_name":"响水县","children":null},{"district_id":320922,"district_name":"滨海县","children":null},{"district_id":320923,"district_name":"阜宁县","children":null},{"district_id":320924,"district_name":"射阳县","children":null},{"district_id":320925,"district_name":"建湖县","children":null},{"district_id":320971,"district_name":"盐城经济技术开发区","children":null},{"district_id":320981,"district_name":"东台市","children":null}]},{"district_id":321000,"district_name":"扬州市","children":[{"district_id":321002,"district_name":"广陵区","children":null},{"district_id":321003,"district_name":"邗江区","children":null},{"district_id":321012,"district_name":"江都区","children":null},{"district_id":321023,"district_name":"宝应县","children":null},{"district_id":321071,"district_name":"扬州经济技术开发区","children":null},{"district_id":321081,"district_name":"仪征市","children":null},{"district_id":321084,"district_name":"高邮市","children":null}]},{"district_id":321100,"district_name":"镇江市","children":[{"district_id":321102,"district_name":"京口区","children":null},{"district_id":321111,"district_name":"润州区","children":null},{"district_id":321112,"district_name":"丹徒区","children":null},{"district_id":321171,"district_name":"镇江新区","children":null},{"district_id":321181,"district_name":"丹阳市","children":null},{"district_id":321182,"district_name":"扬中市","children":null},{"district_id":321183,"district_name":"句容市","children":null}]},{"district_id":321200,"district_name":"泰州市","children":[{"district_id":321202,"district_name":"海陵区","children":null},{"district_id":321203,"district_name":"高港区","children":null},{"district_id":321204,"district_name":"姜堰区","children":null},{"district_id":321271,"district_name":"泰州医药高新技术产业开发区","children":null},{"district_id":321281,"district_name":"兴化市","children":null},{"district_id":321282,"district_name":"靖江市","children":null},{"district_id":321283,"district_name":"泰兴市","children":null}]},{"district_id":321300,"district_name":"宿迁市","children":[{"district_id":321302,"district_name":"宿城区","children":null},{"district_id":321311,"district_name":"宿豫区","children":null},{"district_id":321322,"district_name":"沭阳县","children":null},{"district_id":321323,"district_name":"泗阳县","children":null},{"district_id":321324,"district_name":"泗洪县","children":null},{"district_id":321371,"district_name":"宿迁经济技术开发区","children":null}]}]},{"district_id":330000,"district_name":"浙江省","children":[{"district_id":330100,"district_name":"杭州市","children":[{"district_id":330102,"district_name":"上城区","children":null},{"district_id":330103,"district_name":"下城区","children":null},{"district_id":330104,"district_name":"江干区","children":null},{"district_id":330105,"district_name":"拱墅区","children":null},{"district_id":330106,"district_name":"西湖区","children":null},{"district_id":330108,"district_name":"滨江区","children":null},{"district_id":330109,"district_name":"萧山区","children":null},{"district_id":330110,"district_name":"余杭区","children":null},{"district_id":330111,"district_name":"富阳区","children":null},{"district_id":330112,"district_name":"临安区","children":null},{"district_id":330122,"district_name":"桐庐县","children":null},{"district_id":330127,"district_name":"淳安县","children":null},{"district_id":330182,"district_name":"建德市","children":null}]},{"district_id":330200,"district_name":"宁波市","children":[{"district_id":330203,"district_name":"海曙区","children":null},{"district_id":330205,"district_name":"江北区","children":null},{"district_id":330206,"district_name":"北仑区","children":null},{"district_id":330211,"district_name":"镇海区","children":null},{"district_id":330212,"district_name":"鄞州区","children":null},{"district_id":330213,"district_name":"奉化区","children":null},{"district_id":330225,"district_name":"象山县","children":null},{"district_id":330226,"district_name":"宁海县","children":null},{"district_id":330281,"district_name":"余姚市","children":null},{"district_id":330282,"district_name":"慈溪市","children":null}]},{"district_id":330300,"district_name":"温州市","children":[{"district_id":330302,"district_name":"鹿城区","children":null},{"district_id":330303,"district_name":"龙湾区","children":null},{"district_id":330304,"district_name":"瓯海区","children":null},{"district_id":330305,"district_name":"洞头区","children":null}]}]}],
    })

    const validatePhone = (rule, value, callback) => {
      if (!state.form.ss_mobile || !isPhone(state.form.ss_mobile)) {
        callback(new Error(t('请输入正确的手机号')))
      } else {
        callback()
      }
    }

    const rules = reactive({
      ss_name: [{required: true, trigger: 'blur', message: t('请输入联系人')}],
      ss_intl: [{required: true, trigger: 'change', message: t('请选择国家编码')}],
      ss_mobile: [{required: true, trigger: 'blur', message: t('请输入手机号')},{ validator: validatePhone, trigger: 'blur' }],
      ss_address: [{required: true, trigger: 'blur', message: t('请输入详细地址')}],
      ss_is_default: [{required: true, trigger: 'change', message: t('请选择是否默认')}],
    })

    const showEdit = (row) => {
      if (!row) {
        state.isUpdate = false
        state.title = t('添加')
      } else {
        state.isUpdate = true
        state.title = t('编辑')
        initArea(row)
        state.form = Object.assign({}, row)
      }

      state.form.area = ["110000", "110100", "110101"]

      state.dialogFormVisible = true
    }
    const close = () => {
      state.selectArea = {
        province: {},
        city: {},
        district: {},
      }
      state['formRef'].resetFields()
      state.form = {
      }
      state.dialogFormVisible = false
    }
    const save = () => {
      state['formRef'].validate(async (valid) => {
        saveArea()
        const params = Object.assign({}, state.form)
        params.districtIds = params.area.join(",")

        if (valid) {
          if (state.isUpdate) {

            const { msg, status } = await doEdit(params)
            if (200 == status) {
              $message(msg, 'success')
            } else {
              $message(msg, 'error')
            }
          } else {
            const { msg, status } = await doAdd(params)
            if (200 == status) {
              $message(msg, 'success')
            } else {
              $message(msg, 'error')
            }
          }

          emit('fetch-data')
          close()
        }
      })
    }

    const saveArea = () => {
      const province = state.selectArea.province
      const city = state.selectArea.city
      const district = state.selectArea.district
      state.form.ss_province_id = province.code
      state.form.ss_province = province.name
      state.form.ss_city_id = city.code
      state.form.ss_city = city.name
      state.form.ss_county_id = district.code
      state.form.ss_county = district.name
    }

    const initArea = (row) => {
      state.selectArea.province = {
        code: row.ss_province_id,
        name: row.ss_province,
      }
      state.selectArea.city = {
        code: row.ss_city_id,
        name: row.ss_city,
      }
      state.selectArea.district = {
        code: row.ss_county_id,
        name: row.ss_county,
      }
    }

    return {
      t: t,
      ...toRefs(state),
      showEdit,
      saveArea,
      close,
      save,
      rules,
      initArea,
    }
  },
})
</script>
<style lang="scss">
.el-input__wrapper{
  width: 100%;
}
.city-picker-span {
  width: 380px;
}
</style>
