<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">	
		<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> 
						
					</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>
							<?php if($data['user_id'] >0) { 
								$mb_info = M('member')->where( array('member_id' => $data['user_id']) )->find();
							?>
								<span class="red bold">已领取(<?php echo $mb_info['name']; ?>)</span>
							<?php }else{ ?>
								<span class="green bold">未领取</span>
							<?php } ?>

							</td>
							<td>
								开始时间：<?php echo date('Y-m-d H:i:s',$voucher_info['begin_time']); ?>
								<br/>
								结束时间：<?php echo date('Y-m-d H:i:s', $voucher_info['end_time']); ?>
							</td>
							<td>  
							<?php  if($data['consume'] == 'Y') {
									echo '<span class="red">已使用</span>';
								} else {
									echo '<span class="blue">未使用</span>';
								}
							?>
						</tr>
						</volist>	
						<tr>
							<td colspan="5" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>