import {getMyTroubleshootDemand,getMyWaitTroubleshootDemand} from "../../../../utils/api" var global = require('../../../../utils/config') const app = getApp() Page({ /** * 页面的初始数据 */ data: { active:0, tableData:[], tableData1:[], pageNo:1, pageSize:8, lowerThreshold:'10', loadMoreVisible:false, loadMoreType: "none", nodata:false, checkResultFlag:0, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ satisfactionCategory:options.category, inspRecordId:options.inspRecordId, createdBy:app.globalData.user.id }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.setData({ pageNo:1, tableData:[], tableData1:[] }) this.getMyWaitTroubleshootDemandList() }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, onScrollToLower(e){ if (this.data.loadMoreType === 'more') { this.setData({ loadMoreVisible: true, }) this.data.pageNo += 1 // 待我处理 if(this.data.checkResultFlag===0){ this.getMyWaitTroubleshootDemandList() } // 我上报的 if(this.data.checkResultFlag===1){ this.getMyTroubleshootDemandList() } } }, getMyTroubleshootDemandList(){ this.setData({ loadMoreVisible: true, nodata: false, loadMoreType: "more", }) let parm = { pageNo:this.data.pageNo, pageSize:this.data.pageSize } if(!parm.type) delete parm.type getMyTroubleshootDemand(parm).then(res=>{ this.setData({ loadMoreType: res.data.list.length === this.data.pageSize ? 'more' : 'none', tableData: this.data.tableData.concat(res.data.list), }) if (this.data.tableData.length == 0) { this.setData({ loadMoreVisible: false, nodata: true }) } }).catch(err=>{ console.log(err); this.setData({ loadMoreVisible: false, nodata: true, }) }) }, getMyWaitTroubleshootDemandList(){ this.setData({ loadMoreVisible: true, nodata: false, loadMoreType: "more", }) let parm = { pageNo:this.data.pageNo, pageSize:this.data.pageSize } if(!parm.type) delete parm.type getMyWaitTroubleshootDemand(parm).then(res=>{ this.setData({ loadMoreType: res.data.list.length === this.data.pageSize ? 'more' : 'none', tableData1: this.data.tableData.concat(res.data.list), }) if (this.data.tableData1.length == 0) { this.setData({ loadMoreVisible: false, nodata: true }) } }).catch(err=>{ console.log(err); this.setData({ loadMoreVisible: false, nodata: true, }) }) }, handleClickPhone(e){ wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.mobile, }) }, toDetail(e){ console.log(e); wx.navigateTo({ url: `/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck?id=${e.currentTarget.dataset.item.id}&type=${(e.currentTarget.dataset.item.type==="event" || e.currentTarget.dataset.item.type==="chengguan")?0:1}`, }) }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, toggleColor(e) { const let1 =e.detail.index this.setData({ tableData:[], tableData1:[], checkResultFlag:let1, pageNo: 1, pageSize:20, }) this.getList() this.setData({ active:let1 }) }, getList() { this.setData({ loadMoreVisible: true, nodata: false, loadMoreType: "more", }); // 待我处理 if(this.data.checkResultFlag===0){ this.getMyWaitTroubleshootDemandList() } // 我上报的 if(this.data.checkResultFlag===1){ this.getMyTroubleshootDemandList() } }, })