roomService.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="pages">
  3. <Header @change="headerChange">
  4. <template #search>
  5. <u-subsection :list="list" mode="subsection" :current="current" @change="topChange"></u-subsection>
  6. </template>
  7. </Header>
  8. <div class="content">
  9. <div>
  10. <u-collapse>
  11. <u-collapse-item>
  12. <div class="title" slot="title">
  13. <div>
  14. 待服务
  15. </div>
  16. </div>
  17. <div class="content-detail" v-for="(item, index) in dataList.filter(item=> item.status==1)" :class="{'active':item.id==activeId}" :key="index" @click="changeActive(item)">
  18. <div>
  19. <b>{{index+1}}</b>
  20. <b style="margin-left:10px;margin-right:10px;">{{item.roomNo}}</b>
  21. <b>呼叫时间:{{item.createDate}}</b>
  22. </div>
  23. <!-- <div style="margin-left:30px;display:flex;justify-content:space-between;font-size: 12px;">
  24. <div>房型:{{'高级商务大床房'}}/1间</div>
  25. <div>预离时间:{{item.validDate}}</div>
  26. </div> -->
  27. <div style="margin-left:30px;display:flex;justify-content:space-between;font-size: 12px;">
  28. 服务事项:{{item.contentBody}}
  29. </div>
  30. </div>
  31. </u-collapse-item>
  32. <u-collapse-item>
  33. <div class="title" slot="title">
  34. <div>
  35. 已服务
  36. </div>
  37. </div>
  38. <div class="content-detail" v-for="(item, index) in dataList.filter(item=> item.relay==2)" :class="{'active':item.id==activeId}" :key="index" @click="changeActive(item)">
  39. <div>
  40. <b>{{index+1}}</b>
  41. <b style="margin-left:10px;margin-right:10px;">{{item.roomNo}}</b>
  42. <b>呼叫时间:{{item.createDate}}</b>
  43. </div>
  44. <!-- <div style="margin-left:30px;display:flex;justify-content:space-between;font-size: 12px;">
  45. <div>房型:{{'高级商务大床房'}}/1间</div>
  46. <div>预离时间:{{item.validDate}}</div>
  47. </div> -->
  48. <div style="margin-left:30px;display:flex;justify-content:space-between;font-size: 12px;">
  49. 服务事项:{{item.contentBody}}
  50. </div>
  51. </div>
  52. </u-collapse-item>
  53. </u-collapse>
  54. </div>
  55. </div>
  56. <div class="btn">
  57. <u-subsection :list="btnList" mode="subsection" :current="btnCurrent" @change="btnChange"></u-subsection>
  58. </div>
  59. <u-toast ref="uToast"></u-toast>
  60. </view>
  61. </template>
  62. <script>
  63. import Header from '../header.vue'
  64. import {
  65. getRoomServiceList,
  66. cancelRoomService
  67. } from '../../utils/roomService'
  68. import { mapState } from 'vuex'
  69. export default {
  70. components: {
  71. Header
  72. },
  73. data() {
  74. return {
  75. list: ['客房服务', '查房'],
  76. btnList: ['取消服务', '添加账单', '完成服务'],
  77. btnCurrent: 0,
  78. current: 0,
  79. dataList: [],
  80. activeId: '',
  81. activeItem: null,
  82. }
  83. },
  84. computed:{
  85. ...mapState(['hotelId'])
  86. },
  87. mounted() {
  88. // this.getData()
  89. },
  90. methods: {
  91. headerChange(e) {
  92. console.log(e)
  93. this.getData(e)
  94. },
  95. topChange(e) {
  96. console.log(e)
  97. this.current = e
  98. },
  99. getData(hotelId) {
  100. if (this.current == 0) {
  101. getRoomServiceList({
  102. hotelId: hotelId
  103. }).then(res => {
  104. console.log(res);
  105. if (res.code == 200 && res.result.records.length > 0) {
  106. this.dataList = res.result.records
  107. }else{
  108. this.dataList = []
  109. }
  110. })
  111. }
  112. },
  113. changeActive(data) {
  114. console.log(data.id);
  115. this.activeId = data.id
  116. this.activeItem = JSON.parse(JSON.stringify(data))
  117. },
  118. btnChange(e) {
  119. console.log(e)
  120. this.btnCurrent = e
  121. if (e == 0 && this.activeItem) {
  122. this.activeItem.status = 3
  123. cancelRoomService(this.activeItem).then(res => {
  124. console.log(res);
  125. if (res.code == 200) {
  126. this.$refs.uToast.show({
  127. message: '取消成功',
  128. type: 'success',
  129. duration: 2000
  130. })
  131. this.getData(this.hotelId)
  132. }
  133. })
  134. }
  135. if (e == 2 && this.activeItem) {
  136. this.activeItem.status = 2
  137. cancelRoomService(this.activeItem).then(res => {
  138. console.log(res);
  139. if (res.code == 200) {
  140. this.$refs.uToast.show({
  141. message: '设置成功',
  142. type: 'success',
  143. duration: 2000
  144. })
  145. this.getData(this.hotelId)
  146. }
  147. })
  148. }
  149. }
  150. }
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. .pages {
  155. height: 100vh;
  156. width: 100vw;
  157. background-color: #f5f5f5;
  158. }
  159. .content {
  160. margin-top: 10px;
  161. padding: 10px 5px;
  162. background-color: #fff;
  163. .title {
  164. display: flex;
  165. justify-content: space-between;
  166. color: #409EFF;
  167. font-size: 18px;
  168. }
  169. }
  170. .content-detail {
  171. >div {
  172. // display: flex;
  173. // align-items: center;
  174. margin-top: 10px;
  175. }
  176. }
  177. .active {
  178. background: rgb(228, 240, 253);
  179. >b {
  180. font-size: 16px !important;
  181. }
  182. }
  183. </style>