1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- const utils = require('../../utils/util')
- const app = getApp()
- Page({
- data: {
- userInfo:{},
- currentTab: 0,
- tabs: [{
- name: "昨日"
- }, {
- name: "今日"
- }, {
- name: "本月"
- }],
- statisData:{},
-
- searchParams: {
- timeType:"oldDay",
- },
- isLogin:false
- },
- 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,
- isLogin:app.globalData.isLogin
- })
- 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){
- if(app.globalData.isLogin){
- wx.navigateTo({
- url: e.currentTarget.dataset.url,
- })
- }else{
- wx.reLaunch({
- url: '/pages/login/index',
- })
- }
- },
- tip(){
- utils.toast('功能暂未开放')
- },
- getStatis(){
- let that = this;
- if(app.globalData.isLogin){
- 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) => {})
- }
- }
- })
|