const utils = require('../../utils/util') const app = getApp() Page({ data: { userInfo:{}, currentTab: 0, tabs: [{ name: "昨日" }, { name: "今日" }, { name: "本月" }], statisData:{}, searchParams: { timeType:"oldDay", } }, onShow:function(){ if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ current: 0 // 根据tab的索引值设置 }) } }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, onLoad: function () { this.getStatis(); this.setData({ userInfo: app.globalData.userInfo }) setTimeout(()=>{ this.setData({ animation:true }) },600) }, change(e) { this.setData({ currentTab: e.detail.index }) if(e.detail.index==0){ this.setData({['searchParams.timeType']: "oldDay"}) }else if(e.detail.index==1){ this.setData({['searchParams.timeType']: "day"}) }else if(e.detail.index==2){ this.setData({['searchParams.timeType'] : "month"}) } this.getStatis() }, toRouter(e){ console.log(e) wx.navigateTo({ url: e.currentTarget.dataset.url, }) }, tip(){ utils.toast('功能暂未开放') }, getStatis(){ let that = this; utils.request(utils.api.indexSalesOrderApp, this.data.searchParams, "GET", false, true,app.globalData.token).then((res)=>{ if (res.code == 200) { that.setData({ statisData:res.result }) }else{ util.toast(res.message); } }).catch((res) => {}) } })