{extend name="default/base/base_home" /}
{block name="mall_main"}


<script src="{$Think.HOME_SITE_ROOT}/js/search_goods.js"></script>
<div class="dsh-container wrapper" >
  <div class="left">
    {notempty name="goods_class_array"}
    <div class="dsh-module dsh-module-style02">
      <div class="title">
        <h3>{$Think.lang.category_filtering}</h3>
      </div>
      <div class="content">
        <ul id="files" class="tree">
          {foreach name="goods_class_array" item="value"}
          <li><i class="tree-parent tree-parent-collapsed"></i><a href="{:url('Search/index',['cate_id'=>$value.gc_id,'keyword'=>$Request.param.keyword])}" {if condition="$value.gc_id eq $Request.param.cate_id"}class="selected"{/if}>{$value.gc_name}</a>
            {notempty name="$value.class2"}
            <ul>
              {foreach name="$value.class2" item="val"}
              <li><i class="tree-parent tree-parent-collapsed"></i><a href="{:url('Search/index',['cate_id'=>$val.gc_id,'keyword'=>$Request.param.keyword])}" {if condition="$val.gc_id eq $Request.param.cate_id"}class="selected"{/if}>{$val.gc_name}</a>
                {notempty name="$val.class3"}
                <ul>
                  {foreach name="$val.class3" item="v"}
                  <li class="tree-parent tree-parent-collapsed"><i></i><a href="{:url('Search/index',['cate_id'=>$v.gc_id,'keyword'=>$Request.param.keyword])}" {if condition="$v.gc_id eq $Request.param.cate_id"}class="selected"{/if}>{$v.gc_name}</a></li>
                  {/foreach}
                </ul>
                {/notempty}
              </li>
              {/foreach}
            </ul>
            {/notempty}
          </li>
          {/foreach}
        </ul>
      </div>
    </div>
    {/notempty}
    <!-- S 推荐展位 -->
    <div dstype="booth_goods" class="dsh-module" style="display:none;"> </div>
    <!-- F 同类排行 -->
    <div stype="listhot_goods" style="display:none;"></div>
    <!-- E 推荐展位 -->
    <!-- 最近浏览 -->
    <div class="dsh-module dsh-module-style03">
      <div class="title">
        <h3>{$Think.lang.goods_class_viewed_goods}</h3>
      </div>
      <div class="content">
        <div class="dsh-sidebar-viewed" id="dshSidebarViewed">
          <ul>
            {notempty name="viewed_goods"}
            {foreach name="viewed_goods" item="v" key="k" }
            <li class="dsh-sidebar-bowers">
              <div class="goods-pic"><a href="{:url('Goods/index',['goods_id'=>$v.goods_id])}" target="_blank"><img  class="lazyload" data-original="{:goods_thumb($v, 240);}" title="{$v.goods_name}" alt="{$v.goods_name}" ></a></div>
              <dl>
                <dt><a href="{:url('Goods/index',['goods_id'=>$v.goods_id])}" target="_blank">{$v.goods_name}</a></dt>
                <dd>{$Think.lang.currency}{$v.goods_promotion_price}</dd>
              </dl>
            </li>
            {/foreach}
            {/notempty}
          </ul>
        </div>
        <a href="{:url('Membergoodsbrowse/listinfo')}" class="dsh-sidebar-all-viewed">{$Think.lang.full_browsing_history}</a></div>
    </div>

  </div>
  <div class="right">
    <div id="gc_goods_recommend_div" style="width:980px;"></div>
    <?php if(!isset($goods_class_array['child']) && empty($goods_class_array['child']) && !empty($goods_class_array)){?>
    <?php $dl=1;  //dl标记?>
    <?php if((!empty($brand_array) && is_array($brand_array)) || (!empty($attr_array) && is_array($attr_array))){?>
    <div class="dsh-module dsh-module-style01">
      <div class="title">
        <h3>
          {notempty name="show_keyword"}
          <em>{$show_keyword}</em> -
          {/notempty}
          {$Think.lang.product_screening}</h3>
      </div>
      <div class="content">
        <div class="dsh-module-filter">
            {if (isset($checked_brand) && is_array($checked_brand)) || (isset($checked_attr) && is_array($checked_attr))}
            <dl ds_type="ul_filter">
                <dt>{$Think.lang.goods_class_index_selected}{$Think.lang.ds_colon}</dt>
                <dd class="list">
                    {notempty name="checked_brand"}
                    {foreach name="checked_brand" item="val" key="key" }
                    <span class="selected" dstype="span_filter">{$Think.lang.goods_class_index_brand}:<em>{$val.brand_name}</em><i data-uri="{:removeParam(array('b_id' => $key))}">X</i></span>
                    {/foreach}
                    {/notempty}
                    {notempty name="checked_attr"}
                    {foreach name="checked_attr" item="val"}
                    <span class="selected" dstype="span_filter">{$val.attr_name}:<em>{$val.attrvalue_name}</em><i data-uri="{:removeParam(array('a_id' => $val['attrvalue_id']))}">X</i></span>
                    {/foreach}
                    {/notempty}
                </dd>
            </dl>
            {/if}
          {notempty name="brand_array"}
          <dl>
              <dt>{$Think.lang.goods_class_index_brand}{$Think.lang.ds_colon}</dt>
              <dd class="list">
                  <ul class="dsh-brand-tab" dstype="ul_initial" style="display:none;">
                      <li data-initial="all"><a href="javascript:void(0);">{$Think.lang.all_brands}<i class="arrow"></i></a></li>
                      {notempty name="initial_array"}
                      {foreach name="initial_array" item="val" }
                      <li data-initial="{$val}"><a href="javascript:void(0);">{$val}<i class="arrow"></i></a></li>
                      {/foreach}
                      {/notempty}
                  </ul>
                  <div id="dsBrandlist">
                      <ul class="dsh-brand-con" dstype="ul_brand">
                          {php}$i = 0;{/php}
                          {foreach name="brand_array" item="v" key="k" }
                          {php}$i++;{/php}
                          <li data-initial="{$v.brand_initial}" {if $i > 14}style="display:none;"{/if}>
                              <a href="{:replaceParam(array('b_id' => $k))}">
                                  {if $v.brand_showtype == 0}
                                  <img  class="lazyload" data-original="{:brand_image($v['brand_pic'])}" alt="{$v.brand_name}" /> <span>{$v.brand_name}</span>
                                  {else/}
                                  {$v.brand_name}
                                  {/if}
                              </a>
                          </li>
                          {/foreach}
                      </ul>
                  </div>
              </dd>
              {if count($brand_array) > 16}
              <dd class="all"><span dstype="brand_show"><i class="iconfont">&#xe689;</i>{$Think.lang.goods_class_index_more}</span></dd>
              {/if}
          </dl>
          {php}$dl++;{/php}
          {/notempty}
          {notempty name="attr_array"}
          {php}$j = 0;{/php}
          {foreach name="attr_array" item="val" key="key" }
          {php}$j++;{/php}
          {if !isset($checked_attr[$key]) && !empty($val['value']) && is_array($val['value'])}
          <dl>
            <dt>{$val.name}{$Think.lang.ds_colon}</dt>
            <dd class="list">
              <ul>
                {php}$i = 0;{/php}
                {foreach name="$val.value" item="v" key="k" }
                {php}$i++;{/php}
                <li {if $i>10}style="display:none" ds_type="none"{/if}><a href="<?php $a_id = ((input('param.a_id')!= '' && input('param.a_id')!= 0)?input('param.a_id').'_'.$k:$k); echo replaceParam(array('a_id' => $a_id));?>">{$v.attrvalue_name}</a></li>
                {/foreach}
              </ul>
            </dd>
            {if count($val['value']) > 10}
            <dd class="all"><span ds_type="show"><i class="iconfont">&#xe689;</i>{$Think.lang.goods_class_index_more}</span></dd>
            {/if}
          </dl>
          {/if}
          {php}$dl++;{/php}
          {/foreach}
          {/notempty}
        </div>
      </div>
    </div>
    <?php } ?>
    <div class="shop_con_list" id="main-nav-holder">
      <nav class="sort-bar" id="main-nav">
        <div class="pagination"></div>
        <div class="dsh-sortbar-array"> {$Think.lang.sort}：
          <ul>
            <li {if $Request.param.key eq '0'}class="selected"{/if}><a href="{:dropParam(array('order', 'key'))}"  title="{$Think.lang.goods_class_index_default_sort}">{$Think.lang.goods_class_index_default}</a></li>
            <li {if $Request.param.key eq '1'}class="selected"{/if}><a href="{if $Request.param.order=='2' && $Request.param.key=='1'}{:replaceParam(array('key' => '1', 'order' => '1'))}{else/}{:replaceParam(array('key' => '1', 'order' => '2'))}{/if}" {if $Request.param.key=='1'}class="{if $Request.param.order==1}asc{else/}desc{/if}"{/if} >{$Think.lang.goods_class_index_sold}<i></i></a></li>
            <li {if $Request.param.key eq '2'}class="selected"{/if}><a href="{if $Request.param.order=='2' && $Request.param.key=='2'}{:replaceParam(array('key' => '2', 'order' => '1'))}{else/}{:replaceParam(array('key' => '2', 'order' => '2'))}{/if}" {if $Request.param.key=='2'}class="{if $Request.param.order==1}asc{else/}desc{/if}"{/if} >{$Think.lang.goods_class_index_click}<i></i></a></li>
            <li {if $Request.param.key eq '3'}class="selected"{/if}><a href="{if $Request.param.order=='2' && $Request.param.key=='3'}{:replaceParam(array('key' => '3', 'order' => '1'))}{else/}{:replaceParam(array('key' => '3', 'order' => '2'))}{/if}" {if $Request.param.key=='3'}class="{if $Request.param.order==1}asc{else/}desc{/if}"{/if} >{$Think.lang.goods_class_index_price}<i></i></a></li>
            <li><div><input id="priceMin" title={$Think.lang.lowest_price} value="{$Request.param.priceMin}" maxlength="6" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');" class="input-txt"><em>-</em><input id="priceMax" title={$Think.lang.highest_price} value="{$Request.param.priceMax}" maxlength="6" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');" class="input-txt"><a id="priceBtn" class="priceBtn">{$Think.lang.ds_ok}</a></div></li>
          </ul>
        </div>
        <div class="dsh-sortbar-owner"><span><a href="{if $Request.param.type == '1'}{:dropParam(array('type'))}{else/}{:replaceParam(array('type' => '1'))}{/if}" {if $Request.param.type == '1'}class="selected"{/if}><i></i>{$Think.lang.platform_proprietary}</a></span></div>
        <div class="dsh-sortbar-owner"><span><a href="{if $Request.param.gift == '1'}{:dropParam(array('gift'))}{else/}{:replaceParam(array('gift' => '1'))}{/if}" {if $Request.param.gift == '1'}class="selected"{/if}><i></i>{$Think.lang.complimentary}</a></span></div>
        <div class="dsh-sortbar-location">{$Think.lang.location_goods}：
          <span class="area-wrapper">
            <input type="hidden" id="goods_area" value="{$Request.param.area_id}" />
            <input type="hidden" id="_area" />
            <input onclick="change_area()" type="button" class="input-btn" value="{$Think.lang.ds_ok}" />
          </span>
        </div>
      </nav>
      <!-- 商品列表循环  -->

      <div>
          
          {include file="default/base/home/goods_squares" /}
        
      </div>
      <div class="tc mt20 mb20">
        <div class="pagination">{$show_page|raw}</div>
      </div>
    </div>

    <!-- 猜你喜欢 -->
    <div id="guesslike_div" style="width:980px;"></div>
  </div>
  <div class="clear"></div>
