const config = require('../../config/config.js') const Http = require('../../utils/HttpBasics.js') const util = require('../../utils/util.js') Page({ /** * 页面的初始数据 */ data: { pageNum: 1, status: -1, //初始值全部 createDateBegin: "", //时间选中 list: [], extraClasses: "drawerBox-transition", indexFlag: -1, tiemIndex: -1, navigationLsit: [{ name: "全部", value: -1 }, { name: "提现中", value: 99 }, { name: "提现成功", value: 98 }, { name: "提现失败", value: 97 }, { name: "提现拒绝", value: 96 }, { name: " 审批中", value: 95 }], tiemLsit: ["1个月", "3个月", "6个月"], }, setTiemLsit() { let arr = this.data.tiemLsit let date = new Date().getFullYear() arr.push(date + "年") arr.push((date - 1) + '年') this.setData({ tiemLsit: arr }) console.log(arr) }, setIndex(e) { let index = e.currentTarget.dataset.index console.log(666, index) this.setData({ indexFlag: index, pageNum:1 }) this.getLsit() }, goXq(e) { let data = e.currentTarget.dataset.item wx.navigateTo({ url: `/pages/withdrawDetails/withdrawDetails?data=${JSON.stringify(data)}`, }) }, getLsit() { let data = { pageNum: this.data.pageNum, pageSize: 5, status: this.data.indexFlag, createDateBegin: this.data.createDateBegin, } Http.get({ url: config.api.withdrawLsit, data: data }).then(res => { res.data.list.map(item => { item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss") }) if (this.data.pageNum == 1) { this.setData({ list: res.data.list }) } else { let temp = this.data.list temp.push(...res.data.list) this.setData({ list: temp }) } wx.stopPullDownRefresh() }) }, setTiemIndex(e) { let index = e.currentTarget.dataset.index let thenDate = new Date() let y = thenDate.getFullYear() let m = thenDate.getMonth() + 1 let d = thenDate.getDate() let sing = "" this.setData({ tiemIndex: index }) if (index == 0) { if (m == 1) { sing = String(y - 1) + "-" + "12" + "-" + String(d) + ' 00:00:00' } else { sing = String(y) + "-" + String(m - 1) + "-" + String(d) + ' 00:00:00' } //一个月 } else if (index <= 1) { //三个月 if (m <= 3) { sing = String(y - 1) + "-" + String(12 + (m - 3)) + "-" + String(d) + ' 00:00:00' } else { sing = String(y) + "-" + String(m - 3) + "-" + String(d) + ' 00:00:00' } } else if (index == 2) { //6个月 if (m <= 6) { sing = String(y - 1) + "-" + String(12 + (m - 6)) + "-" + String(d) + ' 00:00:00' } else { sing = String(y) + "-" + String(m - 6) + "-" + String(d) + ' 00:00:00' } } else if (index == 3) { sing = String(y) + "-" + String(m) + "-" + String(d) + ' 00:00:00' //今年 } else if (index == 4) { sing = String(y - 1) + "-" + String(m) + "-" + String(d) + ' 00:00:00' //去年个月 } this.setData({ createDateBegin: sing }) this.getLsit() console.log(sing, this.data.tiemIndex) }, showScreen() { if (this.data.extraClasses == 'drawerBox-transition drawerBox-moved') { this.setData({ extraClasses: 'drawerBox-transition' }) } else { this.setData({ extraClasses: 'drawerBox-transition drawerBox-moved' }) } }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { this.setTiemLsit() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { this.getLsit() }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { this.setData({ pageNum:1 }) this.getLsit() }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { this.setData({ pageNum: this.data.pageNum + 1 }) this.getLsit() }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { } })