index.js 1.9 KB

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