action.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. const util = require("../../../utils/util");
  2. const api = require('../../../api/api.js');
  3. var app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. isCurent:true,
  10. isShowLeftLine:true,
  11. actions:[],
  12. ticket:{},
  13. myqr_show: false, //显示追加信息框
  14. myqr_blur: 1, //背景模糊值
  15. remark:'',
  16. ticketSn:''
  17. },
  18. goAddContent(){
  19. wx.pageScrollTo({
  20. scrollTop: 0
  21. });
  22. this.setData({
  23. myqr_show:true,
  24. myqr_blur:1
  25. })
  26. },
  27. qrtouchstart: function () {
  28. this.setData({
  29. myqr_blur: 1,
  30. myqr_show: false
  31. });
  32. },
  33. /**
  34. * 生命周期函数--监听页面加载
  35. */
  36. onLoad: function (options) {
  37. let that=this
  38. let ticketSn=options.ticketSn;
  39. that.setData({
  40. ticketSn:ticketSn
  41. })
  42. this.getInfo();
  43. },
  44. getInfo(){
  45. let that=this
  46. wx.showLoading();
  47. util.request(api.ProblemAction, {
  48. ticketSn: that.data.ticketSn
  49. }).then(function (res) {
  50. wx.hideLoading();
  51. console.info(res.data)
  52. if (res.errno === 0) {
  53. that.setData({
  54. actions: res.data.actions,
  55. ticket:res.data.ticket
  56. });
  57. }
  58. });
  59. },
  60. goSaveContent(){
  61. let that=this
  62. if (!that.data.remark) {
  63. wx.showToast({
  64. title: '请输入追加内容',
  65. duration: 3000
  66. });
  67. return;
  68. }
  69. wx.showLoading();
  70. util.request(api.ProblemAddRemark, {
  71. ticketSn: that.data.ticketSn,
  72. remark:that.data.remark
  73. }).then(function (res) {
  74. wx.hideLoading();
  75. if (res.errno === 0) {
  76. that.getInfo();
  77. that.setData({
  78. remark:'',
  79. myqr_blur: 1,
  80. myqr_show: false
  81. })
  82. wx.showToast({
  83. title: '追加成功',
  84. duration: 3000
  85. });
  86. }
  87. });
  88. },
  89. bindRemark(e){
  90. this.setData({
  91. remark: e.detail.value
  92. })
  93. },
  94. /**
  95. * 生命周期函数--监听页面初次渲染完成
  96. */
  97. onReady: function () {
  98. },
  99. /**
  100. * 生命周期函数--监听页面显示
  101. */
  102. onShow: function () {
  103. },
  104. /**
  105. * 生命周期函数--监听页面隐藏
  106. */
  107. onHide: function () {
  108. },
  109. /**
  110. * 生命周期函数--监听页面卸载
  111. */
  112. onUnload: function () {
  113. },
  114. /**
  115. * 页面相关事件处理函数--监听用户下拉动作
  116. */
  117. onPullDownRefresh: function () {
  118. },
  119. /**
  120. * 页面上拉触底事件的处理函数
  121. */
  122. onReachBottom: function () {
  123. },
  124. /**
  125. * 用户点击右上角分享
  126. */
  127. onShareAppMessage: function () {
  128. }
  129. })