
Some checks are pending
Actions / Litemall-all (11) (push) Waiting to run
Actions / Litemall-all (11.0.3) (push) Waiting to run
Actions / Litemall-all (8) (push) Waiting to run
Actions / Litemall-all (8.0.192) (push) Waiting to run
Actions / Litemall-admin (10.x) (push) Waiting to run
Actions / Litemall-admin (12.x) (push) Waiting to run
Actions / Litemall-admin (14.x) (push) Waiting to run
Actions / Litemall-vue (10.x) (push) Waiting to run
Actions / Litemall-vue (12.x) (push) Waiting to run
Actions / Litemall-vue (14.x) (push) Waiting to run
79 lines
1.6 KiB
JavaScript
79 lines
1.6 KiB
JavaScript
var util = require('../../../utils/util.js');
|
|
var api = require('../../../config/api.js');
|
|
|
|
Page({
|
|
data: {
|
|
orderList: [],
|
|
showType: 0,
|
|
page: 1,
|
|
limit: 10,
|
|
totalPages: 1
|
|
},
|
|
onLoad: function(options) {
|
|
// 页面初始化 options为页面跳转所带来的参数
|
|
let that = this
|
|
try {
|
|
var tab = wx.getStorageSync('tab');
|
|
|
|
this.setData({
|
|
showType: tab
|
|
});
|
|
} catch (e) {}
|
|
|
|
},
|
|
getOrderList() {
|
|
let that = this;
|
|
util.request(api.OrderList, {
|
|
showType: that.data.showType,
|
|
page: that.data.page,
|
|
limit: that.data.limit
|
|
}).then(function(res) {
|
|
if (res.errno === 0) {
|
|
console.log(res.data);
|
|
that.setData({
|
|
orderList: that.data.orderList.concat(res.data.list),
|
|
totalPages: res.data.pages
|
|
});
|
|
}
|
|
});
|
|
},
|
|
onReachBottom() {
|
|
if (this.data.totalPages > this.data.page) {
|
|
this.setData({
|
|
page: this.data.page + 1
|
|
});
|
|
this.getOrderList();
|
|
} else {
|
|
wx.showToast({
|
|
title: '没有更多订单了',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
return false;
|
|
}
|
|
},
|
|
switchTab: function(event) {
|
|
let showType = event.currentTarget.dataset.index;
|
|
this.setData({
|
|
orderList: [],
|
|
showType: showType,
|
|
page: 1,
|
|
limit: 10,
|
|
totalPages: 1
|
|
});
|
|
this.getOrderList();
|
|
},
|
|
onReady: function() {
|
|
// 页面渲染完成
|
|
},
|
|
onShow: function() {
|
|
// 页面显示
|
|
this.getOrderList();
|
|
},
|
|
onHide: function() {
|
|
// 页面隐藏
|
|
},
|
|
onUnload: function() {
|
|
// 页面关闭
|
|
}
|
|
}) |