detailInfo.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="container" v-if="detailInfo">
  3. <!-- 顶部民宿信息区域 -->
  4. <view class="header">
  5. <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/18.png" />
  6. <!-- 标题区域 -->
  7. <view class="header_title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }">设施详情</view>
  8. <!-- 返回图标区域 -->
  9. <view class="header_icon" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }" @click="handleBack">
  10. <img src="../../static/index/left.png" />
  11. </view>
  12. <!-- 民宿名称区域 -->
  13. <view class="header_name" :style="{ paddingTop: statusBarH * 2 + 72 + 'rpx' }">{{ detailInfo.hotel_name }}</view>
  14. <!-- 开业时间区域 -->
  15. <view class="header_info" :style="{ paddingTop: statusBarH * 2 + 145 + 'rpx' }">
  16. {{ detailInfo.openTime }}开业 I {{ detailInfo.fitupTime }}装修 I {{ detailInfo.room_number_calc }}间客房
  17. </view>
  18. <!-- 类型区域 -->
  19. <view class="header_types" :style="{ paddingTop: statusBarH * 2 + 200 + 'rpx' }">
  20. <view class="types_item">{{ detailInfo.hTypeName }}</view>
  21. </view>
  22. </view>
  23. <!-- 主体内容详细民宿信息区域 -->
  24. <view class="body">
  25. <view class="body_title">基本信息</view>
  26. <view class="body_towns">所属乡镇:{{ detailInfo.hotelTownshipName }}</view>
  27. <view class="body_address">
  28. <view class="address_text">地址:</view>
  29. <view class="address_info">
  30. {{ detailInfo.hposition }}
  31. <img src="../../static/index/address.png" @click="handleMap" />
  32. </view>
  33. </view>
  34. <view class="body_phone" @click="handlePhone(detailInfo.managerPhone)">联系电话:{{ detailInfo.managerPhone }}</view>
  35. <view class="body_title">政策</view>
  36. <view class="body_box">
  37. <img class="box_icon" src="../../static/index/time.png" />
  38. <view class="box_text">入离时间</view>
  39. </view>
  40. <view class="body_time">
  41. <view class="time_start">入住时间:{{ detailInfo.liveTime }}以后</view>
  42. <view class="time_end">离店时间:{{ detailInfo.leaveTime }}以前</view>
  43. </view>
  44. <view class="body_box">
  45. <img class="box_icon2" src="../../static/index/info.png" />
  46. <view class="box_text">民宿介绍</view>
  47. </view>
  48. <view class="body_desc">
  49. {{ detailInfo.remark }}
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. // 民宿ID
  59. hotelId: '',
  60. // 详细信息
  61. detailInfo: null,
  62. // 状态栏高度
  63. statusBarH: 0,
  64. // 胶囊按钮栏高度
  65. customBarH: 0
  66. }
  67. },
  68. created() {
  69. // 获取系统信息
  70. uni.getSystemInfo({
  71. success: (e) => {
  72. // 获取状态栏高度
  73. this.statusBarH = e.statusBarHeight + 10
  74. // // 获取菜单按钮栏高度
  75. let custom = uni.getMenuButtonBoundingClientRect()
  76. this.customBarH = custom.height + 10
  77. }
  78. })
  79. },
  80. onLoad(options) {
  81. this.hotelId = options.hotelId
  82. this.getDetailInfo()
  83. },
  84. methods: {
  85. async getDetailInfo() {
  86. const res = await this.$myRequest({
  87. url: '/mhotel/ahpgetHotelInfoByHotelId.action',
  88. data: {
  89. hotelId: this.hotelId
  90. }
  91. })
  92. // console.log(res)
  93. if (res.code === 200) {
  94. this.detailInfo = res.data
  95. }
  96. },
  97. handleMap() {
  98. uni.getSetting({
  99. success: (res) => {
  100. if (res.authSetting['scope.userLocation']) {
  101. let lat = this.detailInfo.hpositionWens.split(',')[0] * 1
  102. let lng = this.detailInfo.hpositionWens.split(',')[1] * 1
  103. uni.openLocation({
  104. latitude: lat,
  105. longitude: lng,
  106. name: this.detailInfo.hname,
  107. address: this.detailInfo.hposition,
  108. success: () => {}
  109. })
  110. } else {
  111. uni.showModal({
  112. content: '当前没有定位权限,是否去设置打开?',
  113. confirmText: '确认',
  114. cancelText: '取消',
  115. success: (res) => {
  116. if (res.confirm) {
  117. uni.openSetting({
  118. success: (res) => {
  119. this.handleMap()
  120. }
  121. })
  122. } else {
  123. uni.showToast({
  124. title: '获取定位权限失败',
  125. icon: 'none',
  126. mask: true
  127. })
  128. }
  129. }
  130. })
  131. }
  132. }
  133. })
  134. },
  135. handleBack() {
  136. uni.navigateBack(1)
  137. },
  138. handlePhone(phone) {
  139. uni.makePhoneCall({
  140. phoneNumber: phone
  141. })
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. .container {
  148. position: relative;
  149. height: 100vh;
  150. overflow: hidden;
  151. background-color: #fff;
  152. .header {
  153. position: relative;
  154. height: 480rpx;
  155. color: #fff;
  156. overflow: hidden;
  157. img {
  158. width: 100%;
  159. }
  160. .header_title {
  161. position: absolute;
  162. top: 0;
  163. left: 308rpx;
  164. color: #fff;
  165. font-size: 28rpx;
  166. }
  167. .header_icon {
  168. z-index: 2;
  169. position: absolute;
  170. top: 0;
  171. left: 5rpx;
  172. width: 47rpx;
  173. height: 70rpx;
  174. img {
  175. width: 47rpx;
  176. height: 47rpx;
  177. }
  178. }
  179. .header_name {
  180. position: absolute;
  181. top: 0;
  182. left: 30rpx;
  183. font-size: 40rpx;
  184. font-weight: bold;
  185. }
  186. .header_info {
  187. position: absolute;
  188. top: 0;
  189. left: 30rpx;
  190. font-size: 24rpx;
  191. }
  192. .header_types {
  193. position: absolute;
  194. top: 0;
  195. left: 30rpx;
  196. display: flex;
  197. font-size: 20rpx;
  198. .types_item {
  199. box-sizing: border-box;
  200. padding: 0 10rpx;
  201. margin-right: 15rpx;
  202. height: 30rpx;
  203. border-radius: 9rpx;
  204. background-color: rgba(255, 255, 255, 0.2);
  205. }
  206. }
  207. }
  208. .body {
  209. position: absolute;
  210. top: 350rpx;
  211. left: 0;
  212. right: 0;
  213. box-sizing: border-box;
  214. padding: 0 30rpx 50rpx;
  215. height: calc(100vh - 350rpx);
  216. border-radius: 20rpx 20rpx 0 0;
  217. background-color: #fff;
  218. overflow-y: auto;
  219. .body_title {
  220. line-height: 90rpx;
  221. font-size: 32rpx;
  222. font-weight: bold;
  223. }
  224. .body_towns {
  225. line-height: 55rpx;
  226. font-size: 28rpx;
  227. }
  228. .body_address {
  229. display: flex;
  230. padding-right: 20rpx;
  231. line-height: 55rpx;
  232. font-size: 28rpx;
  233. .address_text {
  234. width: 105rpx;
  235. }
  236. .address_info {
  237. flex: 1;
  238. img {
  239. margin-left: 20rpx;
  240. width: 28rpx;
  241. height: 28rpx;
  242. }
  243. }
  244. }
  245. .body_phone {
  246. line-height: 55rpx;
  247. font-size: 28rpx;
  248. }
  249. .body_box {
  250. display: flex;
  251. align-items: center;
  252. .box_icon {
  253. width: 36rpx;
  254. height: 36rpx;
  255. }
  256. .box_icon2 {
  257. margin-top: 4rpx;
  258. width: 40rpx;
  259. height: 40rpx;
  260. }
  261. .box_text {
  262. margin-left: 16rpx;
  263. font-size: 28rpx;
  264. }
  265. }
  266. .body_time {
  267. display: flex;
  268. align-items: center;
  269. margin: 20rpx 0;
  270. color: #808080;
  271. font-size: 24rpx;
  272. .time_start {
  273. margin-left: 50rpx;
  274. margin-right: 60rpx;
  275. }
  276. }
  277. .body_desc {
  278. margin: 10rpx 0 0 50rpx;
  279. line-height: 45rpx;
  280. color: #808080;
  281. font-size: 24rpx;
  282. }
  283. }
  284. }
  285. </style>