detailInfo.vue 5.8 KB

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