<!-- 焦点图和选项卡插件 -->
<script src="{theme:javascript/FengFocus.js}"></script>
<script src="{theme:javascript/FengTab.js}"></script>
<script src="{theme:javascript/jquery.marquee.js}"></script>
<div class="all_background">
<!-- 焦点图 -->
<section id="home_fouse" class="home_fouse">
	{if:$this->index_slide}
	<ul>
		{foreach:items=$this->index_slide}
		<li><a href="{url:$item[url]}"><img src="{url:/pic/thumb/img/$item['img']}"></a></li>
		{/foreach}
	</ul>
	{/if}
</section>
<!-- 首页焦点图下广告 -->
<section class="home_focus_show">
	<div class="show">{echo:Ad::show("首页焦点图下广告1_292*184(suning)")}</div>
	<div class="show">{echo:Ad::show("首页焦点图下广告1_292*184(suning)")}</div>
	<div class="show">{echo:Ad::show("首页焦点图下广告2_292*184(suning)")}</div>
	<div class="show">{echo:Ad::show("首页焦点图下广告3_292*184(suning)")}</div>
</section>

<div class="container">
	<!-- 放心去喜欢 -->
	<div class="rest_assured">
		<h3>放心去喜欢</h3>
		<!--热卖商品-->
		<div class="index_card_container">
		{foreach:items=Api::run('getCommendHot',8)}
			<a href="{url:/site/products/id/$item['id']}">
				<img src="{url:/pic/thumb/img/$item[img]/w/120/h/120}" alt="{$item['name']}" />
				<p class="pro_title">{$item['name']}</p>
				<p class="brown">￥{$item['sell_price']}</p>
			</a>
		{/foreach}
		</div>
		<!--热卖商品-->
		<div class="feature">
			<div class="feature_content">
				<h4><a href="{url:/site/notice}">商城公告</a></h4>
				{foreach:items=Api::run('getAnnouncementList', 6)}
				<a href="{url:/site/notice_detail/id/$item['id']}">{$item['title']}</a>
				{/foreach}
			</div>
			<div class="feature_content">
				<h4><a href="{url:/site/article}">新闻动态</a></h4>
				{foreach:items=Api::run('getArtList', 6)}
				<a href="{url:/site/notice_detail/id/$item['id']}">{$item['title']}</a>
				{/foreach}
			</div>
		</div>
	</div>
	<!-- 模块展示 -->
	<div class="module">
		<!--团购-->
		<div class="index_card">
			<h4>团购</h4>
			<div class="index_card_container">
			{foreach:items=Api::run('getRegimentList', 6)}
				<a href="{url:/site/groupon/id/$item['id']}">
					<img alt="{$item['title']}" src="{webroot:$item[img]}" />
					<p class="pro_title">{$item['title']}</p>
					<p class="brown">团购价：<em>￥{$item['regiment_price']}</em></p>
				</a>
			{/foreach}
			</div>
		</div>
		<!--团购-->
		<!--限时抢购-->
		<div class="index_card">
			<h4>限时抢购<small>抢到就是赚到</small></h4>
			<div class="index_card_container">
			{foreach:items=Api::run('getPromotionList', 5)}
			{set:$free_time = ITime::getDiffSec($item['end_time'])}
			{set:$countNumsItem[] = $item['p_id'];}
				<a href="{url:/site/products/id/$item['goods_id']/promo/time/active_id/$item['p_id']}">
					<img alt="{$item['name']}" src="{url:/pic/thumb/img/$item[img]/w/70/h/70}" />
					<p class="pro_title">{$item['name']}</p>
					<p class="brown">抢购价：<em>￥{$item['award_value']}</em></p>
					<p class="countdown"><b id='cd_hour_{$item['p_id']}'>{echo:floor($free_time/3600);}</b>时<b id='cd_minute_{$item['p_id']}'>{echo:floor(($free_time%3600)/60);}</b>分<b id='cd_second_{$item['p_id']}'>{echo:$free_time%60;}</b>秒</p>
				</a>
			{/foreach}
			</div>
		</div>
		<!--限时抢购-->
		<!--特价商品-->
		<div class="index_card">
			<h4>特价商品
				<!-- <a href="" class="more">更多>></a> -->
				<small>每日有爆品 特价又超值！</small>
			</h4>
			<div class="index_card_container">
				{foreach:items=Api::run('getCommendPrice', 6)}
				<a href="{url:/site/products/id/$item['id']}">
					<img src="{url:/pic/thumb/img/$item['img']/w/70/h/70}">
					<p class="pro_title">{$item['name']}</p>
					<p class="brown"><em>￥{$item['sell_price']}</em></p>
					<del>￥{$item['market_price']}</del>
				</a>
				{/foreach}
			</div>
		</div>
		<!--特价商品-->
	</div>
