<!--pages/bank/bank.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" id="top_view" style="margin-top:{{isIPX?'100px':'75px'}};">
  <van-search
    value="{{ name }}"
    shape="round"
    background="transparent"
    placeholder="请输入合同名称"
    clearable
    bind:change="goSearch"
  />
  <view class="add_btn" bindtap="goAdd"><text>填报</text></view>
</view>
<scroll-view scroll-y refresher-threshold="0" style="height:{{scrollHeight}}px" bindscrolltolower="paging" lower-threshold="100">
<van-swipe-cell right-width="{{ 225 }}" class="workflow" wx:for="{{list}}" wx:key="index" wx:for-item="item" >
  <view class="li" bindtap="goUpdate" data-id="{{item.id}}">
      <view class="tit_box">
        <image src="/image/icon/contract_icon.png" style="width: 15px;height: 15px;margin-right: 10px;"  referrer="no-referrer|origin|unsafe-url"></image>
        <text class="tit">{{item.name}}</text>
        <view style="flex:1;">
            <text wx:if="{{item.contractionStatus=='1'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 154, 4,0.2);color:rgb(235, 154, 4);width:50px;line-height: 20px;">正常</text> 
            <text wx:if="{{item.contractionStatus=='2'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 4, 4,0.2);color:rgb(235, 4, 4);width:50px;line-height: 20px;">撤销</text>     
            <text wx:if="{{item.contractionStatus=='3'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 4, 4,0.2);color:rgb(235, 4, 4);width:50px;line-height: 20px;">终止</text>  
        </view>
      </view>
      <view>
        <text>
            {{item.code}}
        </text>
      </view>
      <view class="detail_box">
        <view style="width: 50%;">
          <image src="/image/icon/jia_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
          <text>{{item.firstParty}}</text>
        </view>
        <view style="width: 50%;">
          <image src="/image/icon/yi_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
          <text>{{item.secondParty}}</text>
        </view>
      </view>
      <view class="detail_box">
        <view style="width: 60%;">
          <image src="/image/icon/clock_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
          <text>{{item.startTime}}~{{item.endTime}}</text>
        </view>
        <view style="width: 40%;text-align: right;">
          合同金额:
          <text style="color:red">￥{{item.totalAmount}}</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(255,0,0,0.2);" data-id="{{item.id}}" data-index="{{index}}" bindtap="delete" wx-if="{{item.contractionStatus=='1'}}">
      <view>
        <image src="../../image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;display: block;" ></image>
      </view>
      <view>
        <text style="color:red">删除</text>
      </view>
    </view>
    <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 style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(239,135,7,0.2);"  data-id="{{item.id}}" data-index="{{index}}" data-contractionstatus="{{item.contractionStatus}}" bindtap="relevance">
      <view>
        <image src="../../image/icon/relevance_icon.png" style="width: 25px;height: 25px;margin: 0 auto;display: block;" ></image>
      </view>
      <view>
        <text style="color: #ffa601;">资产</text>
      </view>
    </view>
    <view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(255,0,0,0.2);" data-id="{{item.id}}" data-index="{{index}}" bindtap="terminate">
      <view>
        <image src="../../image/icon/terminate_icon.png" style="width: 25px;height: 25px;margin: 0 auto;display: block;" ></image>
      </view>
      <view>
        <text style="color:red">终止</text>
      </view>
    </view>
    <view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(179,219,98,0.2);"  data-id="{{item.id}}" data-index="{{index}}"  bindtap="cancel">
      <view>
        <image src="../../image/icon/cancel_icon.png" style="width: 25px;height: 25px;margin: 0 auto;display: block;" ></image>
      </view>
      <view>
        <text style="color: #B3DB62;">撤销</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;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" 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" bind:click-preview="lookDown" data-idx="{{index}}">
                  </van-upload> 
                </view>
              </view>
            </view>
          </view>
  </scroll-view>
</van-action-sheet>
<van-action-sheet show="{{showRelevance}}" title="已关联资产" bind:close="closeBox">
  <scroll-view scroll-y="true" style="height: 700rpx;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-top="0">
    <view class="table">
        <view class="tr" style="background:#62AD66;color: #fff;border-radius:10px;">
          <view class="th">资产类型</view>
          <view class="th">资产名称</view>
          <view class="th">数量（单位）</view>
        </view>
        <van-swipe-cell right-width="{{ 50 }}" wx:for="{{revelanceList}}" wx:key="index" wx:for-item="item" >
            <view class="tr">
                <view class="th">{{item.assetTable=='t_asset_permanent'?"固定资产":"资源资产"}}</view>
                <view class="th">{{item.name}}</view>
                <view class="th">{{item.num}}{{item.unit}}</view>
              </view>
          <view slot="right" class="deleteBoxAsset">
            <view style="flex: 1;height: 100%;display: flex;align-items: center;flex-direction: column;justify-content: center;background-color: rgb(255,0,0,0.2);" bindtap="relevanceDelete"  data-id="{{item.id}}" data-index="{{index}}" >
              <view>
                <text style="color:red">删除</text>
              </view>
            </view>
          </view>
        </van-swipe-cell>
        <view class="tr" wx:if="{{showAdd}}" >
          <button type="primary" size="mini" bindtap="addAssets">+</button>
        </view>
      </view>
  </scroll-view>
</van-action-sheet>
<modal hidden="{{!showPopup}}" title="是否删除？" confirm-text="是" cancel-text="否" bindcancel="cancelTem" bindconfirm="confirmTem">  
 
</modal>
<modal hidden="{{!showPopupDel}}" title="是否删除？" confirm-text="是" cancel-text="否" bindcancel="cancelTemDel" bindconfirm="confirmTemDel">  
 
</modal>