{extend name="default/base" /}
{block name="title"}商品搜索 - {__block__}{/block}
{block name="meta"}
<meta name="description" content="{:WSTConf('CONF.seoShopDesc')}，商品关键字搜索">
<meta name="Keywords" content="{$keyword}">
{/block}
{block name="css"}
<link href="__STYLE__/css/swiper.min.css?v={$v}" rel="stylesheet">
<link href="__STYLE__/css/goodslist.css?v={$v}" rel="stylesheet">
{/block}
{block name="main"}
<input type="hidden" id="keyword" class="sipt" value='{$keyword}'/>
<input type="hidden" id="orderBy" class="sipt" value='{$orderBy}'/>
<input type="hidden" id="order" class="sipt" value='{php}echo ($order=="0")?"1":"0";{/php}' autocomplete="off"/>
<div class='wst-filters'>
<div class='filters'>
   <div class='item'>
      <a class='link' href='{:WSTDomain()}'>首页</a>
	  <i class="arrow">></i>
	  <a class='link' href='javascript:void(0);'>{$keyword}</a>
   </div>
   <div class='wst-clear'></div>
</div>
</div>
<div class="wst-container">
	<div class="wst-option"></div>
</div>
<div class="wst-go-container">
	{/* 商品展示  */}
	<div class="wst-container">
		<div class="wst-screen">
			<div class="choice">
				<a href="javascript:void(0);" class="term {if($orderBy==0)}active{/if}" onclick="javascript:searchOrder(0)" style="border-left:0px;padding-left:0px;">销量<i class="iconfont">{if($order==0 && $orderBy==0)}{else}{/if}</i></a>
				<a href="javascript:void(0);" class="term {if($orderBy==1)}active{/if}" onclick="javascript:searchOrder(1)">价格<i class="iconfont">{if($order==0 && $orderBy==1)}{else}{/if}</i></a>
				<a href="javascript:void(0);" class="term {if($orderBy==2)}active{/if}" onclick="javascript:searchOrder(2)">评论数<i class="iconfont">{if($order==0 && $orderBy==2)}{else}{/if}</i></a>
				<a href="javascript:void(0);" class="term {if($orderBy==3)}active{/if}" onclick="javascript:searchOrder(3)">人气<i class="iconfont">{if($order==0 && $orderBy==3)}{else}{/if}</i></a>
				<a href="javascript:void(0);" class="term {if($orderBy==4)}active{/if}" onclick="javascript:searchOrder(4)">上架时间<i class="iconfont">{if($order==0 && $orderBy==4)}{else}{/if}</i></a>
			</div>
			<div class="check">
				<input type="hidden" id="isNew" class="sipt" value="{$isNew}"/>
				<input type="hidden" id="isFreeShipping" class="sipt" value="{$isFreeShipping}"/>
				<input type="hidden" id="isStock" class="sipt" value="{$isStock}"/>
				<a href="javascript:void(0);" class="term {if ($isNew==1)}active{/if}" onclick="javascript:searchFilter(this,4)" v="isNew"><span><i class="iconfont">√</i></span>新品</a>
				<a href="javascript:void(0);" class="term {if ($isFreeShipping==1)}active{/if}" onclick="javascript:searchFilter(this,4)" v="isFreeShipping"><span><i class="iconfont">√</i></span>包邮</a>
				<a href="javascript:void(0);" class="term {if ($isStock==1)}active{/if}" onclick="javascript:searchFilter(this,4)" v="isStock"><span><i class="iconfont">√</i></span>仅显示有货商品</a>
			</div>
			<div class="price">
				<div class="wst-price-ipts">
				<span class="wst-price-ipt1">元</span><span class="wst-price-ipt2">元</span>
				<input type="text" class="sipt wst-price-ipt" id="sprice" value="{$sprice}" onkeypress='return WST.isNumberdoteKey(event);' onkeyup="javascript:WST.isChinese(this,1)">
				- <input type="text" class="sipt wst-price-ipt" id="eprice" value="{$eprice}" onkeypress='return WST.isNumberKey(event);' onkeyup="javascript:WST.isChinese(this,1)">
				</div>
				<button class="wst-price-but" type="submit" onclick='javascript:searchOrder()'>确定</button>
			</div>
		</div>
		<div class="wst-list">
			<div class="wst-goods">
				{if($goodsPage["Rows"])}
				{volist name='$goodsPage["Rows"]' id='go'}
				<div class="goods">
					<a target='_blank' href="{:url('home/goods/detail','goodsId='.$go['goodsId'])}"><img class="goodsImg2" data-original="__RESOURCE_PATH__/{:WSTImg($go['goodsImg'])}" title="{$go['goodsName']|WSTStripTags}" src="__RESOURCE_PATH__/{:WSTConf('CONF.goodsLogo')}"></a>
					<a target='_blank' href="{:url('home/goods/detail','goodsId='.$go['goodsId'])}"><p class="name">{$go['goodsName']}</p></a>
					<div style="padding: 5px 5px 5px 12px;">
					 <div class="price" >{$go['shopPrice']}元</div>
					 <a class="contrast"  href="javascript:void(0);" onclick="javascript:contrastGoods(1,{$go['goodsId']},1)"><i></i>对比</a> 
					</div>
					{if($go['favGood']>0)}
					<a href="javascript:void(0);" class="like j-fav" onclick="WST.cancelFavorite(this,0,{$go['goodsId']},{$go['favGood']},1)"><i class="iconfont"></i><span> 喜欢</span></a>
					{else}
					<a href="javascript:void(0);" class="like j-fav2" onclick="WST.addFavorite(this,0,{$go['goodsId']},{$go['goodsId']},1)"><i class="iconfont"></i><span> 喜欢</span></a>
					{/if}
					<a href="javascript:void(0);" onclick="javascript:WST.addCart({$go['goodsId']})" class="cart"><span>加入购物车 </span><i class="iconfont"></i></a>
					<div class='tags'>
					    {if($go['isNew']==1)}<span class="tag">新品</span>{/if}
						{volist name="go['tags']" id='tv'}
				        {$tv}
				      	{/volist}
					</div>	
				</div>
				{/volist}
				{else}
				<p class="empty">很抱歉，没有找到“<span>{$keyword}</span>”为关键字的商品搜索结果。</p>
				{/if}
				<div class="wst-clear"></div>
			</div>
	  		<div id="wst-pager" class="wst-pager"></div>
		</div>
	</div>
	<div class="wst-container">
		{if($goodsPage["Rows"])}
		<div class="wst-label">
			<div class="title"><span>热卖推荐</span></div>
			<div class="swiper-container goods-recom">
			    <div class="swiper-wrapper">
			    	{wst:goods type='recom' id="rec" num='20'}
				    <div class="swiper-slide">
				    	<div class="goods">
				    		<a href="{:Url("home/goods/detail","goodsId=".$rec["goodsId"])}" target="_blank"><img class='goodsImg2 goodsImg-recom' data-original="__RESOURCE_PATH__/{:WSTImg($rec['goodsImg'])}" title="{$rec['goodsName']|WSTStripTags}" src="__RESOURCE_PATH__/{:WSTConf('CONF.goodsLogo')}"></a>
				    		<a href="{:Url("home/goods/detail","goodsId=".$rec["goodsId"])}" target="_blank"><p class="name">{$rec['goodsName']}</p></a>
				    		<p class="price">{$rec['shopPrice']}元</p>
				    		<p class="deal">{$rec['saleNum']}人购买</p>
				    	</div>
				    </div>
				    {/wst:goods}
			    </div>
			    <div class="swiper-pagination paging"></div>
			</div>
		</div>
		{else}
		<div class="wst-label">
			<div class="title"><span>为您推荐</span></div>
			<div class="swiper-container goods-recom">
			    <div class="swiper-wrapper">
			    	{wst:goods type='best' id="bes" num='20'}
				    <div class="swiper-slide">
				    	<div class="goods">
				    		<a href="{:Url("home/goods/detail","goodsId=".$bes["goodsId"])}" target="_blank"><img class='goodsImg2 goodsImg-recom' data-original="__RESOURCE_PATH__/{:WSTImg($bes['goodsImg'])}"  title="{$bes['goodsName']|WSTStripTags}"></a>
				    		<a href="{:Url("home/goods/detail","goodsId=".$bes["goodsId"])}" target="_blank"><p class="name">{$bes['goodsName']}</p></a>
				    		<p class="price">{$bes['shopPrice']}元</p>
				    		<p class="deal">{$bes['saleNum']}人购买</p>
				    	</div>
				    </div>
				    {/wst:goods}
			    </div>
			    <div class="swiper-pagination paging"></div>
			</div>
		</div>
		{/if}
		{if cookie("history_goods")!=''}
		<div class="wst-label">
			<div class="title"><span>最近浏览的商品</span></div>
			<div class="swiper-container goods-recom">
			    <div class="swiper-wrapper">
			    	{wst:goods type='history' id="his" num='20'}
				    <div class="swiper-slide">
				    	<div class="goods">
				    		<a href="{:Url("home/goods/detail","goodsId=".$his["goodsId"])}" target="_blank"><img class='goodsImg2 goodsImg-recom' data-original="__RESOURCE_PATH__/{:WSTImg($his['goodsImg'])}"  title="{$his['goodsName']|WSTStripTags}"></a>
				    		<a href="{:Url("home/goods/detail","goodsId=".$his["goodsId"])}" target="_blank"><p class="name">{$his['goodsName']}</p></a>
				    		<p class="price">{$his['shopPrice']}元</p>
				    		<p class="deal">{$his['saleNum']}人购买</p>
				    	</div>
				    </div>
				    {/wst:goods}
			    </div>
			    <div class="swiper-pagination paging"></div>
			</div>
		</div>
		{/if}
	</div>
