{wc:templates "index","header"}
<link rel="stylesheet" type="text/css" href="{G_TEMPLATES_STYLE}/css/GoodsList.css"/>
<link rel="stylesheet" type="text/css" href="{G_TEMPLATES_STYLE}/css/header.css"/>
<script>
function showh(){
var height=$("#ddBrandList_brand").innerHeight();	
	if(height==78){
		$("#ddBrandList_brand").css("height","auto");
		$(".list_classMore").addClass("MoreClick");
		$(".list_classMore").html("收起<i></i>");
	}else{
		$("#ddBrandList_brand").css("height","78px");
		$(".list_classMore").removeClass("MoreClick");
		$(".list_classMore").html("展开<i></i>");
	};
}
$(function(){	
	$(".list_classMore").click(showh);
});
</script>
<div class="wrap" id="loadingPicBlock">
	<div class="Current_nav"><a href="{WEB_PATH}">首页</a> &gt; {wc:$daohang_title}</div>
	<div id="current" class="list_Curtit">
		<h1 class="fl">{wc:$daohang_title}</h1>
		<span id="spTotalCount">(共<em class="orange">{wc:$total}</em>件相关商品)</span>
	</div>	
	{wc:php:start}
		if($cid){
			$two_cate_list = $this->db->GetList("select cateid,parentid,name from `@#_category` where `parentid` = '$cid' order by `order` DESC");
			if(!$two_cate_list && $daohang['parentid'])
			$two_cate_list = $this->db->GetList("select cateid,parentid,name from `@#_category` where `parentid` = '$daohang[parentid]' order by `order` DESC");
		}else{
			$two_cate_list = $this->db->GetList("select cateid,parentid,name from `@#_category` where `model` = '1' and `parentid` = '0' order by `order` DESC");
		}
	{wc:php:end}
	{wc:if !empty($two_cate_list)}
	<div class="list_class">
	<dl>
		<dt>分类</dt>
		<dd id="ddBrandList">
			<ul>            
				{wc:if isset($daohang['parentid'])}
				<li><a href="{WEB_PATH}/goods_list/{wc:$daohang['parentid']}_0_0">全部</a></li>
                {wc:else}
                <li><a href="{WEB_PATH}/goods_list/{wc:$cid}_0_0" class="ClassCur" >全部</a></li>
                {wc:if:end}
		
				{wc:loop $two_cate_list $two_cate}
					{wc:if $cid == $two_cate['cateid']}
					<li><a href="{WEB_PATH}/goods_list/{wc:$two_cate['cateid']}_0_0" class="ClassCur">{wc:$two_cate['name']}</a></li>
					{wc:else}
					<li><a href="{WEB_PATH}/goods_list/{wc:$two_cate['cateid']}_0_0">{wc:$two_cate['name']}</a></li>
					{wc:if:end}
				{wc:loop:end}
			</ul>
		</dd>
	</dl>
	</div>	
	{wc:if:end}
	
	<div class="list_class">
	<dl>
		<dt>品牌</dt>
		{wc:if count($brand)>17}
		<dd id="ddBrandList_brand" style="height:78px">
		{wc:else}
		<dd id="ddBrandList_brand">
		{wc:if:end}
			<ul>
            	{wc:if !$bid}
				<li><a href="{WEB_PATH}/goods_list/{wc:$cid}_0_{wc:$order}" class="ClassCur" >全部</a></li> 
                {wc:else}
                <li><a href="{WEB_PATH}/goods_list/{wc:$cid}_0_{wc:$order}">全部</a></li>
                {wc:if:end}				
				{wc:loop $brand $brands}             
				{wc:if $brands['id'] == $bid}
				<li><a class="ClassCur" href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$brands['id']}_{wc:$order}">{wc:$brands['name']}</a></li>   
				{wc:else}
				<li><a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$brands['id']}_{wc:$order}">{wc:$brands['name']}</a></li>   
				{wc:if:end}
				{wc:loop:end}
			</ul>
		</dd>
	</dl>

	{wc:if count($brand)>17}	
	<a class="list_classMore" href="javascript:;">展开<i></i></a>
	{wc:if:end}	
	</div>
	    <div class="list_Sort">
		    <dl>
			    <dt>排序</dt>
			    <dd>
                <a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_1" {wc:if $order=='1'}class="SortCur"{wc:if:end}>即将揭晓</a>
                <a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_2" {wc:if $order=='2'}class="SortCur"{wc:if:end}>人气</a>
                <a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_3" {wc:if $order=='3'}class="SortCur"{wc:if:end}>剩余人次</a>
                <a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_4" {wc:if $order=='4'}class="SortCur"{wc:if:end}>最新</a>
                {wc:if $order=='5'}
                <a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_6" class="Price_Sort SortCur">价格 <i></i></a>
                {wc:else}
                    {wc:if $order=='6'}
                   		<a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_5" class="Price_Sort SortCur">价格 <s></s></a>
                    {wc:else}
                    	<a href="{WEB_PATH}/goods_list/{wc:$cid}_{wc:$bid}_5" class="Price_Sort">价格 <s></s></a>
                    {wc:if:end}
                {wc:if:end}
                </dd>
		    </dl>
	    </div>
	
	{wc:if $shoplist}
	<!--商品列表-->
	<div class="listContent">
		<ul class="item" id="ulGoodsList">		
			{wc:loop $shoplist $shop}
			<li class="goods-iten" >
				<div class="pic">
					<a href="{WEB_PATH}/goods/{wc:$shop['id']}" target="_blank" title="{wc:$shop['title']} ">
                    	<!--补丁3.1.5_b.0.1-->                    	 
                    	{wc:php:start}$i_googd_bj = null;{wc:php:end}        
                        <!--补丁3.1.5_b.0.1-->        
						{wc:if ($this_time - $shop['time']) < 86400}						
								{wc:php:start}$i_googd_bj = '<i class="goods_xp"></i>';{wc:php:end}					
						{wc:if:end}
                        {wc:if $shop['pos']!='0' && !isset($i_googd_bj)}						
                       	 	{wc:php:start}$i_googd_bj = '<i class="goods_tj"></i>';{wc:php:end}	
						{wc:if:end}
						{wc:if $shop['renqi']=='1' && !isset($i_googd_bj)}						
                                {wc:php:start}$i_googd_bj = '<i class="goods_rq"></i>';{wc:php:end}				
						{wc:if:end}					
                        {wc:$i_googd_bj}                     	
						<img alt="{wc:$shop['title']}" src="{G_UPLOAD_PATH}/{wc:$shop['thumb']}">
					</a>
					<p name="buyCount" style="display:none;"></p>
				</div>
				<p class="name">
					<a href="{WEB_PATH}/goods/{wc:$shop['id']}" target="_blank" title="{wc:$shop['title']} ">{wc:$shop['title']}</a>
				</p>
				<p class="money">价值：<span class="rmbgray">{wc:$shop['money']}</span></p>
				<div class="Progress-bar">
					<p title="已完成{wc:fun:percent($shop['canyurenshu'],$shop['zongrenshu'])}"><span style="width:{wc:fun:width($shop['canyurenshu'],$shop['zongrenshu'],213)}px;"></span></p>
					<ul class="Pro-bar-li">
						<li class="P-bar01"><em>{wc:$shop['canyurenshu']}</em>已参与人次</li>
						<li class="P-bar02"><em>{wc:$shop['zongrenshu']}</em>总需人次</li>
						<li class="P-bar03"><em>{wc:$shop['zongrenshu']-$shop['canyurenshu']}</em>剩余人次</li>
					</ul>
				</div>
				<div class="gl_buybtn">
					<div class="go_buy">
						<a href="javascript:;" title="立即购买" class="go_Shopping fl">立即{wc:fun:_cfg('web_name_two')}</a>
						<a href="javascript:;" title="加入购物车" class="go_cart fr">加入购物车</a>
					</div>
				</div>
				
				<div class="Curbor_id" style="display:none;">{wc:$shop['id']}</div>
				<div class="Curbor_yunjiage" style="display:none;">{wc:$shop['yunjiage']}</div>
				<div class="Curbor_shenyu" style="display:none;">{wc:$shop['shenyurenshu']}</div>
			</li>
			{wc:loop:end}
		</ul>
	{wc:if $total>$num}
	<div class="pagesx">{wc:page:two}</div>
	{wc:if:end}
	</div>
	<!--商品列表完-->
	{wc:else}
	<!--未找到商品-->
	<div class="NoConMsg"><span>无相关商品记录哦~！</span></div>
	<!--未找到商品-->
	{wc:if:end}
	
