let util = require('../../../../utils/util') let apiArr = require('../../../../api/water_filter') // packages/partner/pages/desk/desk.js Page({ /** * 页面的初始数据 */ data: { show:false, show2:false, banlance:"", maxDate: new Date().getTime(), currentDate:new Date().getTime(), startTime:"", endTime:"", SelectDate:[], totalMony:"", formatter(type, value) { if (type === 'year') { return `${value}年`; } if (type === 'month') { return `${value}月`; } if (type === 'day') { return `${value}日`; } return value; }, }, endTime(){ let that = this that.setData({ show2:true }) }, // getTotalBanlance getTotalBanlance(){ let that = this wx.showLoading({ title: '加载中...', mask:true }) util.postUrl(apiArr.getTotalBanlance,{ pay_time:that.data.SelectDate, dealer_id:wx.getStorageSync('dealer_id') },res=>{ wx.hideLoading() that.setData({ totalMony:res }) }) }, Filter(){ let that = this let date = [] if(that.data.startTime && that.data.endTime){ date.push(that.data.startTime + ' 00:00:00') date.push(that.data.endTime+ ' 23:59:59') }else{ date = [] wx.showToast({ title: '请选择完整日期', icon:"none" }) return } that.setData({ SelectDate:date }) wx.setStorageSync('SelectDate', date) that.getTotalBanlance() }, startTime(){ let that = this that.setData({ show:true }) }, onClose(e){ let that = this that.setData({ show:false }) }, onClose2(e){ let that = this that.setData({ show2:false }) }, onInput(event){ let that = this const date = new Date(event.detail); // 获取选中的 Date 对象 const year = date.getFullYear(); // 获取年份 const month = date.getMonth() + 1; // 获取月份(注意月份从 0 开始,需要 +1) const day = date.getDate(); // 获取日期 const formattedDate = `${year}-${month}-${day}`; that.setData({ startTime:formattedDate, show:false }) }, onInput2(event){ let that = this const date = new Date(event.detail); // 获取选中的 Date 对象 const year = date.getFullYear(); // 获取年份 const month = date.getMonth() + 1; // 获取月份(注意月份从 0 开始,需要 +1) const day = date.getDate(); // 获取日期 const formattedDate = `${year}-${month}-${day}`; that.setData({ endTime:formattedDate, show2:false }) }, income(){ let that= this wx.navigateTo({ url: `../income/income`, }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let that = this that.getTotalBanlance() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })