<!--pages/paymentManager/paymentManager.wxml-->
<view class="ns" id="top_ban" style="height:{{isIPX?'88px':'64px'}};">
  <image src="../../image/apply/back.png" style="top:{{isIPX?'54px':'30px'}};height: 19.0909px;" mode="widthFix" bindtap="back" referrer="no-referrer|origin|unsafe-url"></image>
  <text style="top:{{isIPX?'54px':'30px'}};">支付管理</text>
</view>
<view class="search_box" style="margin-top:{{isIPX?'88px':'64px'}};">
  <van-search
    value="{{ value }}"
    shape="round"
    background="transparent"
    placeholder="请输入名称搜索"
    clearable
    bind:change="goSearch"
  />
</view>

<van-dropdown-menu active-color="#5CAE77" bind:change="changeTab" id="top_view1" class="search_box">
  <van-dropdown-item value="{{ value1 }}" options="{{ option1 }}" bind:change="changeTab" />
  <van-dropdown-item value="{{ value2 }}" options="{{ option2 }}" bind:change="changeTab2" />
  <van-dropdown-item value="{{ value3 }}" options="{{ option3 }}" bind:change="changeTab3" />
</van-dropdown-menu>
<scroll-view scroll-y refresher-threshold="0" style="height:{{scrollHeight}}px" bindscrolltolower="paging" lower-threshold="100">
<van-swipe-cell right-width="{{ 50 }}" class="workflow" wx:for="{{list}}" wx:key="index" wx:for-item="item">
  <view class="li">
    <view style="width:70%;flex:7;" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}" bindtap="toPayDetail" >
      <view class="tit_box">
        <image src="/image/icon/paymentManager_icon.png" style="width: 15px;height: 15px;margin-right: 10px;vertical-align: middle;"  referrer="no-referrer|origin|unsafe-url"></image>
        <text class="tit">{{item.remark}}</text>
      </view>
      <view class="detail_box">
        <view style="margin-left:5%;color:grey;font-size: 12px;justify-content: space-between;display: contents;">
          <text>{{item.payerAccount}}</text>
          <text style="color:#62AD66;background-color: rgb(98,173,102,0.2);padding:2px 4px;text-align: right;">{{item.transferType==1?"银行还款":"信用卡还款"}}</text> 
        </view>
      </view>
      <view class="detail_box">
        <view style="width: 50%;">
          <image src="/image/icon/clock_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
          <text>{{item.applyDate}}</text>
        </view>
        <view style="width: 50%;">
          <image src="/image/icon/clock_red_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
          <text>{{item.applyDate}}</text>
        </view>
      </view>
    </view>
    <view style="width:30%;flex:3;display: flex;flex-direction: column;justify-content: space-between;">
      <view style="text-align: right;">
          <view style="color:red;font-size: 18px;">
            <text style="font-size: 10px;display: inline;">￥</text>{{item.expenditureAmount}}
          </view>
        </view>
        <view style="text-align: right;" wx-if="{{(item.paymentState==4 || item.paymentState==5) && item.downId != null}}">
          <view style="color:red;font-size: 18px;">
            <text style="font-size: 12px;display: inline;">(已申请)</text>
          </view>
        </view>
        <view style="text-align: right;" wx-if="{{(item.paymentState==4 || item.paymentState==5) && item.downId == null}}">
          <view style="color:rgb(26,173,25);font-size: 18px;">
            <text style="font-size: 12px;display: inline;">可重新申请</text>
          </view>
        </view>
        <view style="text-align: right;">

          <button wx-if="{{item.paymentState==1}}" type="primary" size="mini" style="border-radius: 15px;"  bindtap="toPay" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}">待支付</button>

          <button wx-if="{{item.paymentState==3}}" type="primary"  size="mini" style="border-radius: 15px;background-color: #B3DB62;" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}" bindtap="toPayDetail">银行受理</button>

          <button wx-if="{{item.paymentState==4 && item.downId == null}}" type="warn" size="mini" style="border-radius: 15px;" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}" bindtap="toPayReapply">支付失败</button>

          <button wx-if="{{item.paymentState==5 && item.downId == null}}" type="primary" size="mini" style="border-radius: 15px;background-color: #FC9A55;" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}" bindtap="toPayReapply">部分失败</button>

          <button wx-if="{{item.paymentState==4 && item.downId != null}}" type="warn" size="mini" style="border-radius: 15px;" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}" bindtap="toPayDetail">支付失败</button>

          <button wx-if="{{item.paymentState==5 && item.downId != null}}" type="primary" size="mini" style="border-radius: 15px;background-color: #FC9A55;" data-id="{{item.approvalItemTemplateId}}" data-ids="{{item.id}}" bindtap="toPayDetail">部分失败</button>
        
          <button wx-if="{{item.paymentState==6}}" type="primary" size="mini" style="border-radius: 15px;">支付成功</button>

        </view>
    </view> 
  </view>
  <view slot="right" class="deleteBox">
    <view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(98,173,102,0.2);" data-id="{{item.id}}" data-index="{{index}}" bindtap="upload">
      <view>
        <image src="../../image/icon/upload_icon.png" style="width: 25px;height: 25px;margin: 0 auto;display: block;"  ></image>
      </view>
      <view>
        <text style="color: #62AD66;">附件</text>
      </view>
    </view>
  </view>
</van-swipe-cell>
</scroll-view>

<van-action-sheet show="{{showUpload}}" title="附件" bind:close="closeBox">
  <scroll-view scroll-y="true" style="height: 600rpx;"  scroll-top="0">
    <view class="fj-box">
            <view class="fj-li" wx:for="{{fileList}}" wx:key="index" wx:for-item="item" >
              <view>
                <text>{{item.dictLabel}}</text>
              </view>
              <view class="img_box">
                <view class="img_li">
                  <van-upload file-list="{{ item.list }}" deletable="{{false}}" show-upload="{{false}}" bind:click-preview="lookDown">
                  </van-upload> 
                </view>
              </view>
            </view>
          </view>
  </scroll-view>
</van-action-sheet>
