index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // pages/meeting/renewalContract/index.js
  2. import {
  3. continueMeetingSpan,
  4. continueMeeting
  5. } from '../../../utils/api/meeting'
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. item: {},
  12. startTime: null,
  13. endTime: null,
  14. },
  15. getValue(e) {
  16. let type = e.currentTarget.dataset.type
  17. this.setData({
  18. [`${type}`]: e.detail
  19. });
  20. },
  21. submit() {
  22. let {
  23. continueAppointmentEndTime,
  24. item
  25. } = this.data
  26. if (!continueAppointmentEndTime) {
  27. wx.showToast({
  28. title: '请将内容填写完整',
  29. icon: 'none'
  30. })
  31. return
  32. }
  33. let data = {
  34. continueAppointmentEndTime: continueAppointmentEndTime,
  35. meetingRecordId: item.meetingRecordId
  36. }
  37. wx.requestSubscribeMessage({
  38. tmplIds: ['mJs6TXjIFuwgPu2JOEIpu3lO9ym9rnai-schUPuLuok'],
  39. success(res) {
  40. continueMeeting(data).then(res => {
  41. wx.showToast({
  42. title: '操作成功',
  43. icon: 'none',
  44. duration: 800,
  45. mask: true,
  46. success: function () {
  47. setTimeout(function () {
  48. wx.switchTab({
  49. url: '/pages/home/home',
  50. })
  51. }, 800)
  52. }
  53. })
  54. })
  55. }
  56. })
  57. },
  58. continueMeetingSpan() {
  59. continueMeetingSpan({
  60. meetingRecordId: this.data.item.meetingRecordId
  61. }).then(res => {
  62. this.setData({
  63. startTime: this.data.item.appointmentEndTime,
  64. endTime: res.data.continueAppointmentEndTime,
  65. })
  66. })
  67. },
  68. /**
  69. * 生命周期函数--监听页面加载
  70. */
  71. onLoad(options) {
  72. this.setData({
  73. item: JSON.parse(options.item),
  74. })
  75. this.continueMeetingSpan()
  76. },
  77. /**
  78. * 生命周期函数--监听页面初次渲染完成
  79. */
  80. onReady() {
  81. },
  82. /**
  83. * 生命周期函数--监听页面显示
  84. */
  85. onShow() {
  86. },
  87. /**
  88. * 生命周期函数--监听页面隐藏
  89. */
  90. onHide() {
  91. },
  92. /**
  93. * 生命周期函数--监听页面卸载
  94. */
  95. onUnload() {
  96. },
  97. /**
  98. * 页面相关事件处理函数--监听用户下拉动作
  99. */
  100. onPullDownRefresh() {
  101. },
  102. /**
  103. * 页面上拉触底事件的处理函数
  104. */
  105. onReachBottom() {
  106. },
  107. /**
  108. * 用户点击右上角分享
  109. */
  110. onShareAppMessage() {
  111. }
  112. })