home.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view>
  3. <view class="top">
  4. <u-image class="top-pic" :src="topSrc" height="350rpx" width="100%" mode="aspectFill"></u-image>
  5. </view>
  6. <view class="hotel-name">
  7. <u-text :text="currentHotelName" align="center" size="36rpx"></u-text>
  8. </view>
  9. <view class="bottom">
  10. <view class="bottom-item" v-for="item in businessListTop" @click="navigateTo(item.url)">
  11. <view class="top-img">
  12. <u-image :src="item.src" width="180rpx" height="180rpx"></u-image>
  13. </view>
  14. <view class="bottom-img">
  15. <u-image :src="item.backgroundSrc" width="160rpx" height="160rpx"></u-image>
  16. </view>
  17. <view class="tip">
  18. <text class="">{{ item.text }}</text>
  19. </view>
  20. </view>
  21. <view class="bottom-item" v-for="item in businessListBottom" @click="navigateTo(item.url)">
  22. <view class="top-img">
  23. <u-image :src="item.src" width="180rpx" height="180rpx"></u-image>
  24. </view>
  25. <view class="bottom-img">
  26. <u-image :src="item.backgroundSrc" width="160rpx" height="160rpx"></u-image>
  27. </view>
  28. <view class="tip">
  29. <text class="">{{ item.text }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. stringHasText
  38. } from '../../utils/commonUtils.js'
  39. import {
  40. startEid
  41. } from "../../mp_ecard_sdk/main.js";
  42. import moment from "moment";
  43. import {
  44. mapState,
  45. mapMutations
  46. } from "vuex";
  47. import {
  48. IMG_BASE_URL
  49. } from "../../config.js"
  50. export default {
  51. data() {
  52. return {
  53. topSrc: IMG_BASE_URL + "/home_top.png",
  54. businessListTop: [{
  55. backgroundSrc: IMG_BASE_URL + "/home_business_background.png",
  56. src: IMG_BASE_URL + "/checkin.png",
  57. text: "入住",
  58. url: "/subpkg_checkin/selectCheckinType/selectCheckinType",
  59. },
  60. {
  61. backgroundSrc: IMG_BASE_URL + "/home_business_background.png",
  62. src: IMG_BASE_URL + "/extand.png",
  63. text: "续住",
  64. url: "/subpkg/extend/extend",
  65. },
  66. {
  67. backgroundSrc: IMG_BASE_URL + "/home_business_background.png",
  68. src: IMG_BASE_URL + "/checkout.png",
  69. text: "退房",
  70. url: "/subpkg/checkout/checkout",
  71. },
  72. ],
  73. businessListBottom: [{
  74. backgroundSrc: IMG_BASE_URL + "/home_business_background.png",
  75. src: IMG_BASE_URL + "/emergency_key.png",
  76. text: "手机开门",
  77. url: "/subpkg/emergencyKey/emergencyKey",
  78. },
  79. {
  80. backgroundSrc: IMG_BASE_URL + "/home_business_background.png",
  81. src: IMG_BASE_URL + "/lift.png",
  82. text: "梯控二维码",
  83. url: "/subpkg/elevatorControl/elevatorControl",
  84. },
  85. ],
  86. };
  87. },
  88. computed: {
  89. ...mapState("m_user", ["userInfo"]),
  90. ...mapState("m_business", ["currentHotelName"]),
  91. },
  92. methods: {
  93. ...mapMutations('m_business', ['updateCurrentHotelId', 'updateCurrentHotelName']),
  94. navigateTo(url) {
  95. if (url !== "" && url !== null && url !== undefined) {
  96. uni.navigateTo({
  97. url: url,
  98. });
  99. }
  100. },
  101. },
  102. onLoad(query) {
  103. //二维码扫描时传入hotelId和hotelName
  104. if (query.q !== null && query.q !== undefined) {
  105. let url = decodeURIComponent(query.q)
  106. let hotelId = url.split('=')[1].split('&')[0]
  107. let hotelName = url.split('=')[2]
  108. if (stringHasText(hotelId)) {
  109. this.updateCurrentHotelId(hotelId)
  110. }
  111. if (stringHasText(hotelName)) {
  112. this.updateCurrentHotelName(hotelName)
  113. }
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss">
  119. .top {}
  120. .hotel-name {
  121. margin: 40rpx;
  122. }
  123. .bottom {
  124. display: flex;
  125. flex-wrap: wrap;
  126. width: 90%;
  127. margin: 0 auto;
  128. justify-content: space-around;
  129. .bottom-item {
  130. position: relative;
  131. width: 33%;
  132. height: 300rpx;
  133. display: flex;
  134. flex-direction: column;
  135. align-items: center;
  136. justify-content: center;
  137. margin-top: 20rpx;
  138. .top-img {
  139. // width: 180rpx;
  140. // height: 180rpx;
  141. position: absolute;
  142. margin: 0 auto;
  143. z-index: 2;
  144. }
  145. .bottom-img {
  146. // width: 180rpx;
  147. // height: 180rpx;
  148. margin: 20rpx 0;
  149. position: absolute;
  150. z-index: 1;
  151. }
  152. .tip {
  153. font-size: 40rpx;
  154. margin-top: 20rpx;
  155. position: absolute;
  156. bottom: 0;
  157. }
  158. }
  159. }
  160. .completeBtn {
  161. left: 80rpx;
  162. right: 80rpx;
  163. bottom: 160rpx;
  164. position: fixed;
  165. background-color: #0081ff;
  166. color: #ffffff;
  167. }
  168. .testBtn {
  169. left: 80rpx;
  170. right: 80rpx;
  171. bottom: 80rpx;
  172. position: fixed;
  173. background-color: #0081ff;
  174. color: #ffffff;
  175. }
  176. </style>