<!--pages/apply/index.wxml-->
<view class="ns" style="height:{{isIPX?'88px':'64px'}};">
  <image src="../../image/apply/back.png" style="top:{{isIPX?'54px':'30px'}};" mode="widthFix" bindtap="back"></image>
  <text style="top:{{isIPX?'54px':'30px'}};">支出申请</text>
</view>
<!-- 付款单位开始 -->
<view class="top" style="margin-top:{{isIPX?'100px':'75px'}};">
  <image src="../../image/apply/dress_icon.png" mode="widthFix"></image>
  <view class="top-tit">付款单位</view>
  <view class="top-title">{{bookName}}</view>
</view>

<view class="main">
  <van-tabs sticky color="#000" animated>
    <van-tab title="银行账户">
      <view class="bank_box" wx:for="{{accountList}}" wx:key="index">
        <text class="zt">{{item.bankUseType == 1 ?'基本户':'一般户'}}</text>
        <image src="../../image/apply/bgt.png" wx:if="{{item.bankUseType == 1}}" style="width: 100%;position: absolute;top:0;right:0;z-index: 9;height: 100%;"></image>
        <image src="../../image/apply/bgy.png" wx:else style="width: 100%;position: absolute;top:0;right:0;z-index: 9;height: 100%;"></image>
        <view class="bank_content {{iOf.indexOf(item.bankTypeText,'中国银行') > -1 ? 'ICBC':iOf.indexOf(item.bankTypeText,'农商行') > -1 ? 'RCB':iOf.indexOf(item.bankTypeText,'农业银行') > -1 ? 'ABC':iOf.indexOf(item.bankTypeText,'建设银行') > -1 ? 'CCB':iOf.indexOf(item.bankTypeText,'邮储银行') > -1 ? 'EMS':iOf.indexOf(item.bankTypeText,'工商银行') > -1 ? 'BOC':iOf.indexOf(item.bankTypeText,'中原银行') > -1 ? 'ZYB':'bank_other'}}">
          <view class="bankName">
            <image src="../../image/apply/{{iOf.indexOf(item.bankTypeText,'中国银行') > -1 ? 'ICBC':iOf.indexOf(item.bankTypeText,'农商行') > -1 ? 'RCB':iOf.indexOf(item.bankTypeText,'农业银行') > -1 ? 'ABC':iOf.indexOf(item.bankTypeText,'建设银行') > -1 ? 'CCB':iOf.indexOf(item.bankTypeText,'邮储银行') > -1 ? 'EMS':iOf.indexOf(item.bankTypeText,'工商银行') > -1 ? 'BOC':iOf.indexOf(item.bankTypeText,'中原银行') > -1 ? 'ZYB':'other'}}.png" style="width: 25px"  mode="widthFix"></image>
            <text>{{item.accountName}}</text>
          </view>
          
          <view style="margin-top: 2vh;">{{item.bankAccountNumber}}<text>卡号</text></view> 
          <view>可用余额</view> 
          <view style="font-weight: bold;font-size: 22px;margin-top: 2vh;">
            {{item.balance}}
            <image src="/image/apply/update.png" data-id="{{item.id}}" data-index="{{index}}" bindtap="updateMoney" style="width: 20px;height: 20px;vertical-align: middle;position: absolute;right: 2vh;z-index: 10;"></image>
          </view> 
        </view>
      </view>
      <van-empty wx:if="{{accountList.length == 0}}" description="暂无银行账户" />
    </van-tab>

    <van-tab title="现金账户">
    
    <view class="bank_box" wx:for="{{accountListXJ}}" wx:key="index">
      <view class="bank_content XJ">
        <view class="bankName">
          <image src="../../image/apply/XJ.png" style="width: 25px"  mode="widthFix"></image>
          <text>{{item.accountName}}</text>
        </view>
        
        <view style="margin-top: 2vh;">{{item.subjectId}}<text>科目</text></view> 
        <view>可用余额</view> 
        <view style="font-weight: bold;font-size: 22px;margin-top: 2vh;">
          {{item.balance}}
          <!-- <image src="/image/apply/update.png" data-id="{{item.id}}" data-index="{{index}}" bindtap="updateMoney" style="width: 20px;height: 20px;vertical-align: middle;position: absolute;right: 2vh;z-index: 10;"></image> -->
        </view> 
      </view>
    </view>

    <!-- <view class="addBtn">
      <image src="/image/icon/icon_add.png"></image>
      <text>添加现金账户</text>
    </view> -->

    <van-empty wx:if="{{accountListXJ.length == 0}}" description="暂无现金账户" />
    
    <!-- <van-empty wx:if="{{accountList.length == 0}}" description="暂无银行账户" /> -->
  </van-tab>

    <van-tab title="公务卡">
    <!--  wx:for="{{accountListGWK}}" wx:key="index" -->
      <view class="bank_box" wx:for="{{accountListGWK}}" wx:key="index">
        <view class="bank_content gwk">
          <view class="bankName">
            <image src="../../image/apply/icon_GWK.png" style="width: 25px"  mode="widthFix"></image>
            <text>公务卡</text>
          </view>
          <view style="margin-top: 2vh;">{{item.payeeAccount}}<text>卡号</text></view> 

          <view>{{item.bankDeposit}}</view>
          <!-- <view>可用余额</view> 
          <view style="font-weight: bold;font-size: 22px;margin-top: 2vh;">{{item.payeePaymentLines}}</view>  -->
        </view>
        <view class="holder">持有人：{{item.payee}}</view>
      </view>
    <van-empty wx:if="{{accountListGWK.length == 0}}" description="暂无公务卡账户" />
      
    </van-tab>
  </van-tabs>