</div>
{/* 对比框 */}
<div class="wst-cont-frame" id="j-cont-frame">
	<div class="head"><span>对比栏</span><a href="javascript:void(0);" class="close" onclick="javascript:contrastGoods(0,0,0)">关闭</a></div>
	<div class="list">
		<div class="goods" id="contrastList"></div>
		<div class="term-contrast">
			<p><a class="contrast" href="{:Url('home/goods/contrast')}" target="_blank">对比</a></p>
			<p><a href="javascript:void(0);" onclick="javascript:contrastDels(0)" class="empty">清空</a></p>
		</div>
	</div>
	<script id="colist" type="text/html">
		{{# if(d.data && d.data.length>0){ }}
		{{# for(var i=0; i<d.data.length; i++){ }}
		<div class="term">
			<div class="img"><a href="{{WST.U('home/goods/detail','goodsId='+d.data[i].goodsId)}}" target="_blank"><img class="contImg" data-original="__RESOURCE_PATH__/{{ d.data[i].goodsImg }}" title="{{ d.data[i].goodsName }}" width="50" height="50"></a></div>
			<div class="info"><a href="{{WST.U('home/goods/detail','goodsId='+d.data[i].goodsId)}}" target="_blank"><p class="name">{{ d.data[i].goodsName }}</p></a><p class="price"><span>￥{{ d.data[i].shopPrice }}</span><a href="javascript:contrastDels({{ d.data[i].goodsId }});" >删除</a></p></div>
		</div>
		{{# } }}
		{{# } }}
		{{# var data = (d.data)?d.data.length:0 }}
		{{# for(var i=data+1; i<5; i++){ }}
		<div class="term-empty">
			<div class="img">{{ i }}</div>
			<div class="info"><p>您还可以继续添加</p></div>
		</div>
		{{# } }}
    </script>
</div>
{/block}
{block name="js"}
<script type='text/javascript' src='__STYLE__/js/swiper.jquery.min.js?v={$v}'></script>
<script type='text/javascript' src='__STYLE__/js/goodslist.js?v={$v}'></script>
{if !empty($goodsPage["Rows"])}
<script type='text/javascript'>
$(function(){
	{if !isset($areaInfo)}
	$('#fl_1_1').click();
	{/if}
	contrastGoods(1,0,2);
	swiperGoods('recom');
})
laypage({
    cont: 'wst-pager',
    pages: {$goodsPage["TotalPage"]}, //总页数
    skin: '#757575',
    prev: '', //若不显示，设置false即可
    next: '', //若不显示，设置false即可
    groups: 3, //连续显示分页数
    curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
        var page = location.search.match(/page=(\d+)/);
        return page ? page[1] : 1;
    }(), 
    jump: function(e, first){ //触发分页后的回调
        if(!first){ //一定要加此判断，否则初始时会无限刷新
        	var nuewurl = WST.splitURL("page");
        	var ulist = nuewurl.split("?");
        	if(ulist.length>1){
        		location.href = nuewurl+'&page='+e.curr;
        	}else{
        		location.href = '?page='+e.curr;
        	}
            
        }
    }
});
</script>
{/if}
{/block}
