index.js 751 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. onLoad(options) {
  12. console.log(options)
  13. this.setData({
  14. deviceid: options.deviceid,
  15. roomName: options.roomName,
  16. deviceCode: options.deviceCode
  17. })
  18. this.getList(options.deviceid)
  19. },
  20. getList(id){
  21. let obj = {
  22. url: '/chargeRecords',
  23. data: {
  24. deviceId: id,
  25. token: wx.getStorageSync('token'),
  26. }
  27. }
  28. httpUtils.request(obj).then(res=>{
  29. console.log(res)
  30. this.setData({
  31. list: res.data.data
  32. })
  33. }).catch(err=>{
  34. console.log('ERROR')
  35. });
  36. }
  37. })