<!--pages/loadArrive/index.wxml-->
<view class="container listMain">
  <block wx:if="{{loginStatus}}">
    <view url="" class="addBtn" catch:tap="changeAdd" hover-class="none" catchtouchmove="buttonMove" bindtouchstart="buttonStart" bindtouchend="buttonEnd" style="top:{{buttonTop}}px;left:{{buttonLeft}}px;" wx:if="{{roleCodeList == 'ship'}}">
      <van-icon name="plus" size="30px" />
    </view>
    <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>
            <view slot="label" style="width:160rpx;margin-right: 20rpx;">
                  <van-field label="" input-align="center" style="width: 100%;">
                    <view slot="input" style="width: 100%;">
                      <input name="status" value='{{arriveStatusArray[arriveStatusIndex].dictValue}}' hidden='true' />
                      <picker bindchange="bindPickerChange" value="{{arriveStatusIndex}}" range="{{arriveStatusArray}}" range-key="dictLabel" data-pickername='arriveStatus'>
                        <view wx:if="{{arriveStatusArray[arriveStatusIndex].dictLabel}}" style="font-size: 12px;white-space: nowrap;"> {{arriveStatusArray[arriveStatusIndex].dictLabel}}</view>
                        <view wx:else class="selectPlaceholder" style="font-size: 12px;white-space: nowrap;">{{defaultText}}</view>
                      </picker>
                    </view>
                    <view slot="right-icon">
                      <van-icon name="arrow-down" />
                    </view>
                  </van-field>
                </view>
            <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="width710">
      <block wx:if="{{!requestStatu}}">
        <block wx:if="{{resData.length>0}}">
          <block wx:for="{{resData}}" wx:key="index">
            <navigator url="info?id={{item.id}}&name={{item.name}}&index={{index}}" class="listItem">
              <view class="title van-ellipsis">
                <van-icon class='iconfont' name='/images/codeNumber.png' size="36rpx"></van-icon>
                <text>{{item.loadNumber}}</text>
                <text wx:if="{{item.status}}" class="status arriveStatus{{item.status}}">{{item.statusName}}</text>
              </view>
              <view class="info">
                <text>客户名称：{{item.customerName?item.customerName:'未填写'}}</text>
              </view>
              <view class="info">
                <text decode="{{true}}">货品信息：{{item.goodsName?item.goodsName:'未填写'}}/{{item.goodsModel?item.goodsModel:'未填写'}}</text>
              </view>
              <view class="info"><text>船号：{{item.shipNo?item.shipNo:'未填写'}}</text><text>报港数量：{{item.arriveNumber?item.arriveNumber+' 吨':''}}</text></view>
              <view class="info"><text>预约单号：{{ item.arriveNumber }}</text></view>
              <view class="time"><text>到港时间：{{item.arriveTime?filters.tosubStr(item.arriveTime,0,16):''}}</text></view>
              
              <view class="bottomBtn" wx:if="{{ (roleCodeList == 'ship' && (item.status == '1' || item.status == '3')) || (roleCodeList == 'bizAdmin' && item.status == '1') || (roleCodeList == 'ship' && item.loadStatus == '8' && item.status == '2')}}">
                <van-button type="info" size="small" data-url="edit?index={{index}}" catchtap="toLink" style="margin-right: 20rpx;" wx:if="{{roleCodeList == 'ship' && item.status == '3'}}">修改</van-button>

                <van-button type="danger" size="small" data-id="{{item.id}}" data-arrive-number="{{item.arriveNumber}}" catchtap="delFun" style="margin-right: 20rpx;" wx:if="{{roleCodeList == 'ship' && (item.status == '1' || item.status == '3')}}">删除</van-button>
                
                <van-button type="primary" size="small" data-id="{{item.id}}" data-approve-type="one" catchtap="showPopup" wx:if="{{roleCodeList == 'bizAdmin' && item.status == '1'}}">审核</van-button>

                <van-button type="warning" size="small" data-id="{{item.id}}" data-arrive-number="{{item.arriveNumber}}" catchtap="confirmFun" style="margin-right: 20rpx;" wx:if="{{roleCodeList == 'ship' && item.loadStatus == '8' && item.status == '2'}}">确认</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: 200rpx;"> </view>
        </block>
        <block wx:else>
          <van-empty description="未搜索到相关记录" image="/images/null5.png" />
        </block>
      </block>
    </view>
  </block>
  <block wx:else>
    <view>
      <van-empty image="/images/loginNull.png">
        <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>

<!-- 弹窗 -->
<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="auditFlag" value="{{ auditFlag }}" required input-align="right" class="radioHeight fieldAutoHeight">
        <view slot="input" class="radioHeightBx">
          <radio-group class="radio-group" bindchange="dangerStatusChange" data-radioType="auditFlag">
            <label class="radio">
              <radio value="true" checked="{{auditFlag=='true'}}" color="#4B70EA" />通过
            </label>
            <label class="radio">
              <radio value="false" checked="{{auditFlag=='false'}}" color="#4B70EA" />不通过
            </label>
          </radio-group>
        </view>
      </van-field>
      <van-field label="审核备注" required="{{auditFlag=='false'}}" name="arriveReason" value="{{ arriveReason }}" 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>

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