var vouchersType = '',
	isExpected = '';
var data_href = '';
var pageSize = 20;
var count = 1;
var isLoading = false;
mui.plusReady(function() {

	var self = plus.webview.currentWebview();
	//console.log(self)
	vouchersType = self.data_type;
	isExpected = self.data_expected;
	data_href = data_href;
	getBillList(count, pageSize)

	function getBillList(count, pageSize) {
		if (true == isLoading) return;
		isLoading = true;
		JZL.ajax(qlgUrl('app/Uservouchers/getVouchers'), {
			page: count,
			perPage: pageSize,
			vouchersType: vouchersType,
			isExpected: isExpected,
		}, function(data) { //服务器返回响应，根据响应结果，分析是否登录成功；  
			//					//console.log(data.data.goodsFavoritesNum)
			//					//console.log(data.data.Rows)
			//console.log(data);
			var data = toJson(data);
			if (data.status == 1) {
				data = data.data;
				if (data.Rows == '') {
					$('.con').append(
						'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多数据</p>');
					return;
				}
				var html = ''
				$.each(data.Rows, function() {
					html +=
						'<div class="row shadown_wai"><div class="left"> <img src="../img/dingwei1.png" alt=""></div><div class="context"><p class="con_text">' +
						this.remark + '</p><p class="con_time">' + this.createTime + '</p></div><div class="num">-' + this.num +
						'</div></div>';

				})
				if (count == 1) {
					$('.con').html(html);
				} else {
					$('.con').append(html);
				}

			} else {
				mui.alert(data.msg)
			}
			isLoading = false;
		});
	}


	document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
		if (e.cancelable) {
			// 判断默认行为是否已经被禁用
			if (!e.defaultPrevented) {
				e.preventDefault();
			}
		}
		if (scroll.y == scroll.maxScrollY) {
			if (isLoading == false) {
				count++;
				getBillList(count, pageSize)
			}
		}
	})
})
