<!--coupon.wxml-->
<view class="nav_bar {{tabIndex == 1?'active':''}}" bindtap="switchTab">
  <view class="nav_item {{tabIndex == 0?'active':''}}" data-index="0">活动列表</view>
  <view class="nav_item {{tabIndex == 1?'active':''}}" data-index="1">我的优惠券</view>
</view>

<block wx:if="{{tabIndex == 0}}">
  <view class="list activity">
    <view class="activity_item" wx:for="{{activityList}}" wx:key="activityList">
      <view class="activity_title">
        <view class="activity_name">{{item.title}}</view>
        <view class="activity_time">{{item.end_time}}结束</view>
      </view>
      <view class="activity_img">
        <image mode="aspectFill" src="{{imgUrlBefore + item.img}}"></image>
      </view>
      <view class="activity_footer">
        <view class="coupon_box">
          <view class="coupon_item" wx:for="{{item.coupon_text}}" wx:key="coupon_text"> {{item}} </view>
        </view>
        <view class="coupon_btn" data-index="{{index}}" bindtap="getCoupon">立即领取</view>
      </view>
    </view>
  </view>
  <block wx:if="{{!activityList.length}}">
    <view class="empty_box">
      暂无活动
    </view>
  </block>
</block>
<block wx:else>
  <view class="list coupon">
    <view class="item {{item.status == 1?'gary':''}}" wx:for="{{couponList}}" wx:key="couponList">
      <view class="content">
        <view class="left">
          <view class="coupon_info">
            <view class="coupon_name">{{item.title}}</view>
            <view class="coupon_desc">
              <block wx:if="{{item.detail.type == 1}}">
                <view class="coupon_text">{{item.minus}}元</view>
                <view class="coupon_limit">满{{item.sale}}元即可使用</view>
              </block>
              <block wx:else>
                <view class="coupon_text">{{item.minus*10}}折优惠</view>
                <view class="coupon_limit">满{{item.sale}}元即可使用</view>
              </block>
            </view>
          </view>
        </view>
        <view class="right">
          <block wx:if="{{item.status == 0}}">
            <view class="title">有效期限</view>
            <view class="time_box">
              <view class="time_row">{{item.addtime}}</view>
              <view class="time_row">{{item.endtime}}</view>
            </view>
          </block>
          <block wx:else>
            <view class="tips">
              已使用
            </view>
          </block>
        </view>
      </view>
    </view>
  </view>
  <block wx:if="{{!couponList.length}}">
    <view class="empty_box">
      暂无优惠券
    </view>
  </block>
</block>