index.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. // pages/meeting/appointmentDetail/index.js
  2. import {
  3. cancellationMeeting,
  4. getMeetingInServiceList,
  5. meetingServiceListSubmit,appointmentDateRecordList
  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. nextMeetingStartTime:null,
  42. },
  43. // 是否显示提示框区域
  44. showFun() {
  45. let isShowFun = this.data.isShowFun
  46. this.setData({
  47. isShowFun: !isShowFun
  48. })
  49. },
  50. // 显示服务点单
  51. showPopupFun() {
  52. this.setData({
  53. showPopup: true
  54. })
  55. },
  56. // 关闭服务点单
  57. onClose() {
  58. let {
  59. orderMealList
  60. } = this.data
  61. orderMealList.forEach(item => {
  62. item.isTrue = false
  63. })
  64. this.setData({
  65. showPopup: false,
  66. orderMealList
  67. });
  68. },
  69. // 点餐
  70. getOrde(e) {
  71. let index = e.currentTarget.dataset.index
  72. this.setData({
  73. [`orderMealList[${index}].isTrue`]: !this.data.orderMealList[index].isTrue
  74. })
  75. },
  76. //确定点餐
  77. orderMealFun() {
  78. let {
  79. orderMealList,
  80. item
  81. } = this.data
  82. let data = {
  83. meetingInServiceList: [],
  84. meetingRecordId: item.meetingRecordId
  85. }
  86. orderMealList.forEach(item => {
  87. if (item.isTrue) {
  88. data.meetingInServiceList.push(item.name)
  89. }
  90. })
  91. if(data.meetingInServiceList.length<=0){
  92. wx.showToast({
  93. title: '请选择服务项',
  94. icon: 'none',
  95. })
  96. return
  97. }
  98. meetingServiceListSubmit(data).then(res => {
  99. wx.showToast({
  100. title: '点单成功',
  101. icon: 'none',
  102. duration: 1000,
  103. //显示透明蒙层,防止触摸穿透
  104. mask: true,
  105. })
  106. this.onClose()
  107. })
  108. },
  109. // 功能
  110. clickFun(e) {
  111. let data = e.currentTarget.dataset.item
  112. let item = JSON.stringify(this.data.item)
  113. if (data.name == '取消会议') {
  114. this.cancel()
  115. } else {
  116. wx.navigateTo({
  117. url: data.url + '?item=' + item,
  118. })
  119. }
  120. },
  121. // 跳转
  122. gotoFun(e) {
  123. let {
  124. item,
  125. type
  126. } = this.data
  127. let url;
  128. let id = e.currentTarget.dataset.id
  129. if (id == 3) {
  130. // 返回
  131. wx.navigateBack({
  132. delta: 1,
  133. })
  134. } else {
  135. switch (id) {
  136. case '1':
  137. // 审核详情
  138. url = '/pages/audit/deteil/index?item=' + JSON.stringify(item) + '&type=' + type
  139. break;
  140. case '2':
  141. //审核
  142. url = '/pages/audit/index/index?item=' + JSON.stringify(item) + '&type=' + type
  143. break;
  144. case '4':
  145. // 点单
  146. url = '/pages/orderMeal/index/index?item=' + JSON.stringify(item) + '&type=' + type
  147. break;
  148. default:
  149. break;
  150. }
  151. wx.navigateTo({
  152. url
  153. })
  154. }
  155. },
  156. // 取消
  157. cancel() {
  158. wx.showModal({
  159. title: '提示',
  160. content: '确定要取消吗',
  161. complete: (res) => {
  162. if (res.confirm) {
  163. cancellationMeeting({
  164. meetingRecordId: this.data.item.meetingRecordId
  165. }).then(res => {
  166. wx.showToast({
  167. title: '操作成功',
  168. icon: 'none',
  169. duration: 2000,
  170. //显示透明蒙层,防止触摸穿透
  171. mask: true,
  172. success: function () {
  173. setTimeout(function () {
  174. wx.switchTab({
  175. url: '/pages/home/home',
  176. })
  177. }, 1500)
  178. }
  179. })
  180. })
  181. }
  182. }
  183. })
  184. },
  185. // 会议中可提供的服务列表
  186. getMeetingInServiceList() {
  187. getMeetingInServiceList({
  188. meetingRecordId: this.data.item.meetingRecordId
  189. }).then(res => {
  190. let list = []
  191. res.data.forEach(item => {
  192. let data = {}
  193. data.isTrue = false
  194. data.name = item
  195. list.push(data)
  196. })
  197. this.setData({
  198. orderMealList: list
  199. })
  200. })
  201. },
  202. // 本会议室预约的会议列表
  203. appointmentDateRecordList() {
  204. let item = this.data.item
  205. let data = {
  206. appointmentDate:item.appointmentDate,
  207. meetingRoomId: item.meetingRoomId
  208. }
  209. appointmentDateRecordList(data).then(res => {
  210. let index = res.data.findIndex(data=>{
  211. return data.appointmentStartTime ==item.appointmentStartTime
  212. })
  213. if(index+1>=res.data.length){
  214. this.setData({
  215. nextMeetingStartTime:null
  216. })
  217. }else if(index>-1){
  218. this.setData({
  219. nextMeetingStartTime:res.data[index+1].appointmentStartTime
  220. })
  221. }
  222. console.log(index);
  223. })
  224. },
  225. /**
  226. * 生命周期函数--监听页面加载
  227. */
  228. onLoad(options) {
  229. if (options.item) {
  230. let item = JSON.parse(options.item)
  231. this.setData({
  232. type: options.type,
  233. item,
  234. leftList: item.meetingDeskVoList,
  235. rightList: item.meetingDeskOtherSideVoList,
  236. aircondition: item.aircondition,
  237. projection: item.projection,
  238. meetingData: item.meetingRoomVo || item
  239. })
  240. }
  241. console.log(this.data.type);
  242. console.log(this.data.item);
  243. if (this.data.type == 'my-meeting'){
  244. this.appointmentDateRecordList()
  245. }
  246. if (this.data.type == 'my-meeting' && this.data.item.status == 2) {
  247. this.getMeetingInServiceList()
  248. }
  249. },
  250. /**
  251. * 生命周期函数--监听页面初次渲染完成
  252. */
  253. onReady() {
  254. },
  255. /**
  256. * 生命周期函数--监听页面显示
  257. */
  258. onShow() {
  259. },
  260. /**
  261. * 生命周期函数--监听页面隐藏
  262. */
  263. onHide() {
  264. },
  265. /**
  266. * 生命周期函数--监听页面卸载
  267. */
  268. onUnload() {
  269. },
  270. /**
  271. * 页面相关事件处理函数--监听用户下拉动作
  272. */
  273. onPullDownRefresh() {
  274. },
  275. /**
  276. * 页面上拉触底事件的处理函数
  277. */
  278. onReachBottom() {
  279. },
  280. /**
  281. * 用户点击右上角分享
  282. */
  283. onShareAppMessage() {
  284. }
  285. })