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

//上拉加载
function pullupRefresh() {
	++pageNumber;
	var btnArray = ['否', '是'];
	mui.ajax('/iamberry/wechat/rebackStatic/underUnderlingStatisc?dates=' + new Date().getTime(), {
		data: {
			"pageSize": pagesize,
			"pageNumber": pageNumber,
			"endNo": endNo,
			"openid": getParam("openid")
		},
		dataType: 'json',
		type: 'post',
		timeout: 15000,
		success: function(dt) {
			console.log(dt);
			if(dt.status) {
				var chanpin_data = []; //定义一个数组类型存放dt.data.productList
				if(dt.data.list != null) {
					chanpin_data = dt.data.list
				}
				document.querySelector("#b_accounts").innerHTML = dt.data.size;
				endNo = dt.data.endNo;
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(chanpin_data.length < pagesize); //参数为true代表没有更多数据了
				var table = document.body.querySelector('.my-tab-view-pull');
				mui(chanpin_data).each(function(index) {
					var li = document.createElement('li');
					li.className = 'mui-table-view-cell';
					if(this.img == null) {
						li.innerHTML = '<table class="my-dl-tb-order"><tr><td><img class="wh-50" src="http://static.iamberry.com/images/shop/logo_head.png"></td><td class="mui-text-left">' + decodeURI("未命名") + '</td><td style="color:blue;">' + this.roleName + '</td><td>' + this.strDate + '</td></tr></table>';
					} else {
						li.innerHTML = '<table class="my-dl-tb-order"><tr><td><img class="wh-50" src="' + this.img + '"></td><td class="mui-text-left">' + decodeURI(this.name) + '</td><td style="color:blue;">' + this.roleName + '</td><td>' + this.strDate + '</td></tr></table>';
					}
					table.appendChild(li);
				});
			} else {
				mui.confirm(dt.message, '提示', btnArray, function(e) {
					if(e.index == 1) {
						//console.log("您点击了是");
					}
				});
			}
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			errorfn(xhr);
		}
	});
}
mui.ready(function() {
	mui('#pullrefresh').pullRefresh().pullupLoading();
	document.querySelector('.loading-bg').style.display = 'none';
});