<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>个人帐变</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
<script src="https://cdn.bootcss.com/dayjs/1.7.8/dayjs.min.js"></script>
<script src="/js/common/common.js"></script>
<link href="/css/common/common.css" rel="stylesheet" type="text/css">
<style type="text/css">
</style>
</head>

<body>
	<div th:replace="common/header::html"></div>
	<div id="personalAccountChange" v-cloak>
		<div class="page-body" style="background: #f2f2f2;">
			<div class="input-group" style="padding-bottom: 0.3rem; padding-top: 0.3rem;">
				<select class="form-control" style="width: 2.2rem; height: 3rem;" v-model="accountChangeTypeCode">
					<option value="">帐变类型</option>
					<option v-for="dictItem in accountChangeTypeDictItems" :value="dictItem.dictItemCode">{{dictItem.dictItemName}}</option>
				</select><input type="date" class="form-control" style="width: 8rem;" v-model="accountTime">
				<div class="input-group-append">
					<button class="btn btn-outline-secondary" type="button" v-on:click="query">查询</button>
				</div>
			</div>
			<div class="form-details" v-for="accountChangeLog in accountChangeLogs">
				<div class="form-details-body">
					<div class="form-details-item">
						<label>帐变时间:</label> <span>{{accountChangeLog.accountChangeTime}}</span>
					</div>
					<div class="form-details-item">
						<label>帐变类型:</label> <span>{{accountChangeLog.accountChangeTypeName}}</span>
					</div>
					<div class="form-details-item">
						<label>帐变金额:</label> <span>{{accountChangeLog.accountChangeAmount}}元</span><label>保证金:</label> <span class="form-details-item-highlight">{{accountChangeLog.cashDeposit}}元</span>
					</div>
				</div>
			</div>
			<div style="padding-left: 13rem;">
				<ul class="pagination">
					<li class="page-item"><a class="page-link" v-show="totalPage > 0 && pageNum > 1" v-on:click="prePage">上一页</a></li>
					<li class="page-item"><a class="page-link" v-show="pageNum >= 1 && pageNum < totalPage" v-on:click="nextPage">下一页</a></li>
				</ul>
			</div>

		</div>
	</div>
	<div th:replace="common/footer::html"></div>
	<script type="text/javascript">
		var personalAccountChangeVM = new Vue({
			el : '#personalAccountChange',
			data : {
				accountChangeTypeCode : '',
				accountChangeTypeDictItems : [],
				accountTime : dayjs().format('YYYY-MM-DD'),
				accountChangeLogs : [],
				pageNum : 1,
				totalPage : 1
			},
			computed : {},
			created : function() {
			},
			mounted : function() {
				headerVM.title = '个人帐变';
				headerVM.showBackFlag = true;
				this.loadAccountChangeTypeDictItem();
				this.loadByPage();
			},
			methods : {
				/**
				 * 加载账变类型字典项
				 */
				loadAccountChangeTypeDictItem : function() {
					var that = this;
					that.$http.get('/dictconfig/findDictItemInCache', {
						params : {
							dictTypeCode : 'accountChangeType'
						}
					}).then(function(res) {
						this.accountChangeTypeDictItems = res.body.data;
					});
				},

				query : function() {
					this.pageNum = 1;
					this.loadByPage();
				},

				prePage : function() {
					this.pageNum = this.pageNum - 1;
					this.loadByPage();
				},

				nextPage : function() {
					this.pageNum = this.pageNum + 1;
					this.loadByPage();
				},

				loadByPage : function() {
					var that = this;
					that.$http.get('/userAccount/findMyAccountChangeLogByPage', {
						params : {
							pageSize : 5,
							pageNum : that.pageNum,
							startTime : that.accountTime,
							endTime : that.accountTime,
							accountChangeTypeCode : that.accountChangeTypeCode
						}
					}).then(function(res) {
						that.accountChangeLogs = res.body.data.content;
						that.pageNum = res.body.data.pageNum;
						that.totalPage = res.body.data.totalPage;
					});
				}
			}
		});
	</script>
</body>
</html>