index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { express } from '../../api/order.js'
  2. import { getProductHot } from '../../api/store.js'
  3. var app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. parameter: {
  10. navbar: '1',
  11. return: '1',
  12. title: '物流信息'
  13. },
  14. orderId: '',
  15. product: {
  16. productInfo: {}
  17. },
  18. orderInfo: {},
  19. expressList: []
  20. },
  21. /**
  22. * 授权回调
  23. */
  24. onLoadFun: function () {
  25. this.getExpress()
  26. this.get_host_product()
  27. },
  28. copyOrderId: function () {
  29. wx.setClipboardData({
  30. data: this.data.orderInfo.delivery_id
  31. })
  32. },
  33. getExpress: function () {
  34. var that = this
  35. express(that.data.orderId).then(function (res) {
  36. var result = res.data.express.result || {}
  37. that.setData({
  38. product: res.data.order.cartInfo[0] || {},
  39. orderInfo: res.data.order,
  40. expressList: result.list || []
  41. })
  42. })
  43. },
  44. /**
  45. * 获取我的推荐
  46. */
  47. get_host_product: function () {
  48. var that = this
  49. var data = {
  50. offset: 1,
  51. limit: 4
  52. }
  53. getProductHot().then(function (res) {
  54. that.setData({
  55. host_product: res.data
  56. })
  57. })
  58. },
  59. /**
  60. * 生命周期函数--监听页面加载
  61. */
  62. onLoad: function (options) {
  63. if (!options.orderId)
  64. return app.Tips({
  65. title: '缺少订单号'
  66. })
  67. this.setData({
  68. orderId: options.orderId
  69. })
  70. },
  71. /**
  72. * 生命周期函数--监听页面初次渲染完成
  73. */
  74. onReady: function () {},
  75. /**
  76. * 生命周期函数--监听页面显示
  77. */
  78. onShow: function () {},
  79. /**
  80. * 生命周期函数--监听页面隐藏
  81. */
  82. onHide: function () {},
  83. /**
  84. * 生命周期函数--监听页面卸载
  85. */
  86. onUnload: function () {},
  87. /**
  88. * 页面相关事件处理函数--监听用户下拉动作
  89. */
  90. onPullDownRefresh: function () {},
  91. /**
  92. * 页面上拉触底事件的处理函数
  93. */
  94. onReachBottom: function () {},
  95. /**
  96. * 用户点击右上角分享
  97. */
  98. onShareAppMessage: function () {}
  99. })