140 lines
3.0 KiB
JavaScript
140 lines
3.0 KiB
JavaScript
// packageE/TeamDistribution/TeamDistribution.js
|
|
var app = getApp();
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
member: {},
|
|
total: "",
|
|
recordsList: [],
|
|
inputs: "",
|
|
isLoadMore: true,
|
|
total_page: 0,
|
|
page: 1,
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getRecordList();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
if (this.data.isLoadMore) {
|
|
this._getMoreData();
|
|
} else {
|
|
console.log("没有更多数据");
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
enterSearch() {
|
|
this.data.isLoadMore = true;
|
|
this.data.total_page = 0;
|
|
this.data.page = 1;
|
|
this.getRecordList();
|
|
},
|
|
getRecordList() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss(
|
|
"plugin.commission-statistics.api.index.index"
|
|
);
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
page: 1,
|
|
keyword: this.data.inputs,
|
|
},
|
|
success: (resdata) => {
|
|
let res = resdata.data;
|
|
if (res.result != 1) return;
|
|
this.data.total_page = res.data.agent.last_page;
|
|
if (res.data.agent.current_page >= res.data.agent.last_page) {
|
|
that.setData({
|
|
isLoadMore: false,
|
|
});
|
|
}
|
|
if (!this.data.inputs) {
|
|
this.setData({
|
|
total: res.data.agent.total,
|
|
});
|
|
}
|
|
console.log("666666", res.data.agent.data);
|
|
this.setData({
|
|
member: res.data.member,
|
|
recordsList: res.data.agent.data,
|
|
});
|
|
},
|
|
fail: function (res) {
|
|
console.log(res.msg);
|
|
},
|
|
});
|
|
},
|
|
_getMoreData() {
|
|
if (this.data.page >= this.data.total_page) {
|
|
return;
|
|
} else {
|
|
let urlStr = app.getNetAddresss(
|
|
"plugin.commission-statistics.api.index.index"
|
|
);
|
|
this.data.page++;
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
page: this.data.page,
|
|
keyword: this.data.inputs,
|
|
},
|
|
success: (resdata) => {
|
|
let res = resdata.data;
|
|
if (res.result != 1) {
|
|
this.data.isLoadMore = false;
|
|
return;
|
|
}
|
|
if (res.data.agent.current_page >= res.data.agent.last_page) {
|
|
this.data.isLoadMore = false;
|
|
}
|
|
let recordsList = this.data.recordsList;
|
|
recordsList.push(...res.data.agent.data);
|
|
this.setData({ recordsList });
|
|
},
|
|
fail: function (res) {
|
|
console.log(res.msg);
|
|
},
|
|
});
|
|
}
|
|
},
|
|
});
|