<!--packageB/member/love/love_gift_bag/love_gift_bag.wxml-->
<view class="love-gift-bag">
    <view class="content img-con">
      <h2 class="message">可领取红包数量
        <span class="num">
          {{can_total}}
        </span>个
      </h2>
      <view class="btn-receive {{can_total <= 0 ? 'grey': '' }}" bindtap="showPopup">立即领取</view>
      <view class="history">
        <view class="total">
          <view class="num">
            {{stored_total }}
          </view>
          <view>累计获得数量</view>
        </view>
        <view class="received">
          <view class="num">
            {{gain_total}}
          </view>
          <view>已领取数量</view>
        </view>
        <view class="invalid">
          <view class="num">
            {{past_total}}
          </view>
          <view>已过期数量</view>
        </view>
      </view>
    </view>
    <view class="record-list">
      <van-tabs
        active="{{tabActive}}"
        color="#af1319"
        title-inactive-color="#ffffff"
        title-active-color="#af1319"
        bind:change="switchTab"
      >
        <van-tab name="2" title="领取记录" title-class="nav"></van-tab>
        <van-tab name="-1" title="过期红包" title-class="nav"></van-tab>
      </van-tabs>

      <scroll-view 
        class="listContent" 
        wx:if="{{recordList.length > 0}}"
        scroll-y="{{true}}"
        scroll-anchoring="{{true}}"
        bindscrolltolower="getData"
      >
        <view class="item" wx:for="{{recordList}}" wx:key="index">
          <view class="time">{{item.date}}</view>
          <view class="value">
            <span class="{{item.love > 0 ? 'text-red' : ''}}">
              {{ item.love }}
            </span> {{titleText}}</view>
        </view>
        <view wx:if="{{finished}}" style="margin-top: 10rpx;">没有更多了</view>
      </scroll-view>

      <view class="empty" wx:else>
        <image class="img" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/massage_blankpage@3x.png"></image>
        <view class="text">还没有记录哦</view>
      </view>
    </view>
    
    <van-popup show="{{showDialog}}" round bind:close="onClose" custom-style="background: transparent;">
      <view class="popup-content img-con">
        <h2 class="message">{{redpack.msg}}</h2>
        <span class="money">{{redpack.love ? redpack.love : 0 }}</span>
        <view class="btn-confirm" bindtap="onClose">确定</view>
      </view>
    </van-popup>
  </view>