detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. <template>
  2. <view class="container" :style="'overflow:' + (showPage ? 'hidden' : 'visible')">
  3. <!-- 顶部民宿图片区域 -->
  4. <view class="banner">
  5. <img class="img" :src="info.imgUrl || '../../static/index/banner.png'" />
  6. <view class="slogan">
  7. <img src="../../static/index/slogan.png" />
  8. </view>
  9. </view>
  10. <!-- 民宿详细信息区域 -->
  11. <view class="detail">
  12. <view class="detail_name">{{ info.hotelName || '默认名字' }}</view>
  13. <view class="detail_info">
  14. <view class="info_left">2021年装修|2023年开业</view>
  15. <view class="info_right" @click="goPageDetailInfo">
  16. 设施/详情
  17. <img src="../../static/index/right.png" />
  18. </view>
  19. </view>
  20. <view class="detail_group">
  21. <view class="group_item">
  22. <img src="../../static/index/meeting.png" />
  23. 会议室
  24. </view>
  25. <view class="group_item">
  26. <img src="../../static/index/brekker.png" />
  27. 含早
  28. </view>
  29. <view class="group_item">
  30. <img src="../../static/index/parking.png" />
  31. 免费停车场
  32. </view>
  33. </view>
  34. <view class="address">
  35. <view class="address_left">宜春市靖安县北高速路口什么路899号</view>
  36. <view class="address_right">
  37. <view class="right_box" @click="handleMap(info)">
  38. <img src="../../static/index/map.png" />
  39. </view>
  40. <view class="right_box" @click="handlePhone(info.phone)">
  41. <img src="../../static/index/phone.png" />
  42. </view>
  43. </view>
  44. </view>
  45. <view class="distance">距离我{{ info.distance }}km</view>
  46. </view>
  47. <!-- 房型信息区域 -->
  48. <view class="body">
  49. <!-- 选择日期区域 -->
  50. <view class="body_header" @click="handleOpen">
  51. <view class="header_start">
  52. <view class="header_top">周{{ startTimeWeek }}入住</view>
  53. <view class="header_bottom">{{ startTimeMonth }}月{{ startTimeDay }}日</view>
  54. </view>
  55. <view class="header_night">
  56. <view class="night_line"></view>
  57. <view class="night_box">{{ nightNum }}晚</view>
  58. <view class="night_line"></view>
  59. </view>
  60. <view class="header_end">
  61. <view class="header_top">周{{ endTimeWeek }}离店</view>
  62. <view class="header_bottom">{{ endTimeMonth }}月{{ endTimeDay }}日</view>
  63. </view>
  64. </view>
  65. <!-- 日历组件 -->
  66. <uv-calendar
  67. ref="calendar"
  68. showLunar
  69. color="#096562"
  70. mode="range"
  71. :defaultDate="defaultDateMultiple"
  72. startText="住店"
  73. endText="离店"
  74. confirmDisabledText="请选择离店日期"
  75. @confirm="handleConfirm"
  76. ></uv-calendar>
  77. <!-- 房型列表区域 -->
  78. <view class="body_content">
  79. <!-- 每一个房型盒子区域 -->
  80. <view class="body_box" v-for="item in list" :key="item.id" @click="handleLookDetail(item)">
  81. <view class="box_left">
  82. <img :src="item.imgUrl" />
  83. </view>
  84. <view class="box_center">
  85. <view class="center_top">{{ item.name }}</view>
  86. <view class="center_center">
  87. <view class="center_item">大床</view>
  88. <view class="center_item">无早</view>
  89. </view>
  90. <view class="center_bottom">
  91. <img class="img" src="../../static/index/wifi.png" />
  92. <img class="img" src="../../static/index/air.png" />
  93. <img class="img" src="../../static/index/smoke.png" />
  94. <img class="img" src="../../static/index/lock.png" />
  95. </view>
  96. </view>
  97. <view class="box_right">
  98. <view class="right_price">
  99. <text>¥</text>
  100. {{ item.price }}
  101. </view>
  102. <view class="right_btn" :class="{ inactive: !item.active }" @click.stop="goPageAffOrder(item)">订</view>
  103. </view>
  104. </view>
  105. <!-- 点击房型弹窗区域 -->
  106. <uv-popup ref="popup" bgColor="none" :safeAreaInsetBottom="false">
  107. <view class="body_pop">
  108. <!-- 轮播图区域 -->
  109. <swiper indicator-dots circular indicator-color="#FFFFFF" indicator-active-color="#096562" class="pop_swiper">
  110. <swiper-item class="pop_swiper_item">
  111. <img class="img" src="../../static/index/banner.png" />
  112. </swiper-item>
  113. <swiper-item class="pop_swiper_item">
  114. <img class="img" src="../../static/index/banner.png" />
  115. </swiper-item>
  116. </swiper>
  117. <!-- 轮播图关闭图标区域 -->
  118. <img class="pop_icon" src="../../static/index/close.png" @click="handleClosePop" />
  119. <view class="pop_body">
  120. <view class="body_title">{{ roomInfo.name }}</view>
  121. <view class="body_tags">
  122. <view class="tags_item">
  123. <img class="img" src="../../static/index/bed.png" />
  124. 1张大床房
  125. </view>
  126. <view class="tags_item">
  127. <img class="img" src="../../static/index/wifi.png" />
  128. wifi免费
  129. </view>
  130. <view class="tags_item">
  131. <img class="img" src="../../static/index/place.png" />
  132. 15-20㎡
  133. </view>
  134. <view class="tags_item">
  135. <img class="img" src="../../static/index/window.png" />
  136. 窗户位于走廊/窗户较小
  137. </view>
  138. </view>
  139. <view class="body_title2">费用明细</view>
  140. <view class="body_detail">
  141. <view class="detail_old">¥{{ roomInfo.price }}</view>
  142. <view class="detail_box">
  143. 黄金会员9折
  144. <text>-¥25</text>
  145. </view>
  146. <view class="detail_box">
  147. 活动
  148. <text>-¥2.5</text>
  149. </view>
  150. <view class="detail_new">
  151. 每间每晚
  152. <view class="ml_10 color">¥</view>
  153. <view class="price color">{{ roomInfo.price }}</view>
  154. </view>
  155. </view>
  156. <view class="body_bottom">
  157. <view class="bottom_left" @click="handlePhone('18320846714')">
  158. <img class="img" src="../../static/index/phone2.png" />
  159. 联系商家
  160. </view>
  161. <view class="bottom_right">
  162. <text>¥</text>
  163. {{ roomInfo.price }}
  164. <view class="btn" @click="goPageAffOrder(roomInfo)">预定</view>
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. </uv-popup>
  170. </view>
  171. </view>
  172. </view>
  173. </template>
  174. <script>
  175. export default {
  176. data() {
  177. return {
  178. // 滚动穿透控制
  179. showPage: false,
  180. // 房型数据数组
  181. list: [
  182. {
  183. id: 1,
  184. imgUrl: '../../static/index/banner.png',
  185. name: '01户型',
  186. price: '323.00',
  187. active: true
  188. },
  189. {
  190. id: 2,
  191. imgUrl: '../../static/index/banner.png',
  192. name: '02户型',
  193. price: '283.00',
  194. active: false
  195. },
  196. {
  197. id: 3,
  198. imgUrl: '../../static/index/banner.png',
  199. name: '03户型',
  200. price: '223.00',
  201. active: true
  202. }
  203. ],
  204. // 住几晚
  205. nightNum: 1,
  206. // 入住时间-月
  207. startTimeMonth: '',
  208. // 入住时间-日
  209. startTimeDay: '',
  210. // 入住时间-星期
  211. startTimeWeek: '',
  212. // 离店时间-月
  213. endTimeMonth: '',
  214. // 离店时间-日
  215. endTimeDay: '',
  216. // 离店时间-星期
  217. endTimeWeek: '',
  218. // 日历默认选择日期
  219. defaultDateMultiple: [],
  220. // 酒店信息
  221. info: {},
  222. // 房间信息
  223. roomInfo: {}
  224. }
  225. },
  226. onLoad(options) {
  227. // console.log(JSON.parse(options.info))
  228. if (options.info) {
  229. this.info = JSON.parse(options.info)
  230. }
  231. this.getTimes()
  232. },
  233. methods: {
  234. // 点击地图图标回调
  235. handleMap(item) {
  236. uni.openLocation({
  237. latitude: 28.86054,
  238. longitude: 115.361744,
  239. name: item.hotelName,
  240. address: '靖安县---详细地址',
  241. success: () => {}
  242. })
  243. },
  244. // 点击电话图标回调
  245. handlePhone(phone) {
  246. uni.makePhoneCall({
  247. phoneNumber: phone
  248. })
  249. },
  250. // 点击弹窗关闭图标回调
  251. handleClosePop() {
  252. this.showPage = false
  253. this.$refs.popup.close()
  254. },
  255. // 点击每一个户型回调
  256. handleLookDetail(item) {
  257. // console.log(item)
  258. this.roomInfo = item
  259. this.showPage = true
  260. this.$refs.popup.open('bottom')
  261. },
  262. // 点击设施详情回调
  263. goPageDetailInfo() {
  264. uni.navigateTo({
  265. url: '/pages/detailInfo/detailInfo'
  266. })
  267. },
  268. // 点击 订 按钮回调
  269. goPageAffOrder(item) {
  270. if (item.active) {
  271. this.$refs.popup.close()
  272. this.showPage = false
  273. let info = JSON.stringify({
  274. nightNum: this.nightNum,
  275. startTimeDay: this.startTimeDay,
  276. startTimeMonth: this.startTimeMonth,
  277. startTimeWeek: this.startTimeWeek,
  278. endTimeDay: this.endTimeDay,
  279. endTimeMonth: this.endTimeMonth,
  280. endTimeWeek: this.endTimeWeek,
  281. price: item.price
  282. })
  283. uni.navigateTo({
  284. url: `/pages/affirmOrder/affirmOrder?info=${info}`
  285. })
  286. } else {
  287. uni.showToast({
  288. title: '该房间已售罄',
  289. icon: 'none'
  290. })
  291. }
  292. },
  293. // 点击日期区域回调
  294. handleOpen() {
  295. this.$refs.calendar.open()
  296. },
  297. // 选择日历确定按钮回调
  298. handleConfirm(e) {
  299. // console.log(e)
  300. this.startTimeWeek = this.getWeek(e[0])
  301. this.endTimeWeek = this.getWeek(e[e.length - 1])
  302. let temStart = e[0].split('-')
  303. let temEnd = e[e.length - 1].split('-')
  304. this.startTimeMonth = temStart[1]
  305. this.startTimeDay = temStart[2]
  306. this.endTimeMonth = temEnd[1]
  307. this.endTimeDay = temEnd[2]
  308. this.nightNum = e.length - 1
  309. },
  310. // 获取今明两天的日期,星期
  311. getTimes() {
  312. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  313. //今天的日期
  314. let today = new Date()
  315. this.startTimeWeek = weekList[today.getDay()]
  316. this.startTimeMonth = (today.getMonth() + 1).toString().padStart(2, 0)
  317. this.startTimeDay = today.getDate().toString().padStart(2, 0)
  318. //明天的日期
  319. let tomorrow = new Date()
  320. tomorrow.setTime(tomorrow.getTime() + 24 * 60 * 60 * 1000)
  321. this.endTimeWeek = weekList[tomorrow.getDay()]
  322. this.endTimeMonth = (tomorrow.getMonth() + 1).toString().padStart(2, 0)
  323. this.endTimeDay = tomorrow.getDate().toString().padStart(2, 0)
  324. // 日历默认选择的日期
  325. this.defaultDateMultiple = [`${today.getFullYear()}-${this.startTimeMonth}-${this.startTimeDay}`, `${tomorrow.getFullYear()}-${this.endTimeMonth}-${this.endTimeDay}`]
  326. },
  327. // 传入参数获取当前是星期几
  328. getWeek(time) {
  329. let date = new Date(time)
  330. let week = date.getDay()
  331. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  332. return weekList[week]
  333. }
  334. }
  335. }
  336. </script>
  337. <style lang="scss" scoped>
  338. .container {
  339. display: flex;
  340. flex-direction: column;
  341. position: relative;
  342. min-height: 100vh;
  343. background-color: #ebeced;
  344. .banner {
  345. position: relative;
  346. margin-top: 20rpx;
  347. width: 750rpx;
  348. height: 422rpx;
  349. .img {
  350. width: 100%;
  351. height: 100%;
  352. }
  353. .slogan {
  354. position: absolute;
  355. top: 0;
  356. left: 0;
  357. display: flex;
  358. justify-content: center;
  359. align-items: center;
  360. width: 163rpx;
  361. height: 60rpx;
  362. background-color: rgba(255, 255, 255, 0.4);
  363. img {
  364. width: 125rpx;
  365. height: 44rpx;
  366. }
  367. }
  368. }
  369. .detail {
  370. position: absolute;
  371. top: 265rpx;
  372. left: 20rpx;
  373. box-sizing: border-box;
  374. padding: 0 30rpx;
  375. width: 710rpx;
  376. height: 254rpx;
  377. border-radius: 10rpx;
  378. background-color: #fff;
  379. .detail_name {
  380. margin-top: 25rpx;
  381. font-size: 34rpx;
  382. font-weight: bold;
  383. }
  384. .detail_info {
  385. display: flex;
  386. justify-content: space-between;
  387. margin-top: 10rpx;
  388. .info_left {
  389. color: #999999;
  390. font-size: 20rpx;
  391. }
  392. .info_right {
  393. display: flex;
  394. align-items: center;
  395. color: #096562;
  396. font-size: 24rpx;
  397. img {
  398. margin-left: 6rpx;
  399. width: 10rpx;
  400. height: 20rpx;
  401. }
  402. }
  403. }
  404. .detail_group {
  405. display: flex;
  406. flex-wrap: wrap;
  407. margin-top: 5rpx;
  408. .group_item {
  409. display: flex;
  410. align-items: center;
  411. margin-right: 10rpx;
  412. color: #999999;
  413. font-size: 20rpx;
  414. img {
  415. margin-right: 5rpx;
  416. width: 22rpx;
  417. height: 22rpx;
  418. }
  419. }
  420. }
  421. .address {
  422. display: flex;
  423. justify-content: space-between;
  424. margin-top: 8rpx;
  425. font-size: 28rpx;
  426. font-weight: bold;
  427. .address_left {
  428. width: 480rpx;
  429. overflow: hidden;
  430. text-overflow: ellipsis;
  431. white-space: nowrap;
  432. }
  433. .address_right {
  434. display: flex;
  435. .right_box {
  436. margin-left: 28rpx;
  437. width: 50rpx;
  438. height: 78rpx;
  439. img {
  440. width: 100%;
  441. height: 100%;
  442. }
  443. }
  444. }
  445. }
  446. .distance {
  447. margin-top: -35rpx;
  448. color: #999999;
  449. font-size: 24rpx;
  450. }
  451. }
  452. .body {
  453. position: absolute;
  454. top: 539rpx;
  455. left: 20rpx;
  456. padding-bottom: 30rpx;
  457. width: 710rpx;
  458. border-radius: 10rpx;
  459. background-color: #fff;
  460. .body_header {
  461. display: flex;
  462. justify-content: space-around;
  463. box-sizing: border-box;
  464. padding: 0 30rpx;
  465. height: 150rpx;
  466. .header_start {
  467. display: flex;
  468. flex-direction: column;
  469. justify-content: center;
  470. align-items: center;
  471. width: 213rpx;
  472. height: 150rpx;
  473. .header_top {
  474. margin-bottom: 10rpx;
  475. color: #999999;
  476. font-size: 24rpx;
  477. }
  478. .header_bottom {
  479. font-size: 34rpx;
  480. font-weight: bold;
  481. }
  482. }
  483. .header_night {
  484. display: flex;
  485. justify-content: center;
  486. align-items: center;
  487. .night_line {
  488. width: 17rpx;
  489. height: 1rpx;
  490. background-color: #296de3;
  491. }
  492. .night_box {
  493. display: flex;
  494. align-items: center;
  495. justify-content: center;
  496. width: 81rpx;
  497. height: 46rpx;
  498. font-size: 24rpx;
  499. border-radius: 66rpx;
  500. border: 1rpx solid #296de3;
  501. }
  502. }
  503. .header_end {
  504. display: flex;
  505. flex-direction: column;
  506. justify-content: center;
  507. align-items: center;
  508. width: 213rpx;
  509. height: 150rpx;
  510. .header_top {
  511. margin-bottom: 10rpx;
  512. color: #999999;
  513. font-size: 24rpx;
  514. }
  515. .header_bottom {
  516. font-size: 34rpx;
  517. font-weight: bold;
  518. }
  519. }
  520. }
  521. .body_content {
  522. .body_box {
  523. box-sizing: border-box;
  524. padding: 0 30rpx;
  525. margin-bottom: 30rpx;
  526. display: flex;
  527. height: 193rpx;
  528. border-bottom: 1rpx solid #cccccc;
  529. .box_left {
  530. width: 213rpx;
  531. height: 161rpx;
  532. border-radius: 5rpx;
  533. img {
  534. width: 100%;
  535. height: 100%;
  536. }
  537. }
  538. .box_center {
  539. margin-left: 16rpx;
  540. .center_top {
  541. font-size: 34rpx;
  542. font-weight: bold;
  543. }
  544. .center_center {
  545. display: flex;
  546. flex-wrap: wrap;
  547. margin-top: 10rpx;
  548. color: #999999;
  549. font-size: 24rpx;
  550. .center_item {
  551. margin-right: 15rpx;
  552. }
  553. }
  554. .center_bottom {
  555. margin-top: 25rpx;
  556. .img {
  557. margin-right: 15rpx;
  558. width: 30rpx;
  559. height: 30rpx;
  560. }
  561. }
  562. }
  563. .box_right {
  564. display: flex;
  565. flex-direction: column;
  566. align-items: flex-end;
  567. margin-left: auto;
  568. margin-top: 20rpx;
  569. .right_price {
  570. color: #ff5733;
  571. font-size: 42rpx;
  572. text {
  573. font-size: 24rpx;
  574. }
  575. }
  576. .right_btn {
  577. display: flex;
  578. justify-content: center;
  579. align-items: center;
  580. margin-top: 10rpx;
  581. width: 100rpx;
  582. height: 66rpx;
  583. color: #fff;
  584. font-size: 36rpx;
  585. border-radius: 11rpx;
  586. background-color: #096562;
  587. }
  588. .inactive {
  589. background-color: #cccccc;
  590. }
  591. }
  592. }
  593. .body_pop {
  594. position: relative;
  595. height: 955rpx;
  596. border-radius: 22rpx 22rpx 0 0;
  597. background-color: #fff;
  598. overflow-y: auto;
  599. .pop_swiper {
  600. height: 422rpx;
  601. border-radius: 22rpx 22rpx 0 0;
  602. .pop_swiper_item {
  603. width: 100%;
  604. height: 100%;
  605. .img {
  606. width: 100%;
  607. height: 100%;
  608. border-radius: 22rpx 22rpx 0 0;
  609. }
  610. }
  611. }
  612. .pop_icon {
  613. position: absolute;
  614. top: 20rpx;
  615. right: 30rpx;
  616. width: 58rpx;
  617. height: 58rpx;
  618. }
  619. .pop_body {
  620. box-sizing: border-box;
  621. padding: 0 20rpx 30rpx;
  622. .body_title {
  623. margin-top: 30rpx;
  624. font-size: 32rpx;
  625. font-weight: bold;
  626. }
  627. .body_tags {
  628. display: flex;
  629. flex-wrap: wrap;
  630. margin-top: 20rpx;
  631. .tags_item {
  632. display: flex;
  633. align-items: center;
  634. margin-right: 76rpx;
  635. margin-bottom: 20rpx;
  636. color: #383838;
  637. font-size: 24rpx;
  638. .img {
  639. margin-right: 5rpx;
  640. width: 28rpx;
  641. height: 28rpx;
  642. }
  643. }
  644. }
  645. .body_title2 {
  646. margin-top: 20rpx;
  647. font-size: 28rpx;
  648. }
  649. .body_detail {
  650. display: flex;
  651. flex-direction: column;
  652. justify-content: space-between;
  653. // align-items: flex-end;
  654. box-sizing: border-box;
  655. padding: 20rpx 30rpx;
  656. margin-top: 18rpx;
  657. width: 710rpx;
  658. height: 266rpx;
  659. font-size: 24rpx;
  660. border-radius: 7rpx;
  661. background-color: #f2f2f2;
  662. .detail_old {
  663. text-align: end;
  664. text-decoration: line-through;
  665. }
  666. .detail_box {
  667. display: flex;
  668. justify-content: space-between;
  669. color: #808080;
  670. text {
  671. color: #ff5733;
  672. }
  673. }
  674. .detail_new {
  675. display: flex;
  676. justify-content: flex-end;
  677. align-items: center;
  678. font-size: 24rpx;
  679. .color {
  680. color: #ff5733;
  681. }
  682. .price {
  683. font-size: 36rpx;
  684. }
  685. .ml_10 {
  686. margin-left: 10rpx;
  687. }
  688. }
  689. }
  690. .body_bottom {
  691. display: flex;
  692. justify-content: space-between;
  693. align-items: center;
  694. margin-top: 250rpx;
  695. height: 80rpx;
  696. .bottom_left {
  697. display: flex;
  698. align-items: center;
  699. color: #333333;
  700. font-size: 24rpx;
  701. .img {
  702. margin-right: 10rpx;
  703. width: 48rpx;
  704. height: 48rpx;
  705. }
  706. }
  707. .bottom_right {
  708. display: flex;
  709. align-items: center;
  710. color: #ff5733;
  711. font-size: 40rpx;
  712. font-weight: bold;
  713. text {
  714. font-size: 24rpx;
  715. }
  716. .btn {
  717. display: flex;
  718. justify-content: center;
  719. align-items: center;
  720. margin-left: 30rpx;
  721. width: 238rpx;
  722. height: 80rpx;
  723. color: #fff;
  724. font-size: 32rpx;
  725. font-weight: 400;
  726. border-radius: 64rpx;
  727. background-color: #096562;
  728. }
  729. }
  730. }
  731. }
  732. }
  733. }
  734. }
  735. }
  736. </style>