<template>
  <div id="UserEssential">
    <validator name='v' @valid="$emit('valid')" @invalid="$emit('invalid')">
      <form class="form-horizontal select-overspread ">
        <div class="row">
          <div class="col-sm-4 form-group " :class="[$v.f_user_name.required ? 'has-error' : '']"
               v-if="getConfigShowItem('f_user_name')">
            <label for="f_user_name" class="font_normal_body">*{{getConfigLabelName('f_user_name','用户姓名')}}</label>
            <input type="text" v-model="baseinfo.base.f_user_name"
                   v-validate:f_user_name='getConfigValidate("f_user_name",true)'
                   class="input_search" style="width:60%" :placeholder="getConfigPlaceholder('f_user_name','用户姓名')" v-next-el="phone">
          </div>
          <div style="" class="col-sm-4 form-group"
               :class="[$v.f_user_phone.minlength || $v.f_user_phone.maxlength ? 'has-error' : '']" v-if="getConfigShowItem('f_user_phone')">
            <label for="f_user_phone" class="font_normal_body">*{{getConfigLabelName('f_user_phone','客户电话')}}</label>
            <input type="text" maxlength="11" v-model="baseinfo.base.f_user_phone"
                   v-validate:f_user_phone=getConfigValidate("f_user_phone") class="input_search" style="width:55%"
                   :placeholder="getConfigPlaceholder('f_user_phone','客户电话')"
                   v-el:phone v-next-el="area">
            <button type="button" class="glyphicon glyphicon-plus" @click.stop="phoneManage()"></button>
          </div>

          <div style=""
               v-show="(formconfig && formconfig.f_rent_phone && formconfig.f_rent_phone.required) || !onlyshowmust"
               :class="[$v.f_rent_phone.required ? 'has-error' : '']"
               class="col-sm-4 form-group" v-if="getConfigShowItem('f_rent_phone')">
            <label for="f_rent_phone" class="font_normal_body">&ensp;{{getConfigLabelName('f_rent_phone','曾用电话')}}</label>
            <input type="text" v-model="baseinfo.base.f_rent_phone" class="input_search" style="width:60%"
                   v-validate:f_rent_phone=getConfigValidate("f_rent_phone",false)
                   :placeholder="getConfigPlaceholder('f_rent_phone','曾用电话')">
          </div>

          <div class="col-sm-4 form-group" style="" v-if="true">
            <label for="f_user_state" class="font_normal_body">&ensp;{{getConfigLabelName('f_user_state','客户状态')}}</label>
            <v-select :value.sync="baseinfo.base.f_user_state"
                      :disabled="true"
                      :value-single="true"
                      :options='userstates' :placeholder="getConfigPlaceholder('f_user_state','客户状态')"
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" style="" >
            <label for="f_uservent_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_uservent_date','通气日期')}}</label>
            <datepicker style="width:60%" placeholder="用户通气日期"
                        v-model="baseinfo.base.f_uservent_date"
                        v-ref:f_uservent_date
                        :value.sync="baseinfo.base.f_uservent_date"
                        :format="'yyyy-MM-dd HH:mm:ss'"
            ></datepicker>
          </div>
        </div>
        <div class="row">
          <div style="" class="col-sm-4 form-group" v-if="getConfigShowItem('f_credentials')">
            <label for="f_credentials" class="font_normal_body">&ensp;{{getConfigLabelName('f_credentials','证件类型')}}</label>
            <v-select id="idCardType" :value.sync="baseinfo.base.f_credentials"
                      v-model="baseinfo.base.f_credentials"
                      :value-single="true"
                      :options='credentials'
                      :placeholder="getConfigPlaceholder('f_credentials','证件类型')"
                      style="width: 65%"
                      close-on-select></v-select>
          </div>
          <div style="" class="col-sm-8 form-group"
               :class="[$v.f_idnumber2.required ? 'has-error' : '']"
               v-if="baseinfo.base.f_credentials === '身份证' &&  config.f_idnumber ">
            <label for="f_idnumber" class="font_normal_body">*证件号码</label>
            <input type="text" maxlength="18" v-model="baseinfo.base.f_idnumber"
                   v-validate:f_idnumber2='{required: true}' class="input_search" style="width:80%"
                   :placeholder="getConfigPlaceholder('f_idnumber','证件号码')">
          </div>
          <div style="" class="col-sm-8 form-group" v-if="baseinfo.base.f_credentials !== '身份证' ||  !config.f_idnumber ">
            <label class="font_normal_body">&ensp;证件号码</label>
            <input type="text" v-model="baseinfo.base.f_idnumber" class="input_search" style="width:80%"
                   :placeholder="getConfigPlaceholder('f_idnumber','证件号码')">
          </div>
        </div>
        <div class="row">
          <div class="col-sm-12 form-group" :class="[$v.f_address.required ? 'has-error' : '']">
            <label for="f_address" class="font_normal_body">*地址信息</label>
            <input type="text" v-model="addressinfo.f_address" :value.sync="addressinfo.f_address" v-validate:f_address='{required: true }'
                   class="input_search" disabled="disabled" style="width:70%;" placeholder="用户地址" >
            <span>
              <button class="button_search button_spacing" type="button" style="width: max-content" v-if="!isedit" @click="selectaddress()">选择地址</button>
              <!--              <button class="button_search button_spacing" type="button" style="width: max-content" v-if="isedit" @click="modifyaddress()">修改地址</button>-->
              <button class="button_search button_spacing" type="button" style="width: max-content" v-if="isedit" @click="selectaddress()">修改地址</button>
            </span>
          </div>
        </div>
        <div class="row">
          <div style=""
               v-show="(formconfig && formconfig.f_used_name && formconfig.f_used_name.required) || !onlyshowmust"
               :class="[$v.f_used_name.required ? 'has-error' : '']"
               class="col-sm-4 form-group" v-if="getConfigShowItem('f_used_name')">
            <label style="letter-spacing: 0.5em;margin-right: -0.5em" for="f_used_name" class="font_normal_body w3">{{getConfigLabelName('f_used_name','曾用名')}}</label>
            <input type="text" v-model="baseinfo.base.f_used_name" class="input_search" style="width:60%"
                   v-validate:f_used_name=getConfigValidate("f_used_name",false)
                   :placeholder="getConfigPlaceholder('f_used_name','曾用名')">
          </div>
          <div class="col-sm-4 form-group"
               v-show="(formconfig && formconfig.f_people_num && formconfig.f_people_num.required) || !onlyshowmust"
               :class="[$v.f_people_num.dctest ? 'has-error' : '']" v-if="getConfigShowItem('f_people_num')">
            <label for="f_people_num" style="letter-spacing: 0.5em;margin-right: -0.5em" class="font_normal_body w3">{{getConfigLabelName('f_people_num','人口数')}}</label>
            <input type="number" v-model="baseinfo.base.f_people_num" v-show="!peopleMax" v-validate:f_people_num='{dctest: [0, ">=" ]}'
                   :disabled="!jurisdiction.includes('修改人口数')" class="input_search" style="width:60%"
                   placeholder="家庭人口数">
            <v-select id="f_people_num" :value.sync="baseinfo.base.f_people_num"
                      v-if="peopleMax"
                      v-model="baseinfo.base.f_people_num"
                      :value-single="true"
                      :options='peoplenums'
                      :placeholder="getConfigPlaceholder('f_people_num','家庭人口数')"
                      style="width: 65%"
                      close-on-select></v-select>
          </div>
        </div>
        <div class="row">
          <div style=""
               v-show="(formconfig && formconfig.f_balance && formconfig.f_balance.required) || !onlyshowmust"
               :class="[$v.f_balance.required ? 'has-error' : '']"
               class="col-sm-4 form-group" v-if="getConfigShowItem('f_balance')">
            <label for="f_balance" class="font_normal_body">&ensp;{{getConfigLabelName('f_balance','用户余额')}}</label>
            <input type="text" v-model="baseinfo.base.f_balance" class="input_search" style="width:60%"
                   v-validate:f_balance=getConfigValidate("f_balance",false)
                   :placeholder="getConfigPlaceholder('f_balance','用户余额')"
                   :disabled="!jurisdiction.includes('档案信息查询修改')">
          </div>
          <div style="" class="col-sm-4 form-group" v-if="getConfigShowItem('f_is_mgq')"
               v-show="(formconfig && formconfig.f_is_mgq && formconfig.f_is_mgq.required) || !onlyshowmust"
               :class="[$v.f_is_mgq.required ? 'has-error' : '']">
            <label for="f_is_mgq" style="letter-spacing: 0.5em;margin-right: -0.5em" class="font_normal_body w3">{{getConfigLabelName('f_is_mgq','煤改气')}}</label>
            <input type="text" v-show="false" v-model="baseinfo.base.f_is_mgq"
                   v-validate:f_is_mgq=getConfigValidate("f_is_mgq",false)>
            <v-select id="f_is_mgq" :value.sync="baseinfo.base.f_is_mgq"  v-model="baseinfo.base.f_is_mgq"
                      :placeholder="getConfigPlaceholder('f_is_mgq','是否煤改气')"
                      :options='mgq' style="width: 65%"       close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_book_no')"
               v-show="(formconfig && formconfig.f_book_no && formconfig.f_book_no.required) || !onlyshowmust"
               :class="[$v.f_book_no.required ? 'has-error' : '']">
            <label for="f_contract" class="font_normal_body">&ensp;{{getConfigLabelName('f_book_no','燃气本号')}}</label>
            <input type="text"  v-model="baseinfo.base.f_book_no" class="input_search" style="width:60%"
                   v-validate:f_book_no=getConfigValidate("f_book_no",false)
                   :placeholder="getConfigPlaceholder('f_book_no','用户证号')">
          </div>
        </div>
        <div class="row">
          <div style="" class="col-sm-4 form-group" v-if="getConfigShowItem('f_rent_name')"
               v-show="(formconfig && formconfig.f_rent_name && formconfig.f_rent_name.required) || !onlyshowmust"
               :class="[$v.f_rent_name.required ? 'has-error' : '']">
            <label for="f_rent_name" class="font_normal_body">&ensp;{{getConfigLabelName('f_rent_name','租户姓名')}}</label>
            <input type="text" v-model="baseinfo.base.f_rent_name" class="input_search" style="width:60%"
                   v-validate:f_rent_name=getConfigValidate("f_rent_name",false)
                   :placeholder="getConfigPlaceholder('f_rent_name','租户姓名')">
          </div>
          <div style="" class="col-sm-4 form-group" v-if="getConfigShowItem('f_zuhu_phone')"
               v-show="(formconfig && formconfig.f_zuhu_phone && formconfig.f_zuhu_phone.required) || !onlyshowmust"
               :class="[$v.f_zuhu_phone.required ? 'has-error' : '']">
            <label for="f_zuhu_phone" class="font_normal_body">{{getConfigLabelName('f_zuhu_phone','租户电话')}}</label>
            <input type="text" v-model="baseinfo.base.f_zuhu_phone" class="input_search" style="width:60%"
                   v-validate:f_zuhu_phone=getConfigValidate("f_zuhu_phone",false)
                   :placeholder="getConfigPlaceholder('f_zuhu_phone','租户电话')">
          </div>
        </div>
        <div class="row">
          <div style="" class="col-sm-8 form-group"
               v-show="(formconfig && formconfig.f_zuhu_idnumber && formconfig.f_zuhu_idnumber.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_zuhu_idnumber')"
               :class="[$v.f_zuhu_idnumber.required ? 'has-error' : '']">
          <label for="f_zuhu_idnumber" class="font_normal_body">{{getConfigLabelName('f_zuhu_idnumber','租户身份证')}}</label>
          <input type="text" v-model="baseinfo.base.f_zuhu_idnumber" class="input_search" style="width:80%"
                   v-validate:f_zuhu_idnumber=getConfigValidate("f_zuhu_idnumber",false)
                   :placeholder="getConfigPlaceholder('f_zuhu_idnumber','租户身份证')">
          </div>
          <div style="" class="col-sm-4 form-group"
               v-show="(formconfig && formconfig.f_cost_type && formconfig.f_cost_type.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_cost_type')">
            <label for="f_is_mgq" class="font_normal_body ">&ensp;{{getConfigLabelName('f_cost_type','付款类型')}}</label>
            <v-select id="f_is_mgq" :value.sync="baseinfo.base.f_cost_type"  v-model="baseinfo.base.f_cost_type"
                      :options='costtype'
                      :placeholder="getConfigPlaceholder('f_cost_type','付款类型')"  style="width: 65%"       close-on-select></v-select>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-8 form-group" v-if="getConfigShowItem('f_contract_id')"
               v-show="(formconfig && formconfig.f_contract_id && formconfig.f_contract_id.required) || !onlyshowmust"
               :class="[$v.f_contract_id.required ? 'has-error' : '']">
            <label for="f_contract" class="font_normal_body">&ensp;{{getConfigLabelName('f_contract_id','合同编号')}}</label>
            <input type="text" v-model="baseinfo.base.f_contract_id" class="input_search" style="width:80%"
                   v-validate:f_contract_id=getConfigValidate("f_contract_id",false)
                   :placeholder="getConfigPlaceholder('f_contract_id','合同编号')">
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_house_type')"
               v-show="(formconfig && formconfig.f_house_type && formconfig.f_house_type.required) || !onlyshowmust"
               :class="[$v.f_house_type.required ? 'has-error' : '']">
            <label for="f_user_state" class="font_normal_body">&ensp;{{getConfigLabelName('f_house_type','房屋类型')}}</label>
            <input type="text" v-show="false" v-model="baseinfo.base.f_house_type"
                   v-validate:f_house_type=getConfigValidate("f_house_type",false)>
            <v-select :value.sync="baseinfo.base.f_house_type" :search="false" :value-single="true"
                      :options='housetype' close-on-select
                      :placeholder="getConfigPlaceholder('f_house_type','房屋类型')">
            </v-select>
          </div>
        </div>
        <div class="row">
          <div style="" class="col-sm-4 form-group" v-if="getConfigShowItem('f_user_level')"
               v-show="(formconfig && formconfig.f_user_level && formconfig.f_user_level.required) || !onlyshowmust"
               :class="[$v.f_user_level.required ? 'has-error' : '']">
            <label for="f_user_level" class="font_normal_body ">&ensp;{{getConfigLabelName('f_user_level','用户等级')}}</label>
            <input type="text" v-show="false" v-model="baseinfo.base.f_user_level"
                   v-validate:f_user_level=getConfigValidate("f_user_level",false)>
            <v-select :value.sync="baseinfo.base.f_user_level" :search="false" :value-single="true"
                      :options='userlevel'
                      :placeholder="getConfigPlaceholder('f_user_level','用户等级')" close-on-select>
            </v-select>
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_user_nature')"
               v-show="(formconfig && formconfig.f_user_nature && formconfig.f_user_nature.required) || !onlyshowmust"
               :class="[$v.f_user_nature.required ? 'has-error' : '']">
            <label for="f_user_nature" class="font_normal_body" title="用户性质">&ensp;{{getConfigLabelName('f_user_nature','用气类型')}}</label>
            <input type="text" v-show="false" v-model="baseinfo.base.f_user_nature"
                   v-validate:f_user_nature=getConfigValidate("f_user_nature",false)>
            <v-select :value.sync="baseinfo.base.f_user_nature" :search="false" :value-single="true"
                      :placeholder="getConfigPlaceholder('f_user_nature','用气类型')"
                      :options='usernature' close-on-select>
            </v-select>
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_olduserinfo_code')"
               v-show="(formconfig && formconfig.f_olduserinfo_code && formconfig.f_olduserinfo_code.required) || !onlyshowmust"
               :class="[$v.f_olduserinfo_code.required ? 'has-error' : '']">
            <label for="f_user_nature" class="font_normal_body">&ensp;{{getConfigLabelName('f_olduserinfo_code','档案编号')}}</label>
            <input type="text" v-model="baseinfo.base.f_olduserinfo_code" class="input_search" style="width:60%"
                   v-validate:f_olduserinfo_code=getConfigValidate("f_olduserinfo_code",false)
                   :placeholder="getConfigPlaceholder('f_olduserinfo_code','档案编号')">
          </div>
          <div class="col-sm-4 form-group"
               v-show="(formconfig && formconfig.f_gas_pointsnumber && formconfig.f_gas_pointsnumber.required) || !onlyshowmust"
               :class="[$v.f_gas_pointsnumber.dctest ? 'has-error' : '']" v-if="getConfigShowItem('f_gas_pointsnumber')">
            <label for="f_gas_pointsnumber" class="font_normal_body">{{getConfigLabelName('f_gas_pointsnumber','用气点数量')}}</label>
            <v-select id="f_gas_pointsnumber" :value.sync="baseinfo.base.f_gas_pointsnumber"
                      v-model="baseinfo.base.f_gas_pointsnumber"
                      :value-single="true"
                      :options='pointsnums'
                      :placeholder="getConfigPlaceholder('f_gas_pointsnumber','用气点数量')"
                      style="width: 65%"
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_reminder_amount')"
               v-show="(formconfig && formconfig.f_reminder_amount && formconfig.f_reminder_amount.required) || !onlyshowmust"
               :class="[$v.f_reminder_amount.required ? 'has-error' : '']" title="余额小于该值后，微信公众号或短信推送余额不足提醒">
            <label for="f_reminder_amount" :style="{color: baseinfo.base.f_reminder_amount === null || baseinfo.base.f_reminder_amount === '' ? 'red' : null}" class="font_normal_body">{{getConfigLabelName('f_reminder_amount','提示金额')}}</label>
            <input type="number" v-model="baseinfo.base.f_reminder_amount" class="input_search" style="width:60%"
                   v-validate:f_reminder_amount=getConfigValidate("f_reminder_amount",false)
                   :placeholder="getConfigPlaceholder('f_reminder_amount','提示金额')" @input="reminderAmountHandle">
          </div>
        </div>
        <div class="row">
          <div style="" class="col-sm-12 form-group" v-if="getConfigShowItem('f_comments')"
               v-show="(formconfig && formconfig.f_comments && formconfig.f_comments.required) || !onlyshowmust"
               :class="[$v.f_comments.required ? 'has-error' : '']">
            <label for="f_paper_accoun" class="font_normal_body">&ensp;{{getConfigLabelName('f_comments','备注')}}</label>
            <input class="input_search" style="width:86.5%;height: 40px" v-model="baseinfo.base.f_comments"
                   :placeholder="getConfigPlaceholder('f_comments','请输入备注信息')"
                   v-validate:f_comments=getConfigValidate("f_comments",false)>
          </div>
        </div>

        <div class="row" style="margin-top: 2%;">
          <a style="font-size: 16px;font-weight: 500;"
             v-if="baseinfo.base.f_cost_type[0] === '银行代扣'">银行信息</a>
        </div>
        <div v-if="baseinfo.base.f_cost_type[0] === '银行代扣'">
          <div class="row">
            <div class="col-sm-4 form-group"
                 :class="[$v.f_bank_accopen.required ? 'has-error' : '']" v-if="getConfigShowItem('f_bank_accopen')">
              <label for="f_username" class="font_normal_body">{{getConfigLabelName('f_bank_accopen','银行户名')}}</label>
              <input type="text" v-model="baseinfo.bank.f_bank_accopen"
                     class="input_search" style="width:60%" id="f_username"
                     :placeholder="getConfigPlaceholder('f_bank_accopen','客户名称')"
                     v-validate:f_bank_accopen=getConfigValidate("f_bank_accopen",false)
                     v-next-el="bankaccount">
            </div>
            <div class="col-sm-4 form-group" id=userfiles-useEssInf-银行名称 v-if="getConfigShowItem('f_bank_name')"
                 :class="[$v.f_bank_name.required ? 'has-error' : '']">
            <label for="f_username" class="font_normal_body ">{{getConfigLabelName('f_bank_name','银行名称')}}</label>
              <input type="text" v-show="false" v-model="baseinfo.base.f_bank_name"
                     v-validate:f_bank_name=getConfigValidate("f_bank_name",false)>
              <v-select :value.sync="baseinfo.bank.f_bank_name"
                        :options='banknames'
                        :placeholder="getConfigPlaceholder('f_bank_name','银行名称')"
                        close-on-select></v-select>
            </div>
            <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_bank_pay_number')"
                 :class="[$v.f_bank_pay_number.required ? 'has-error' : '']">
              <label for="f_bank_idnumber" class="font_normal_body">{{getConfigLabelName('f_bank_pay_number','缴费编号')}}</label>
              <input type="text" v-model="baseinfo.bank.f_bank_pay_number"
                     class="input_search" style="width:60%"
                     v-validate:f_bank_pay_number=getConfigValidate("f_bank_pay_number",false)
                     :placeholder="getConfigPlaceholder('f_bank_pay_number','缴费编号')"
                     aria-describedby="helpBlock" v-el:bankpaynumber>
            </div>
            <div class="col-sm-12 form-group" v-if="getConfigShowItem('f_bank_idnumber')"
                 :class="[$v.f_bank_idnumber.required ? 'has-error' : '']">
              <label for="f_bank_idnumber" class="font_normal_body">{{getConfigLabelName('f_bank_idnumber','身份证号')}}</label>
              <input type="text" v-model="baseinfo.bank.f_bank_idnumber"
                     class="input_search" style="width:54%"
                     :placeholder="getConfigPlaceholder('f_bank_idnumber','身份证号')"
                     v-validate:f_bank_idnumber=getConfigValidate("f_bank_idnumber",false)
                     aria-describedby="helpBlock" v-el:bankidnumber>
            </div>
            <div class="col-sm-12 form-group"
                 :class="[$v.f_bank_account.required ? 'has-error' : '']" v-if="getConfigShowItem('f_bank_account')">
              <label for="f_userid" class="font_normal_body">{{getConfigLabelName('f_bank_account','银行账号')}}</label>
              <input type="text" v-model="baseinfo.bank.f_bank_account" class="input_search" style="width:54%"
                     v-validate:f_bank_account=getConfigValidate("f_bank_account",true) v-el:bankaccount
                     :placeholder="getConfigPlaceholder('f_bank_account','银行账号')"
                     v-next-el="bankidnumber">
            </div>
          </div>
        </div>
      </form>
    </validator>
    <modal v-if="showselectaddress" :show.sync="showselectaddress" width="50%" height="80%" title="地址信息" v-ref:modal large backdrop="false">
      <article slot="modal-body" class="modal-body" style="height: 700px;padding: 0!important;">
        <file-address-manage :is-select="isSelect" :fileinfo="addressinfo"
                             @address-valid="doNothing"   :showselectaddress.sync="showselectaddress" v-ref:fileaddress ></file-address-manage>
      </article>
      <footer slot="modal-footer" class="modal-footer">
      </footer>
    </modal>
    <file-user-phone :show.sync="showphone" :userphonelist="userphonelist" :f_userinfo_id="baseinfo.base.f_userinfo_id"></file-user-phone>
  </div>
