index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. let Parse = getApp().Parse;
  2. const company = getApp().globalData.company
  3. const dateF = require('../../../../../../utils/date')
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. store: null,
  10. list: null,
  11. },
  12. async getShopOrder() {
  13. let Order = new Parse.Query('Order')
  14. Order.equalTo('company', company)
  15. Order.equalTo('store', this.data.store)
  16. Order.include('store')
  17. Order.include('user')
  18. Order.greaterThan('status', '100')
  19. Order.descending('createdAt')
  20. let order = await Order.find()
  21. console.log(order);
  22. let listJSON = []
  23. if (order && order.length > 0) {
  24. order.forEach(c => {
  25. let orders = c.toJSON()
  26. orders.time = dateF.formatTime("YYYY-mm-dd HH:MM:SS", orders.createdAt)
  27. listJSON.push(orders)
  28. })
  29. }
  30. this.setData({
  31. list: listJSON
  32. })
  33. console.log(this.data.list, 111);
  34. },
  35. orderdeils(e) {
  36. let id = e.currentTarget.dataset.item.objectId
  37. console.log(id);
  38. wx.navigateTo({
  39. url: '/nova-tourism/pages/my/merchant/merchant-home/order3-list/order-deils/index?id=' + id,
  40. });
  41. },
  42. /**
  43. * 生命周期函数--监听页面加载
  44. */
  45. onLoad: function (options) {
  46. let store = options.storeId; //用户
  47. console.log(store);
  48. this.setData({ store: store })
  49. this.getShopOrder()
  50. console.log(Parse.User.current().id);
  51. },
  52. /**
  53. * 生命周期函数--监听页面初次渲染完成
  54. */
  55. onReady: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面显示
  59. */
  60. onShow: function () {
  61. this.getShopOrder()
  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. })