</view>

<view class="bottom">
  <!-- <view class="btn1" bindtap="openBox">支付模板</view> -->
  <view class="btn2" bindtap="swichPaymentApply">下一步</view>
</view>
<view class="ipXbtn"></view>
<van-action-sheet show="{{show}}" title="支付模板" bind:close="closeBox">
  <scroll-view scroll-y="true" style="height: 400rpx;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-top="0">
    <van-swipe-cell right-width="{{ 130 }}" wx:for="{{approvalItemsOptions}}" wx:key="index">
      <van-cell-group>
        <van-cell label="{{item.approvalItems}}" bindtap="goTemplate" data-options="{{item.templateContent}}" data-id="{{item.id}}">
          <view slot="title">
            <view class="van-cell-text">{{item.templateName}}<van-tag plain type="danger" color="#FC9A55" style="margin-left:10px;" wx:if="{{index == 0&&item.defaultValue == 1}}"><image src="/image/apply/icon_mr.png" style="width: 12px;height: 12px;margin-right: 2px;"></image>默认</van-tag></view>
          </view>
          <image src="/image/apply/icon_mrmb.png" wx:if="{{index == 0&&item.defaultValue == 1}}" slot="icon" class="custom-icon" style="margin-right: 10px;width: 40px;" mode="widthFix" ></image>
          <image src="/image/apply/icon_mb.png" wx:else slot="icon" class="custom-icon" size="40"  style="margin-right: 10px;width: 40px;" mode="widthFix" ></image>
        </van-cell>
      </van-cell-group>
      <view slot="right" class="deleteBox">

        <view style="flex: 1;height: 100%;display: flex;align-items: center;justify-content: center;background-color: rgb(252, 154, 85,0.2);">
          <view>
            <image src="../../image/apply/button_mr.png" style="width: 25px;height: 25px;margin: 0 auto;" data-id="{{item.id}}" data-index="{{index}}" bindtap="getMr"></image>
            <text style="display: block;text-align: center;color: rgb(252, 154, 85);">默认</text>
          </view>
        </view>

        <view style="flex: 1;height: 100%;display: flex;align-items: center;justify-content: center;background-color: rgb(255,0,0,0.2);">
          <view>
            <image src="../../image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;" data-id="{{item.id}}" data-index="{{index}}" bindtap="delete"></image>
            <text style="display: block;text-align: center;color: #e90000;">删除</text>
          </view>
        </view>

      </view>
    </van-swipe-cell>
    <van-empty wx:if="{{approvalItemsOptions.length == 0}}" description="暂无支付模板" />
  </scroll-view>
</van-action-sheet>
<wxs module="iOf">
  var indexOf = function(name,value){
    return name.indexOf(value);
  }
  module.exports.indexOf = indexOf;
</wxs>