<!--packageF/storeManagement/storeCouponList/storeCouponList.wxml-->
<view class="coupon_index">

  <view class="coupon_card">
    <van-tabs active="{{ selected }}" bind:click="switchItem">
      <scroll-view scroll-x="true" wx:if="{{types.length > 0}}">
        <view class="types">
          <view class="type_item" wx:for="{{types}}" wx:key="index">
            <text class="text {{index==typesIndex ? 'active' : ''}}" bindtap="setTypesIndex"
              data-index="{{index}}">{{types[index]}}</text>
          </view>
        </view>
      </scroll-view>
      <van-tab title="待使用"></van-tab>
      <van-tab title="已过期"></van-tab>
      <van-tab title="已使用"></van-tab>
    </van-tabs>
  </view>
</view>







<!-- 这个不卡，但有小问题 -->
<view wx:for="{{couponListData}}">
	<view class="coupon_voucher">
	
			<van-cell-group>
				<view class="coupon_voucher_wrapper">
					<view class="coupon_voucher_left">

						<image wx:if="{{selectedidx==1}}" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/couponsbg_{{item.type || 1}}.png" class="bg_icon" ></image>
						<image wx:else src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/couponsbg_7.png" class="bg_icon" ></image>

						<view class="wrapper">
							<block wx:if="{{item.belongs_to_coupon.coupon_method==2}}">
								<view class="discount">{{item.belongs_to_coupon.discount}}折</view>
								<view class="limit">满{{item.belongs_to_coupon.enough}}可用</view>
							</block>
							<block wx:if="{{item.belongs_to_coupon.coupon_method==1}}">
								<view class="{{item.belongs_to_coupon.deduct.length >= 6?'discount_none':'discount'}}" ><text>{{language['money']}}</text>{{item.belongs_to_coupon.deduct}}</view>
								<view class="limit">满{{item.belongs_to_coupon.enough}}立减</view>
							</block>
						</view>
					</view>
					<view class="coupon_voucher_right">

						<view class="status" wx:if="{{item.over_due && selectedidx==1}}">快过期</view>
						<view class="status blank" wx:elif="{{selectedidx==2}}">已过期</view>
						<view class="status blank" wx:elif="{{selectedidx==3}}">已过期</view>

						<view class="c1">

							<view wx:if="{{selectedidx==1}}" class="label" style="background:{{colors[item.type-1]}}">{{item.belongs_to_coupon.coupon_type_name}}</view>
							<view wx:else class="label" style="background:rgb(206,206,206);">{{item.belongs_to_coupon.coupon_type_name}}</view>

							<view  wx:if="{{selectedidx==1}}" class="title" wx:if="{{item.combine && item.num != 1}}">{{item.num}}张</view>

						</view>
						<view class="c2">
							{{item.belongs_to_coupon.name}}
						</view>
						<view class="time">有效期:{{item.time_start}}-{{item.time_end}}</view>
					</view>
				</view>
				<!-- <view wx:if="{{item.openIs}}" class="coupon_voucher_btm">{{item.api_limit}}</view> -->
				
			</van-cell-group>
			<!-- <view slot="right" class="van-swipe-cell__right" catchtap="delteteItem" data-index="{{index}}" data-item="{{item}}">删除</view> -->

	</view>
</view>  