</template>

<script>
  import {HttpResetClass} from 'vue-client'
  import form from "vue-resource/src/http/interceptor/form";
  // import HighMeter from '../../plugins/HighMeterPlugin'

  let getEditUserState = async function (self) {
    try {
      let http = new HttpResetClass()
      let result = await http.load('GET', `rs/vue/EditUserState.json`, {}, {resolveMsg: null, rejectMsg: null})
      console.log(result.data.EditUserState)
      self.edituserstate = result.data.EditUserState
      Object.assign(self.config, result.data)
    } catch (e) {
      console.log(e)
    }
  }

  export default {
    title: '基本信息',
    props: ['baseinfo', 'addressinfo', 'isedit', 'userphonelist', 'formconfig', 'onlyshowmust'],
    data () {
      return {
        showselectaddress: false,
        site: '',
        config: {
          f_idnumber: true
        },
        showphone: false,
        areas: [],
        streets: [],
        residentials: [],
        inputtores: this.$appdata.getParam('抄表员'),
        credentials: this.$appdata.getParam('证件类型'),
        costtypes: this.$appdata.getParam('缴费类型'),
        banknames: this.$appdata.getParam('银行名称'),
        userstates: this.$appdata.getParam('用户状态'),
        mgq: this.$appdata.getParam('是否煤改气'),
        peopleMax: this.$appdata.getSingleValue('最大人口数'),
        pointsMax: this.$appdata.getSingleValue('最大用气点数量'),
        costtype: this.$appdata.getParam('付款类型'),
        usernature: this.$appdata.getParam('用户性质'),
        userlevel: this.$appdata.getParam('用户等级'),
        housetype: this.$appdata.getParam('房屋类型'),
        jurisdiction: this.$login.r,
        edituserstate: false,
        // highMeterPlugin: {},
        readCardFlag: true,

        isSelect: false,
        rules: {}
      }
    },
    ready () {
      getEditUserState(this)
      this.$resetValidation()
      // this.highMeterPlugin = new HighMeter(this,this.readIDCardCallback)
    },
    beforeDestroy () {
      // this.highMeterPlugin.Stop()
    },
    methods: {
      reminderAmountHandle (e) {
        this.$emit('input', e.target.value)
        e.target.value = (e.target.value.match(/^\d*(\.?\d{0,1})/g)[0]) || null
        this.baseinfo.base.f_reminder_amount = parseInt(e.target.value, 10)
      },
      getConfigValidate (name, defaultVal) {
        this.$resetValidation()
        if (this.formconfig && this.formconfig[name]) {
          let Validate = {}
          if (this.formconfig[name].required) {
            Object.assign(Validate, {required: true})
          }
          if (this.formconfig[name].minlength || this.formconfig[name].minlength === 0) {
            Object.assign(Validate, {minlength: this.formconfig[name].minlength})
          }
          if (this.formconfig[name].maxlength) {
            Object.assign(Validate, {maxlength: this.formconfig[name].maxlength})
          }
          return Validate
        } else if (name === 'f_user_phone') {
          return { minlength: 11, maxlength: 11 }
        } else if (defaultVal) {
          return {required: defaultVal}
        }
        return {}
      },
      getConfigShowItem (name,defaultVal = true) {
        if (this.formconfig && this.formconfig[name] && this.formconfig[name].hasOwnProperty('showItem')) {
          return this.formconfig[name].showItem
        } else {
          return defaultVal
        }
      },
      getConfigLabelName (name, defaultVal) {
        if (this.formconfig && this.formconfig[name] && this.formconfig[name].labelName) {
          return this.formconfig[name].labelName
        } else {
          return defaultVal
        }
      },
      getConfigPlaceholder (name, defaultVal) {
        if (this.formconfig && this.formconfig[name] && this.formconfig[name].placeholder) {
          return this.formconfig[name].placeholder
        } else {
          return defaultVal
        }
      },
      selectaddress () {
        this.showselectaddress = true
        this.isSelect = true
      },
      modifyaddress () {
        this.showselectaddress = true
        this.isSelect = false
      },
      onValid (res) {
        this.$dispatch('valid')
      },
      onInvalid (res) {
        this.$dispatch('invalid')
      },
      doNothing () {
      },
      readIDCardCallback (compoent, msg) {
        console.log('进入高拍仪', msg)
        if (msg.err !== 0) {
          return
        }
        // document.getElementById("idCardType").getElementsByClassName("btn-content")[0].innerHTML="身份证"
        compoent.baseinfo.base.f_idnumber = msg.strID
        compoent.baseinfo.base.f_user_name = msg.strName.trim()
        // compoent.baseinfo.base.f_credentials=["身份证"]
      },
      phoneManage () {
        this.showphone = true
        console.log('查看用户备用电话信息', this.userphonelist)
      }
    },
    watch: {
      'baseinfo.base.f_userinfo_id' (val) {
        if(this.formconfig.f_reminder_amount!=null){
        if (this.baseinfo.base.f_reminder_amount === null && this.formconfig.f_reminder_amount.required) {
          this.$showAlert('当前用户还未设置余额提示金额，请在提示金额字段进行设置', 'warning', 3000)
        }}
      },
      // 重置验证结果，当证件类型切换时，验证结果不能立即刷新，需要重置
      'baseinfo.base.f_credentials[0]' () {
        console.log('验证器重置')
        this.$resetValidation()
      },
      'baseinfo.base.f_cost_type[0]' () {
        console.log('验证器重置')
        this.$resetValidation()
      }
      // 当选择销户，需要给其提醒是否进行销户
      // 'baseinfo.base.f_user_state'(val) {
      //     // if (val[0] === '销户') {
      //     //     this.$showMessage('是否要对该客户进行销户操作？', ['confirm', 'cancel']).then((res) => {
      //     //         if (res !== 'confirm') {
      //     //             this.baseinfo.base.f_user_state = ['正常']
      //     //         }
      //     //     })
      //     // }
      // }
    },
    computed: {
      peoplenums () {
        let peopleMax = this.$appdata.getSingleValue('最大人口数') ? this.$appdata.getSingleValue('最大人口数') : 0
        let nums = []
        for (let i = 1; i <= peopleMax; i++) {
          let temp = {}
          temp.label = i
          temp.value = i
          nums.push(temp)
        }
        return nums
      },
      pointsnums () {
        let pointsMax = this.$appdata.getSingleValue('最大用气点数量') ? this.$appdata.getSingleValue('最大用气点数量') : 10
        let nums = []
        for (let i = 1; i <= pointsMax; i++) {
          let temp = {}
          temp.label = i
          temp.value = i
          nums.push(temp)
        }
        return nums
      }
    },
    events: {
      'confirmaddress' (res) {
        console.log('选定地址', res)
        this.showselectaddress = false
        this.addressinfo.f_address = res.f_address
        this.addressinfo.id = res.id
        this.$dispatch('defaultOtheret', res)
      }
    }
  }
