<!--pages/car/index.wxml-->
<view class="container listMain">
  <block wx:if="{{loginStatus}}">
    <navigator url="add" class="addBtn" hover-class="none" catchtouchmove="buttonMove" bindtouchstart="buttonStart" bindtouchend="buttonEnd" style="top:{{buttonTop}}px;left:{{buttonLeft}}px;">
      <van-icon name="plus" size="30px" />
    </navigator>
    <van-sticky>
      <view class="topSeach">
        <view class="rightBox" style="position: relative;">
          <van-search value="{{ searchVal }}" shape="round" placeholder="请输入车牌号码" bind:change="onChange" bind:search="onSearch" bind:cancel="onCancel" use-action-slot>
            <van-icon slot="action" class-prefix="iconfont" name="arrow3-right_fill" size="28px" color="#4B70EA" bind:tap="toSearch" />
          </van-search>
        </view>
      </view>
    </van-sticky>
    <view class="height20"></view>
    <view class="width710">
      <block wx:if="{{!requestStatu}}">
        <block wx:if="{{resData.length>0}}">
          <block wx:for="{{resData}}" wx:key="index">
            <navigator url="info?id={{item.id}}&index={{index}}" class="listItem">
              <view class="title van-ellipsis">
                <van-icon name="/images/icon_1.png" size="20px" color="red" /><text>{{item.licensePlate}}</text>
                <text wx:if="{{item.status}}" class="status carStatus{{item.status}}">{{item.status=='1'?'启用':'关闭'}}</text>
              </view>
              <view class="info">
                <text decode="{{true}}">司{{str+str}}机：{{item.driverName?item.driverName:'未填写'}}<block>/{{item.driverMobile?item.driverMobile:'未填写'}}</block></text>
              </view>
              <view class="info">
                <text>车辆轴数：{{item.vehicleAxleNumber}}</text>
              </view>
              <view class="bottomBtn">
                <van-button type="info" size="small" data-url="edit?id={{item.id}}&index={{index}}" catchtap="toLink" style="margin-right: 20rpx;">修改</van-button>
                <van-button type="danger" size="small" data-id="{{item.id}}" data-license-plate="{{item.licensePlate}}" catchtap="delFun" style="margin-right: 20rpx;">删除</van-button>
                <van-button type="primary" size="small" data-id="{{item.id}}" data-status="1" data-license-plate="{{item.licensePlate}}" catchtap="changeStatus" wx:if="{{ item.status=='2' }}">启用</van-button>
                <van-button type="warning" size="small" data-id="{{item.id}}" data-status="2" data-license-plate="{{item.licensePlate}}" catchtap="changeStatus" wx:if="{{ item.status=='1' }}">关闭</van-button>
              </view>
            </navigator>
          </block>
          <!-- 底部加载动画 -->
          <view class='more'>
            <block wx:if="{{more}}">
              <van-loading size="24px" color="#1989fa">加载中...</van-loading>
            </block>
            <block wx:else>{{nomore}}</block>
          </view>
          <view style="height: 160rpx;"> </view>
        </block>
        <block wx:else>
          <van-empty description="未搜索到车辆信息" />
        </block>
      </block>
    </view>


    <!-- 弹窗 -->
    <van-popup show="{{ show }}" position="bottom" round closeable custom-style="width:100%;padding:0rpx 30rpx 160rpx;" bind:close="onClose">
      <view style="height: 90rpx;line-height: 90rpx;text-align: center;">审核</view>
      <form bindsubmit="formSubmit">
        <view class="part">
          <view class="height20"> </view>
          <view class="height20"> </view>
          <input name="id" value='{{id}}' hidden='true' />
          <van-field label="审核结果" name="status" value="{{ status }}" required input-align="right" class="radioHeight">
            <view slot="input" class="radioHeightBx">
              <radio-group class="radio-group" bindchange="dangerStatusChange" data-radioType="status">
                <label class="radio">
                  <radio value="1" checked="true" color="#4B70EA" />通过
                </label>
                <label class="radio">
                  <radio value="2" color="#4B70EA" /> 不通过
                </label>
              </radio-group>
            </view>
          </van-field>
          <van-field label="审核备注" required="{{status=='2'}}" name="reason" value="{{ reason }}" type="textarea" input-align="right" placeholder="请输入审核备注" autosize></van-field>
        </view>

        <view class="submitBtn">
          <view style="padding-top: 60rpx;">
            <van-button block round type="info" form-type="submit" color="#0396FF">确认</van-button>
          </view>
        </view>
      </form>
    </van-popup>
  </block>
  <block wx:else>
    <view>
      <van-empty>
        <view slot="description" style="text-align: center;">
          <text style="display:block;margin-bottom: 20rpx;">您还未登录，登录后查看更多～</text>
          <van-button type="info" bindtap="toLogin">立即登录</van-button>
        </view>
      </van-empty>
    </view>
  </block>
</view>

<wxs module="filters" src="../../utils/filter.wxs"></wxs>