index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. let Parse = getApp().Parse;
  2. const company = getApp().globalData.company
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. list: null,
  9. merchant: null,
  10. id: null,
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. let merchant = wx.getStorageSync('merchant'); //用户
  17. let id = options.id
  18. this.setData({
  19. merchant: merchant,
  20. id: id
  21. })
  22. this.getTableNumber()
  23. },
  24. async getTableNumber() {
  25. let TableNumber = new Parse.Query('TableNumber')
  26. TableNumber.equalTo('store', this.data.id)
  27. TableNumber.equalTo('company', company)
  28. TableNumber.include('store')
  29. let table = await TableNumber.find()
  30. if (table && table.length > 0) {
  31. let listJSON = []
  32. table.forEach(c => {
  33. listJSON.push(c.toJSON())
  34. })
  35. this.setData({
  36. list: listJSON
  37. })
  38. }
  39. console.log(this.data.list);
  40. },
  41. editors() {
  42. wx.navigateTo({
  43. url: '/nova-tourism/pages/my/merchant/merchant-home/tables/editor/index'
  44. });
  45. },
  46. editor(e) {
  47. let id = e.currentTarget.dataset.item.objectId
  48. wx.navigateTo({
  49. url: '/nova-tourism/pages/my/merchant/merchant-home/tables/editor/index?id=' + id
  50. });
  51. },
  52. /**
  53. * 生命周期函数--监听页面初次渲染完成
  54. */
  55. onReady: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面显示
  59. */
  60. onShow: function () {
  61. this.getTableNumber()
  62. },
  63. /**
  64. * 生命周期函数--监听页面隐藏
  65. */
  66. onHide: function () {
  67. },
  68. /**
  69. * 生命周期函数--监听页面卸载
  70. */
  71. onUnload: function () {
  72. },
  73. /**
  74. * 页面相关事件处理函数--监听用户下拉动作
  75. */
  76. onPullDownRefresh: function () {
  77. },
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom: function () {
  82. },
  83. /**
  84. * 用户点击右上角分享
  85. */
  86. onShareAppMessage: function () {
  87. }
  88. })