<!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=<?php echo $data['rootUrl_CSS']; ?>global.css>
	<script src=<?php echo $data['rootUrl_JS']; ?>jquery-1.7.1.min.js></script>
	<script src=<?php echo $data['rootUrl_JS']; ?>global.js></script>
</head>
<body>
<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_header.php"; ?>
<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_body_top.php"; ?>
<div class="globalContent width950">
	<div class="formContent clearfix">
		<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_left_profile.php"; ?>
		<div class="mainContent formItem userProfile">
			<div class="voucher">
				<div class="voucher-list">
					<legend>历史账单</legend>
					<table class="table table-hover table-bordered">
						<thead>
						<th>类型</th>
						<th>来源</th>
						<th>金额</th>
						<th>日期</th>
						</thead>
						<tbody id="incomepaylist">
						<?php if( isset($data['incomepaylist']) ): ?>
						<?php foreach($data['incomepaylist'] as $k1=>$v1): ?>
						<tr>
							<td><?php if( $v1['type'] == 1 ): ?>收入<?php else: ?>支出<?php endif; ?></td>
							<td><?php echo $v1['comefrom']; ?></td>
							<td>￥<?php echo $v1['money']; ?></td>
							<td><?php echo formatDate($v1['addtime']); ?></td>
						</tr>
						<?php endforeach; ?>
						<?php endif; ?>
						</tbody>
					</table>
					<?php if( $data['incomepaynum'] > 20 ): ?>
					<a page="1">查看更多</a>
					<?php endif; ?>
				</div>
			</div>
		</div>
	</div>
</div>
<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_footer.php"; ?>
<?php if( $data['incomepaynum'] > 20 ): ?>
<script>
	$(function(){
		$('.voucher-list a').click(function(){
			$.ajax({
				type: 'get',
				url: '/getorder/'+$(this).attr('page'),
				dataType: 'json',
				success: function(result){
					console.log(result);
					if(result.code == 200){
						var html = '';
						$.each(result.incomepaylist,function(k,v){
							if(v.type == 1){
								var note = '收入';
							}else{
								var note = '支出';
							}
							html += '<tr><td>'+note+'</td><td>'+v.comefrom+'</td><td>￥'+v.money+'</td><td>'+v.addtime+'</td></tr>'
						});
						if(result.num == 0){
							$('.voucher-list a').remove();
						}else{
							$('.voucher-list a').attr('page',result.num);
						}
						$('#incomepaylist').append(html);
					}
				}
			})
		})
	})
</script>
<?php endif; ?>
</body>
