index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 ShopOrder = new Parse.Query('ShopOrder')
  14. ShopOrder.equalTo('company', company)
  15. ShopOrder.equalTo('shopStore', this.data.store)
  16. ShopOrder.include('shopStore')
  17. ShopOrder.include('user')
  18. ShopOrder.greaterThan('status', 100)
  19. ShopOrder.descending('createdAt')
  20. let shopOrder = await ShopOrder.find()
  21. let listJSON = []
  22. if (shopOrder && shopOrder.length > 0) {
  23. shopOrder.forEach(c => {
  24. let order = c.toJSON()
  25. order.time = dateF.formatTime("YYYY-mm-dd HH:MM:SS", order.createdAt)
  26. listJSON.push(order)
  27. })
  28. }
  29. this.setData({
  30. list: listJSON
  31. })
  32. console.log(this.data.list);
  33. },
  34. orderdeils(e) {
  35. let id = e.currentTarget.dataset.item.objectId
  36. console.log(id);
  37. wx.navigateTo({
  38. url: '/nova-tourism/pages/my/merchant/merchant-home/order-list/order-deils/index?id=' + id,
  39. });
  40. },
  41. /**
  42. * 生命周期函数--监听页面加载
  43. */
  44. onLoad: function(options) {
  45. let store = options.storeId; //用户
  46. console.log(store);
  47. this.setData({ store: store })
  48. this.getShopOrder()
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function() {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function() {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function() {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function() {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function() {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function() {
  79. },
  80. /**
  81. * 用户点击右上角分享
  82. */
  83. onShareAppMessage: function() {
  84. }
  85. })