123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- const app = getApp()
- const httpUtils = require('../../utils/http.js')
- const ui = require('../../utils/ui.js')
- Page({
- data: {
- list: []
- },
- onShow(){
- if(wx.getStorageSync('token')){
- this.getList()
- }else{
- wx.switchTab({
- url: '/pages/index/index',
- })
- }
- },
- toUrl(e){
- console.log(e)
- let deviceid = e.currentTarget.dataset.deviceid
- let roomName = e.currentTarget.dataset.roomname
- let deviceCode = e.currentTarget.dataset.devicecode
- let balance = e.currentTarget.dataset.balance
- wx.navigateTo({
- url: '/pages/bill/index?deviceid=' + deviceid + '&roomName=' + roomName + '&deviceCode=' + deviceCode + '&balance=' + balance
- })
- },
- getList(){
- let obj = {
- url: '/roomList',
- data: {
- phone: wx.getStorageSync('phone'),
- token: wx.getStorageSync('token'),
- }
- }
- httpUtils.request(obj).then(res=>{
- console.log(res)
- this.setData({
- list: res.data.data
- })
- }).catch(err=>{
- console.log('ERROR')
- });
- }
-
- })
|