<!DOCTYPE html>
<html>
<head>
<title>{if $all_cat}分类列表{else}{$cat_name}{/if} - {$shop_name}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="ecdaddy.com">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="style/base.css?v=mzw" />
{insert_scripts files='../../js/transport.js,../js/utils.js'}
<script type="text/javascript">
function add_num(rec_id,goods_id){
	document.getElementById("goods_number_"+rec_id+"").value++;
	var number = document.getElementById("goods_number_"+rec_id+"").value;
	//Ajax.call('cart.php', 'act=update_group_cart&rec_id=' + rec_id +'&number=' + number+'&goods_id=' + goods_id, changePriceResponse, 'GET', 'JSON');
	Ajax.call('cart.php?act=update_group_cart', 'rec_id=' + rec_id +'&number=' + number+'&goods_id=' + goods_id, changePriceResponse, 'GET', 'JSON');

}

function red_num(rec_id,goods_id){
	if (document.getElementById("goods_number_"+rec_id+"").value>=1){
		document.getElementById("goods_number_"+rec_id+"").value--;
	}
	var number = document.getElementById("goods_number_"+rec_id+"").value;
	Ajax.call('cart.php', 'act=update_group_cart&rec_id=' + rec_id +'&number=' + number+'&goods_id=' + goods_id, changePriceResponse, 'GET', 'JSON');
}

function change_price(rec_id,goods_id){
	var number = document.getElementById("goods_number_"+rec_id+"").value;
	Ajax.call('cart.php','act=update_group_cart&rec_id=' + rec_id +'&number=' + number+'&goods_id=' + goods_id, changePriceResponse, 'GET', 'JSON');
}

function changePriceResponse(result){
	document.getElementById('cartnum').innerHTML = result.cartnum;
}
</script>
</head>
<body>
{include file='head1.html'}
{if $all_cat}

	{foreach from=$cat_array item=cat_data}
<div class="mc radius">
	<h3><a href='category.php?c_id={$cat_data.id}'>{$cat_data.name}</a></h3>
	{foreach from=$cat_data['cat_id'] item=ccat_data} <a href='category.php?c_id={$ccat_data.id}' style="display: inline-table;width: 30%;padding: 10px 0;text-align: center;color: #546280;font-size: .75em;">{$ccat_data.name}</a> {/foreach} </div>
{/foreach}

{else}
{if $cat_children}
<div style="margin-top: 8px;padding: 10px;background-color: #f2ebe3;border-top: 1px solid #ddd2c0;border-bottom: 1px solid #ddd2c0;box-shadow: inset 0 1px 0 #fff;"> <span class="red">{foreach from=$cat_children item=child_data} <a href='category.php?c_id={$child_data.id}' style="display: inline-table;width: 30%;padding: 6px 0;text-align: center;color: #546280;font-size: .75em;">{$child_data.name}</a> {/foreach}</span></div>
{/if}
<div class="mc radius">
	<ul class="mu-l2w">
		{foreach from=$goods_data item=goods name=goodsit}
		<li style="padding: 10px;border-top: none;overflow: hidden;{if $smarty.foreach.goodsit.iteration neq 1}border-top: 1px solid #DED6C9;{/if}line-height: 1.6em;">
        <a href="goods.php?id={$goods.id}" style=" float:left;padding: .22em 0;"> <span class="mu-tmb" style="float:left;margin-right:8px;">{if $goods.i <= 3}<b style="position:absolute;padding:2px 2px 2px 2px;font-size:.65em;background:red;color:white;">HOT</b>{/if}<img src="../../{$goods.thumb}" alt="{$goods.name}" width="100" height="100"> </span></a>
         <span><a href="goods.php?id={$goods.id}">{$goods.name}</a></span><span class="red" style="display: block;">{$goods.price}</span>
         <p> <a href="javascript:;" class="btn_num" onclick="red_num({$goods.id},{$goods.id});" title="减少数量">-</a> 
			<input type="text" name="goods_number[{$goods.id}]" id="goods_number_{$goods.id}" value="0" size="3" style="text-align:center;border: 1px solid #b3b3b3;" onblur="change_price({$goods.id},{$goods.id})" />
			 <a href="javascript:;" class="btn_num" onclick="add_num({$goods.id},{$goods.id})" title="增加数量" >+</a>
            </p>
         </li>
		{foreachelse}
		暂无此类商品
		{/foreach}
	</ul>
</div>
{if $pagebar}
{$pagebar}
{/if}
{/if}
{include file='foot2.html'}
</body>
</html>
