<!--pages/gift/gift.wxml-->
<wxs src="gift.wxs" module="Tools" />
<view class="title">
  <view class="integral">
    <image class="integral-star" src="../../images/exchange_star.png"></image>
    <view class="integral-core">积分余额：{{integral}}分</view>
  </view>
  <navigator hover-class="none" class="detail" data-url="/pages/integral/pages/exchange-record/exchange-record?type={{type}}" url="/pages/integral/pages/exchange-record/exchange-record?type={{type}}">查看兑换记录 ></navigator>
</view>
<view class="container safe_area">
  <view class="content">
    <navigator class="cell" wx:for='{{list}}' wx:key='index' hover-class="none" url="/pages/integral/pages/gift-detail/gift-detail?id={{item.id}}&&type={{type}}">
      <image src="{{item.rewardPic || item.activityPic}}" class="images"></image>
      <view class="info">
        <view class="name">{{item.rewardName || item.activityName}}</view>
        <view class="action">
          <view class="int">
            <image class="integral-star" src="../../images/exchange_star.png"></image>
            <view class="int-text">
              <text>{{item.points}}积分</text>
              <text wx:if='{{item.money}}'>+{{item.money}}元</text>
            </view>
          </view>
          <view class="button" wx:if='{{type==="gift"}}'>
            <image src="../../images/exchange_button.png" wx:if='{{Tools.getGiftStatus(item.exchangeRewardNum, item.rewardNumber, item.exchangeStartDate, item.exchangeEndDate) ===3 }}'></image>
            <view class="button-content" wx:if='{{Tools.getGiftStatus(item.exchangeRewardNum, item.rewardNumber, item.exchangeStartDate, item.exchangeEndDate) ===3 }}'>{{button}}</view>
            <view class="button-content button-text" wx:if='{{Tools.getGiftStatus(item.exchangeRewardNum, item.rewardNumber, item.exchangeStartDate, item.exchangeEndDate) ===2 }}'>{{Tools.getMonthDay(item.exchangeStartDate)}}开始</view>
            <view class="button-content button-text" wx:if='{{Tools.getGiftStatus(item.exchangeRewardNum, item.rewardNumber, item.exchangeStartDate, item.exchangeEndDate) ===1 }}'>已兑完</view>
            <view class="button-content button-text" wx:if='{{Tools.getGiftStatus(item.exchangeRewardNum, item.rewardNumber, item.exchangeStartDate, item.exchangeEndDate) ===0 }}'>已兑完</view>
          </view>
          <view class="button" wx:if='{{type==="activity"}}'>
            <image src="../../images/exchange_button.png" wx:if='{{Tools.getActivityStatus(item.attendActivityNum, item.activityNumber, item.exchangeStartDate, item.exchangeEndDate) ===3 }}'></image>
            <view class="button-content" wx:if='{{Tools.getActivityStatus(item.attendActivityNum, item.activityNumber, item.exchangeStartDate, item.exchangeEndDate) ===3 }}'>{{button}}</view>
            <view class="button-content button-text" wx:if='{{Tools.getActivityStatus(item.attendActivityNum, item.activityNumber, item.exchangeStartDate, item.exchangeEndDate) ===2 }}'>{{Tools.getMonthDay(item.exchangeStartDate)}}开始</view>
            <view class="button-content button-text" wx:if='{{Tools.getActivityStatus(item.attendActivityNum, item.activityNumber, item.exchangeStartDate, item.exchangeEndDate) ===1 }}'>名额已满</view>
            <view class="button-content button-text" wx:if='{{Tools.getActivityStatus(item.attendActivityNum, item.activityNumber, item.exchangeStartDate, item.exchangeEndDate) ===0 }}'>名额已满</view>
          </view>
        </view>
      </view>
    </navigator>
    <image src="../../images/empty.png" class="empty" wx:if='{{!list.length}}'></image>
    <view class='no_text'>暂无{{type==="gift"?'好礼':'活动'}}兑换</view>
  </view>
</view>