<view class="container">
  <view class="titleView">
    <view class="title">请填写访客信息</view>
  </view>
  <view class="inputView">
    <van-cell-group>
      <van-field label="被访单位" model:value="{{ value }}" is-link required readonly placeholder="请选择" border="{{ true }}" arrow-direction="down" input-align="right" bind:tap="getCompanyHandle" />
      <van-field label="被访人姓名" model:value="{{ value }}" is-link required readonly placeholder="请选择" placeholder="请输入" arrow-direction="down" border="{{ true }}" input-align="right" bind:tap="getUsernameHandle" />
      <van-field label="被访人电话" model:value="{{ value }}" placeholder="请输入" border="{{ true }}" input-align="right" />
      <van-field label="访客姓名" model:value="{{ value }}" required placeholder="请输入" border="{{ true }}" input-align="right" />
      <van-field label="手机号码" model:value="{{ value }}" required placeholder="请输入" border="{{ true }}" input-align="right" />
      <van-field label="身份证类型" model:value="{{ value}}" is-link required readonly placeholder="请选择" arrow-direction="down" input-align="right" bind:tap="getCardTypeHandle" />
      <van-field label="身份证号" model:value="{{ value }}" required placeholder="请输入" border="{{ true }}" input-align="right" />
      <van-field label="到访时间" model:value="{{ value }}" is-link required readonly placeholder="请选择" border="{{ true }}" arrow-direction="down" input-align="right" bind:tap="getArriveHandle" />
      <van-field label="离开时间" model:value="{{ value }}" is-link required readonly placeholder="请选择" border="{{ true }}" arrow-direction="down" input-align="right" bind:tap="getLeaveHandle" />
      <van-field label="来访事由" required model:value="{{ value }}" placeholder="请输入" border="{{ true }}" input-align="right" />
      <view class="uploadImgView">
        <view style="margin-bottom: 20rpx;">访客照片</view>
        <van-uploader file-list="{{ fileList }}" upload-text="点击上传照片" bind:after-read="afterRead" />
        <view class="tipsView">提示:请保持五官清晰，以方便系统精准识</view>
      </view>
    </van-cell-group>
    <view class="submitBtnView">
      <van-button block type="info" bind:click="submitFormFn">提交</van-button>
    </view>
    <!-- 被访单位弹框 -->
    <van-popup show="{{ companyShow }}" round position="bottom">
      <van-picker show-toolbar title="被访单位" columns="{{ companyColumns }}" bind:confirm="confirmHandle" bind:cancel="cancelHandle" bind:change="changeHandler"/>
    </van-popup>
    <!-- 被访人姓名弹框 -->
    <!-- <van-popup show="{{ usernameShow }}" round position="bottom" closeable custom-style="height: 100%;position:absolute" bind:close="onClose">
      <van-index-bar index-list="{{ indexList }}" scroll-top="{{ scrollTop }}" z-index="2">
        <van-index-anchor wx:for="{{customerList}}" wx:key="index" index="{{item.firstLetter}}" use-slot="{{true}}">
          {{item.firstLetter}}
          <van-cell wx:for="{{item.list}}" wx:key="index" data-id="{{item.code}}" data-name="{{item.name}}" title="{{item.name}}" bindtap="getCustomer" />
        </van-index-anchor>
      </van-index-bar>
    </van-popup> -->
    <!-- 身份证类型弹框 -->
    <van-popup show="{{ cardTypeShow }}" round position="bottom">
      <van-picker show-toolbar title="身份证类型" columns="{{ columns }}" bind:confirm="confirmHandle" bind:cancel="cancelHandle" />
    </van-popup>
    <!-- 到访时间选择弹框 -->
    <van-popup show="{{ arriveShow }}" round position="bottom">
      <van-datetime-picker type="datetime" value="{{ currentDate }}" bind:input="onInput" bind:confirm="confirmHandle" bind:cancel="cancelHandle" />
    </van-popup>
    <!-- 离开时间弹框 -->
    <van-popup show="{{ arriveShow }}" round position="bottom">
      <van-datetime-picker type="datetime" value="{{ currentDate }}" bind:input="onInput" bind:confirm="confirmHandle" bind:cancel="cancelHandle" />
    </van-popup>
    <!-- 提交成功弹框 -->
    <van-dialog  title="提交成功" show="{{ submitSuccesShow }}" confirm-button-color="#4187f2" bind:confirm="submitDialogFn"/>
  </view>
</view>