mui.init({
	pullRefresh: {
		container: '#pullrefresh',
		down: {
			//callback: pulldownRefresh
		},
		up: {
			contentrefresh: '正在加载...',
			callback: pullupRefresh
		}
	}
});
var pageNumber = 0,pagesize = 10;
//上拉加载
function pullupRefresh() {
	var btnArray = ['否', '是'];
	mui.ajax(base_path + '/WithDrawalsLogs/historyWithdrawNext?dates=' + new Date().getTime(), {
		data: {
			"openid": "",
			"page": {
				"pageSize": pagesize,
				"pageNumber": pageNumber
			}
		},
		dataType: 'json',
		type: 'post',
		timeout: 15000,
		success: function(dt) {
			//console.log(dt);
			if(dt.status) {
				var fenxiao_list = [];
				fenxiao_list = dt.data.list;
				$("#amount").html("¥" + accDiv(dt.data.amount, 100));
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(fenxiao_list.length < pagesize); //参数为true代表没有更多数据了。
				var table = document.body.querySelector('.my-tab-view-pull');
				mui(fenxiao_list).each(function(index) {
					var li = document.createElement('li');
					li.className = 'mui-table-view-cell';
					this.name == null ? this.name = "神仙哥哥" : this.name;
					var status = this.status;
					switch(status) {
						case 1:
							status = "申请中";
							break;
						case 2:
							status = "申请成功";
							break;
						default:
							status = "申请失败";
					};
					li.innerHTML = '<a><div class="mui-media-body">提现:<span class="cl-red">¥' + accDiv(this.withDrawalsNum, 100) + '</span><span class="mui-btn-link">' + status + '</span><span class="mui-badge mui-badge-inverted mui-pull-right">' + this.createDate + '</span><p class="mui-ellipsis">' + this.withDrawalsName + ':' + this.accountNo + '<span class="mui-badge mui-badge-inverted mui-pull-right">' + this.bankLocal + '</span></p></div></a>';
					table.appendChild(li);
				});
			} else {
				mui.confirm(dt.message, '爱贝源-提示', btnArray, function(e) {
					if(e.index == 1) {
						location.reload(true);
					}
				});
			}
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			errorfn(xhr);
		}
	});
}
//调整到提现页面
function getMoney() {
	window.location.href = "/iamberry/wechat/drp/withdrawalsPage?openid=";
}
mui.ready(function() {
	document.querySelector('.loading-bg').style.display = 'none';
	mui('#pullrefresh').pullRefresh().pullupLoading();
});