// subpages/communitySelfInsp/pages/dissatisfactionDetails/dissatisfactionDetails.js import {getInspResult} from "../../../../utils/api" Page({ /** * 页面的初始数据 */ data: { tableData:[], pageNo:1, pageSize:20, lowerThreshold:'10', loadMoreVisible:false, loadMoreType: "none", nodata:false }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options); this.setData({ satisfactionCategory:options.category, inspRecordId:options.inspRecordId }) this.getInspResult() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, onScrollToLower(e){ if (this.data.loadMoreType === 'more') { this.setData({ loadMoreVisible: true, }) this.data.pageNo += 1 this.getInspResult() } }, getInspResult(){ this.setData({ loadMoreVisible: true, nodata: false, loadMoreType: "more", }) let parm = { inspRecordId:this.data.inspRecordId, satisfactionCategory:this.data.satisfactionCategory, satisfactionLevel:'bad', pageNo:this.data.pageNo, pageSize:this.data.pageSize } if(!parm.type) delete parm.type getInspResult(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, }) }) }, handleClickPhone(e){ wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.mobile, }) }, toFollowUpDetails(e){ wx.navigateTo({ url: `/subpages/communitySelfInsp/pages/followUpDetail/followUpDetail?resiInfo=${JSON.stringify(e.currentTarget.dataset.item)}&type=add`, }) }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })