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

<!-- 上部分 -->
<view class="up_part">
    <view class="img_part">
        <image style="width: 100%; height: 450rpx" src="{{iurl}}/miniapp/images/coupon_img/q_detail_bg.png"></image>
        <view class="q_content">
            <view class="upper quan_box jc_sb co-w" style="padding: 20rpx 20rpx 0;">
                <view>
                    <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image>
                    <text wx:if="{{q_data}}">{{q_data.name}}</text>
                    <text wx:elif="{{is_get==1}}" class="fs28">不存在此微券或数量已领取完</text>
                    <text wx:elif="{{is_get==2}}" class="fs28">该优惠券不是免费发放类型</text>
                    <text wx:elif="{{is_get==3}}" class="fs28">活动未开始暂时无法领取优惠券</text>
                    <text wx:elif="{{is_get==4}}" class="fs28">优惠券已过期</text>
                </view>
                <view class="fs30 flex" wx:if="{{q_data}}" style="height: 100rpx;justify-content: space-between;">
                    <view class="flex ai-center">
                        <view class="t_circle"></view>
                        <view class="ellipsis-2" style="width: 400rpx;">
                            <text wx:if="{{q_data.useobjecttype==0}}">全场通用</text>
                            <text wx:else >仅限{{q_data.useobjectname}}使用</text>
                        </view>
                    </view>
                    <view>
                        <view class="fs40 t-c"><text class="fs26">￥</text>{{filters.toFix(q_data.money,2)}}</view>
                        <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view>
                    </view>
                </view>
                <view class="coupon_remark">
                    <text class="ellipsis-2 fs26" style="height: 100%;">{{q_data.coupon_remark}}</text>
                </view>
            </view>

            <block wx:if="{{q_data}}">
                <view wx:if="{{ q_data.endtype==0}}" class="lower fs30">有效期
                    <text wx:if="{{q_data.starttype==1}}"> {{filters.format_time(getcurday+3600*24*q_data.startdays)}}</text>
                    <text wx:if="{{q_data.use_start_time>0 && q_data.starttype==0}}"> {{filters.format_time(q_data.use_start_time)}}</text>至
                    <text wx:if="{{q_data.use_end_time>0}}"> {{filters.format_time(q_data.use_end_time)}}</text><text wx:else>不限</text>
                </view>
                <view wx:else class="lower fs30">有效期
                    <text wx:if="{{ q_data.starttype==1}}"> {{filters.format_time(getcurday+3600*24*q_data.startdays)}}</text>
                    <text wx:else>{{filters.format_time(getcurday)}}</text>至
                    <text wx:if="{{q_data.days>0}}"> {{filters.format_time(getcurday+3600*24*q_data.days+3600*24*q_data.startdays)}}</text><text wx:else>不限</text>
                </view>
            </block>

            <view wx:elif="{{is_get}}" class="fs28" style="text-align: center;color: #999;position: absolute;bottom: 20rpx;">
                <text wx:if="{{is_get==1}}">不存在此微券或数量已领取完</text>
                <text wx:if="{{is_get==2}}">该优惠券不是免费发放类型</text>
                <text wx:if="{{is_get==3}}">活动未开始暂时无法领取优惠券</text>
                <text wx:if="{{is_get==4}}">优惠券已过期</text>
            </view>

        </view>
    </view>

    <view wx:if="{{q_data}}" class="flex jc-center" style="margin-top: 40rpx">
        <view wx:if="{{q_data.sum_num>0 && q_data.use_sumnum>=q_data.sum_num}}" class="btn flex jc-center ai-center gray" >该券已领完</view>
        <view wx:elif="{{is_get==4}}" class="btn flex jc-center ai-center gray" >优惠券已过期</view>
        <view wx:elif="{{is_get==5}}" class="btn flex jc-center ai-center gray" >{{err_txt}}</view>
        <view wx:else class="btn flex jc-center ai-center" bindtap="get_quan">立即领取</view>
    </view>

    <view class="flex jc-center fs36" style="margin-top: 40rpx">
        <image style="margin-right: 20rpx" class="love" src="{{iurl}}/miniapp/images/coupon_img/love.png"></image>猜你喜欢
    </view>
</view>
<!-- 下部分 -->
<view class="down_part">
    <!-- 商品列表组件 -->
    <goods_recommend id="goods_list"></goods_recommend>
</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  class="q_title fs36">恭喜您获得【{{q_data.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>