</div>
<script src="{$Think.HOME_SITE_ROOT}/js/waypoints.js"></script>
<script src="{$Think.HOME_SITE_ROOT}/js/search_category_menu.js"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/jquery.query.js" charset="utf-8"></script>
<script type="text/javascript">
var defaultSmallGoodsImage = '{:ds_get_pic(ATTACH_COMMON,$Think.config.ds_config.default_goods_image)}';
var defaultTinyGoodsImage = '{:ds_get_pic(ATTACH_COMMON,$Think.config.ds_config.default_goods_image)}';
function change_area(){
  if($.query.get('area_id')!=$('#_area').val()){
    location.assign($.query.set('area_id', $('#_area').val()));
  }
}
$(function(){
    $('#goods_area').ds_region();
    $('#files').tree({
        expanded: 'li:lt(2)'
    });
	//品牌索引过长滚条
    $('#dsBrandlist').perfectScrollbar({suppressScrollX:true});
    //浮动导航  waypoints.js
    $('#main-nav-holder').waypoint(function(event, direction) {
        $(this).parent().toggleClass('sticky', direction === "down");
        event.stopPropagation();
    });
	// 单行显示更多
	$('span[ds_type="show"]').click(function(){
		s = $(this).parents('dd').prev().find('li[ds_type="none"]');
		if(s.css('display') == 'none'){
			s.show();
			$(this).html('<i class="iconfont">&#xe688;</i>{$Think.lang.goods_class_index_retract}');
		}else{
			s.hide();
			$(this).html('<i class="iconfont">&#xe689;</i>{$Think.lang.goods_class_index_more}');
		}
	});



        {if $Request.param.cate_id > 0}
    $('div[dstype="booth_goods"]').load("{:url('Search/get_booth_goods',['cate_id'=>$Request.param.cate_id])}", function(){
        $(this).show();
    });
	{/if}
        {if $Request.param.cate_id > 0}

    $('div[id="gc_goods_recommend_div"]').load("{:url('Search/get_hot_goods',['cate_id'=>$Request.param.cate_id])}", function(){
        $(this).show();
    });
	{/if}
	//浏览历史处滚条
	$('#dshSidebarViewed').perfectScrollbar({suppressScrollX:true});

	//猜你喜欢
	$('#guesslike_div').load("{:url('Search/get_guesslike')}", function(){
        $(this).show();
    });
    $('#priceBtn').click(function(){
        var priceMin = $('#priceMin').val();
        var priceMax = $('#priceMax').val();
        location.assign($.query.set('priceMin', priceMin).set('priceMax', priceMax));
    });
});
</script>






{/block}
