You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.5 KiB

// monitor/pages/station/station.js
const Api = require("../../../utils/util.js"),
app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
list:[],
pageNum: 1,
pageSize: 10,
keyWords: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.hideHomeButton()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getList()
},
// 列表
getList: function () {
var that = this
var data = {
current: this.data.pageNum,
size: this.data.pageSize,
condition: this.data.keyWords,
}
wx.showLoading({
title: '加载中...',
})
Api.req('nh/powerStation/findMyPowerStation', data, 'get').then(res => {
wx.stopPullDownRefresh()
wx.hideLoading()
if(res.code== 200){
this.data.loadEnd = res.data.records.length < this.data.pageSize
if (this.data.pageNum == 1) {
this.data.records = res.data.records
} else {
this.data.records = this.data.records.concat(res.data.records)
}
if (!this.data.loadEnd) {
this.data.pageNum++;
}
this.setData({
list: this.data.records,
loadEnd: this.data.loadEnd,
})
}else{
wx.showToast({
title: res.errMsg,
icon: 'none'
})
}
})
},
//搜索
keyWordsSearch: function (e) {
this.setData({
keyWords: e.detail,
pageNum: 1,
list: []
})
this.getList()
},
/** 联系租户 **/
phone(e) {
const phone = e.currentTarget.dataset.phone;
if (!phone) {
wx.showToast({
title: '暂无租户联系方式',
icon: 'none'
})
return
}
wx.makePhoneCall({
phoneNumber: phone,
})
},
//跳转详情
goDetail(e){
var entryId = e.currentTarget.dataset.eid
var code = e.currentTarget.dataset.code
var id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../stationDetail/stationDetail?code=' + code + '&id='+ id +'&eid=' + entryId,
})
},
/** 下拉刷新 **/
onPullDownRefresh(e) {
this.setData({
pageNum: 1,
pageSize: 10,
loadEnd: false,
})
this.getOrder()
this.getNum();
},
/** 页面触底上拉刷新 **/
onReachBottom(e) {
if (!this.data.loadEnd) {
this.getOrder()
} else {
wx.showToast({
title: '暂无更多数据',
icon: 'none',
duration: 500
})
}
},
})