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.
		
		
		
		
		
			
		
			
				
					
					
						
							133 lines
						
					
					
						
							2.9 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							133 lines
						
					
					
						
							2.9 KiB
						
					
					
				
								import {getMyTroubleshootDemand} from "../../../../utils/api"
							 | 
						|
								var global = require('../../../../utils/config')
							 | 
						|
								
							 | 
						|
								const app = getApp()
							 | 
						|
								Page({
							 | 
						|
								    /**
							 | 
						|
								     * 页面的初始数据
							 | 
						|
								     */
							 | 
						|
								    data: {
							 | 
						|
								        tableData:[],
							 | 
						|
								        pageNo:1,
							 | 
						|
								        pageSize:7,
							 | 
						|
								        lowerThreshold:'10',
							 | 
						|
								        loadMoreVisible:false,
							 | 
						|
								        loadMoreType: "none",
							 | 
						|
								        nodata:false
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面加载
							 | 
						|
								     */
							 | 
						|
								    onLoad(options) {
							 | 
						|
								        this.setData({
							 | 
						|
								            satisfactionCategory:options.category,
							 | 
						|
								            inspRecordId:options.inspRecordId,
							 | 
						|
								            createdBy:app.globalData.user.id
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面初次渲染完成
							 | 
						|
								     */
							 | 
						|
								    onReady() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面显示
							 | 
						|
								     */
							 | 
						|
								    onShow() {
							 | 
						|
								      this.setData({
							 | 
						|
								        pageNo:1,
							 | 
						|
								        tableData:[]
							 | 
						|
								      })
							 | 
						|
								      this.getMyTroubleshootDemand()
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面隐藏
							 | 
						|
								     */
							 | 
						|
								    onHide() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面卸载
							 | 
						|
								     */
							 | 
						|
								    onUnload() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面相关事件处理函数--监听用户下拉动作
							 | 
						|
								     */
							 | 
						|
								    onPullDownRefresh() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面上拉触底事件的处理函数
							 | 
						|
								     */
							 | 
						|
								    onReachBottom() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								    onScrollToLower(e){
							 | 
						|
								        if (this.data.loadMoreType === 'more') {
							 | 
						|
								            this.setData({
							 | 
						|
								              loadMoreVisible: true,
							 | 
						|
								            })
							 | 
						|
								            this.data.pageNo += 1
							 | 
						|
								            this.getMyTroubleshootDemand()
							 | 
						|
								          }
							 | 
						|
								    },
							 | 
						|
								    getMyTroubleshootDemand(){
							 | 
						|
								        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,
							 | 
						|
								              })
							 | 
						|
								        })
							 | 
						|
								
							 | 
						|
								      },
							 | 
						|
								    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"?0:1}`,
							 | 
						|
								      })
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								    /**
							 | 
						|
								     * 用户点击右上角分享
							 | 
						|
								     */
							 | 
						|
								    onShareAppMessage() {
							 | 
						|
								
							 | 
						|
								    }
							 | 
						|
								})
							 |