</script>
<style scoped lang="less">
// 两个字符占用4个字符距离
.w2 {
  letter-spacing:2em; /*如果需要y个字两端对齐，则为(x-y)/(y-1),这里是（4-2）/(2-1)=2em */
  margin-right:-2em; /*同上*/
}
// 三个字符占用4个字符距离
.w3 {
  letter-spacing: 0.5em;
  margin-right: -0.5em
}

#UserEssential{
  // 去掉number类型输入框的上下箭头
  input[type="number"] {
    &::-webkit-inner-spin-button,
    &::-webkit-outer-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    & {
      -moz-appearance: textfield;
    }
  }
  #addboxmap {
    height: 300px;
  }
  .glyphicon-map-marker:hover {
    color: red;
  }
  .glyphicon-map-marker {
    color: blue;
    cursor: pointer;
  }
  .scrollbar() {
    .font_normal_body {
      width: 73px;
      overflow: auto;
      white-space: nowrap;
      // 指滚动条两边的按钮
      &::-webkit-scrollbar-button {
        display: none;
      }
      // 滚动条的宽度
      &::-webkit-scrollbar {
        width: 5px !important;
        height: 5px !important;
      }
      // 滚动条的设置
      &::-webkit-scrollbar-thumb {
        background-color: #ddd;
        background-clip: padding-box;
      }
      &::-webkit-scrollbar-thumb:hover {
        background-color: #bbb;
      }
      &::-webkit-scrollbar-track {
        /*滚动条里面轨道*/
        box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        background: #ededed;
      }
    }
  }

  .col-sm-4 ,.col-sm-12 ,.col-sm-8{
    .scrollbar();
  }
}
</style>
