const math = require('../../../utils/math') const event = require('../../../utils/event') const app = getApp() Component({ options: { addGlobalClass: true, multipleSlots: true }, /** 页面的初始数据 */ data: { firstShow: false, userInfo: null, menuList: [ {url: '/pages/home/factory-list/index', text: '在线对账', icon: '/assets/image/reconciliation-icon.png'} ], tabIndex: 0, tabList: [ {id: 0, name: '全部', badge: 0, status: '' }, {id: 1, name: '待预约', badge: 0, status: 1 }, {id: 2, name: '待上传', badge: 0, status: 2 }, {id: 3, name: '待审核', badge: 0, status: 3 }, {id: 3, name: '待结算', badge: 0, status: 3 }, {id: 3, name: '已完成', badge: 0, status: 3 } ] }, lifetimes: { attached: function () { event.on('EventMessage', this, this.onEvent) }, detached: function () { event.remove('EventMessage', this) } }, methods: { onRestart: function () { if(!this.data.firstShow) { this.setData({height: app.globalData.windowHeight - app.globalData.safeBottom - 100, userInfo: app.userInfo }) } // this.fetchStatisticsInfo() this.data.firstShow = true }, onEvent: function (message) { if (message.what == 888) { } }, fetchStatisticsInfo: function(loading){ getBalanceInfo().then(result => { if(result.data){ result.data.accountMoney = math.minus(result.data.accountMoney, result.data.frozenMoney) this.setData({ banlanceInfo: result.data }) } if(loading){ wx.hideLoading() } }).catch(err => { if(loading){ wx.hideLoading() } }) }, menuClick: function(e){ } } })