<{import 
	file="header.html"
	title="优惠券" 
	describe=$row.describe
	css="public,coupon"
}> 
<div class="main_bar">
	<div class="main">
		<div class="maincon">
		<{uqcms m="goods_promote" v="data" c="coupon"}>
		<{if $data}>
			<{foreach item=i from=$data.list}>
				<div class="cbox">
					<div class="img">
						<{if $i.range == '1'}>
							<img src="<{$__IMG__}><{$i.images|img_size:100x100}>"/>
						<{else}>
							<span>全场可用</span>
						<{/if}> 
					</div>
					<div class="prbox">
						<div class="pr">
							<span>¥<{$i.price}></span>
							<i>满<{$i.full_price}>可用</i>
						</div>
						<div class="ttl">
							<span>
							<{if $i.range == '1'}>
								<a href="<{$__URI__}>goods/index.html?coupon_id=<{$i.id}>" target="_blank">部分商品可用</a>
							<{else}>
								全场可用
							<{/if}>
							</span>
						</div>
						<div class="tm">有效期至 <{$i.end_time}></div>
					</div>
					<{if $i.is_save == '1'}>
						<div class="lq lqq">
							<a href="javascript:;" data-id="<{$i.id}>">已经领取</a>
						</div>  
					<{else}>
						<div class="lq">
							<a href="javascript:;" data-id="<{$i.id}>">立即领取</a>
						</div> 
					<{/if}> 
				</div>
			<{/foreach}>
		<{/if}>
		</div>
	</div>
</div>
<{import file="footer.html"}> 
<script type="text/javascript">
$(function(){
	$(document).on('click', '.lq a', function(){
		$this = $(this);
		id = $this.attr('data-id');
		$.post("<{$__URI__}>ajax/coupon_receive", {id:id}, function(result){ 
			data = jQuery.parseJSON(result);
			if(data.error == '0'){
				$.alert('领取成功', function(){
					location.reload();
				});
			}else if(data.error == '4'){
				sys_login(function(){
					location.reload();
				});
			}else{
				$.alert(data.msg);
			}
		});
		 
	});
	 
});
</script>