<extend name="Public:base" />
<block name="content">

<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>ID</th>
						<th>图片</th>
						<th>商品名称</th> 
						<th>当前状态</th>	
						<th>价格</th>
						<th>库存</th> 
						<th>销售数量</th> 
						<th>所属店铺</th>	
					
						<th>申请时间</th>	
						
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						<volist name="list" id="data" empty="$empty">
						<tr>						
							<td>{$data.id}</td>
							<td><img src="__ROOT__/{$data.image}" /></td>
							<td>{$data.name}</td>
							<td>
							<?php if($data['state'] == 0) { ?>
							<span class="red bold">申请中</span>
							<?php }else{ ?>
							<span class="green bold">已通过</span>
							<?php } ?>
							</td>
							<td>
							<span class="green bold">拼团价：{$data.pinprice}</span>
							<br/>
							<span class="blue bold">单独价：{$data.danprice}</span>
							</td>
							<td>
							{$data.quantity}
							</td>
							<td>
							{$data.seller_count}
							</td>
							<td>
							<?php $s = M('seller')->where(array('s_id'=>$data['store_id']))->field('s_true_name')->find();echo $s['s_true_name']; ?>
							</td>
							<td>
							
							
							<?php if( $state == 1){ ?>
								<?php echo date('Y-m-d H:i:s',$data['begin_time']); ?><br/>
							    <?php echo date('Y-m-d H:i:s',$data['end_time']); ?>
							
							<?php }else{ ?>
								<?php echo date('Y-m-d H:i:s',$data['addtime']); ?>
							<?php } ?>
						
							</td>
							<td>
							<?php if($data['state'] == 0) { ?>
								<a  class="btn btn-xs btn-info shenhe" href="javascript:;" rel-url='{:U("SuperSpike/shenhe",array("id" => $data["id"]))}'>
									<i class="icon-check bigger-120"></i>
								</a> 
							<?php } ?>		
							</td>
						</tr>
						</volist>	
						
						<tr>
							<td colspan="20" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>

  
</block>
<block name="javascript">
<script>

$(function(){
	$('.shenhe').click(function(){
		var ask_url = $(this).attr('rel-url');
		if(!confirm('确认审核通过吗？')){
			return false;
		}
		$.ajax({
			url:ask_url,
			type:'get',
			dataType:'json',
			success:function(result){
				if(result.code == 1) {
					alert('操作成功');
					location.href = location.href;
				} else {
					return false;
					alert(result.msg);
				}
			}
			
		})
		
	})	
})
</script>						
</block>