const app = getApp()
const httpUtils = require('../../utils/http.js')
const ui = require('../../utils/ui.js')
Page({
  data: {
   list: [],
   deviceid: '',
   roomName: '',
   deviceCode: ''
  },
  onLoad(options) {
    console.log(options)
    this.setData({
      deviceid: options.deviceid,
      roomName: options.roomName,
      deviceCode: options.deviceCode
    })
    this.getList(options.deviceid)
  },
  getList(id){
    let obj = {
      url: '/chargeRecords',
      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')
    });
  }
  
})
