167 lines
3.6 KiB
JavaScript
167 lines
3.6 KiB
JavaScript
// packageB/member/distribution_queue/expected_commission/expected_commission.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
link_url: '',
|
|
list: [],
|
|
//more
|
|
isLoadMore: true,
|
|
page: 1,
|
|
total_page: 0,
|
|
tag: ''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
if (options.tag) {
|
|
this.setData({
|
|
tag: options.tag
|
|
});
|
|
}
|
|
this.initData();
|
|
this.getData();
|
|
},
|
|
getData() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss(this.data.link_url);
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
showToastIn: false,
|
|
data: {
|
|
page: this.data.page
|
|
},
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
let datas = res.data;
|
|
that.setData({
|
|
list: datas.data,
|
|
page: datas.current_page,
|
|
total_page: datas.last_page
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: res.msg,
|
|
duration: 1500
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
_getMoreData() {
|
|
const that = this;
|
|
let json = {
|
|
page: this.data.page
|
|
};
|
|
let api = this.data.link_url;
|
|
let urlStr = '';
|
|
that.data.isLoadMore = false; // 防止多次请求分页数据
|
|
if (this.data.page >= this.data.total_page) {
|
|
return;
|
|
} else {
|
|
this.data.page = this.data.page + 1;
|
|
urlStr = app.getNetAddresss(api);
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
showToastIn: false,
|
|
data: json,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
var myData = res.data.data;
|
|
that.setData({
|
|
isLoadMore: true,
|
|
list: that.data.list.concat(myData)
|
|
});
|
|
} else {
|
|
that.setData({
|
|
page: that.data.page - 1,
|
|
isLoadMore: false
|
|
});
|
|
return;
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
if (this.data.isLoadMore) {
|
|
this._getMoreData();
|
|
} else {
|
|
console.log('没有更多数据');
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
initData() {
|
|
if (this.data.tag == 1) {
|
|
this.data.link_url = 'plugin.commission-activity.api.dividend-list.estimate';
|
|
} else if (this.data.tag == 2) {
|
|
this.data.link_url = 'plugin.commission-activity.api.dividend-list.unsettlement';
|
|
} else if (this.data.tag == 3) {
|
|
this.data.link_url = 'plugin.commission-activity.api.dividend-list.settlement';
|
|
} else if (this.data.tag == 4) {
|
|
this.data.link_url = 'plugin.commission-activity.api.dividend-list.nowithdraw';
|
|
} else if (this.data.tag == 5) {
|
|
this.data.link_url = 'plugin.commission-activity.api.dividend-list.withdraw';
|
|
} else if (this.data.tag == 6) {
|
|
this.data.link_url = 'plugin.commission-activity.api.dividend-list.failure';
|
|
}
|
|
}
|
|
});
|