JS代码
mui.init({
swipeBack: true, //启用右滑关闭功能
pullRefresh: {
container: "#myOrderList", //待刷新区域标识,querySelector能定位的css选择器均可,比如:id、.class等
up: {
contentrefresh: "正在加载...", //可选,正在加载状态时,上拉加载控件上显示的标题内容
contentnomore: '没有更多数据了', //可选,请求完毕若没有更多数据时显示的提醒内容;
callback: pullfreshup //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
}
}
});
$(function() {
$(".order-info").on("tap", function() {
openWindow({
url: "../../html/order/order_view.html",
id: "order_view"
});
});
});
//上拉刷新
function pullfreshup() {
setTimeout(function() {
orderList(currentPageNo);
}, 0);
};
function init() {
orderList(1);
};
//获取订单列表
function orderList(pagenum) {
// console.log(myOrderList)
requestAjax(myOrderList, {
page: pagenum, //当前页码
pageSize: pagesize, //每页数量
},
function(data) {
// console.log("我的订单:"+JSON.stringify(data));
var div = document.querySelector(".mui-content");
if (data.result == 1) {
console.log("订单列表aaaa:" + JSON.stringify(data));
var obj = data.data.result;
if (currentPageNo == 1) {
div.innerHTML = "";
}
for (var i = 0; i < obj.length; i++) {
//订单
var orderObj = obj[i];
//订单div对象
var div_order_info = document.createElement("div");
div_order_info.className = "order-info";
div_order_info.order_id = obj[i].order_id //商品ID
var orderinfocontent = [];
//订单编号
orderinfocontent.push('<div class="pd15" style="overflow:hidden">');
orderinfocontent.push('<span style="color:#DA434E;" class="mui-pull-left">' + getOrderStatus(orderObj.status) + '</span>');
orderinfocontent.push('<span class="mui-pull-right">订单号:' + orderObj.sn + '</span>');
orderinfocontent.push('</div>');
//订单商品列表
var goodsItemList = orderObj.orderItemList;
for (var j = 0; j < goodsItemList.length; j++) {
orderinfocontent.push('<div class="mui-row" style="padding:20px 0;">');
orderinfocontent.push('<div class="mui-col-xs-9">');
orderinfocontent.push('<img src="' + goodsItemList[j].image + '" class="media-object" width="75" height="75"/>');
orderinfocontent.push('<h4 class="mui-ellipsis-2">' + goodsItemList[j].name + '</h4>');
orderinfocontent.push('<span>x' + goodsItemList[j].num + '</span>');
orderinfocontent.push('</div>');
orderinfocontent.push('<div class="mui-col-xs-3 mui-text-right price">');
orderinfocontent.push('<span style="color:#DA434E;">¥' + goodsItemList[j].price + '</span>');
orderinfocontent.push('</div>');
orderinfocontent.push('</div>');
}
//实付款
orderinfocontent.push('<div class="pd15" style="overflow:hidden">');
orderinfocontent.push('<span class="mui-pull-left">实付款:¥' + orderObj.order_amount + '</span>');
orderinfocontent.push('</div>');
div_order_info.innerHTML = orderinfocontent.join('');
div.appendChild(div_order_info);
div_order_info.addEventListener("tap", function() {
openWindow({
url: "../../html/order/order_view.html?orderId=" + this.order_id,
id: "order_view"
});
});
}
if (obj.length == 0) {
div.innerHTML = '<div class="mui-scroll">' +
'<div class="text" style="text-align: center;"><div class="textInfo">您还没有订单哦~~~</div></div>' +
'</div>';
}
if (parseInt(data.data.totalPageCount) == currentPageNo) {
mui('#myOrderList').pullRefresh().endPullupToRefresh(true);
} else {
mui('#myOrderList').pullRefresh().endPullupToRefresh(false);
currentPageNo += 1;
}
} else {
mui.toast(data.message || "未获取到数据!");
}
});
}
页面下拉内容容器
<div class="mui-content">
<div class="mui-scroll-wrapper" id="myOrderList">
<div class="mui-scroll">
<ul class="mui-table-view">
</ul>
</div>
</div>
</div>
报错信息
[ERROR] : TypeError: 'undefined' is not an object (evaluating 'mui('#myOrderList').pullRefresh().endPullupToRefresh')
file name:b2b2c/html/order/order_list.js
line no:114
请大神们指教一二。IOS有问题。安卓正常
0 个回复