<!--pages/regular/index.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 class="add_btn" bindtap="goAdd"><text>新增</text></view>
</view>
<view class="top_view">
  <van-dropdown-menu active-color="#5CAE77" bind:change="changeTab" id="top_view1" style="flex: 1;">
    <van-dropdown-item value="{{ value1 }}" options="{{ option1 }}" bind:change="changeTab1" />
    <van-dropdown-item value="{{ value2 }}" options="{{ option2 }}" bind:change="changeTab2" />
    <van-dropdown-item value="{{ value3 }}" options="{{ option3 }}" bind:change="changeTab3" />
  </van-dropdown-menu>
  <view class="sx_view" bindtap="showPopup">
    <text>筛选</text>
    <image src="/image/icon/icon_sx.png" style="width: 15px;height: 15px;margin-left: 5px;"></image>
  </view>
</view>
<scroll-view scroll-y refresher-threshold="0" style="height:100%" bindscrolltolower="paging" lower-threshold="100">
  <!-- wx:for="{{list}}" wx:key="index" wx:for-item="item" right-width="{{ 50 }}" -->
<van-swipe-cell right-width="{{ item.billType != '5' ? 165 : 0 }}" class="workflow" wx:for="{{billList}}" wx:key="index">
  <view class="li" >
    <view style="width:70%;flex:7;">
      <view class="tit_box">
        <image src="/image/apply/icon_text.png" style="width: 16px;height: 19px;margin-right: 2px;"></image>
        <text class="tit">{{item.billNum}}</text>
        <text class="tit_tab5">{{item.billTypeText}}</text>
      </view>
      <view class="money_box">
        <view style="width: 50%;">
          <text>支出（元）</text>
          <text style="color: #E90000;font-size: 22px;margin-top: 10px;">{{item.daiAmount ? item.daiAmount : '0.00'}}</text>
          <view style="display: flex;align-items: center;margin-top: 10px;">
            <image src="/image/icon/clock_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
            <text>{{item.billDate}}</text>
          </view>
        </view>
        <view style="width: 50%;">
          <text>收入（元）</text>
          <text style="color: #5CAE77;font-size: 22px;margin-top: 10px;">{{item.jieAmount ? item.jieAmount : '0.00'}}</text>
          <view style="display: flex;align-items: center;margin-top: 10px;justify-content: space-between;">
            <text style="border-bottom: 1px solid;">{{item.cashierFlowId ? item.cashierFlowId : ''}}</text>
            <text style="color: #B3DB62;">{{item.incomeExpensesTypeText}}</text>
          </view>
        </view>
      </view>
      
    </view>
    <view class="list_btn">
      <view>
        <view class="btn btn_xf" data-id="{{item.id}}" bindtap="goHX" wx:if="{{item.billType == '4'}}">核销</view>
        <view class="btn btn_qs" data-options="{{item}}" bindtap="goSCLS" wx:if="{{item.cashierFlowId == null && item.billType == '4' && item.accountId != null}}">生成流水</view>
        <view class="btn btn_zf" data-id="{{item.id}}" bindtap="goZF">作废</view>
      </view>
    </view> 
  </view>
  <view slot="right" class="cell_right" wx:if="{{item.billType != '5'}}">
    <!-- <view class="button_box"><view></view></view> -->
    <view class="button_box" data-id="{{item.id}}" bindtap="goYS">
      <view>
        <image src="/image/icon/icon_ys.png" style="width: 20.55px;height: 20.55px;"></image>
        <text>遗失</text>
      </view>
    </view>
    <view class="button_box" data-id="{{item.id}}" data-index="{{index}}"  bindtap="upload">
      <view>
        <image src="/image/icon/icon_scfj.png" style="width: 20.55px;height: 20.55px;"></image>
        <text>附件</text>
      </view>
    </view>
    <view class="button_box" data-options="{{item}}" bindtap="goEdit" wx:if="{{item.cashierFlowId == null && item.billType == '4'}}">
      <view>
        <image src="/image/icon/icon_xg2.png" style="width: 20.55px;height: 20.55px;"></image>
        <text>修改</text>
      </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 }}" bind:after-read="afterRead" bind:delete="deleteImg" data-idx="{{index}}" bind:click-preview="lookDown">
                  </van-upload> 
                </view>
              </view>
            </view>
          </view>
  </scroll-view>
</van-action-sheet>
<modal hidden="{{!showPopup2}}" title="是否删除？" confirm-text="是" cancel-text="否" bindcancel="cancelTem" bindconfirm="confirmTem">  
 
</modal>
<van-popup
  show="{{ showPopup }}"
  round
  position="right"
  custom-style="height: 100%;width:90%;"
  bind:close="onClose"
>
  <view class="sx_box" style="margin-top:{{isIPX?'88px':'64px'}};">
    <text class="sx_tit">收支类型</text>

    <van-radio-group value="{{ result1 }}" bind:change="onChangeSZ">
      <van-radio use-icon-slot name="{{item.value}}" wx:for="{{option1}}" wx:key="index">
        <view slot="icon" class="{{result1 == item.value ? 'ys_checkbox_icon':'checkbox_icon'}}">
          {{item.text}}
        </view>
      </van-radio>
    </van-radio-group>

    <text class="sx_tit">结算方式</text>

    <van-radio-group value="{{ result2 }}" bind:change="onChangeJS">
      <van-radio use-icon-slot name="{{item.value}}" wx:for="{{option2}}" wx:key="index">
        <view slot="icon" class="{{result2 == item.value ? 'ys_checkbox_icon':'checkbox_icon'}}">
          {{item.text}}
        </view>
      </van-radio>
    </van-radio-group>
     
    <text class="sx_tit">票据状态</text>

    <van-radio-group value="{{ result3 }}" bind:change="onChangePJ">
      <van-radio use-icon-slot name="{{item.value}}" wx:for="{{option3}}" wx:key="index">
        <view slot="icon" class="{{result3 == item.value ? 'ys_checkbox_icon':'checkbox_icon'}}">
          {{item.text}}
        </view>
      </van-radio>
    </van-radio-group>

    <text class="sx_tit">开票日期</text>

    <view class="sx_input_box">
      <picker mode="date" value="{{billDate}}" bindchange="bindDateBeginChange">
        <view class="picker">
          <input disabled placeholder="开始日期" value="{{billDate}}" />
        </view>
      </picker>
    </view>


    <view class="bottom">
      <!-- <view class="btn1" data-type="3" bindtap="goSubmit">提交复核</view> -->
      <view class="btn1" bindtap="reset">重置</view>
      <view class="btn2" data-type="0" bindtap="goSubmit" hover-class="btnView">确定</view>
    </view>
  </view>
</van-popup>
<van-dialog
  use-slot
  show="{{ showReceiptDialog }}"
  bind:close="onClose"
  theme='round-button'
  confirmButtonText="票本下发"
  data-type="1"
  bind:confirm="edit"
  before-close="{{beforeClose}}"
  closeOnClickOverlay="{{ true }}"
>
  <!-- <image src="/image/icon/icon_delete.png" style="width: 20px; height: 20px;position: absolute;top: 0;"></image> -->
  <view style="text-align: center;padding: 20px;border-bottom: 1px dashed #e6e6e6;width: 92%;margin: 0 auto;color: #2C8E68;font-size: 18px;">查询回单明细参数</view>
  <van-field value="{{ value }}" required label="下发单位" placeholder="请选择下发单位" input-align="right" is-link arrow-direction="down" bind:change="onChange" />
</van-dialog>