weizhang_detail.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. var app = getApp();
  2. const util = require('../../utils/utils.js')
  3. Page({
  4. data: {
  5. detail: [],
  6. order_no: ''
  7. },
  8. onLoad: function (options) {
  9. console.log(options)
  10. my.showLoading({
  11. content: '加载中...',
  12. mask: true
  13. })
  14. app.request('/punishment_order?no=' + options.no, '', 'GET').then(res => {
  15. if (res.status == 200) {
  16. console.log(res)
  17. // this.data.detail = res.data
  18. this.setData({ detail: res.data, order_no: options.no })
  19. }
  20. my.hideLoading({
  21. complete: (res) => { },
  22. })
  23. })
  24. },
  25. pay: util.throttle(function () {
  26. var data = {
  27. no: this.data.order_no
  28. }
  29. app.request('/punishment_order/pay', data, 'POST').then(res => {
  30. if (res.status == 200) {
  31. console.log(res)
  32. my.tradePay({
  33. tradeNO: res.data.tradeNo,
  34. success(resp) {
  35. console.log(resp, 'zhifubao')
  36. if (resp.resultCode == 9000) {
  37. my.showToast({
  38. content: '支付成功',
  39. success: function () {
  40. my.navigateBack()
  41. }
  42. })
  43. } else {
  44. return
  45. }
  46. },
  47. fail(err) {
  48. // console.log(err)
  49. // my.showToast({
  50. // title: '支付失败',
  51. // icon: 'none'
  52. // })
  53. }
  54. })
  55. }
  56. })
  57. }, 2000),
  58. onReady: function () {
  59. },
  60. onShow: function () {
  61. },
  62. onHide: function () {
  63. },
  64. onUnload: function () {
  65. },
  66. onPullDownRefresh: function () {
  67. },
  68. onReachBottom: function () {
  69. },
  70. onShareAppMessage: function () {
  71. }
  72. })