</div>

<!-- 推荐列表 -->
<section class="home_rec">
	<header>
		<h3>为您推荐</h3>
		<div class="control">
			<i id="home_rec_left" class="icon-angle-left"></i>
			<i id="home_rec_right" class="icon-angle-right"></i>
		</div>
	</header>
	<div id="home_rec" class="con">
		<ul>
			{foreach:items=Api::run('getCommendRecom',10)}
			<li>
				<a href="{url:/site/products/id/$item['id']}">
					<img src="{url:/pic/thumb/img/$item['img']/w/160/h/160}">
					<p>{$item['name']}</p>
					<del>￥{$item['market_price']}</del>
					<em>￥{$item['sell_price']} <span>大聚惠</span></em>
				</a>
			</li>
			{/foreach}
		</ul>
	</div>
</section>

<!-- 楼层上广告 -->
<section class="home_focus_show">
	{echo:Ad::show("首页横幅广告1_1200*120(suning)")}
</section>

<div class="container">
	<!-- 开始循环楼层 -->
	{foreach:items=Api::run('getCategoryListTop') item=$first }
	<div class="home_floor">
		<h3>F{echo:$key+1} {$first['name']}</h3>
		<!-- 二级栏目 -->
		<ul class="tab_title">
			<!--获取商品二级分类-->
			{set:$secondData=Api::run('getCategoryByParentid',array('#parent_id#',$first['id']))}
			{foreach:items=$secondData item=$second}
			<li>
				<a href="{url:/site/pro_list/cat/$second[id]}" target="_blank">
					<span>{$second['name']}</span>
				</a>
			</li>
			{/foreach}
		</ul>
		<!-- 二级栏目 -->
		<!-- 左侧 -->
		<div class="card_container_left card_color{echo:$key+1}">
			<div class="side_img">
				{echo:Ad::show("首页分类广告394*297(suning)",$first['id'])}
				<i></i>
			</div>
			<!-- 说明：底部附图为下面循环第八个，以定位实现 -->
		</div>
		<!-- 右侧 -->
		<!-- 这里循环二级商品分类下的商品 -->
		<div class="card_container_right">
			{foreach:items=Api::run('getCategoryExtendList',array('#categroy_id#',$first['id']), 9)}
			<a class="side_img" href="{url:/site/products/id/$item['id']}" target="_blank">
				<p class="title">{$item['name']}</p>
				<p class="desc" style="color:#f15453;">￥{$item['market_price']}</p>
				<img src="{url:/pic/thumb/img/$item['img']}">
			</a>
			{/foreach}
		</div>
	</div>
	{/foreach}
</div>

<!--最新商品-->
<div class="home_rec recommand_allshow">
	<h3>最新商品</h3>
	<div>
		<ul>
			{foreach:items=Api::run('getCommendNew', 36)}
			<li>
				<a href="{url:/site/products/id/$item['id']}">
					<img src="{url:/pic/thumb/img/$item['img']/w/160/h/160}">
					<p class="pro_title">{$item['name']}</p>
					<del>￥{$item['market_price']}</del>
					<em>￥{$item['sell_price']} <span>大聚惠</span></em>
				</a>
			</li>
			{/foreach}
		</ul>
	</div>
</div>
<!--最新商品-->
</div>

<script>
//dom载入完毕执行
$(function(){
	// 调用焦点图
	$("#home_fouse").FengFocus({trigger : "mouseover"});
	$('#home_rec').kxbdSuperMarquee({
		distance:200,
		time: 5,
		btnGo:{left:'#home_rec_left',right:'#home_rec_right'},
		direction:'left'
	});
	//显示抢购倒计时
	var cd_timer = new countdown();
	{if:isset($countNumsItem) && $countNumsItem}
	{foreach:items = $countNumsItem}
		cd_timer.add({$item});
	{/foreach}
	{/if}
});
</script>
