index.js 2.4 KB

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