214 lines
4.7 KiB
JavaScript
214 lines
4.7 KiB
JavaScript
// pages/member/presentationRecord/presentationRecord.js
|
|
var app = getApp();
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
enterpriseActiveName: '0',
|
|
status: '3',
|
|
first_list: [],
|
|
total: '',
|
|
current_page: '',
|
|
thismonth: '', // 月份
|
|
lastweek: '', // 周
|
|
yesterday: '', // 昨天
|
|
today: '', // 今天
|
|
page: 1,
|
|
total_page: '', // 总的页数
|
|
isMore: true
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getData(this.data.status);
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
console.log('下拉刷新');
|
|
this.getData(this.data.status);
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
if (this.data.isMore) {
|
|
this.getMoreData(this.data.status);
|
|
} else {
|
|
wx.showToast({
|
|
title: '没有更多了',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
getData(status) {
|
|
console.log(status, '6546566445646564');
|
|
|
|
let json = {
|
|
status: status,
|
|
withdrawal_type: this.options.type,
|
|
page: this.data.page
|
|
};
|
|
let urlStr = app.getNetAddresss('finance.withdraw.withdraw-list');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: json,
|
|
success: (res) => {
|
|
// var data = res.data;
|
|
if (res.result == 1) {
|
|
this.setData({
|
|
total: res.data.total,
|
|
current_page: res.data.current_page,
|
|
today: res.data.today,
|
|
yesterday: res.data.yesterday,
|
|
lastweek: res.data.lastweek,
|
|
thismonth: res.data.thismonth,
|
|
total_page: res.data.last_page
|
|
});
|
|
let arr = res.data.data;
|
|
for (var i = 0; i < arr.length; i++) {
|
|
if (arr[i].status == 0) {
|
|
arr[i].status = '未结算';
|
|
}
|
|
if (arr[i].status == 1) {
|
|
arr[i].status = '已结算';
|
|
}
|
|
if (arr[i].status == -1) {
|
|
arr[i].status = '已失效';
|
|
}
|
|
}
|
|
this.setData({
|
|
first_list: arr
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: res.msg,
|
|
duration: 1500
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
// 加载更多
|
|
getMoreData(status) {
|
|
let page = this.data.page;
|
|
console.log(page, this.data.total_page, '11111');
|
|
|
|
if (page >= this.data.total_page) {
|
|
this.setData({
|
|
isMore: false
|
|
});
|
|
} else {
|
|
page++;
|
|
this.setData({
|
|
page});
|
|
let json = {
|
|
status: status,
|
|
withdrawal_type: this.options.type,
|
|
page: page
|
|
};
|
|
let urlStr = app.getNetAddresss('finance.withdraw.withdraw-list');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: json,
|
|
success: (res) => {
|
|
// var res = res.data;
|
|
if (res.result == 1) {
|
|
this.setData({
|
|
total: res.data.total,
|
|
current_page: res.data.current_page
|
|
});
|
|
|
|
let arr = this.data.first_list.concat(res.data.data);
|
|
for (var i = 0; i < arr.length; i++) {
|
|
if (arr[i].status == 0) {
|
|
arr[i].status = '未结算';
|
|
}
|
|
if (arr[i].status == 1) {
|
|
arr[i].status = '已结算';
|
|
}
|
|
if (arr[i].status == -1) {
|
|
arr[i].status = '已失效';
|
|
}
|
|
}
|
|
this.setData({
|
|
first_list: arr
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: res.msg,
|
|
duration: 1500
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
handleClick(e) {
|
|
console.log(e.detail, '2121154541');
|
|
if (e.detail.index == '2') {
|
|
this.setData({
|
|
status: '0'
|
|
});
|
|
}
|
|
if (e.detail.index == '1') {
|
|
this.setData({
|
|
status: '1'
|
|
});
|
|
}
|
|
if (e.detail.index == '0') {
|
|
this.setData({
|
|
status: '3'
|
|
});
|
|
}
|
|
if (e.detail.index == '3') {
|
|
this.setData({
|
|
status: '-1'
|
|
});
|
|
}
|
|
|
|
this.getData(this.data.status);
|
|
}
|
|
});
|