<!DOCTYPE html>
<html lang=zh-cn>
<head>
	<meta charset=utf-8>
	<title>个人信息纵横通行帐号</title>
	<meta name=description content=一个帐号通用纵横旗下所有网络产品。>
	<meta name=copyright content=smartcost.com.cn>
	<link rel=stylesheet href={{rootUrl_CSS}}global.css>
	<script src={{rootUrl_JS}}jquery-1.7.1.min.js></script>
	<script src={{rootUrl_JS}}global.js></script>
</head>
<body>
<!-- include '_header' -->
<!-- include '_body_top' -->
<div class="globalContent width950">
	<div class="formContent clearfix">
		<!-- include '_left_profile' -->
		<div class="mainContent formItem userProfile">
			<div class="voucher">
				<div class="voucher-input">
					<form action="/voucher" method="post">
					<div class="clearfix"><input type="text" name="code" placeholder="输入领取码"><button type="submit" class="button btn-red">领取代金券</button>
					</div>
					</form>
					<br>
					<!-- if isset({{pnote}}) --><p class="colRed">{{pnote}}</p><!-- endif -->
				</div>
				<div class="voucher-list">
					<legend>领取历史</legend>
					<table class="table table-hover table-bordered">
						<thead>
						<th>活动名称</th>
						<th>代金券金额</th>
						<th>领取日期</th>
						</thead>
						<tbody id="voulist">
						<!-- if isset({{uvoulist}}) -->
						<!-- loop uvoulist -->
							<tr>
								<td>{{uvoulist' value.vname}}</td>
								<td>￥{{uvoulist' value.vmoney}}</td>
								<td>{{formatDate(uvoulist' value.addtime)}}</td>
							</tr>
						<!-- endloop -->
						<!-- endif -->
						</tbody>
					</table>
					<!-- if {{uvounum}} > 20 -->
					<a page="1">查看更多</a>
					<!-- endif -->
				</div>
			</div>
		</div>
	</div>
</div>
<!-- include '_footer' -->
<!-- if {{uvounum}} > 20 -->
<script>
	$(function(){
		$('.voucher-list a').click(function(){
			$.ajax({
				type: 'get',
				url: '/getvoucher/'+$(this).attr('page'),
				dataType: 'json',
				success: function(result){
					console.log(result);
					if(result.code == 200){
						var html = '';
						$.each(result.uvoulist,function(k,v){
							html += '<tr><td>'+v.vname+'</td><td>￥'+v.vmoney+'</td><td>'+v.addtime+'</td></tr>'
						});
						if(result.num == 0){
							$('.voucher-list a').remove();
						}else{
							$('.voucher-list a').attr('page',result.num);
						}
						$('#voulist').append(html);
					}
				}
			})
		})
	})
</script>
<!-- endif -->
</body>
