<{include file="index/header.html"}> 
<div class="nav"><span>商品列表</span></div>
<div class="filter"> 
	<input type="button" name="del_checked" class="del_ck button" value="删除选项"/>
	<form action="<{$__ADMIN__}>goods/index" method="get"> 
		<div class="sch">
			<input type="text" name="key" class="text" value="" placeholder="请输入产品关键字"/>
			<input type="submit" class="submit" value="确定"/>
		</div>
	</form>
	<a href="<{$__ADMIN__}>goods/index" class="option <{if $smarty.get.status == ''}>option_ch<{/if}>">全部</a>
	<a href="<{$__ADMIN__}>goods/index?status=1" class="option <{if $smarty.get.status == '1'}>option_ch<{/if}>">正常</a> 
	<a href="<{$__ADMIN__}>goods/index?status=0" class="option <{if $smarty.get.status == '0'}>option_ch<{/if}>">下线</a> 
</div>
<style type="text/css">
.vtype2{ color:#B5B5B5; padding:10px 0 0 0; }
</style>
<div class="main"> 
	<table class="ltable">
	  	<thead>
		  	<tr>
				<th width="30"><input type="checkbox" class="checked_all"/></th>  
				<th width="55">图片</th>
				<th>标题</td>  
				<th width="50" class="center">主页</th>
				<th width="50" class="center">推荐</th> 
				<th width="60" class="center">库存</th>
				<th width="60">状态</th>
				<th width="90">时间</th>
		  	</tr>
	  	</thead>
		<tbody>
		<{if $data.list}>
			<{foreach item=i from=$data.list}>
				<tr>
					<td><input name="key_id[]" type="checkbox" value="<{$i.id}>" class="checked_list"/></td> 
					<td>
						<a href="<{$__URI__}>goods/<{$i.id}><{$__HTML__}>" target="_blank"><img src="<{$__IMG__}><{$i.images|img_size:50x50}>" width="50" height="50"/></a>
					</td> 
					<td valign="top">
						<a href="<{$__URI__}>goods/<{$i.id}><{$__HTML__}>" target="_blank"><{$i.title}></a>
						<p class="vtype2">
							分类：<{$i.cats_cn}> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							销量：<{$i.volume}> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							评论：<{$i.comment}>
						</p>
					</td>
					<td class="center"><a href="javascript:status('<{$i.id}>','px_index')" id="px_index_<{$i.id}>"><img src="<{$__APP__}>public/images/status_<{$i.px_index}>.png"></a></td> 
					<td class="center"><a href="javascript:status('<{$i.id}>','px_recommend')" id="px_recommend_<{$i.id}>"><img src="<{$__APP__}>public/images/status_<{$i.px_recommend}>.png"></a></td> 
					<td class="center"><{$i.stock}></td>
					<td><input type="checkbox" name="status" class="type2 offline" data-id="<{$i.id}>" <{if $i.status == '1'}>checked="checked"<{/if}>/> </td>
					<td><{$i.addtime}></td>
				</tr>
			<{/foreach}>
		<{else}>
	  			<tr><td colspan="8">还没有数据，赶快添加吧！</td></tr>
		<{/if}>
		</tbody>
	</table> 
	<{if $data.page}><div class="page"><{$data.page}></div><{/if}> 
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript">
_delete("<{$__ADMIN__}>goods/del", '.del_ck');
function status(id,type){
	$.post("<{$__ADMIN__}>goods/px_status",{id:id, type:type},function(data){
 		if(data == '0' || data == '1'){
			$("#"+type+"_"+id+" img").attr('src','<{$__APP__}>public/images/status_'+data+'.png');
		}else{
			alert('更新失败');
		} 
	});	
}
$(function(){
	$("input.offline").click(function(){
		id = $(this).attr('data-id'); 
		$.post('<{$__ADMIN__}>goods/status?id='+id, function(result){
			data = jQuery.parseJSON(result); 
			if(data.error == '0'){
				$.alert('操作成功'); 
			}else{
				alert(data.msg);
			}
		}); 
	});
});
</script>