mui.init({
	pullRefresh: {
		container: '#pullrefresh',
		down: {
			//callback: pulldownRefresh
		},
		up: {
			contentrefresh: '正在加载...',
			callback: pullupRefresh
		}
	}
});
var pageNumber = 0,pagesize = 10;

//上拉加载
function pullupRefresh() {
	++pageNumber;
	var btnArray = ['否', '是'];
	mui.ajax(base_path + '/placeLogs/unIncomeOrderCastNext?dates=' + new Date().getTime(), {
		data: {
			"openid": "",
			"pageSize": pagesize,
			"pageNumber": pageNumber
		},
		dataType: 'json',
		type: 'post',
		timeout: 15000,
		success: function(dt) {
			//console.log(dt);
			if(dt.status) {
				var fenxiao_list = [];
				if(fenxiao_list != null) {
					fenxiao_list = dt.data.list;
				}
				$(".price_to").html(accDiv(dt.data.amount, 100));
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(fenxiao_list.lenght < 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 = decodeURI(this.name);
					li.innerHTML = '<table class="my-dl-tb-order"><tr><td rowspan="2"><img class="wh-80" src="' + this.img + '"></td><td>订单：' + this.orderNo + '</td><td><span class="cl-red">+¥' + accDiv(this.amount, 100) + '</span></td></tr><tr><td>' + this.name + '</td><td>' + this.strDate + '</td></tr></table>';
					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);
		}
	});
}
mui.ready(function() {
	mui('#pullrefresh').pullRefresh().pullupLoading();
	document.querySelector('.loading-bg').style.display = 'none';
});