fine_detail.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. wx.showLoading({
  11. title: '加载中...',
  12. mask:true
  13. })
  14. app.request('/punishment_order?no='+options.no, '', 'GET').then(res => {
  15. if (res.statusCode == 200) {
  16. console.log(res)
  17. // this.data.detail = res.data
  18. this.setData({detail:res.data,order_no:options.no})
  19. }
  20. wx.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.statusCode == 200) {
  31. console.log(res)
  32. wx.requestPayment({ //调用微信支付
  33. timeStamp: res.data.timeStamp.toString(),
  34. nonceStr: res.data.nonceStr,
  35. package: res.data.package,
  36. signType: res.data.signType,
  37. paySign: res.data.paySign,
  38. success(resp) {
  39. console.log(resp)
  40. wx.showToast({
  41. title: '支付成功',
  42. success:function(){
  43. wx.navigateBack()
  44. }
  45. })
  46. },
  47. fail(err) {
  48. console.log(err)
  49. wx.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. })