<{include file="index/header_shop.html"}>
<div class="tab_name"><a class="back" href="?m=distribute&a=index">增加产品</a></div> 
<style type="text/css">
.dbox{ width:960px; float:left; }
.box{ width:180px; margin:0 11px 10px 0; float:left; }
.box a.simg{ width:160px; height:160px; margin:0 0 0 10px; text-align:center; line-height:60px; border:1px solid #efefef; padding:3px; float:left;}
.box a.simg img{ max-height:160px; max-width:160px; }
.box .ttl{ width:100%; padding:8px 0 0 0; float:left;}
.box .ttl a{ text-align:left; font-size:12px; height:40px; overflow:hidden; color:#666; padding:0 10px 0 10px; line-height:20px; float:left;  }
.box .ttl span{font-size:12px;line-height:22px; padding:0 10px 0 20px; color:#999999; text-align:left; float: left;} 
.box .pr{ width:100%; float:left; }
.box .pr span{margin:0 0 0 8px; font-size:18px; color:#f00; float:left; } 
.box .st{ width:100%;  float:left; }
.box .st span{ padding:8px 0 0 10px; color:#666; float:left; }
.box .st a{ float:right; }
a.insert_distribute{ width:30px; height:30px; text-indent:-9999px; background: url(<{$__APP__}>public/images/addbtn.png); background-size:30px auto; float:left; }
</style>
<div class="lbox">
	<div class="dbox">
		<{if $data.list}>	
			<{foreach item=i from=$data.list}>
				<div class="box">
					<div class="img"><a class="simg" href="index.php?m=goods&a=detail&id=<{$i.id}>" target="_blank"><img src="<{$__IMG__}><{$i.images|img_size:160x160}>"/></a></div>
					<div class="ttl"><a href="index.php?m=goods&a=detail&id=<{$i.id}>" target="_blank"><{$i.title}></a></div>
					<div class="pr"><span><{if $i.discount_price == ''}> ￥<{$i.price}><{else}> ￥<{$i.discount_price}></s><{/if}></span></div>
					<div class="st">
						<span>库存：<{if $i.stock}><{$i.stock}><{else}>无货<{/if}></span>
						<a href="javascript:;" class="insert_distribute" data-id="<{$i.id}>"><{if $i.gid}>取消分销<{else}>加入分销<{/if}></a>	
					</div>
				</div>
			<{/foreach}>  
		<{else}> 
			<div class="nomsg"><i></i><span>暂无分销产品~</span></div>
		<{/if}>		
	</div> 
	<{if $data.page}><div class="page"><{$data.page}></div><{/if}>
</div>
<{include file="index/footer.html"}>
<script type="text/javascript">
$(function(){
	$(".insert_distribute").click(function(){
		var $this = $(this);
		var goods_id = $this.attr('data-id'); 
		$.post('?m=distribute&a=add_distribute',{gid:goods_id},function(result){ 
			data = jQuery.parseJSON(result); 
			if(data.error == '0'){
				location.reload();
			}else{
				$.alert(data.msg);
			}
		}); 
	}); 
});
</script>