<!--pages/gift-detail/gift-detail.wxml-->
<wxs src="../../../tools.wxs" module="globalTools" />
<wxs src="gift-detail.wxs" module="Tools" />
<view class="container">
  <view class="header">
    <view class="title">
      <view class="name">{{rewardName || activityName}}</view>
      <view class="info">
        <view class="integral">
          <text>{{points}}<text class="jifen">积分</text> </text>
          <text wx:if='{{money}}'>+{{money}} <text class="jifen">元</text></text>
        </view>
        <view class="info-rule" wx:if='{{type === "gift"&&exchangeNumber}}'>每人限领{{exchangeNumber}}份</view>
      </view>
    </view>
    <view class="info-detail">
      <view class="info-detail-content-gift" wx:if='{{type === "gift"}}'>
        <view class="nums">
          库存:{{rewardNumber===null ? '不限':rewardNumber - exchangeRewardNum}} 已领:{{exchangeRewardNum}}
        </view>
        <view class="time">
          兑换时间:{{Tools.getTimeStatus(exchangeStartDate,exchangeEndDate)}}
        </view>
      </view>

      <view class="info-detail-content-activity" wx:if='{{type === "activity"}}'>
        <view class="info-detail-content-info">
          <view>
            <text class="info-detail-content-name">剩余名额：</text>
            <text class="info-detail-content-value">{{activityNumber === null?'不限':activityNumber - attendActivityNum}}</text>
          </view>
          <view>
            <text class="info-detail-content-name">已报人数：</text>
            <text class="info-detail-content-value">{{attendActivityNum}}</text>
          </view>

        </view>
        <view class="info-detail-content-info">
          <text class="info-detail-content-name">兑换时间：</text>
          <text class="info-detail-content-value">{{Tools.getTimeStatus(exchangeStartDate,exchangeEndDate)}}</text>
        </view>
        <view class="info-detail-content-info">
          <text class="info-detail-content-name">活动时间：</text>
          <text class="info-detail-content-value">{{Tools.formatTime(activityStartTime,'.','')}} - {{Tools.formatTime(activityEndTime,'.','')}}</text>
        </view>
        <view class="info-detail-content-info">
          <text class="info-detail-content-name">活动地点：</text>
          <text class="info-detail-content-value">{{activityProvinceCityCountry}}{{activityAddress}}</text>
        </view>

      </view>

    </view>
  </view>
  <view class="detail">
    <view class="detail-title">
      {{page_title}}
    </view>
    <view class="detail-pic" wx:if='{{type === "gift"}}'>
      <image wx:for='{{rewardDesciptionList}}' wx:key='{{index}}' wx:if='{{item}}' mode="widthFix" src="{{globalTools.formatUrl(item)}}"></image>
    </view>
    <view class="detail-pic" wx:if='{{type === "activity"}}'>
      <image wx:for='{{activityDescriptionList}}' wx:key='{{index}}' wx:if='{{item}}' mode="widthFix" src="{{globalTools.formatUrl(item)}}"></image>
    </view>
  </view>
  <view class="button">
    <view class="button-content" bindtap="showCover" wx:if='{{rewardNumber===null || rewardNumber!==exchangeRewardNum ||activityNumber===null || activityNumber!==attendActivityNum}}'>
      <image src="../../images/sign_button.png"></image>
      <view class="button-text">{{type === "gift"?'立即兑换':'立即报名'}}</view>
    </view>
    <view class="button-content" wx:else>
      <image src="../../images/sign_button_grey.png"></image>
      <view class="button-text">{{type === "gift"?'已兑完':'名额已满'}}</view>
    </view>
  </view>
</view>

<view class="cover" hidden="{{cover}}" bindtap="showCover">
  <view class="cover-content" hidden="{{input}}" catchtap="returnCover">
    <view class="cover-content-top">
      <view class="input-title">请留下您的联系方式</view>
      <view class="input">
        <input type="number" focus='{{!cover}}' maxlength="11" bindinput="savePhone" adjust-position="true"></input>
      </view>
    </view>
    <view class="cover-content-bottom" catchtap="exchange">
      好的
    </view>
  </view>
  <!-- <view class="cover-content" hidden="{{!input}}">
    <view class="cover-content-top">
      <view class="message-title" hidden="{{title}}">兑换失败：</view>
      <view class="message {{title?'padding':''}}">
        {{message}}
      </view>
    </view>
    <view class="cover-content-bottom" catchtap="showCover">
      好的
    </view>
  </view> -->
</view>