<!--pages/apply/approval/approval.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="pure_top" style="top:{{isIPX?'88px':'64px'}};"></view>
<view class="main-box top-box  steps-box" style="margin-top:{{isIPX?'100px':'75px'}};">
  <text class="box-title">审批事项</text>
  <van-row wx:for="{{templateDetailList}}" wx:key="index">
    <van-col span="3">
      <view class="index">{{index+1}}</view>
      <!-- :class="{'indexCenter':index==0 ? false : true}" -->
      <block wx:if="{{index==0}}">
        <view class="indexBorder">
          <view class="ssT" wx:if="{{index>0}}"></view>
          <view class="yq"></view>
          <view class="ss" wx:if="{{templateDetailList.length != index+1}}"></view>
        </view>
      </block>
      <block wx:else>
        <view class="indexBorder indexCenter">
          <view class="ssT" wx:if="{{index>0}}"></view>
          <view class="yq"></view>
          <view class="ss" wx:if="{{templateDetailList.length != index+1}}"></view>
        </view>
      </block>
    </van-col>
    <van-col span="21">
      <van-cell center="{{true}}" border="{{false}}">
        <view slot="title">
          {{item.name?item.name:index+1}}级审批<text style="display: inline-block;margin-left: 10px;">{{item.nickName}}</text>
        </view>
        <view style="display: flex;align-items: center;justify-content:flex-end;">
          <image src="/image/apply/icon_up.png" style="width: 20px;height: 20px;" bindtap="upItem" data-id="{{index}}"></image>
          <image src="/image/apply/icon_down.png" style="width: 20px;height: 20px;margin-left: 10px;" bindtap="downItem" data-id="{{index}}"></image>
        </view>
      </van-cell>
    </van-col>
  </van-row>
  <view class="check_box">
    <van-checkbox-group value="{{ result }}" bind:change="onChange">
      <van-row>
        <van-col span="24" >
              <van-checkbox wx:for="{{groups}}" wx:for-item="item" wx:key="index"  name="{{item.userId}}"  shape="square" checked-color="#2C8E68">{{item.roles[0].roleName}}:{{item.nickName}}</van-checkbox>
        </van-col>
      </van-row>
      <!-- <van-row>
        <van-col span="24" >
              <van-checkbox wx:for="{{villages}}" wx:for-item="item" wx:key="index" name="{{item.userId}}"  shape="square" checked-color="#2C8E68">{{item.roles[0].roleName}}:{{item.nickName}}</van-checkbox>
        </van-col>
      </van-row>
      <van-row>
        <van-col span="24">
              <van-checkbox wx:for="{{towns}}" wx:for-item="item"  wx:key="index" name="{{item.userId}}"  shape="square" checked-color="#2C8E68">{{item.roles[0].roleName}}:{{item.nickName}}</van-checkbox>
        </van-col>
      </van-row> -->
    </van-checkbox-group>
  </view> 

  <view class="bottomBtn">
    <view bindtap="openBox" hover-class="btnView">
      <image src="/image/icon/icon_xzmb.png"></image>
      <text>选择审批模板</text>  
    </view>
    <view bindtap="showPopupNew" style="margin: 0 10px;" hover-class="btnView">
      <image src="/image/icon/icon_zfmb.png"></image>
      <text>保存支付模板</text>  
    </view>
    <view bindtap="showPopup" hover-class="btnView">
      <image src="/image/icon/icon_shmb.png"></image>
      <text>保存审批模板</text>  
    </view>
  </view>
  <!-- <view class="btn_box">      
    <view bindtap="openBox">选择审批模板</view>
    <view bindtap="showPopup">保存审批模板</view>
  </view> -->
</view>

<view class="bottom">
  <view class="btn1" bindtap="save">保存</view>
  <view class="btn2" bindtap="submit" hover-class="btnView">保存并提交</view>
</view>

<van-action-sheet show="{{show}}" title="选择审批模板" bind:close="closeBox" safe-area-inset-bottom="{{true}}">
  <!-- <van-swipe-cell right-width="{{ 65 }}">
    <van-cell label="支付水电、网费、房租" bindtap="goTemplate" >
      <view slot="title">
        <view class="van-cell-text">日常支付水电模板<van-tag plain type="danger" color="#FC9A55" style="margin-left:10px;">默认</van-tag></view>
      </view>
      <van-icon slot="icon" name="https://636c-cloud1-8gya17a31667774d-1310628902.tcb.qcloud.la/icon_mrmb.png?sign=5e5df640777f6a7993c45e1a559dd998&t=1648619865" class="custom-icon" size="40" style="margin-right: 10px;" />
    </van-cell>
    <view slot="right" class="deleteBox">
      <image src="/image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;"></image>
    </view>
  </van-swipe-cell> -->

  <scroll-view scroll-y="true" style="height: 400rpx;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-top="0">
    <van-swipe-cell right-width="{{ 65 }}" wx:for="{{templateList}}"  wx:key="index" wx:for-item="item">
      <van-cell bindtap='chooseTemplate' data-id="{{item.id}}">
        <view slot="title">
          <view class="van-cell-text">{{item.name}}</view>
        </view>
        <image src="/image/apply/icon_mb.png" slot="icon" class="custom-icon" size="40"  style="margin-right: 10px;width: 40px;" mode="widthFix" ></image>
      </van-cell>
      <view slot="right" class="deleteBox" bindtap='deleteTemplate' data-index="{{index}}" data-id="{{item.id}}">
        <view>
          <image src="/image/apply/icon_end.png" style="width: 25px;height: 25px;margin: 0 auto;"></image>
          <text style="display: block;text-align: center;color: #e90000;">禁用</text>
        </view>
      </view>
    </van-swipe-cell>
  </scroll-view>

  

  <van-empty wx:if="{{templateList.length == 0}}" description="暂无审批模板" />
</van-action-sheet>
<modal hidden="{{!showPopup}}" mask="{{true}}" title="审批模板" confirm-text="保存" cancel-text="取消" bindcancel="cancelTem" bindconfirm="confirmTem">  
    <input type='text' value="{{temName}}" placeholder="请输入模板名称" bindinput="inputTem"/>
</modal>
<modal hidden="{{!showPopup2}}" mask="{{true}}" title="支付模板" confirm-text="保存" cancel-text="取消" bindcancel="cancelTemNew" bindconfirm="confirmTemNew">  
    <input type='text' value="{{temName2}}" placeholder="请输入模板名称" bindinput="inputTem2"/>
</modal>
<view class="ipXbtn"></view>