const Parse = getApp().Parse; const company = getApp().globalData.company; const dateServ = require('../../../../../../utils/date') Page({ /** * 页面的初始数据 */ data: { active: "noreply", orders: [], loadIndex:1, storeId:'' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let merchant = wx.getStorageSync('merchant') let merchantId = merchant.objectId; let Store = new Parse.Query('ShopStore') Store.notEqualTo('isDeleted', "true") Store.equalTo('company', company) Store.equalTo('user', merchantId) Store.first().then(store =>{ this.setData({ storeId:store.id }) this.getOrders() }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, async getOrders(replyStatus){ let Order = new Parse.Query('RoomOrder') Order.equalTo('company', company) Order.equalTo('status', 800) Order.equalTo('shopStore', this.data.storeId) if(replyStatus == 'replied'){ Order.exists('reply') }else { Order.doesNotExist('reply') } Order.include('user') Order.include('room') Order.descending('updatedAt') Order.skip((this.data.loadIndex - 1) * 10) 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) order['day'] = parseInt((new Date(order.endTime.iso).getTime() - new Date(order.startTime.iso).getTime()) / (1000 * 60 * 60 * 24)); order.startTime = dateServ.formatTime('mm月dd日',order.startTime.iso) order.endTime = dateServ.formatTime('mm月dd日',order.endTime.iso) return order; }) orders = this.data.loadIndex == 1 ? orders : this.data.orders.concat(orders) console.log(orders) this.setData({ orders }) }, details(event){ let orderId = event.currentTarget.dataset.id wx.navigateTo({ url: `/nova-tourism/pages/my/merchant/comments/hotel/comment-detail/index?id=${orderId}` }) }, tabChange(event) { this.data.active = event.detail.name this.data.loadIndex = 1 console.log(this.data.active) this.getOrders(event.detail.name) }, loadMore() { this.data.loadIndex++ console.log('ddddddddddddd', this.data.loadIndex) this.getOrders() }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.selectComponent("#tabs").resize() }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })