index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const app = getApp()
  2. const httpUtils = require('../../utils/http.js')
  3. const ui = require('../../utils/ui.js')
  4. Page({
  5. data: {
  6. list: [],
  7. deviceid: '',
  8. roomName: '',
  9. deviceCode: ''
  10. },
  11. deviceid: '',
  12. roomName: '',
  13. deviceCode: '',
  14. onLoad(options) {
  15. this.deviceid = options.deviceid
  16. this.roomName = options.roomName
  17. this.deviceCode = options.deviceCode
  18. this.setData({
  19. deviceid: options.deviceid,
  20. roomName: options.roomName,
  21. deviceCode: options.deviceCode
  22. })
  23. this.getList(options.deviceid)
  24. },
  25. historyUrl(){
  26. console.log(this)
  27. wx.navigateTo({
  28. url: '/pages/record/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode
  29. })
  30. },
  31. toRecharge(){
  32. wx.navigateTo({
  33. url: '/pages/recharge/index?deviceid=' + this.deviceid
  34. })
  35. },
  36. getList(id){
  37. let obj = {
  38. url: '/api/erp/we/monthBill',
  39. data: {
  40. deviceId: id,
  41. token: wx.getStorageSync('token'),
  42. }
  43. }
  44. httpUtils.request(obj).then(res=>{
  45. console.log(res)
  46. this.setData({
  47. list: res.data.data
  48. })
  49. }).catch(err=>{
  50. console.log('ERROR')
  51. });
  52. }
  53. })