index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. id: "",
  10. order: null,
  11. orderTime: null,
  12. },
  13. async getShopOrder() {
  14. let id = this.data.id
  15. console.log(id);
  16. let ShopOrder = new Parse.Query('ShopOrder')
  17. ShopOrder.include('goods')
  18. ShopOrder.include('shopStore')
  19. let shopOrder = await ShopOrder.get(id)
  20. let orderTime = dateF.formatTime("YYYY-mm-dd HH:MM:SS", shopOrder.createdAt)
  21. this.setData({
  22. order: shopOrder.toJSON(),
  23. orderTime: orderTime
  24. })
  25. console.log(this.data.order);
  26. },
  27. async submit() {
  28. let id = this.data.id
  29. let shopOrder
  30. let ShopOrder = new Parse.Query("ShopOrder")
  31. shopOrder = await ShopOrder.get(id)
  32. shopOrder.set("status", 400)
  33. shopOrder.save().then(res => {
  34. console.log(res)
  35. wx.showToast({
  36. title: '核销成功',
  37. icon: 'none'
  38. })
  39. })
  40. wx.navigateBack({
  41. delta: 1,
  42. });
  43. },
  44. /**
  45. * 生命周期函数--监听页面加载
  46. */
  47. onLoad: function(options) {
  48. let id = options.id
  49. this.setData({ id: id })
  50. this.getShopOrder()
  51. },
  52. /**
  53. * 生命周期函数--监听页面初次渲染完成
  54. */
  55. onReady: function() {
  56. },
  57. /**
  58. * 生命周期函数--监听页面显示
  59. */
  60. onShow: function() {
  61. },
  62. /**
  63. * 生命周期函数--监听页面隐藏
  64. */
  65. onHide: function() {
  66. },
  67. /**
  68. * 生命周期函数--监听页面卸载
  69. */
  70. onUnload: function() {
  71. },
  72. /**
  73. * 页面相关事件处理函数--监听用户下拉动作
  74. */
  75. onPullDownRefresh: function() {
  76. },
  77. /**
  78. * 页面上拉触底事件的处理函数
  79. */
  80. onReachBottom: function() {
  81. },
  82. /**
  83. * 用户点击右上角分享
  84. */
  85. onShareAppMessage: function() {
  86. }
  87. })