index.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. // pages/meeting/appointmentDetail/index.js
  2. import {
  3. cancellationMeeting,
  4. getMeetingInServiceList,
  5. meetingServiceListSubmit
  6. } from '../../../utils/api/meeting'
  7. const app = getApp();
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. StatusBar: app.globalData.StatusBar, //胶囊按钮位置
  14. CustomBar: app.globalData.CustomBar,
  15. type: '',
  16. item: {},
  17. meetingData: {},
  18. funList: [{
  19. url: '/pages/meeting/renewalContract/index',
  20. name: '会议续约',
  21. status:[1,2],
  22. },
  23. {
  24. url: '/pages/meeting/transfer/index',
  25. name: '会议转让',
  26. status:[1],
  27. },
  28. {
  29. url: '',
  30. name: '取消会议',
  31. status:[1],
  32. },
  33. ],
  34. isShowFun: false,
  35. showPopup: false,
  36. orderMealList: [],
  37. leftList: [],
  38. rightList: [],
  39. projection: false,
  40. aircondition: false,
  41. },
  42. // 是否显示提示框区域
  43. showFun() {
  44. let isShowFun = this.data.isShowFun
  45. this.setData({
  46. isShowFun: !isShowFun
  47. })
  48. },
  49. // 显示服务点单
  50. showPopupFun() {
  51. this.setData({
  52. showPopup: true
  53. })
  54. },
  55. // 关闭服务点单
  56. onClose() {
  57. let {
  58. orderMealList
  59. } = this.data
  60. orderMealList.forEach(item => {
  61. item.isTrue = false
  62. })
  63. this.setData({
  64. showPopup: false,
  65. orderMealList
  66. });
  67. },
  68. // 点餐
  69. getOrde(e) {
  70. let index = e.currentTarget.dataset.index
  71. this.setData({
  72. [`orderMealList[${index}].isTrue`]: !this.data.orderMealList[index].isTrue
  73. })
  74. },
  75. //确定点餐
  76. orderMealFun() {
  77. let {
  78. orderMealList,
  79. item
  80. } = this.data
  81. let data = {
  82. meetingInServiceList: [],
  83. meetingRecordId: item.meetingRecordId
  84. }
  85. orderMealList.forEach(item => {
  86. if (item.isTrue) {
  87. data.meetingInServiceList.push(item.name)
  88. }
  89. })
  90. meetingServiceListSubmit(data).then(res => {
  91. wx.showToast({
  92. title: '点单成功',
  93. icon: 'none',
  94. duration: 1000,
  95. //显示透明蒙层,防止触摸穿透
  96. mask: true,
  97. })
  98. this.onClose()
  99. })
  100. },
  101. // 功能
  102. clickFun(e) {
  103. let data = e.currentTarget.dataset.item
  104. let item = JSON.stringify(this.data.item)
  105. if (data.name == '取消会议') {
  106. this.cancel()
  107. } else {
  108. wx.navigateTo({
  109. url: data.url + '?item=' + item,
  110. })
  111. }
  112. },
  113. // 跳转
  114. gotoFun(e) {
  115. let {
  116. item,
  117. type
  118. } = this.data
  119. let url;
  120. let id = e.currentTarget.dataset.id
  121. if (id == 3) {
  122. // 返回
  123. wx.navigateBack({
  124. delta: 1,
  125. })
  126. } else {
  127. switch (id) {
  128. case '1':
  129. // 审核详情
  130. url = '/pages/audit/deteil/index?item=' + JSON.stringify(item) + '&type=' + type
  131. break;
  132. case '2':
  133. //审核
  134. url = '/pages/audit/index/index?item=' + JSON.stringify(item) + '&type=' + type
  135. break;
  136. case '4':
  137. // 点单
  138. url = '/pages/orderMeal/index/index?item=' + JSON.stringify(item) + '&type=' + type
  139. break;
  140. default:
  141. break;
  142. }
  143. wx.navigateTo({
  144. url
  145. })
  146. }
  147. },
  148. // 取消
  149. cancel() {
  150. wx.showModal({
  151. title: '提示',
  152. content: '确定要取消吗',
  153. complete: (res) => {
  154. if (res.confirm) {
  155. cancellationMeeting({
  156. meetingRecordId: this.data.item.meetingRecordId
  157. }).then(res => {
  158. wx.showToast({
  159. title: '操作成功',
  160. icon: 'none',
  161. duration: 2000,
  162. //显示透明蒙层,防止触摸穿透
  163. mask: true,
  164. success: function () {
  165. setTimeout(function () {
  166. wx.switchTab({
  167. url: '/pages/home/home',
  168. })
  169. }, 1500)
  170. }
  171. })
  172. })
  173. }
  174. }
  175. })
  176. },
  177. // 会议中可提供的服务列表
  178. getMeetingInServiceList() {
  179. getMeetingInServiceList({
  180. meetingRecordId: this.data.item.meetingRecordId
  181. }).then(res => {
  182. let list = []
  183. res.data.forEach(item => {
  184. let data = {}
  185. data.isTrue = false
  186. data.name = item
  187. list.push(data)
  188. })
  189. this.setData({
  190. orderMealList: list
  191. })
  192. })
  193. },
  194. /**
  195. * 生命周期函数--监听页面加载
  196. */
  197. onLoad(options) {
  198. if (options.item) {
  199. let item = JSON.parse(options.item)
  200. this.setData({
  201. type: options.type,
  202. item,
  203. leftList: item.meetingDeskVoList,
  204. rightList: item.meetingDeskOtherSideVoList,
  205. aircondition: item.aircondition,
  206. projection: item.projection,
  207. meetingData: item.meetingRoomVo || item
  208. })
  209. }
  210. if (this.data.type == 'my-meeting' && this.data.item.status == 2) {
  211. this.getMeetingInServiceList()
  212. }
  213. },
  214. /**
  215. * 生命周期函数--监听页面初次渲染完成
  216. */
  217. onReady() {
  218. },
  219. /**
  220. * 生命周期函数--监听页面显示
  221. */
  222. onShow() {
  223. },
  224. /**
  225. * 生命周期函数--监听页面隐藏
  226. */
  227. onHide() {
  228. },
  229. /**
  230. * 生命周期函数--监听页面卸载
  231. */
  232. onUnload() {
  233. },
  234. /**
  235. * 页面相关事件处理函数--监听用户下拉动作
  236. */
  237. onPullDownRefresh() {
  238. },
  239. /**
  240. * 页面上拉触底事件的处理函数
  241. */
  242. onReachBottom() {
  243. },
  244. /**
  245. * 用户点击右上角分享
  246. */
  247. onShareAppMessage() {
  248. }
  249. })