index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. let Parse = getApp().Parse;
  2. const dateF = require('../../../../../utils/date')
  3. const company = getApp().globalData.company
  4. let navigationBarHeight = getApp().globalData.statusBarHeight + 44;
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. roomId: null,
  11. comments: []
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function(options) {
  17. console.log(options)
  18. let roomId = options.id
  19. if (!roomId) {
  20. wx.navigateTo({
  21. url: `/nova-tourism/pages/index/index`
  22. })
  23. }
  24. this.setData({ roomId })
  25. this.getComments()
  26. },
  27. async getComments() {
  28. let Order = new Parse.Query('ShopOrder')
  29. Order.equalTo("shopStore", this.data.roomId);
  30. Order.include("user");
  31. Order.include("goods");
  32. Order.greaterThanOrEqualTo("status", 800);
  33. Order.skip((this.data.loadIndex - 1) * 10)
  34. Order.ascending('updatedAt')
  35. Order.limit(10)
  36. Order.find().then(res => {
  37. let comments = []
  38. res.forEach(item => {
  39. let activitys = item.toJSON()
  40. activitys.orderTime = dateF.formatTime("YYYY-mm-dd HH:MM:SS", activitys.goods.updatedAt)
  41. comments.push(activitys)
  42. })
  43. this.setData({
  44. comments
  45. }),
  46. console.log(this.data.comments)
  47. })
  48. },
  49. /**
  50. * 生命周期函数--监听页面初次渲染完成
  51. */
  52. onReady: function() {
  53. },
  54. /**
  55. * 生命周期函数--监听页面显示
  56. */
  57. onShow: function() {
  58. },
  59. /**
  60. * 生命周期函数--监听页面隐藏
  61. */
  62. onHide: function() {
  63. },
  64. /**
  65. * 生命周期函数--监听页面卸载
  66. */
  67. onUnload: function() {
  68. },
  69. /**
  70. * 页面相关事件处理函数--监听用户下拉动作
  71. */
  72. onPullDownRefresh: function() {
  73. },
  74. /**
  75. * 页面上拉触底事件的处理函数
  76. */
  77. onReachBottom: function() {
  78. },
  79. /**
  80. * 用户点击右上角分享
  81. */
  82. onShareAppMessage: function() {
  83. }
  84. })