<!--pages/addperson/addperson.wxml-->
<view class="page">
  <van-sidebar active-key="{{ activeKey }}" class="left" bind:change="onChange">
    <van-sidebar-item title="密码" />
    <van-sidebar-item title="NFC" wx:if="{{deviceinfo.manufactureId==201||deviceinfo.manufactureId == 221||deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241}}" />
    <van-sidebar-item title="指纹"  wx:if="{{deviceinfo.manufactureId==201 || deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241}}" />
    <!-- <van-sidebar-item title="身份证" /> -->
  </van-sidebar>
  <view class="" class="right">
    <view wx:if="{{activeKey==0}}" class="topBox">
      <view class="list">
        <view class="personli" wx:for="{{passwordList}}" wx:for-item="data" wx:key="{{index}}">
          <view class="name">{{data.pzname}}</view>
          <!-- <view class="name">{{data.password}}</view> -->
          <view class="operation">
            <view class="delete red" bindtap="delMode" data-current="1" data-index="{{index}}">删除</view>
          </view>
        </view>
      </view>
        <van-button type="primary" block size="small" bindtap="addPassword" data-current="0" data-addIndex="0" class="add">添加</van-button>
    </view>

    <view wx:if="{{activeKey==2}}" class="topBox">
      <radio-group bindchange="radioChange" class="radioGroup">
        <label class="weui-cell weui-check__label" wx:for="{{items}}" wx:key="{{item.value}}">
          <view class="weui-cell__hd">
            <radio value="{{item.value}}" checked="{{item.checked}}" />
          </view>
          <view class="weui-cell__bd">{{item.name}}</view>
        </label>
      </radio-group>
      <view class="list">
        <view class="personli" wx:for="{{FpList}}" wx:for-item="data" wx:key="{{index}}">
          <view class="name">{{data.pzname}}-{{data.fingerprintAlias}}</view>
          <view class="operation">
            <view class="delete red" bindtap="delMode" data-current="3" data-index="{{index}}">删除</view>
          </view>
        </view>
      </view>
      <van-button type="primary" class="add" size="small" block bindtap="addPassword" data-current="2"
        data-addIndex="2">添加</van-button>
    </view>

    <view wx:if="{{activeKey==1}}" class="topBox">
      <view class="list">
        <view class="personli" wx:for="{{NfcList}}" wx:for-item="data" wx:key="{{index}}">
          <!-- <view class="name">{{data.password}}</view> -->
          <view class="name">{{data.pzname}}</view>
          <view class="operation">
            <view class="delete red" bindtap="delMode" data-current="2" data-index="{{index}}">删除</view>
          </view>
        </view>
      </view>
      <van-button type="primary" class="add" size="small" block bindtap="addPassword" data-addIndex="1">添加</van-button>
    </view>
    <!-- <view wx:if="{{activeKey==3}}">
      <view class="add" bindtap="addPassword"  data-addIndex="3">添加</view>
      <view class="list">
        <view class="personli" wx:for="{{CarIdList}}" wx:for-item="data" wx:key="{{index}}">
          <view class="name">{{data.password}}</view>
          <view class="operation">
            <view class="delete red" bindtap="delMode" data-current="4" data-index="{{index}}">删除</view>
          </view>
        </view>
      </view>
    </view> -->
  </view>
  <van-popup show="{{ show }}" custom-style="width: 90%" bind:close="onClose" round>
    <view class="addword" wx:if="{{addIndex==0}}">
      <van-field value="{{ password }}" type="number" placeholder="请输入6位数字密码" label="密码" border="{{ true }}"
        bind:change="onChange1" maxlength="6" />
      <picker mode="date" value="{{starttime}}" start="{{minDate}}" end="{{ minDate1 }}" bindchange="bindDateChange">
        <van-field value="{{ starttime }}" placeholder="请选择开始时间" label="开始时间" border="{{ true }}" readonly />
      </picker>
      <picker mode="date" value="{{endtime}}" start="{{minDate}}" end="{{ minDate1 }}" bindchange="bindDateChange1">
        <van-field value="{{ endtime }}" placeholder="请选择结束时间" label="结束时间" border="{{ true }}" readonly />
      </picker>
      <view class=""><button type="primary" bindtap="sendPassword">添加</button></view>
    </view>
    <view class="addword" wx:if="{{addIndex==1}}">
      <!-- <van-field value="{{ password }}" type="number" placeholder="请输入8位卡号" label="NFC" border="{{ true }}" bind:change="onChange1" maxlength="8" /> -->
      <van-field value="{{ pzname }}" placeholder="请输入NFC名称" label="NFC" border="{{ true }}" bind:change="onChange2"/>
      <picker mode="date" value="{{starttime}}" start="{{minDate}}" end="{{ minDate1 }}" bindchange="bindDateChange">
        <van-field value="{{ starttime }}" placeholder="请选择开始时间" label="开始时间" border="{{ true }}" readonly />
      </picker>
      <picker mode="date" value="{{endtime}}" start="{{minDate}}" end="{{ minDate1 }}"bindchange="bindDateChange1">
        <van-field value="{{ endtime }}" placeholder="请选择结束时间" label="结束时间" border="{{ true }}" readonly />
      </picker>
      <view class=""><button type="primary" bindtap="sendNfc">添加</button></view>
    </view>
    <view class="addword" wx:if="{{addIndex==2}}">
      <van-field value="{{ pzname }}" placeholder="请输入指纹名称" label="指纹" border="{{ true }}" bind:change="onChange2"
        maxlength="8" />
      <picker mode="date" value="{{starttime}}" start="{{minDate}}" end="{{ minDate1 }}" bindchange="bindDateChange">
        <van-field value="{{ starttime }}" placeholder="请选择开始时间" label="开始时间" border="{{ true }}" readonly />
      </picker>
      <picker mode="date" value="{{endtime}}" start="{{minDate}}" end="{{ minDate1 }}" bindchange="bindDateChange1">
        <van-field value="{{ endtime }}" placeholder="请选择结束时间" label="结束时间" border="{{ true }}" readonly />
      </picker>
      <view class=""><button type="primary" bindtap="sendFp">添加</button></view>
    </view>
  </van-popup>
</view>

<loading wx:if="{{showLoading}}"></loading>