jazz
2024-01-04 c4b6a26edbf021e5b6cceeac36febfd1313d4165
提交 | 用户 | age
3ac5f2 1 <!--room-detail.vue-->
J 2 <template>
878885 3   <div class="page flex flex-col">
6da3c1 4     <div class="page_header flex flex-ver">
J 5       <div class="left flex flex-ver" @click="back">
878885 6         <div class="page_logo_1">
J 7           <img class="img" src="static/imgs/logo_1.png">
8         </div>
9         <div class="page_logo_2">
10           <img class="img" src="static/imgs/logo_2.png">
11         </div>
3ac5f2 12       </div>
J 13       <div class="right flex-1 flex flex-jcfe flex-ver">
1d1095 14         <el-button type="primary" icon="el-icon-refresh" class="reset_btn flex flex-center" size="small" style="width: 100px;" @click="resetPage">刷新</el-button>
aeb317 15         <div class="reset_btn flex flex-center" @click="resetStatus">重置房间状态</div>
3ac5f2 16         <div class="page_date">
bb2b08 17           <div class="page_week">{{ timeObj.week }}</div>
J 18           <div class="page_day">{{ timeObj.date }}</div>
3ac5f2 19         </div>
bb2b08 20         <div class="page_time">{{ timeObj.timeMin }}</div>
J 21         <!-- <div class="page_time">{{ timeObj.time }}</div> -->
3ac5f2 22       </div>
J 23     </div>
459990 24     <div class="page_header_placeholer" />
bb2b08 25     <!-- 未有安排 -->
583e10 26     <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (!assignTreatListView || !assignTreatListView.length)" class="page_container flex flex-1">
bb2b08 27       <div class="main flex-1">
6da3c1 28         <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
J 29         <div v-if="roomInfo" class="room_main_tip" style="margin-top: 93px;line-height: 186px;font-size: 140px;">-{{ statusTx[roomInfo.status] }}-</div>
bb2b08 30         <div class="btn_box flex flex-center">
J 31           <div class="flex flex-ver">
6da3c1 32             <div class="btn_box__item flex flex-center white" data-tx="空闲" data-status="0" @click="statusChg">
bb2b08 33               <div class="flex flex-ver">
878885 34                 <div class="icon">
J 35                   <img class="img" src="static/imgs/free.png">
36                 </div>
bb2b08 37                 <div class="tx">空闲</div>
J 38               </div>
39             </div>
6da3c1 40             <div class="btn_box__item flex flex-center blue" data-tx="使用中" data-status="1" @click="statusChg">
bb2b08 41               <div class="flex flex-ver">
878885 42                 <div class="icon">
J 43                   <img class="img" src="static/imgs/using.png">
44                 </div>
bb2b08 45                 <div class="tx white">使用中</div>
J 46               </div>
47             </div>
6da3c1 48             <div class="btn_box__item flex flex-center yellow" data-tx="客人休息" data-status="2" @click="statusChg">
bb2b08 49               <div class="flex flex-ver">
878885 50                 <div class="icon">
J 51                   <img class="img" src="static/imgs/rest.png">
52                 </div>
bb2b08 53                 <div class="tx">客人休息</div>
J 54               </div>
55             </div>
6da3c1 56             <div class="btn_box__item flex flex-center gray" data-tx="通知打扫" data-status="3" @click="statusChg">
bb2b08 57               <div class="flex flex-ver">
878885 58                 <div class="icon">
J 59                   <img class="img" src="static/imgs/clear.png">
60                 </div>
bb2b08 61                 <div class="tx">通知打扫</div>
J 62               </div>
63             </div>
64           </div>
65         </div>
66       </div>
67     </div>
6da3c1 68     <!-- 没有客人和有安排 -->
583e10 69     <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (assignTreatListView && assignTreatListView.length)" class="page_container flex flex-1">
bb2b08 70       <div class="main flex-1">
6da3c1 71         <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
J 72         <div v-if="roomInfo" class="room_main_tip">-{{ statusTx[roomInfo.status] }}-</div>
1d1095 73         <div v-show="roomInfo && roomInfo.status >= 1" class="room_left_btn_box flex flex-ver">
J 74           <div v-show="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow btn_ani" @click="setStatus('客人休息', 2)">客人休息</div>
75           <div v-show="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray btn_ani" @click="setStatus('打扫中', 3)">通知打扫</div>
76           <div v-show="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('打扫中', 3)">通知打扫</div>
77           <div v-show="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('空闲', 0)">结束打扫</div>
bb2b08 78         </div>
J 79       </div>
80       <div class="right">
459990 81         <div class="right_block">
J 82           <XioRoomGuestBox ref="XioRoomGuestBox" :assign-treat-list-view-com="assignTreatListView" @selectCustomer="selectCustomer" />
bb2b08 83         </div>
J 84       </div>
85     </div>
459990 86     <!-- 客人和有安排 over-width -->
583e10 87     <div v-if="occupyInfoViewArr && occupyInfoViewArr.length" class="page_container flex flex-1" :class="[occupyInfoViewArr && occupyInfoViewArr.length>1?'over-width':'']">
J 88       <div class="flex flex-1">
89         <div v-for="(item,index) in occupyInfoViewArr" :key="index" class="main flex-1">
12a2f1 90           <div v-if="occupyInfoViewArr.length>1 && item.treatRoomStatus === 0" class="cancel_icon_block" @click="cancelCustomerItem(item)">
583e10 91             <img class="img" src="static/imgs/cancel.png">
J 92           </div>
93           <XioRoomGuestInfoBox :ref="`XioRoomGuestInfoBox_${item.id}`" :room-info="roomInfo" :occupy-info-view="item" :off-narcosis-ids="offNarcosisIds" @setStatus="setComStatus" />
94         </div>
bb2b08 95       </div>
J 96       <div class="right flex flex-col">
583e10 97         <div v-for="(item,index) in occupyInfoViewArr" :key="index" class="flex-1 right_room_info">
J 98           <XioRoomInfoBlock ref="XioRoomInfoBlock" :occupy-info-view="item" />
bb2b08 99         </div>
583e10 100         <div v-if="occupyInfoViewArr.length<=1" class="flex flex-col" style="border-radius: 10px;">
459990 101           <XioRoomGuestBox ref="XioRoomGuestBox" :assign-treat-list-view-com="assignTreatListView" @selectCustomer="selectCustomer" />
bb2b08 102         </div>
J 103       </div>
104     </div>
aeb317 105     <!-- 选择客人弹窗 -->
J 106     <XioCustomerSelect ref="XioCustomerSelect" @cancel="selectCustomerCancel" @submit="selectCustomerSubmit" />
107     <!-- 更改房间状态窗 -->
108     <XioRoomStatusChg ref="XioRoomStatusChg" @changeStatus="changeStatus" />
1fa546 109     <!-- MIC通知卸麻 -->
583e10 110     <!-- <XioRoomOffNarcosisNotice ref="XioRoomOffNarcosisNotice" @confirm="offNarcosisNoticeConfirm" /> -->
3ac5f2 111   </div>
J 112 </template>
113
114 <script>
6da3c1 115 // 空闲 0
J 116 // 使用中 1
117 // 客人休息 2
118 // 待打扫/通知打扫 3
3ac5f2 119 // import Login from '../utils/jun_login.js'
459990 120 // 房间客人信息
J 121 import XioRoomGuestInfoBox from '@/components/xio_room_guest_info_box'
122 // 房间负责员工信息
123 import XioRoomInfoBlock from '@/components/xio_room_info_block'
124 // 房间客户预约列表信息
125 import XioRoomGuestBox from '@/components/xio_room_guest_box'
aeb317 126 // 选择客人弹窗
bb2b08 127 import XioCustomerSelect from '@/components/xio_customer_select'
aeb317 128 // 更改房间状态窗
J 129 import XioRoomStatusChg from '@/components/xio_room_status_chg'
1fa546 130 // 通知卸麻
583e10 131 // import XioRoomOffNarcosisNotice from '@/components/xio_room_off_narcosis_notice'
6da3c1 132 import Req from '../../utils/jun_httpInstall' // http 请求
1d1095 133 // import xioFn from './utils/xio_fn.js'
6da3c1 134 var isUseDefault = false // 是否已使用默认客人
878885 135 var isUseDefaultChg = 0// 已使用默认客人后房间是否有改变状态
3ac5f2 136 export default {
J 137   name: 'RoomDetail',
bb2b08 138   components: {
459990 139     XioRoomGuestInfoBox,
J 140     XioRoomInfoBlock,
141     XioRoomGuestBox,
aeb317 142     XioCustomerSelect,
583e10 143     XioRoomStatusChg
J 144     // XioRoomOffNarcosisNotice
bb2b08 145   },
3ac5f2 146   inject: ['noop'],
J 147   data() {
148     return {
6da3c1 149       id: this.$route.query.id || '',
J 150       roomInfo: {},
151       occupyInfo: '', // 当前占用人的信息
152       assignTreatList: [],
1d1095 153       statusTx: ['空闲', '使用中', '客人休息', '打扫中', '敷麻中'],
34cb2b 154       timeObj: {}, // week:星期,date:年月日,timeMin:时分,time:时分秒,timeStamp:时间戳
1fa546 155       curTreatId: '',
583e10 156       curTreatIds: '', // 已选中的治疗记录id数组
J 157       offNarcosisIds: [] // 是否已通知卸麻的用户id数组
459990 158       // isShowAppellationName: true // 是否显示称谓
3ac5f2 159     }
J 160   },
161   computed: {
583e10 162     // 当前已选择用户的数组数据
459990 163     occupyInfoViewArr() {
12a2f1 164       if (this.occupyInfo && this.occupyInfo.length) {
J 165         return this.occupyInfoViewArrIdsHandleArr()
459990 166       } else {
12a2f1 167         if (this.curTreatIds && this.curTreatIds.length) {
J 168           return this.getCurTreatArr(this.curTreatIds)
459990 169         } else {
J 170           if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
171             isUseDefault = true
172             this.occupyInfoViewArrIdsHandle(this.assignTreatList[0])
173             return [this.assignTreatList[0]]
174           } else {
175             return ''
176           }
177         }
178       }
179     },
583e10 180     // 当前已选择用户的数据(单个)(暂无用)
6da3c1 181     occupyInfoView() {
583e10 182       // console.log('00000000000000000000000', this.occupyInfo, isUseDefault, isUseDefaultChg)
34cb2b 183       // 有当前选中的,根据需求修改增加选中不更改状态,由空闲开始
J 184       if (this.curTreatId) {
185         return this.gatCurTreatInfo()
6da3c1 186       } else {
34cb2b 187         // 有占用
J 188         if (this.occupyInfo) {
189           return this.occupyInfo
190         // 没有占用
6da3c1 191         } else {
34cb2b 192           // 还没使用默认客人值或者已使用默认客人值还没改变状态(适配轮询)
J 193           if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
c4b6a2 194             // isUseDefault = true
34cb2b 195             return this.assignTreatList[0]
J 196           // 已使用过默认客人值
197           } else {
198             return ''
199           }
6da3c1 200         }
34cb2b 201       }
J 202     },
583e10 203     // 该治疗室用户列表
34cb2b 204     assignTreatListView() {
J 205       if (this.assignTreatList && this.assignTreatList.length) {
206         this.assignTreatList.forEach((o) => {
583e10 207           if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
J 208             this.occupyInfoViewArr.forEach((_o) => {
209               if (_o.id === o.id) {
210                 o.act = true
211               }
212             })
34cb2b 213           }
J 214         })
215         return this.assignTreatList
216       } else {
217         return []
6da3c1 218       }
J 219     }
3ac5f2 220   },
bf4dca 221   activated() {
3ac5f2 222     console.log('roomDetail mounted')
34cb2b 223     // 记录当前的治疗ID
583e10 224     // var curTreatId = localStorage.getItem('curTreatId')
J 225     // 记录当前的治疗记录ID数组
459990 226     var curTreatIds = localStorage.getItem('curTreatIds')
J 227     // 卸麻相关
df74f0 228     var localOffNarcosisIds = localStorage.getItem('offNarcosisIds')
J 229     // 获取是否已通知卸麻数组
230     if (localOffNarcosisIds) {
583e10 231       this.offNarcosisIds = JSON.parse(localOffNarcosisIds)
df74f0 232     } else {
583e10 233       this.offNarcosisIds = []
df74f0 234       this.setLocalStorageOffNarcosisIds()
2471a9 235     }
583e10 236     // 治疗记录ID数组
459990 237     if (curTreatIds) {
J 238       try {
239         this.curTreatIds = JSON.parse(curTreatIds)
240       } catch (error) {
241         this.curTreatIds = ''
242       }
1fa546 243     }
583e10 244     // this.curTreatId = curTreatId || ''
J 245     // 治疗室id
bf4dca 246     this.id = this.$route.query.id || ''
3ac5f2 247     this.init()
J 248   },
bf4dca 249   mounted() {},
3ac5f2 250   destroyed() {
J 251
252   },
253   methods: {
254     init() {
bf4dca 255       // 进入页面先初始化常量标识
J 256       isUseDefault = false
257       isUseDefaultChg = 0
6da3c1 258       // 计时
bb2b08 259       this.countGetTime(this, 'timeObj', 'detail')
6da3c1 260       // 轮询getData,8秒一次
878885 261       this.pollingAjaxFn(this, 'getData', 'detail', 8000)
J 262       // this.getData()
459990 263     },
583e10 264     // 初始默认选择的id数组处理
459990 265     occupyInfoViewArrIdsHandle(item) {
J 266       if (!this.curTreatIds) {
267         this.curTreatIds = []
268       }
269       this.curTreatIds.push(item.id)
270       this.setLocalCurTreatIds()
12a2f1 271     },
J 272     // 初始默认选择的id数组处理
273     occupyInfoViewArrIdsHandleArr() {
274       if (!this.curTreatIds) {
275         this.curTreatIds = []
276       }
277       if (this.occupyInfo && this.occupyInfo.length === 1) {
278         var res = []
279         res.push(this.occupyInfo[0])
280         if (this.curTreatIds && this.curTreatIds.length) {
281           this.curTreatIds = this.curTreatIds.filter((o) => { return o !== this.occupyInfo[0].id })
282           if (this.assignTreatList && this.assignTreatList.length && this.curTreatIds && this.curTreatIds.length) {
283             var curTreatItem = this.assignTreatList.find((o) => { return o.id === this.curTreatIds[0] })
284             if (curTreatItem) {
285               res.push(curTreatItem)
286             }
287           }
288         }
289         this.setLocalCurTreatIds()
290         return res
291       } else if (this.occupyInfo && this.occupyInfo.length > 1) {
292         this.occupyInfo.forEach((o) => {
293           this.curTreatIds.push(o.id)
294         })
295         return this.occupyInfo
296       }
1fa546 297     },
df74f0 298     // 设置已通知卸麻id数组
J 299     setLocalStorageOffNarcosisIds() {
583e10 300       localStorage.setItem('offNarcosisIds', JSON.stringify(this.offNarcosisIds))
df74f0 301     },
1fa546 302     // 卸麻通知确认
583e10 303     // offNarcosisNoticeConfirm() {
J 304     //   if (this.occupyInfoView) {
305     //     if (offNarcosisIds && offNarcosisIds.length) {
306     //       var flag = offNarcosisIds.find((o) => { return o === this.occupyInfoView.userId })
307     //       if (!flag) {
308     //         offNarcosisIds.push(this.occupyInfoView.userId)
309     //       }
310     //     } else if (offNarcosisIds) {
311     //       offNarcosisIds.push(this.occupyInfoView.userId)
312     //     }
313     //     this.setLocalStorageOffNarcosisIds()
314     //   }
315     // },
316     // // 显示通知卸麻弹窗
317     // showOffNarcosisNotice() {
318     //   // 打开弹窗
319     //   this.$refs['XioRoomOffNarcosisNotice'].showDialog()
320     // },
321     // 显示通知卸麻弹窗(多个)
322     showOffNarcosisNoticeMulti(id) {
323       // 打开弹窗,动态的ref对象获取
324       // eslint-disable-next-line no-eval
325       var ref = eval('this.$refs.XioRoomGuestInfoBox_' + id)[0]
326       ref.showOffNarcosisNotice()
1fa546 327     },
J 328     // 点击显示隐藏称谓
459990 329     // tapAppellationHandle() {
J 330     //   this.isShowAppellationName = !this.isShowAppellationName
331     // },
332     // 获取当前治疗信息(数组)
333     getCurTreatArr(ids) {
334       var arr = []
335       if (this.assignTreatList && this.assignTreatList.length) {
336         this.assignTreatList.forEach((o) => {
337           if (ids && ids.length) {
338             ids.forEach((_o) => {
339               if (_o === o.id) {
340                 arr.push(o)
341               }
342             })
343           }
344         })
c4b6a2 345         // 基本不会出现这种情况,但是以防万一,若本地缓存id存在,但对不上列表则缓存第一条数据id
J 346         if (!arr.length) {
347           arr.push(this.assignTreatList[0])
348           this.curTreatIds = []
349           this.curTreatIds.push(this.assignTreatList[0].id)
350           this.setLocalCurTreatIds()
351         }
459990 352       }
J 353       return arr
34cb2b 354     },
J 355     // 获取当前治疗信息
356     gatCurTreatInfo() {
357       if (this.assignTreatList && this.assignTreatList.length) {
1d1095 358         return this.assignTreatList.find((o) => { return o.id === this.curTreatId })
34cb2b 359       }
1d1095 360     },
J 361     // 刷新浏览器页面
362     resetPage() {
363       window.location.reload()
6da3c1 364     },
J 365     // 获取房间详情
366     getData() {
367       var params = {}
368       // 房间id
369       if (this.id) {
370         params.shopRoomId = this.id
371       }
372       Req.http.post({
878885 373         url: 'guide/treat/screen/room/info',
6da3c1 374         data: params,
J 375         udData: { noLoading: true },
376         header: { 'Content-Type': 'application/json' },
377         mockData: {
378           code: 100,
379           msg: '',
878885 380           data: {
J 381             roomInfo: {
382               roomNo: 'xx',
1d1095 383               status: 0 // 0空闲 1使用 2休息 3打扫 4 敷麻中
878885 384             },
459990 385             assignTreatList: [
J 386               {
387                 id: 'a111',
388                 startTime: '2023-12-08 00:00:00',
389                 userName: '黄嘉荣',
390                 gender: 1,
583e10 391                 hempStatus: 2,
459990 392                 ciq: '123',
J 393                 adviserName: 'a君',
394                 aDoctorName: 'b君',
395                 aNurseName: 'c君',
396                 projectName: 'xxxxXXxxx',
397                 userId: '111'
398               },
399               {
400                 id: 'a222',
401                 startTime: '2023-12-08 00:15:00',
402                 userName: '李德华',
403                 gender: 1,
583e10 404                 hempStatus: 2,
459990 405                 ciq: '456',
J 406                 adviserName: 'd君',
407                 aDoctorName: 'e君',
408                 aNurseName: 'f君',
409                 projectName: 'xxxxXXxxx',
410                 userId: '222'
411               },
412               {
413                 id: 'a333',
414                 startTime: '2023-12-08 00:20:00',
415                 userName: '猛学友',
416                 gender: 2,
583e10 417                 hempStatus: 2,
459990 418                 ciq: '789',
J 419                 adviserName: 'g君',
420                 aDoctorName: 'h君',
421                 aNurseName: 'i君',
422                 projectName: 'xxxxXXxxx',
423                 userId: '333'
424               }
425             ],
878885 426             occupyInfo: null
J 427           }
6da3c1 428         }
J 429       }).then((res) => {
430         if (res && res.data) {
cf3e3e 431           if (res.data.assignTreatList && res.data.assignTreatList.length) {
J 432             res.data.assignTreatList.forEach((o) => {
583e10 433               // 治疗时间处理
cf3e3e 434               var st = (o.startTime).split(' ')[1].split(':')
J 435               o.startTime = `${st[0]}:${st[1]}`
583e10 436               // 称谓处理
1fa546 437               o.appellationName = o.userName[0] + `${o.gender ? ['女士', '先生', '女士'][o.gender] : '女士'}`
cf3e3e 438             })
J 439           }
12a2f1 440           if (res.data.occupyInfo && res.data.occupyInfo.length) {
J 441             res.data.occupyInfo.forEach((o) => {
442               // 治疗时间处理
443               var st = (o.startTime).split(' ')[1].split(':')
444               o.startTime = `${st[0]}:${st[1]}`
445               // 称谓处理
446               o.appellationName = o.userName[0] + `${o.gender ? ['女士', '先生', '女士'][o.gender] : '女士'}`
447             })
40660a 448           }
12a2f1 449           res.data.occupyInfo && res.data.occupyInfo.length && (isUseDefaultChg = 1)
J 450           res.data.occupyInfo && res.data.occupyInfo.length && (isUseDefault = 1)
6da3c1 451           for (const key in res.data) {
J 452             this[key] = res.data[key]
453           }
454         }
455         // console.log('999999999999999999999999999', res)
583e10 456         // 卸麻弹窗逻辑
df74f0 457         var offNarcosisTimer = null
J 458         offNarcosisTimer = setTimeout(() => {
583e10 459           console.log('================================>判断卸麻弹窗', this.occupyInfoViewArr, 'offNarcosisIds:', this.offNarcosisIds)
J 460           if (this.occupyInfoViewArr && this.occupyInfoViewArr.length && this.offNarcosisIds) {
461             this.occupyInfoViewArr.forEach((o) => {
462               // 判断改用户是否弹出过卸麻弹窗
463               var flag
464               flag = this.offNarcosisIds.find((_o) => { return _o === o.userId })
465               // 状态2且没有弹出过弹窗
466               if (o.hempStatus === 2 && !flag) {
467                 // 弹出对应id弹窗
468                 this.showOffNarcosisNoticeMulti(o.id)
469               }
470             })
df74f0 471           }
J 472           clearTimeout(offNarcosisTimer)
473           offNarcosisTimer = null
474         }, 500)
6da3c1 475       })
aeb317 476     },
J 477     // 返回
478     back() {
34cb2b 479       // 重置默认已使用客人的参数
cf3e3e 480       isUseDefault = false
878885 481       isUseDefaultChg = 0
6da3c1 482       // 关闭计时
aeb317 483       this.stopCountGetTime('detail')
6da3c1 484       // 关闭轮询
aeb317 485       this.stopPollingAjaxFn('detail')
6da3c1 486       // 返回
bf4dca 487       // console.log('111111111', this.$route.meta.isPush)
J 488       if (this.$route && this.$route.meta && this.$route.meta.isPush) {
489         this.$router.go(-1)
490       } else {
491         this.$router.push({
492           path: `/`
493         })
494       }
6da3c1 495     },
cf3e3e 496     // 未有安排直接状态变更
6da3c1 497     statusChg(e) {
J 498       var { tx, status } = e.currentTarget.dataset
583e10 499       // var { occupyInfoView, roomInfo } = this
J 500       console.log('==========================>没有安排时没有客人直接变更状态', tx, status)
6da3c1 501       // if (roomInfo && status * 1 == roomInfo.status) {
J 502       //   return
503       // }
583e10 504       this.changeStatusFn({}, status, () => {
6da3c1 505         this.getData()
J 506       })
507     },
583e10 508     // 没有客人的按流程设置房间状态
6da3c1 509     setStatus(tx, status) {
583e10 510       // var { occupyInfoView, roomInfo } = this
J 511       console.log('============================>有安排没有客人设置房间状态', tx, status)
512       this.changeStatusFn({}, status, () => {
6da3c1 513         // 刷新详情
J 514         this.getData()
515       })
516     },
583e10 517     // 按流程设置房间状态(组件)
459990 518     setComStatus(opt) {
583e10 519       // var { occupyInfoView, roomInfo } = this
J 520       console.log('============================>客人信息组件点击更改状态', opt.tx, opt.status, opt.item)
521       this.changeStatusFn(opt.item, opt.status, () => {
459990 522         // 刷新详情
J 523         this.getData()
524       })
525     },
cf3e3e 526     // 改变房间状态异步方法
6da3c1 527     changeStatusFn(item = {}, status, cb) {
J 528       var params = {}
529       // 房间id
530       if (this.id) {
531         params.shopRoomId = this.id
532       }
12a2f1 533       // 治疗记录id this.curTreatIds occupyInfoViewArr
J 534       // 1.使用中/敷麻中 敷麻中 2 人占用
535       // 2.使用中/使用中 使用中 2 人占用
536       // 3.使用中/休息中  使用中 1 人占用
537       var arr = JSON.parse(JSON.stringify(this.occupyInfoViewArr))
6da3c1 538       if (item && item.id) {
12a2f1 539         if (arr && arr.length) {
J 540           arr.forEach((o) => {
541             if (o.id === item.id) {
542               o.treatRoomStatus = status * 1
543             }
544           })
545           // 是否有人使用中
546           var status_1 = arr.find((o) => { return o.treatRoomStatus === 1 })
547           // 是否有客人休息
548           var status_2 = arr.find((o) => { return o.treatRoomStatus === 2 })
549           // 是否有人打扫中
550           var status_3 = arr.find((o) => { return o.treatRoomStatus === 3 })
551           // 是否有人敷麻
552           var status_4 = arr.find((o) => { return o.treatRoomStatus === 4 })
553           // 更改的状态 敷麻中 > 使用中 > 休息中 > 待打扫
554           params.status = status * 1
555           if (status_3) {
556             params.status = 3
557           }
558           if (status_2) {
559             params.status = 2
560           }
561           if (status_1) {
562             params.status = 1
563           }
564           if (status_4) {
565             params.status = 4
566           }
567         }
568
569         // 当前选择客户的数组删除客户
570         this.occupyInfoViewArrDataHandle('cancel', item)
571       } else {
572         // 更改的状态
573         params.status = status * 1
6da3c1 574       }
12a2f1 575       params.treatRoomList = []
J 576       if (arr && arr.length) {
577         arr.forEach((o) => {
578           params.treatRoomList.push({
579             treatRecordId: o.id,
580             status: o.treatRoomStatus
581           })
582         })
583       }
584
6da3c1 585       Req.http.post({
878885 586         url: 'guide/treat/screen/room/status/update',
6da3c1 587         data: params,
J 588         header: { 'Content-Type': 'application/json' },
589         mockData: {
590           code: 100,
591           msg: '',
592           data: {}
593         }
594       }).then((res) => {
878885 595         // 在已有默认客人的情况下,改变状态更改标识(适配轮询)
J 596         if (isUseDefault) {
34cb2b 597           console.log('在已有默认客人的情况下,改变状态更改标识')
878885 598           isUseDefaultChg = 1
34cb2b 599         }
d73f98 600         // 只要更改为空闲就重置参数
c4b6a2 601         if (params.status === 0) {
583e10 602           console.log('房间更改为空闲')
34cb2b 603           // 重置默认已使用客人的参数
J 604           isUseDefault = false
605           isUseDefaultChg = 0
459990 606           // this.isShowAppellationName = true
878885 607         }
6da3c1 608         // console.log('8888888888888888888888888888888888', res)
J 609         cb && cb()
610       })
aeb317 611     },
J 612     // 重置状态
613     resetStatus() {
614       // 打开弹窗
615       this.$refs['XioRoomStatusChg'].showDialog()
616     },
cf3e3e 617     // 更改房间状态(重置状态的更改方法)
aeb317 618     changeStatus(opt) {
583e10 619       // var { occupyInfoView, roomInfo } = this
J 620       console.log('============================>重置房间状态', opt.statusTx, opt.status)
6da3c1 621       // if (roomInfo && opt.status * 1 == roomInfo.status) {
J 622       //   return
623       // }
34cb2b 624       // 清除选中医疗记录id
583e10 625       // localStorage.removeItem('curTreatId')
J 626       // this.curTreatId = ''
627       // 清除选中医疗记录ids数组
628       localStorage.removeItem('curTreatIds')
629       this.curTreatIds = ''
630       // 变更房间状态方法
34cb2b 631       this.changeStatusFn({}, opt.status, () => {
6da3c1 632         // 刷新详情
J 633         this.getData()
634         // 关闭弹窗
635         this.$refs['XioRoomStatusChg'].hideDialog()
636       })
aeb317 637     },
J 638     // 选择客户
639     selectCustomer(item = {}) {
34cb2b 640       if (item.act) {
J 641         return
642       }
aeb317 643       // 打开弹窗
J 644       this.$refs['XioCustomerSelect'].showDialog()
6da3c1 645       // 组件客户数据处理
aeb317 646       this.$refs['XioCustomerSelect'].dataInit(item)
J 647     },
648     // 选择客户取消
649     selectCustomerCancel(opt) {
650       console.log('cancel', opt)
651       this.$refs['XioCustomerSelect'].hideDialog()
652     },
653     // 选择客户确定
654     selectCustomerSubmit(opt) {
459990 655       console.log('=======================>submit', opt)
34cb2b 656       // 确定选择的用户,记录id
583e10 657       // localStorage.setItem('curTreatId', opt.id)
J 658       // this.curTreatId = opt.id
659       // 当前选择客户的数组增加客户
660       this.occupyInfoViewArrDataHandle('add', opt)
34cb2b 661       // 重置房间状态
12a2f1 662       // if (this.roomInfo) {
J 663       //   this.changeStatusFn({}, 0, () => {
664       //     // 刷新详情
665       //     this.getData()
666       //   })
667       // }
34cb2b 668       // 关闭弹窗
J 669       this.$refs['XioCustomerSelect'].hideDialog()
583e10 670     },
J 671     // 删除已选择的客户数据
672     cancelCustomerItem(item) {
673       // 当前选择客户的数组删除客户
674       this.occupyInfoViewArrDataHandle('cancel', item, true)
675     },
676     // 当前选择客户的数组增删处理方法
677     occupyInfoViewArrDataHandle(key, item, isReset) {
678       // 增加(选择)
679       if (key === 'add') {
680         // id数组处理
681         if (this.curTreatIds && this.curTreatIds.length) {
682           // 当前治疗记录id没有所选用户的治疗记录id
683           var flag = this.curTreatIds.find((o) => { return o === item.id })
684           if (!flag) {
685             this.curTreatIds.push(item.id)
686           }
687           // 缓存
688           this.setLocalCurTreatIds()
689         }
12a2f1 690         if (this.curTreatIds && !this.curTreatIds.length) {
J 691           this.curTreatIds.push(item.id)
692           // 缓存
693           this.setLocalCurTreatIds()
694         }
583e10 695         // 数组数据处理
J 696         // if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
697         //   this.occupyInfoViewArr.push(item)
698         // }
699       }
700       // 删除
701       if (key === 'cancel') {
702         // id数组处理
703         if (this.curTreatIds && this.curTreatIds.length) {
704           // 深复制
705           var ids = JSON.parse(JSON.stringify(this.curTreatIds))
706           this.curTreatIds = ids.filter((o) => { return o !== item.id })
707           // 缓存
708           this.setLocalCurTreatIds()
709           // 刷新
710           if (isReset) {
711             // 刷新详情
712             this.getData()
713           }
714         }
715         // 数组数据处理
716         // if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
717         //   // 深复制
718         //   var arr = JSON.parse(JSON.stringify(this.occupyInfoViewArr))
719         //   this.occupyInfoViewArr = arr.filter((o) => { o.id !== item.id })
720         // }
721       }
459990 722     },
J 723     // 设置本地缓存ids数组
724     setLocalCurTreatIds() {
725       localStorage.setItem('curTreatIds', JSON.stringify(this.curTreatIds))
3ac5f2 726     }
J 727   }
728 }
729 </script>
cf3e3e 730
J 731 <style>
732 .el-popper.top_tx {
733   text-align: center;
734   font-size: 25px;
735 }
736 </style>
3ac5f2 737
J 738 <style scoped>
878885 739 .page{
J 740   overflow: auto;
741 }
459990 742 .page_header_placeholer {
J 743   height: 100px;
744 }
745 .page_header {
746   position: fixed;
747   top: 0;
748   left: 23px;
749   right: 23px;
750   z-index: 1;
751 }
bb2b08 752 .page_header .reset_btn {
J 753   width: 200px;
754   height: 60px;
755   line-height: 35px;
756   border-radius: 5px;
757   background-color: rgba(47,174,206,1);
758   color: rgba(255,255,255,1);
759   font-size: 24px;
760   text-align: center;
761   font-family: Microsoft Yahei;
6da3c1 762   cursor: pointer;
bf4dca 763   border: 0;
J 764   margin-left: 20px;
459990 765 }
J 766 .page_container.over-width {
767   width: 150%;
bb2b08 768 }
J 769 .page_container .main {
878885 770   /* height: 100%; */
bb2b08 771   border-radius: 10px;
J 772   background-color: rgba(255,255,255,1);
773   color: rgba(16,16,16,1);
774   font-size: 14px;
775   /* text-align: center; */
776   font-family: Roboto;
583e10 777   position: relative;
J 778 }
779 .page_container.over-width .main {
780   margin-right: 50px;
781 }
782 .page_container.over-width .main:last-child {
783   margin-right: 0;
784 }
785 .page_container .main .cancel_icon_block {
786   width: 50px;
787   height: 50px;
788   position: absolute;
789   top: 12px;
790   right: 11px;
791   z-index: 1;
792 }
793 .page_container .main .cancel_icon_block .img {
794   width: 100%;
795   height: 100%;
bb2b08 796 }
J 797 .page_container .main .room_title {
798   line-height: 50px;
799   color: rgba(255,255,255,1);
800   font-size: 36px;
801   text-align: center;
802   font-family: PingFangSC-medium;
803   padding: 10px 0;
804   background-color: rgba(34,123,235,1);
805   width: 400px;
806   margin: 39px auto 0 auto;
807 }
808 .page_container .main .room_main_tip {
809   line-height: 168px;
810   font-size: 120px;
811   color: rgba(46,77,124,1);
812   text-align: center;
813   font-family: PingFangSC-medium;
814   margin-top: 107px;
815   /* font-weight: bold; */
816 }
817 .page_container .main .room_main_tip.gray {
818   color: rgba(154,154,154,1);
819 }
820 .page_container .main .btn_box {
821   margin-top: 130px;
822 }
823 .page_container .main .btn_box__item {
824   width: 250px;
825   height: 120px;
826   border-radius: 10px;
827   box-shadow: 0px 2px 6px 0px rgba(206,206,206,1);
828   margin-right: 70px;
6da3c1 829   cursor: pointer;
bb2b08 830 }
J 831 .page_container .main .btn_box__item:last-child {
832   margin-right: 0;
833 }
834 .page_container .main .btn_box__item.white {
835   background-color: rgba(255,255,255,1);
836 }
837 .page_container .main .btn_box__item.blue {
838   background-color: rgba(46,77,124,1);
839 }
840 .page_container .main .btn_box__item.yellow {
841   background-color: rgba(255,199,115,1);
842 }
843 .page_container .main .btn_box__item.gray {
844   background-color: rgba(206,206,206,1);
845 }
846 .page_container .main .btn_box__item .icon {
847   width: 60px;
848   height: 60px;
849   display: block;
850   margin-right: 17px;
878885 851 }
J 852 .page_container .main .btn_box__item .icon .img {
853   width: 100%;
854   height: 100%;
bb2b08 855 }
J 856 .page_container .main .btn_box__item .tx {
857   line-height: 37px;
858   color: rgba(51,51,51,1);
859   font-size: 26px;
860   text-align: center;
861   font-family: PingFangSC-medium;
862 }
863 .page_container .main .btn_box__item .tx.white {
864   color: rgba(255,255,255,1);
865 }
866 .page_container .main .room_left_btn_box {
867   padding: 0 23px;
868   margin-top: 163px;
869 }
870 .page_container .main .room_left_btn_box__item {
1d1095 871   width: 500px;
J 872   height: 150px;
873   line-height: 73px;
874   border-radius: 10px;
875   font-size: 50px;
876   text-align: center;
877   margin: auto;
878 }
879 .page_container .main .room_left_btn_box__item.flex-1 {
880   width: auto;
bb2b08 881   height: 150px;
J 882   line-height: 58px;
883   border-radius: 10px;
884   font-size: 40px;
885   text-align: center;
886   font-family: Microsoft Yahei;
887   margin-right: 20px;
888   font-weight: bold;
889 }
1d1095 890 /* .page_container .main .room_left_btn_box__item:last-child {
bb2b08 891   margin-right: 0;
1d1095 892 } */
bb2b08 893 .page_container .main .room_left_btn_box__item.yellow {
J 894   color: rgba(255,255,255,1);
895   background-color: rgba(233,157,66,1);
896 }
897 .page_container .main .room_left_btn_box__item.gray {
898   background-color: rgba(206,206,206,1);
899   color: rgba(79,79,79,1);
900 }
901 .page_container .main .room_left_btn_box__item.green {
902   background-color: rgba(47,174,206,1);
903   color: rgba(255,255,255,1);
1d1095 904 }
J 905 .page_container .main .room_left_btn_box__item.b-green {
906   background-color: rgba(79,167,114,1);
907   color: rgba(255,255,255,1);
bb2b08 908 }
J 909 .page_container .main .room_content {
910   margin-top: 30px;
911 }
912 .page_container .main .room_content .tip {
913   line-height: 33px;
914   color: rgba(79,79,79,1);
915   font-size: 24px;
916   text-align: center;
917   font-family: PingFangSC-medium;
918 }
919 .page_container .main .room_content .name {
920   line-height: 168px;
921   color: rgba(51,51,51,1);
922   font-size: 120px;
923   text-align: center;
924   font-family: PingFangSC-medium;
925   margin-top: 13px;
926 }
cf3e3e 927 .page_container .main .room_content .name .tx {
J 928   max-width: 666px;
929   margin: auto;
1fa546 930   text-align: center;
J 931 }
932 .page_container .main .room_content .name_icon {
933   width: 40px;
934   height: 40px;
935   display: block;
936   margin-top: 13px;
937   padding: 20px;
938 }
939 .page_container .main .room_content .name_icon .img {
940   width: 100%;
941   height: 100%;
cf3e3e 942 }
bb2b08 943 .page_container .main .room_content .ciq {
J 944   line-height: 42px;
945   color: rgba(51,51,51,1);
946   font-size: 30px;
947   text-align: center;
948   font-family: PingFangSC-regular;
949   margin-top: -5px;
950 }
951 .page_container .main .room_content .time {
952   line-height: 42px;
953   color: rgba(0,0,0,1);
954   font-size: 30px;
955   text-align: center;
956   font-family: PingFangSC-medium;
957   font-weight: bold;
958   margin-top: 21px;
959 }
960 .page_container .right {
961   width: 686px;
962   margin-left: 30px;
878885 963   /* height: 100%; */
bb2b08 964 }
583e10 965 .page_container.over-width .right_room_info {
J 966   margin-bottom: 58px;
967 }
968 .page_container.over-width .right_room_info:last-child {
969   margin-bottom: 0;
970 }
bb2b08 971 .page_container .right_block {
J 972   width: 100%;
973   height: 100%;
974 }
459990 975 .page_container .right_block .guest_box {
J 976   margin-top: 0;
878885 977   width: 100%;
J 978   height: 100%;
459990 979   -webkit-flex-flow: column;
J 980   flex-flow: column;
981   display: box;
982   display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
983   display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
984   display: -ms-flexbox;      /* TWEENER - IE 10 */
985   display: -webkit-flex;     /* NEW - Chrome */
986   display: -moz-flex;
987   display: -ms-flex;
988   display: -o-flex;
989   display: flex;
bb2b08 990 }
J 991 </style>