index.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. const _my = require("../../../__antmove/api/index.js")(my);
  2. const wx = _my; // pages/audit/index/index.js
  3. import { checkMeeting, checkMeetingInService, checkTurnMeeting, checkContinueMeeting, appointmentDateRecordList } from "../../../utils/api/meeting";
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. type: "",
  11. item: {},
  12. form: {
  13. status: 2
  14. },
  15. statusList: [{
  16. name: "同意",
  17. id: 2
  18. }, {
  19. name: "拒绝",
  20. id: 3
  21. }]
  22. },
  23. getValue(e) {
  24. console.log(e, 9999);
  25. let type = e.currentTarget.dataset.type;
  26. this.setData({
  27. [`form.${type}`]: e.detail
  28. });
  29. console.log(this.data.form);
  30. },
  31. async auditFun() {
  32. console.log(1);
  33. let res = {};
  34. let {
  35. type,
  36. item,
  37. form
  38. } = this.data;
  39. console.log(2);
  40. if (form.status == 3 && !form.refuseReason) {
  41. wx.showToast({
  42. icon: "none",
  43. title: "请填写完整"
  44. });
  45. return;
  46. }
  47. console.log(3);
  48. if (type == "subscribe-audit") {
  49. form.meetingRecordId = item.meetingRecordId;
  50. // console.log(4, form, 'formformformformformformform');
  51. res = await checkMeeting(form);
  52. }
  53. if (type == "order-audit") {
  54. form.meetingInServiceId = item.meetingInServiceId;
  55. res = await checkMeetingInService(form);
  56. }
  57. if (type == "transfer-audit") {
  58. form.meetingTurnRecordId = item.meetingTurnRecordId;
  59. if (form.status == 2) {
  60. res.code = 200;
  61. } else {
  62. res = await checkTurnMeeting(form);
  63. }
  64. }
  65. if (type == "renewalContract-audit") {
  66. form.meetingContinueRecordId = item.meetingContinueRecordId;
  67. res = await checkContinueMeeting(form);
  68. }
  69. if (res.code == 200) {
  70. wx.showToast({
  71. title: "操作成功",
  72. icon: "none",
  73. duration: 800,
  74. mask: true,
  75. success: function () {
  76. if (type == "transfer-audit" && form.status == 2) {
  77. setTimeout(function () {
  78. item.meetingRecordVo.meetingRoomVo.meetingRoomId = item.meetingRecordVo.meetingRoomId;
  79. let itemData = Object.assign(item.meetingRecordVo, item.meetingRecordVo.meetingRoomVo, form);
  80. app.data.meettingInfo = {
  81. type,
  82. itemData: JSON.stringify(itemData),
  83. endDate: itemData.appointmentDate,
  84. subscribeYear: itemData.appointmentDate
  85. }
  86. wx.navigateTo({
  87. url: "/pages/meeting/subscribe/index"
  88. });
  89. }, 800);
  90. } else {
  91. setTimeout(function () {
  92. wx.navigateBack({
  93. delta: 2
  94. });
  95. }, 800);
  96. }
  97. }
  98. });
  99. }
  100. },
  101. /**
  102. * 生命周期函数--监听页面加载 修改1
  103. */
  104. onLoad(options) {
  105. if (app.data.renewalInfo) {
  106. let item = JSON.parse(JSON.stringify(app.data.renewalInfo));
  107. // console.log(item,6666);
  108. app.data.renewalInfo = null;
  109. // let item = JSON.parse(options.item)
  110. this.setData({
  111. type: options.type,
  112. item,
  113. })
  114. }
  115. if (app.data.tranInfo) {
  116. let item = JSON.parse(JSON.stringify(app.data.tranInfo));
  117. // console.log(item,6666);
  118. app.data.tranInfo = null;
  119. // let item = JSON.parse(options.item)
  120. this.setData({
  121. type: options.type,
  122. item,
  123. })
  124. }
  125. if (app.data.orderMealInfo) {
  126. let item = JSON.parse(JSON.stringify(app.data.orderMealInfo));
  127. // console.log(item,6666);
  128. app.data.orderMealInfo = null;
  129. // let item = JSON.parse(options.item)
  130. this.setData({
  131. type: options.type,
  132. item,
  133. })
  134. }
  135. if (app.data.roomContentInfo) {
  136. let item = JSON.parse(JSON.stringify(app.data.roomContentInfo));
  137. // console.log(item,6666);
  138. app.data.roomContentInfo = null;
  139. // let item = JSON.parse(options.item)
  140. this.setData({
  141. type: options.type,
  142. item,
  143. })
  144. }
  145. },
  146. /**
  147. * 生命周期函数--监听页面初次渲染完成
  148. */
  149. onReady() { },
  150. /**
  151. * 生命周期函数--监听页面显示
  152. */
  153. onShow() { },
  154. /**
  155. * 生命周期函数--监听页面隐藏
  156. */
  157. onHide() { },
  158. /**
  159. * 生命周期函数--监听页面卸载
  160. */
  161. onUnload() { },
  162. /**
  163. * 页面相关事件处理函数--监听用户下拉动作
  164. */
  165. onPullDownRefresh() { },
  166. /**
  167. * 页面上拉触底事件的处理函数
  168. */
  169. onReachBottom() { },
  170. /**
  171. * 用户点击右上角分享
  172. */
  173. onShareAppMessage() { },
  174. antmoveAction: function () {
  175. //执行时动态赋值,请勿删除
  176. }
  177. });