const util = require('../../../utils/util.js'); const app = getApp(); Page({ data: { options: {}, info: {} }, onLoad(options) { }, onShow() { let pages = getCurrentPages(); let currentPages = pages[pages.length - 1]; let options = currentPages.options; console.log(options) if (app.globalData.userInfo) { this.setData({ options }) this.getCommentInfo() } else { // 静默登录 let that = this util.silentLogin().then(res => { that.setData({ options }) that.getCommentInfo() }) } }, getCommentInfo() { let that = this; util.ajax({ func: "v2/order/detail", data: { orderid: that.data.options.orderid, presellStatus: 0, otype: 0, }, load: false }, function (res) { if (res.code == 0) { if (res.data.subOrders && res.data.subOrders.length > 0) { for (let i = 0; i < res.data.subOrders.length; i++) { const el = res.data.subOrders[i]; if (el.password == that.data.options.password && el.verifyStatus != 1) { wx.showModal({ content: '该订单尚未验票,无法进行反馈', showCancel: false, success(res) { if (res.confirm) { wx.switchTab({ url: '/pages/home/index', }) } } }) break; } } } if (res.data.comment) { res.data.comment.tag = res.data.comment.content.match(/#([^#]+)#/g) ? res.data.comment.content.match(/#([^#]+)#/g).join("") : ''; res.data.comment.content = res.data.comment.content.replace(/#([^#]+)#/g, "").replace(//g, '\n'); if (res.data.comment.additionalComment.content) { res.data.comment.additionalComment.content = res.data.comment.additionalComment.content.replace(//g, '\n') } } that.setData({ info: res.data }) } else { util.showTips(res.reason); } }) }, // 活动评价/修改评价 actEvaluate(e) { wx.navigateTo({ url: '/pages/order/comment/comment?orderid=' + this.data.info.orderid + '&otype=3' }) }, // 修改追评/追加评价 editEvaluate(e) { wx.navigateTo({ url: '/pages/order/addComment/addComment?orderid=' + this.data.info.orderid + '&otype=3' }) }, jumpPage() { wx.navigateTo({ url: '/pages/order/comment/comment?orderid=' + this.data.options.orderid + '&otype=3', }) }, toShow(e) { let link = e.currentTarget.dataset.url; console.log(this.data.info); wx.navigateTo({ url: link, }) } })