const app = getApp() const httpUtils = require('../../utils/http.js') const ui = require('../../utils/ui.js') Page({ data: { list: [], deviceid: '', roomName: '', deviceCode: '' }, deviceid: '', roomName: '', deviceCode: '', balance: '', onLoad(options) { this.deviceid = options.deviceid this.roomName = options.roomName this.deviceCode = options.deviceCode this.balance = options.balance this.setData({ deviceid: options.deviceid, roomName: options.roomName, deviceCode: options.deviceCode, balance: options.balance }) this.getList(options.deviceid) }, historyUrl(){ console.log(this) wx.navigateTo({ url: '/pages/record/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode }) }, toRecharge(){ wx.navigateTo({ url: '/pages/recharge/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode + '&balance=' + this.balance }) }, getList(id){ let obj = { url: '/monthBill', data: { deviceId: id, token: wx.getStorageSync('token'), } } httpUtils.request(obj).then(res=>{ console.log(res) this.setData({ list: res.data.data }) }).catch(err=>{ console.log('ERROR') }); } })