index.js 1.9 KB

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