detailInfo.vue 5.6 KB

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