const math = require('../../../utils/math') const event = require('../../../utils/event') const app = getApp() Component({ options: { addGlobalClass: true, multipleSlots: true }, /** 页面的初始数据 */ data: { firstShow: false, height: app.globalData.safeFragmentHeight - 100, banlanceInfo: {accountMoney: 0, frozenMoney: 0} }, 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.safeFragmentHeight - 100, customHeight: app.globalData.customHeight, customWidth: app.globalData.Custom.left, StatusBar: app.globalData.StatusBar || 40, }) } // 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){ }, agentList: function (e) { } } })