123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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('ShopOrder')
- 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('goods')
- 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)
- 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/setmeal/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 () {
- }
- })
|