let Parse = getApp().Parse const company = getApp().globalData.company let navigationBarHeight = getApp().globalData.statusBarHeight + 44; Page({ /** * 页面的初始数据 */ data: { roomId: null, comments: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { console.log(options) let roomId = options.id if (!roomId) { wx.navigateTo({ url: `/nova-tourism/pages/index/index` }) } this.setData({ roomId }) this.getComments() }, loadMore() { this.data.loadIndex++ console.log('ddddddddddddd', this.loadIndex) this.getRooms() }, async getComments() { let Order = new Parse.Query('RoomOrder') Order.equalTo("room", this.data.roomId); Order.include("user"); Order.greaterThanOrEqualTo("status", 800); Order.skip((this.data.loadIndex - 1) * 10) Order.ascending('updatedAt') Order.limit(10) let orders = await Order.find() orders = orders.map((order) => { order = order.toJSON() order['time'] = dateServ.formatTime('YY-mm-dd HH:MM',order.updatedAt) return order; }) console.log(orders) orders = this.data.loadIndex == 1 ? orders : this.data.comments.concat(orders) this.setData({ comments: orders }) let commentCount = await Order.count() console.log(commentCount); this.setData({ commentCount }) console.log(this.data.comments); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { } })