<extend name="Public:base" />

<block name="content">
	<div class="page-header">
	<a href="{:U('Voucher/add')}" class="btn btn-primary">新增优惠券</a>

	</div>	
	
<div class="row">
	<div class="col-xs-12 search-row">
		<div class="panel-body">
			<ul class="nav nav-tabs">
            <li <?php if($type == 0){ ?>class="active" <?php } ?>><a href="{:U('Voucher/index')}">平台券管理</a></li>
            <li <?php if($type == 1){ ?>class="active" <?php } ?>><a href="{:U('Voucher/free_config')}">免单券配置</a></li>              
           
          </ul>
		</div>
	</div>
	
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<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>{$data.voucher_title}</td>
							<td>{$data.credit}</td>
							<td>{$data.limit_money}</td>
							<td>{$data.total_count}</td>
							<td>{$data.send_count}</td>
							<td>
							<?php 
								if($data['total_count'] > $data['send_count']){
									echo '<span class="green bold">剩余'.($data['total_count'] - $data['send_count']).'张</font>';
								}else {
									echo '<span class="red bold">已发完</font>';
								}
							?>
							</td>
							
							<td>
								开始时间：<?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']); ?>
							</td>
							
							<td>
								<a  class="btn btn-xs btn-info" href='{:U("Voucher/voucherlist",array("id"=>$data["id"]))}'>
									查看所有券
								</a> 
								<a  class="btn btn-xs btn-info" href='{:U("Voucher/membersend",array("id"=>$data["id"]))}'>
									赠送优惠券
								</a>
								<a class="delete btn btn-xs btn-danger" href='{:U("Voucher/del",array("id"=>$data["id"]))}' >
									<i class="icon-trash bigger-120"></i>删除所有券
								</a>
							</td>
						</tr>
						</volist>	
						<tr>
							<td colspan="5" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>