checkin.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view>
  3. <view class="" v-if="Object.keys(checkinInfo).length>0">
  4. <uni-card :title="checkinInfo.hotelName" extra="入住信息" note="Tips">
  5. <view class="card-item" v-if="checkinInfo.building">
  6. <view class="card-item-left">
  7. <text>楼栋:</text>
  8. </view>
  9. <text>{{checkinInfo.building}}</text>
  10. </view>
  11. <view class="card-item">
  12. <view class="card-item-left">
  13. <text>楼层:</text>
  14. </view>
  15. <text>{{checkinInfo.floor}}</text>
  16. </view>
  17. <view class="card-item">
  18. <view class="card-item-left">
  19. <text>房间:</text>
  20. </view>
  21. <text>{{checkinInfo.room}}</text>
  22. </view>
  23. <view class="card-item">
  24. <view class="card-item-left">
  25. <text>起始时间:</text>
  26. </view>
  27. <text>{{checkinInfo.startTime}}\n</text>
  28. </view>
  29. <view class="card-item">
  30. <view class="card-item-left">
  31. <text>结束时间:</text>
  32. </view>
  33. <text>{{checkinInfo.endTime}}</text>
  34. </view>
  35. </uni-card>
  36. </view>
  37. <view class="has-reservation" v-else-if="reservation && Object.keys(reservation).length">
  38. <uni-card :title="reservation.hotelName" extra="订房信息" note="Tips">
  39. <view class="card-item" v-if="reservation.building">
  40. <view class="card-item-left">
  41. <u-text :text="buildingTip" align="center"></u-text>
  42. </view>
  43. <text>{{reservation.building}}</text>
  44. </view>
  45. <view class="card-item">
  46. <view class="card-item-left">
  47. <u-text :text="floorTip" align="center"></u-text>
  48. </view>
  49. <text>{{reservation.floor}}</text>
  50. </view>
  51. <view class="card-item">
  52. <view class="card-item-left">
  53. <u-text :text="roomTip" align="center"></u-text>
  54. </view>
  55. <text>{{reservation.room}}</text>
  56. </view>
  57. <view class="card-item">
  58. <view class="card-item-left">
  59. <u-text :text="startTimeTip" align="center"></u-text>
  60. </view>
  61. <text>{{reservation.startTime}}</text>
  62. </view>
  63. <view class="card-item">
  64. <view class="card-item-left">
  65. <u-text :text="endTimeTip" align="center"></u-text>
  66. </view>
  67. <text>{{reservation.endTime}}</text>
  68. </view>
  69. <view class="card-item" v-for="guest in guestInfo">
  70. <view class="card-item-left">
  71. <u-text :text="'入住人'+guest.id+':'"></u-text>
  72. </view>
  73. <u-text :text="guest.name"></u-text>
  74. <view class="">
  75. </view>
  76. <view class="">
  77. <u-text :text="guest.idNumber"></u-text>
  78. </view>
  79. </view>
  80. </uni-card>
  81. <view>
  82. <!-- <button class="checkinBtn" @click="checkin">入住</button> -->
  83. <!-- <button class="completeBtn" @click="authentication">添加入住人</button> -->
  84. <button class="completeBtn" @click="gotoAddGuest">办理入住</button>
  85. <button class="gobackBtn" @click="deletePicRoom">删除选房</button>
  86. </view>
  87. </view>
  88. <view class="not-reservation" v-else>
  89. <text class="tip">未查询到选房信息,请先选房</text>
  90. <button class="gobackBtn" @click="gotoSelectRoom">去选房</button>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import moment from 'moment'
  96. import {
  97. mapState,
  98. mapMutations
  99. } from 'vuex'
  100. export default {
  101. data() {
  102. return {
  103. startTimeTip: '起始时间:',
  104. endTimeTip: '结束时间:',
  105. buildingTip: '楼 栋 :',
  106. floorTip: '楼 层 :',
  107. roomTip: '房 间 :',
  108. guestInfo: [],
  109. reservation: {},
  110. verificated: false,
  111. eidToken: [],
  112. startTime: '',
  113. endTime: '',
  114. startTimeShow: false,
  115. endTimeShow: false,
  116. checkinInfo: {},
  117. }
  118. },
  119. computed: {
  120. ...mapState('m_user', ['userInfo']),
  121. ...mapState('m_business', ['hotelParams', 'currentHotelId']),
  122. },
  123. methods: {
  124. ...mapMutations('m_business', ['updateCheckinInfo']),
  125. gotoSelectRoom() {
  126. uni.navigateTo({
  127. url: '/subpkg_checkin/selectRoomType/selectRoomType'
  128. })
  129. },
  130. gotoAddGuest() {
  131. uni.navigateTo({
  132. url: '/subpkg_checkin/addGuest/addGuest'
  133. })
  134. },
  135. async deletePicRoom() {
  136. console.log(this.reservation.id)
  137. let res = await uni.$http.delete('/userPicRoomInfo/' + this.reservation.id)
  138. console.log(res)
  139. if (res.data.code === 200) {
  140. uni.$showMsg('删除成功!')
  141. setTimeout(() => {
  142. uni.redirectTo({
  143. url: '/subpkg_checkin/checkin/checkin'
  144. })
  145. }, 1500)
  146. } else {
  147. uni.$showMsg('删除失败!')
  148. }
  149. },
  150. async getReservationInfo() {
  151. let res = await uni.$http.post('/userPicRoomInfo/queryByCondition', {
  152. userId: this.userInfo.userId,
  153. // userId: 29,
  154. status: true,
  155. pageNo: 1,
  156. pageSize: 1
  157. })
  158. console.log(res)
  159. if (res.data.data.records?.length > 0) {
  160. this.reservation = res.data.data.records[0]
  161. this.reservation.startTime = moment(this.reservation.startTime).format('YYYY/MM/DD HH:mm')
  162. this.reservation.endTime = moment(this.reservation.endTime).format('YYYY/MM/DD HH:mm')
  163. } else {
  164. this.reservation = {}
  165. }
  166. console.log(this.reservation)
  167. },
  168. async getCheckinInfo() {
  169. // let {
  170. // data: res
  171. // } = await uni.$http.post('/checkinInfo/queryByCondition', {
  172. // userIdNumber: this.userInfo.idNumber,
  173. // status: 1,
  174. // hotelId: this.currentHotelId,
  175. // pageNo: 1,
  176. // pageSize: 1
  177. // });
  178. let {
  179. data: res
  180. } = await uni.$http.post('/roomCustomer/queryByCondition', {
  181. userIdNumber: this.userInfo.idNumber,
  182. status: 1,
  183. hotelId: this.currentHotelId,
  184. pageNo: 1,
  185. pageSize: 1
  186. });
  187. console.log(res)
  188. if (res.code == 200) {
  189. if (res.data.records.length > 0) {
  190. this.checkinInfo = res.data.records[0];
  191. this.checkinInfo.startTime = moment(this.checkinInfo.startTime).format('YYYY/MM/DD HH:mm')
  192. this.checkinInfo.endTime = moment(this.checkinInfo.endTime).format('YYYY/MM/DD HH:mm')
  193. uni.$showMsg('已入住!')
  194. } else {
  195. this.checkinInfo = {}
  196. }
  197. } else {
  198. uni.$showMsg('查询失败!')
  199. }
  200. }
  201. },
  202. onLoad() {
  203. this.getReservationInfo()
  204. this.getCheckinInfo()
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. .space-around {
  210. display: flex;
  211. justify-content: space-around;
  212. }
  213. .reservation-time {
  214. text-align: center;
  215. display: block;
  216. }
  217. .card-item {
  218. margin-bottom: 40rpx;
  219. display: flex;
  220. .card-item-left {
  221. width: 220rpx;
  222. }
  223. }
  224. .toux {
  225. margin: 20rpx auto;
  226. display: block;
  227. }
  228. .photoBtn {
  229. margin: 20rpx 20rpx;
  230. display: block;
  231. background-color: #0081ff;
  232. color: #ffffff;
  233. }
  234. .checkinBtn {
  235. left: 80rpx;
  236. right: 80rpx;
  237. bottom: 340rpx;
  238. position: fixed;
  239. background-color: #0081ff;
  240. color: #ffffff;
  241. }
  242. .completeBtn {
  243. left: 80rpx;
  244. right: 80rpx;
  245. bottom: 220rpx;
  246. position: fixed;
  247. background-color: #0081ff;
  248. color: #ffffff;
  249. }
  250. .gobackBtn {
  251. left: 80rpx;
  252. right: 80rpx;
  253. bottom: 100rpx;
  254. position: fixed;
  255. background-color: #0081ff;
  256. color: #ffffff;
  257. }
  258. .not-reservation {
  259. display: flex;
  260. justify-content: center;
  261. height: 100%;
  262. text-align: center;
  263. vertical-align: 100rpx;
  264. }
  265. .tip {
  266. padding-top: 40%;
  267. }
  268. .date-picker {
  269. margin-left: 80rpx;
  270. font-weight: bold;
  271. }
  272. </style>