<!-- 历史记录 -->
<!-- <view class="history">
  <view class="historyBtn" bindtap="jumpHis">历史记录</view>
</view> -->
<!-- 切换状态栏 -->
<view class="tab">
  <view class="tab-item {{current==1?'activeTab':''}}" data-current="1" bindtap="selectTab">我的次卡</view>
  <view class="tab-item {{current==2?'activeTab':''}}" data-current="2" style="margin-left: 128rpx;" bindtap="selectTab">我的优惠券</view>
  <view class="moreCard" bindtap="goMoreCard">更多次卡>></view>
</view>
<!-- 次卡列表 -->
<scroll-view wx:if="{{current==1}}" class="scroll" scroll-y bindscrolltolower="toLower" enable-flex="true">
    <view class="content">
      <view class="conItem" wx:for="{{list}}" data-status = '{{item.status}}' data-id="{{item.id}}" wx:key="index" bindtap="jumpCard" >
        <view class="leftLine {{item.status!=1?'leftLineDe':''}}"></view>
        <view class="right">
          <view class="titleFrequency">
            <view class="title">{{item.name}}</view>
            <view class="frequency" wx:if="{{item.status==1&&item.card_type==1}}">
              <text class="usedTimes">{{item.used_num}}</text>
              <text class="totalFrequency">/{{item.total_num}}</text>
            </view>
          </view>
          <view class="beOverdueToUse {{item.day == 0 ? 'hideRight' : ''}}">
            <view class="beOverdue {{item.day == 0 ? 'hide' : ''}}">
              <text class="beOverdueItem">还有</text>
              <text class="beOverdueItem {{item.day < 15 ? 'tips' : ''}}">{{item.day}}天</text>
              <text class="beOverdueItem">({{item.expir_date}})过期</text>
            </view>
            <!-- <view class="toUse" catchtap="jumpProject" data-id="{{item.id}}" data-project_id="{{item.project_id}}" wx:if="{{item.status==1}}">去使用</view> -->
            <view class="toUse finish" wx:if="{{item.status==0}}">已使用</view>
            <view class="toUse finish" wx:if="{{item.status==-1}}">已过期</view>
            <view class="toUse finish" wx:if="{{item.status==-2}}">已注销</view>
          </view>
        </view>
        <view class="cardBg">
          <image src="{{item.status!=1?'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220610/de_icon.png':'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220610/cardBg.png'}}"></image>
        </view>
      </view>
      <view class="loading" hidden="{{!loadMore}}">正在载入更多...</view>
      <view class="loading" hidden="{{!loadAll}}">已加载全部</view>
      <view class="no-data" style="display: {{list.length == 0 ? 'block' : 'none'}};">暂无数据~</view>
    </view>
  </scroll-view>

<!-- 优惠券页面 -->
<view wx:if="{{current==2}}" class="couponList" wx:for="{{couponList}}" wx:key="index">
  <view class="coupon-item {{item.status==1?'used':''||item.status==2?'used':''}}">
  <view class="coupon-left">
    <!-- 优惠券类型，1直接抵扣券，2满减券，3全额减免券，4卡券 -->
    <view class="coupon-type bgc">
      {{couponType[item.coupon_type-1]}}
    </view>
    <view class="coupon-price" wx:if="{{item.coupon_type==3||item.coupon_type==4}}">
    全免
    </view>
    <view class="coupon-price" wx:else>
    <text>￥</text>{{item.price}}
    </view>
  </view>
  <view class="coupon-right">
    <view class="coupon-right-top">
    <view class="coupon-title">{{item.coupon_name}}</view>
    <view class="coupon-condition" wx:if="{{item.coupon_type==2}}">满{{item.full_price}}元可用</view>
    </view>
    <view class="coupon-right-bottom">
    <view class="coupon-time" wx:if="{{item.status==0}}">
    还有<view class="{{item.day<=3?'finaTime':''}}">{{item.day}}天</view>({{item.expir_date}})过期
    </view>
    <view class="coupon-time" wx:else>
    </view>
    <view class="coupon-redio"  bindtap="goToOrderBy" data-item="{{item}}" wx:if="{{item.status==0}}">
    去使用
    </view>
    <view class="coupon-redio" wx:if="{{item.status==1}}">
    已使用
    </view>
    <view class="coupon-redio" wx:if="{{item.status==2}}">
    已过期
    </view>
    </view>
  </view>
  </view>
</view>