mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {},
up: {contentrefresh: '正在加载...', callback: pullupRefresh}
}
});
var pageNumber = 0, pagesize = 10;
function pullupRefresh() {
pageNumber += 1;
var btnArray = ['否', '是'];
$.ajax(base_path + '/agent/agentOrder', {
data: {"pageSize": pagesize, "pageNO": pageNumber},
dataType: 'json',
type: 'post',
timeout: 15000,
xhrFields: {
withCredentials: true
},
crossDomain: true,
success: function (dt) {
if (dt.isRedirect) {
location.href = dt.redirectURL;
} else {
if (dt.status) {
var data = dt.data;
var daili_order_list = [];
daili_order_list = data.orderList;
mui('#pullrefresh').pullRefresh().endPullupToRefresh(daili_order_list.length < pagesize);
var table = document.body.querySelector('.my-tab-view-pull');
var headImg = "";
var nickName = '匿名用户';
mui(daili_order_list).each(function (index) {
var itemList = this.orderItemList;
console.log(itemList);
headImg = this.userHead;
if (this.userNickName != null && typeof(this.userNickName) != "undefined" && this.userNickname != '') {
nickName = decodeURI(this.userNickName)
}
var status = '';
switch (this.rebackStatus) {
case 1:
status = '待返现';
break;
case 2:
status = '已返现';
break;
case 3:
status = '取消';
break;
default:
break
}
var orderCreateDate = this.orderCreateDate;
mui(itemList).each(function (index) {
var productName = this.itemProductName;
if (this.itemProductName.indexOf('冲奶机') != -1) {
productName = '冲奶机'
} else if (this.itemProductName.indexOf('净水机') != -1) {
productName = '净水机'
}
var li = document.createElement('li');
li.className = 'mui-table-view-cell';
li.innerHTML = '' + orderCreateDate + '购买' + this.itemNum + '台' + productName + '' + status + '';
table.appendChild(li)
})
})
} else {
mui.confirm(dt.message, '爱贝源-提示', btnArray, function (e) {
if (e.index == 1) {
}
})
}
}
},
error: function (xhr, type, errorThrown) {
errorfn(xhr)
}
})
};mui.ready(function () {
mui('#pullrefresh').pullRefresh().pullupLoading();
getCartNum();
document.querySelector('.loading-bg').style.display = 'none'
});