index.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. const util = require('../../../utils/util.js');
  2. const app = getApp();
  3. Page({
  4. data: {
  5. options: {},
  6. info: {}
  7. },
  8. onLoad(options) {
  9. },
  10. onShow() {
  11. let pages = getCurrentPages();
  12. let currentPages = pages[pages.length - 1];
  13. let options = currentPages.options;
  14. console.log(options)
  15. if (app.globalData.userInfo) {
  16. this.setData({ options })
  17. this.getCommentInfo()
  18. } else {
  19. // 静默登录
  20. let that = this
  21. util.silentLogin().then(res => {
  22. that.setData({ options })
  23. that.getCommentInfo()
  24. })
  25. }
  26. },
  27. getCommentInfo() {
  28. let that = this;
  29. util.ajax({
  30. func: "v2/order/detail",
  31. data: {
  32. orderid: that.data.options.orderid,
  33. presellStatus: 0,
  34. otype: 0,
  35. },
  36. load: false
  37. }, function (res) {
  38. if (res.code == 0) {
  39. if (res.data.subOrders && res.data.subOrders.length > 0) {
  40. for (let i = 0; i < res.data.subOrders.length; i++) {
  41. const el = res.data.subOrders[i];
  42. if (el.password == that.data.options.password && el.verifyStatus != 1) {
  43. wx.showModal({
  44. content: '该订单尚未验票,无法进行反馈',
  45. showCancel: false,
  46. success(res) {
  47. if (res.confirm) {
  48. wx.switchTab({
  49. url: '/pages/home/index',
  50. })
  51. }
  52. }
  53. })
  54. break;
  55. }
  56. }
  57. }
  58. if (res.data.comment) {
  59. res.data.comment.tag = res.data.comment.content.match(/#([^#]+)#/g) ? res.data.comment.content.match(/#([^#]+)#/g).join("") : '';
  60. res.data.comment.content = res.data.comment.content.replace(/#([^#]+)#/g, "").replace(/<br\/>/g, '\n');
  61. if (res.data.comment.additionalComment.content) {
  62. res.data.comment.additionalComment.content = res.data.comment.additionalComment.content.replace(/<br\/>/g, '\n')
  63. }
  64. }
  65. that.setData({ info: res.data })
  66. } else {
  67. util.showTips(res.reason);
  68. }
  69. })
  70. },
  71. // 活动评价/修改评价
  72. actEvaluate(e) {
  73. wx.navigateTo({
  74. url: '/pages/order/comment/comment?orderid=' + this.data.info.orderid + '&otype=3'
  75. })
  76. },
  77. // 修改追评/追加评价
  78. editEvaluate(e) {
  79. wx.navigateTo({
  80. url: '/pages/order/addComment/addComment?orderid=' + this.data.info.orderid +
  81. '&otype=3'
  82. })
  83. },
  84. jumpPage() {
  85. wx.navigateTo({
  86. url: '/pages/order/comment/comment?orderid=' + this.data.options.orderid + '&otype=3',
  87. })
  88. },
  89. toShow(e) {
  90. let link = e.currentTarget.dataset.url;
  91. console.log(this.data.info);
  92. wx.navigateTo({
  93. url: link,
  94. })
  95. }
  96. })