<{import file="index/header.html" title="商品收藏"}>  
<style type="text/css">
.lbox{ padding-top:30px; float:left;}
.lcon{ width:1030px; float:left; }
.cgbox{ width:215px; height:215px; position: relative; border:1px solid #efefef; padding:25px 10px; margin:0 10px 15px 10px; float:left;}
.cgbox:hover{ border:1px solid #ddd; }
.cgbox .img{ width:215px; height:160px; text-align:center; overflow:hidden; float:left; }
.cgbox .img img{ width:160px;}
.cgbox .ttl{ width:200px; height:20px; overflow:hidden; padding:10px 10px 0 10px; float:left;}
.cgbox .ttl a{ line-height:20px; color:#333; }
.cgbox .pr{ width:205px; padding:5px 0 0 5px; text-align:center; float:left;}
.cgbox .pr span{ padding:0 10px 0 0; color:#f00; font-family: Verdana; font-size:16px; }
.cgbox .pr s{ margin-top:3px; color:#999; float:left; }
.cgbox .cancel{ width:236px; display:none; position:absolute; top:0; right:0; padding:0 0 0 5px; float:left;}
.cgbox .cancel a{ padding:2px 12px; background:#666; border:1px solid #666; color:#fff; float:right; } 
.cgbox:hover .cancel{ display:block; }
</style> 
<{include file="collect/tab.html"}> 
<div class="lbox">
	<{uqcms m="goods" v="data" c="collect:page=smarty.get.page&page_size=32"}>
	<{if $data.list}>
		<div class="lcon"> 
			<{foreach item=i from=$data.list}>	
				<div class="cgbox">
					<div class="img"><a href="index.php?m=goods&a=detail&id=<{$i.gid}>" target="_blank"><img src="<{$__IMG__}><{$i.images|img_size:160x160}>"></a></div>
					<div class="ttl"><a href="index.php?m=goods&a=detail&id=<{$i.gid}>" target="_blank"><{$i.title}></a></div>
					<div class="pr"><span>￥<{$i.price}></span></div>
					<div class="cancel"><a href="javascript:;" class="collect_goods" data-gid="<{$i.gid}>">取消收藏</a></div> 
				</div>
			<{/foreach}>
		</div>
		<{if $data.page}><div class="page" style="text-align:center;"><{$data.page}></div><{/if}>
	<{else}>	
		<div class="bfb">
			<div class="nomsg"><i></i><span>您还没有收藏产品~</span></div>
		</div>
	<{/if}>
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript">
$(function(){ 
	$(".collect_goods").click(function(){
		$this = $(this);
		gid = $this.attr('data-gid');
		$.post("index.php?m=ajax&a=collect_goods",{gid:gid},function(result){  
			var data = jQuery.parseJSON(result);  
			if(data.error == '0'){
				if(data.status == '2'){ 
					location.reload();
				}else if(data.status == '1'){ 
					$this.html('已经收藏');
				}else if(data.status == '0'){
					$this.html('收藏产品');
				}
			}else{
				alert(data.msg);
			} 
		}); 
	}); 
});
</script>