index.js 2.3 KB

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