<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
<wxs module="g_filters" src="g_filter.wxs"></wxs>
<wxs module="tool" src="filter.wxs"></wxs>

<block wx:if="{{config2.couponset}}">
    <view class="header">
        <rich-text nodes="{{config2.couponset}}" class="r_txt fs26"></rich-text>
    </view>
</block>
<view class="content">
    <view bindtap="go_detail" data-ind="{{index}}" class="quan_item flex fs30" wx:for="{{dataList}}">
        <!-- 左边 -->
        <view class="left {{tool.get_color(index,dataList)}} flex ai-center jc-center co-w">
            <view class="t-c">
                <view class="fs40"><text class="fs24">￥</text>{{filters.toFix(item.money,2)}}</view>
                <view>满{{filters.toFix(item.condition,2)}}可用</view>
            </view>
        </view>
        <!-- 右边 -->
        <view class="right fs24 co_g pding" style="background-image:url({{iurl}}/miniapp/images/coupon_img/white.png); position: relative">
            <view class="fs28 co_b" style="margin-top: 15rpx">{{item.name}}</view>

            <view class="ellipsis-1" style="margin-top: 5rpx" wx:if="{{item.coupon_remark!=null && item.coupon_remark!=''}}">{{item.coupon_remark}}</view>
            <view style="margin-top: 5rpx" wx:else>所有门店通用</view>
            <view wx:if="{{item.endtype==0}}">有效期
                <text wx:if="{{item.starttype==1}}">{{filters.format_time(getcurday+3600*24*item.startdays)}}</text>
                <text wx:if="{{item.starttype==0 && item.use_start_time>0}}"> {{filters.format_time(item.use_start_time)}}</text>
                至
                <text wx:if="{{item.use_end_time>0}}"> {{filters.format_time(item.use_end_time)}}</text><text wx:else>不限</text>
            </view>
            <view wx:else>有效期 
                <text wx:if="{{item.starttype==1}}">{{filters.format_time(getcurday+3600*24*item.startdays)}}</text>
                <text wx:else>{{filters.format_time(getcurday)}}</text>
                至
                <text wx:if="{{item.days>0}}">{{filters.format_time(getcurday+3600*24*item.days+3600*24*item.startdays)}}</text>
                <text wx:else>不限</text>

            </view>
            <view>每人限领：<text wx:if="{{item.everyone_num>0}}">{{item.everyone_num}}</text><text wx:else>不限</text></view>
            <!-- 领取按钮 -->
            <view data-ind="{{index}}" data-cid="{{item.id}}" catchtap="get_quan">
                <view wx:if="{{item.everyone_num>0 && item.lqnum>=item.everyone_num}}" class="btn flex jc-center ai-center is_get">已领取</view>
                <view wx:else class="btn flex jc-center ai-center">立即领取</view>
            </view>
        </view>
    </view>
</view>

<view wx:if="{{show_success}}">
    <view class="cover-layer" bindtap="close_show"></view>
    <view class="suc_content">
        <view class="up flex jc-center">
            <view class="t-c">
                <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image>
                <view style="margin-top:32rpx;color:#4e220b" class="fs36 ellipsis-1">恭喜您获得【{{get_item.name}}】优惠券</view>
            </view>
        </view>
        <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view>
    </view>
</view>

<warn id="warn"></warn>
<nav_box id="nav"></nav_box>