detailInfo.vue 6.7 KB

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