<!--packageF/storeManagement/withdrawalDetail/withdrawalDetail.wxml-->

<view class="top-box">
  <view class="amount">￥<text class="num">{{recordData.amounts ? recordData.amounts :
      0}}</text></view>
  <view class="status {{tool.colorClass(status)}}">{{recordData.status_name ? recordData.status_name : '待审核'}}</view>
</view>
<view class="ul">
  <view class="li">
    <text class="title">收入类型</text>
    <text class="text">{{recordData.type_name}}</text>
  </view>
  <view class="li">
    <text class="title">提现编号</text>
    <text class="text">{{recordData.withdraw_sn}}</text>
  </view>
  <view class="li">
    <text class="title">提现方式</text>
    <text class="text">{{recordData.pay_way_name}}</text>
  </view>
  <view class="li">
    <text class="title">提现时间</text>
    <text class="text">{{recordData.created_at}}</text>
  </view>
  <view class="li">
    <text class="title">申请金额</text>
    <text class="text">￥{{recordData.amounts}}</text>
  </view>
  <view class="li">
    <text class="title">手续费</text>
    <text class="text">￥{{recordData.poundage}}</text>
  </view>
</view>

<view class="income">
  <van-cell wx:if="{{recordData.type !== 'balance'}}" title="收入信息" is-link bindtap="setShowPopup"></van-cell>
</view>


<view class="bottom-btns" wx:if="{{recordData.id}}">
  <!-- 余额 -->
  <block wx:if="{{recordData.type == 'balance'}}">
    <view class="btn submit" wx:if="{{status == 0}}" data-type="1" data-opt="1" bindtap="clickButton">通过</view>
    <view class="btn submit" wx:if="{{status == 0}}" data-type="1" data-opt="3" bindtap="clickButton">驳回</view>
    <view class="btn submit" wx:if="{{status == 0}}" data-type="1" data-opt="-1" bindtap="clickButton">无效</view>
  </block>
  <!-- 收入 -->
  <block wx:if="{{recordData.type !== 'balance'}}">
    <view class="btn submit" wx:if="{{status == 0}}" data-type="1" data-opt="1" bindtap="clickButton">提交审核</view>
  </block>

  <view class="btn weChat-pay" wx:if="{{status == 1}}" data-type="2" bindtap="clickButton">
    {{recordData.payment_button_name}}</view>
  <view class="btn offline-pay" wx:if="{{status == 4 || status == 1}}" data-type="7" bindtap="clickButton">线下确认打款</view>
  <view class="btn reject-pay" wx:if="{{status == 1}}" data-type="6" bindtap="clickButton">驳回</view>
  <view class="btn re-pay" wx:if="{{status == 4}}" data-type="5" bindtap="clickButton">重新打款</view>
  <view class="btn re-examine" wx:if="{{status == -1}}" data-type="3" bindtap="clickButton">重新审核</view>
</view>




<van-popup show="{{showPopup}}" custom-class="record-detail-popup" position="bottom">
  <van-row class="th">
    <van-col span="4">收入id</van-col>
    <van-col span="5">金额</van-col>
    <van-col span="9">收入时间</van-col>
    <van-col span="6" bindtap="setShowPopup">
      <van-icon class="close-icon" name="cross"></van-icon>
    </van-col>
  </van-row>
  <view class="srcoll-box">
    <van-checkbox-group value="{{batchIncomes}}" data-name="batchIncomes" bindchange="changeType">
      <van-row class="tr" wx:for="{{incomes}}" wx:key="id">
        <van-col span="4">
          <view style="display:flex;justify-content: space-evenly;align-items: center;">
            <van-checkbox wx:if="{{isOperation}}" name="{{item.id}}" use-icon-slot>
              <i class="iconfont icon-all_select_active {{tool.indexOf(batchIncomes,item.id)>=0 ? 'activeIcon' : ''}}"></i>
            </van-checkbox>
            <text>{{item.id}}</text>
          </view>
        </van-col>
        <van-col span="5">{{item.amount}}</van-col>
        <van-col span="9">{{item.created_at}}</van-col>
        <van-col span="6" style="color:{{item.auditStatus? '#29BA9C' : '#9f9e9e'}};">
        <view style="display: flex;align-items: center;justify-content: center;">
          <text catchtap="showSheet" data-index="{{index}}">{{item.auditStatus?item.auditStatusText:item.pay_status_name}}</text>
          <van-icon wx:if="{{status==0 && !item.auditStatus}}" name="arrow"></van-icon>
        </view>
        </van-col>
      </van-row>
    </van-checkbox-group>
  </view>

  <!-- <view class="empty-placeholder" v-if="isOperation"></view> -->
  <view class="all-handler" wx:if="{{isOperation}}">
   
      <van-checkbox value="{{batchIncomes.length==batchIncomesAll.length ? true : false}}" data-name="allCheck"
          bindchange="changeType" use-icon-slot>
        <view class="check-all">
          <i class="iconfont icon-all_select_active {{batchIncomes.length == batchIncomesAll.length ? 'activeIcon' : ''}}"></i>
          <text>全选</text>
        </view>
      </van-checkbox>
  
    <view class="btns">
      <view class="btn" data-params="{{statusActions[0]}}" bindtap="clickBatchBotton">通过</view>
      <view class="btn" data-params="{{statusActions[1]}}" bindtap="clickBatchBotton">驳回</view>
      <view class="btn" data-params="{{statusActions[2]}}" bindtap="clickBatchBotton">无效</view>
    </view>
    <view class="complete" bindtap="setShowPopup">完成</view>
  </view>

</van-popup>

<van-action-sheet
  show="{{ isShowSheet }}"
  actions="{{ statusActions }}"
  bind:close="onClose"
  bind:select="changeStatus"
/>



<wxs module="tool">
  function indexOf(arr, content) {
    content = content + "";
    return arr.indexOf(content);
  }

  
  function colorClass(status){
    switch (parseInt(status)) {
        case -1:
          return 'grey';
        case 0:
          return 'red';
        case 1:
          return 'yellow';
        case 2:
          return 'green';
        case 3:
          return 'orange ';
        case 4:
          return 'blue';
        }
  }

  module.exports.colorClass=colorClass

  module.exports.indexOf = indexOf;

</wxs>