<!--pages/member/coupon_v2/coupon_v2.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">
		<swipe-cell rightWidth="{{65}}">
			<van-cell-group>
				<view class="coupon_voucher_wrapper" catchtap="tapGo" data-info="{{item}}">
					<view class="coupon_voucher_left">

						<image wx:if="{{selectedidx==1}}" src="../../../image/couponsbg_{{item.type || 1}}.png" class="bg_icon" ></image>
						<image wx:else src="../../../image/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>
		</swipe-cell>
	</view>
</view>  


<!-- 这个卡，但是没Bug -->
<!--   
 <view wx:for="{{couponListData}}">
	<view class="coupon_voucher">
		<van-swipe-cell right-width="{{ 65 }}" class="swipe-{{item.id}}" >
			<van-cell-group>
				<view class="coupon_voucher_wrapper" catchtap="tapGo" data-info="{{item}}">
					<view class="coupon_voucher_left">

						<image wx:if="{{selectedidx==1}}" src="../../../image/couponsbg_{{item.type}}.png" class="bg_icon" ></image>
						<image wx:else src="../../../image/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>
		</van-swipe-cell>
	</view>
</view>  -->


<view class="coupon-shop" catchtap="gocouponStore">
	<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/coupons_centerbg@2x.png" mode="aspectFit"></image>
	<view class="text">领券中心</view>
</view>
<van-dialog use-slot asyncClose show="{{presentershow}}" show-cancel-button bind:confirm="onconfirm" bind:cancel="onclose">
	<view style="text-align: center;margin: 20rpx 0;font-weight: 700;">提示</view>
	<view class="usercontent">
		<view class="left">请输入用户ID</view>
		<view class="right"><input value="{{usermessage.value}}" confirm-type='done' bindinput="usermesbutInput" bindblur="getmemberInfo" placeholder="请输入用户ID" type="number" /></view>
		<text style="margin-left:40rpx;">昵称:{{memberInfo}}</text>
	</view>
	<!-- <van-field value="{{ usermessage.value }}" bind:blur="usermesbut" label="用户ID" placeholder="请输入用户ID" /> -->
</van-dialog>
<shopfoot bindtabrshow="tabrshowbtn"></shopfoot>