index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // index.js
  2. let myPro = require("../../utils/wxRequest.js");
  3. let util = require("../../utils/util.js");
  4. Page({
  5. data: {
  6. pageTitle: '支付成功',
  7. showBack: true,
  8. showHeader: false
  9. },
  10. onLoad: function (options) {
  11. // Do some initialize when page load.
  12. let that = this;
  13. that.setData({
  14. order_id: options.order_id
  15. });
  16. },
  17. onShow: function () {
  18. // Do something when page show.
  19. let that = this;
  20. // 获取订单信息
  21. that.getOrderDetail();
  22. },
  23. // 获取订单信息
  24. getOrderDetail(){
  25. let that = this;
  26. let params = {
  27. order_id: that.data.order_id
  28. };
  29. myPro.wxRequest("user/v2/order/detail","GET",params).then(res=>{
  30. that.setData({
  31. orderInfo: res.result
  32. });
  33. }).catch(err=>{
  34. console.log('报错信息',err);
  35. wx.showToast({
  36. title: err,
  37. icon: "none"
  38. });
  39. })
  40. },
  41. // 去订单详情
  42. toOrderDetail(event){
  43. let that = this;
  44. wx.redirectTo({
  45. url: "/pages/user/order/detail/index?order_id="+that.data.order_id
  46. });
  47. },
  48. onReady: function () {
  49. // Do something when page ready.
  50. },
  51. onHide: function () {
  52. // Do something when page hide.
  53. },
  54. onUnload: function () {
  55. // Do something when page close.
  56. },
  57. onPullDownRefresh: function () {
  58. // Do something when pull down.
  59. },
  60. onReachBottom: function () {
  61. // Do something when page reach bottom.
  62. },
  63. onPageScroll: function () {
  64. // Do something when page scroll
  65. },
  66. onResize: function () {
  67. // Do something when page resize
  68. },
  69. });