</div>
<script type="text/javascript">

$(function(){
	$("#ulGoodsList li a.go_cart").click(function(){ 
		var sw = $("#ulGoodsList li a.go_cart").index(this);
		var src = $("#ulGoodsList li .pic a img").eq(sw).attr('src');				
		var $shadow = $('<img id="cart_dh" style="display:none; border:1px solid #aaa; z-index:99999;" width="200" height="200" src="'+src+'" />').prependTo("body");  			
		var $img = $("#ulGoodsList li .pic").eq(sw);
		$shadow.css({ 
			'width' : 200, 
			'height': 200, 
			'position' : 'absolute',      
			"left":$img.offset().left+16, 
			"top":$img.offset().top+9,
			'opacity' : 1    
		}).show();
		var $cart = $("#btnMyCart");
		$shadow.animate({   
			width: 1, 
			height: 1, 
			top: $cart.offset().top,    
			left: $cart.offset().left, 
			opacity: 0
		},500,function(){
			Cartcookie(sw,false);
		});	
		
	});
	$("#ulGoodsList li a.go_Shopping").click(function(){	
		var sw = $("#ulGoodsList li a.go_Shopping").index(this);

		Cartcookie(sw,true); 
	});	
});
//存到COOKIE
function Cartcookie(sw,cook){
	var shopid = $(".Curbor_id").eq(sw).text(),
		shenyu = $(".Curbor_yunjiage").eq(sw).text(),
		money = $(".Curbor_shenyu").eq(sw).text();
	var Cartlist = $.cookie('Cartlist');
	if(!Cartlist){
		var info = {};
	}else{
		var info = $.evalJSON(Cartlist);
	}
	if(!info[shopid]){
		var CartTotal=$("#sCartTotal").text();
			$("#sCartTotal").text(parseInt(CartTotal)+1);
			$("#btnMyCart em").text(parseInt(CartTotal)+1);
	}	
	info[shopid]={};
	info[shopid]['num']=1;
	info[shopid]['shenyu']=shenyu;
	info[shopid]['money']=money;
	info['MoenyCount']='0.00';
	$.cookie('Cartlist',$.toJSON(info),{expires:30,path:'/'});
	if(cook){
		window.location.href="{WEB_PATH}/member/cart/cartlist";
	}
}  

</script>
{wc:templates "index","footer"}