detail.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // pages/ticketRed/detail.js
  2. const utils = require('../../utils/util.js')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. result: '', //详情数据
  9. remark: '', //备注
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. this.getDetail()
  16. },
  17. //详情
  18. getDetail() {
  19. let result = wx.getStorageSync('ticketRedData')
  20. let remark = ''
  21. if (result.remark) {
  22. remark = result.remark
  23. }
  24. this.setData({
  25. result,
  26. remark
  27. })
  28. },
  29. //提交请求
  30. submitData() {
  31. let params = {
  32. mobile: utils.getInfo().mobile,
  33. reqChannel: 5,
  34. oriInvoiceReqFlowNo: this.data.result.invoiceReqFlowNo
  35. }
  36. let remark = utils.trimAll(this.data.remark)
  37. if (remark !== '') {
  38. params.remark = remark
  39. }
  40. utils.axios({
  41. method: 'post',
  42. url: '/sys/hongchongInfo/save',
  43. data: params,
  44. sendBefore() {
  45. wx.showLoading({
  46. title: '快速红冲中...',
  47. mask: true
  48. })
  49. },
  50. complete() {
  51. wx.hideLoading()
  52. },
  53. success: res => {
  54. utils.funPrev(prev => {
  55. prev.toFresh()
  56. })
  57. wx.redirectTo({
  58. url: '/pages/ticketRed/success'
  59. })
  60. }
  61. })
  62. },
  63. //商品详情
  64. toDetail() {
  65. let invoiceReqFlowNo = this.data.result.invoiceReqFlowNo
  66. wx.navigateTo({
  67. url: '/pages/ticketProdetail/ticketProdetail?invoiceReqFlowNo=' + invoiceReqFlowNo
  68. })
  69. },
  70. //获取备注
  71. getRemark(e) {
  72. this.setData({
  73. remark: e.detail.value
  74. })
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面显示
  83. */
  84. onShow: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面隐藏
  88. */
  89. onHide: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面卸载
  93. */
  94. onUnload: function () {
  95. },
  96. /**
  97. * 页面相关事件处理函数--监听用户下拉动作
  98. */
  99. onPullDownRefresh: function () {
  100. },
  101. /**
  102. * 页面上拉触底事件的处理函数
  103. */
  104. onReachBottom: function () {
  105. },
  106. /**
  107. * 用户点击右上角分享
  108. */
  109. onShareAppMessage: function () {
  110. return {
  111. title: '诺信云',
  112. path: '/pages/index/index'
  113. }
  114. }
  115. })