index.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const Parse = getApp().Parse
  2. const company = getApp().globalData.company
  3. const dateF = require('../../../../utils/date')
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. list: null
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. this.setData({
  16. activeColor:getApp().globalData.activeColor || '#229293'
  17. })
  18. },
  19. async foodorder() {
  20. let uid = Parse.User.current().id
  21. let Foodorder = new Parse.Query("FoodOrder")
  22. Foodorder.equalTo("company", company)
  23. Foodorder.equalTo("user", uid)
  24. Foodorder.include("store")
  25. Foodorder.include("table")
  26. let foodorder = await Foodorder.find()
  27. let listJSON = []
  28. foodorder.forEach(f => {
  29. let a = f.toJSON()
  30. a.time = dateF.formatTime("YYYY-mm-dd HH:MM:SS", a.createdAt)
  31. listJSON.push(a)
  32. })
  33. this.setData({
  34. list: listJSON
  35. })
  36. console.log(this.data.list);
  37. },
  38. details(e) {
  39. let id = e.currentTarget.dataset.item.objectId
  40. wx.navigateTo({
  41. url: "/nova-tourism/pages/my/eat/details/index?id=" + id
  42. })
  43. },
  44. /**
  45. * 生命周期函数--监听页面初次渲染完成
  46. */
  47. onReady: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面显示
  51. */
  52. onShow: function () {
  53. this.foodorder()
  54. },
  55. /**
  56. * 生命周期函数--监听页面隐藏
  57. */
  58. onHide: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面卸载
  62. */
  63. onUnload: function () {
  64. },
  65. /**
  66. * 页面相关事件处理函数--监听用户下拉动作
  67. */
  68. onPullDownRefresh: function () {
  69. },
  70. /**
  71. * 页面上拉触底事件的处理函数
  72. */
  73. onReachBottom: function () {
  74. },
  75. /**
  76. * 用户点击右上角分享
  77. */
  78. onShareAppMessage: function () {
  79. }
  80. })