selectRoomType.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="page-container">
  3. <view class="room-type-item" v-for="item in roomTypeList">
  4. <view class="room-type-item-left">
  5. <u-image :src="item.roomPicPath" width="200rpx" height="200rpx" radius="10"></u-image>
  6. </view>
  7. <view class="room-type-item-middle">
  8. <view class="room-type-item-middle-text">
  9. <text>{{item.roomTypeName}}</text>
  10. </view>
  11. <view class="room-type-item-middle-bottom">
  12. <!-- <text>{{item.breakfirst}} </text> -->
  13. <text>{{item.roomArea}}㎡ </text>
  14. </view>
  15. </view>
  16. <view class="room-type-item-right">
  17. <view class="room-type-item-right-text">
  18. <text>¥{{item.unitPrice}}</text>
  19. </view>
  20. <u-button text="选房" @click="gotoSelectRoom(item)"></u-button>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. IMG_BASE_URL
  28. } from "../../config.js"
  29. import {
  30. mapState,
  31. mapMutations
  32. } from 'vuex'
  33. export default {
  34. data() {
  35. return {
  36. roomTypeList: {},
  37. roomTypeMap: {},
  38. };
  39. },
  40. computed: {
  41. ...mapState('m_business', ['currentHotelId', 'reservationInfo']),
  42. ...mapState('m_user', ['userInfo'])
  43. },
  44. methods: {
  45. ...mapMutations('m_business', ['updateRoomType', 'updateReservationInfo']),
  46. async gotoSelectRoom(item) {
  47. let res = await uni.$http.post('/hotelOrder', {
  48. name: this.userInfo.name,
  49. phone: this.userInfo.phone,
  50. hotelId: this.currentHotelId,
  51. roomType: item.roomType,
  52. startTime: this.reservationInfo.startTime,
  53. endTime: this.reservationInfo.endTime
  54. })
  55. this.reservationInfo.orderInfo = res.data.data
  56. this.reservationInfo.price = item.unitPrice
  57. this.reservationInfo.roomType = item.roomType
  58. this.reservationInfo.roomTypeName = item.roomTypeName
  59. this.updateReservationInfo(this.reservationInfo)
  60. uni.navigateTo({
  61. url: '/subpkg_checkin/submitOrder/submitOrder'
  62. });
  63. },
  64. async getRoomTypeList() {
  65. let res = await uni.$http.post('/roomType', {
  66. hotelId: this.currentHotelId,
  67. pageNo: 1,
  68. pageSize: 10
  69. })
  70. this.roomTypeList = res.data.data.records
  71. this.roomTypeList.forEach((item) => {
  72. item.roomPicPath = IMG_BASE_URL + '/' + item.roomPicPath
  73. })
  74. }
  75. },
  76. onLoad() {
  77. this.getRoomTypeList()
  78. }
  79. }
  80. </script>
  81. <style lang="scss">
  82. .page-container {
  83. background-color: #F5F5F5;
  84. .room-type-item {
  85. border-radius: 30rpx;
  86. background-color: #FFFFFF;
  87. margin: 20rpx 20rpx;
  88. padding: 40rpx 20rpx;
  89. display: flex;
  90. background: #FFFFFF;
  91. box-shadow: 0rpx 10rpx 6rpx 1rpx rgba(75, 75, 75, 0.1);
  92. border-radius: 10rpx;
  93. .room-type-item-middle {
  94. margin-left: 30rpx;
  95. display: flex;
  96. flex-direction: column;
  97. width: 200rpx;
  98. .room-type-item-middle-text {
  99. font-size: 40rpx;
  100. font-weight: bold;
  101. color: #333333;
  102. }
  103. .room-type-item-middle-bottom {
  104. margin-top: 40rpx;
  105. font-size: 25rpx;
  106. text {
  107. margin-right: 20rpx;
  108. color: #666666
  109. }
  110. }
  111. }
  112. .room-type-item-right {
  113. width: 25%;
  114. margin-left: 20rpx;
  115. .room-type-item-right-text {
  116. margin-top: 30rpx;
  117. margin-bottom: 20rpx;
  118. }
  119. text {
  120. font-size: 40rpx;
  121. font-weight: bold;
  122. color: #FF5C58
  123. }
  124. button {
  125. background-color: #F69B49;
  126. height: 60rpx;
  127. width: 100%;
  128. text {
  129. color: white
  130. }
  131. }
  132. }
  133. }
  134. }
  135. </style>