index.js 7.1 KB

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