detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. <template>
  2. <view class="container" :style="'overflow:' + (showPage ? 'hidden' : 'visible')">
  3. <!-- 顶部民宿图片区域 -->
  4. <view class="banner">
  5. <img class="img" :src="info.imgUrl" />
  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">
  38. <img src="../../static/index/map.png" />
  39. </view>
  40. <view class="right_box">
  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" :closeOnClickOverlay="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>¥{{ roomInfo.price }}</view>
  142. <view>
  143. 每间每晚
  144. <text>¥{{ roomInfo.price }}</text>
  145. </view>
  146. </view>
  147. <view class="body_bottom">
  148. <view class="bottom_left">
  149. <img class="img" src="../../static/index/phone2.png" />
  150. 联系商家
  151. </view>
  152. <view class="bottom_right">
  153. <text>¥</text>
  154. {{ roomInfo.price }}
  155. <view class="btn" @click="goPageAffOrder(roomInfo)">预定</view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. </uv-popup>
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. export default {
  167. data() {
  168. return {
  169. // 滚动穿透控制
  170. showPage: false,
  171. // 房型数据数组
  172. list: [
  173. {
  174. id: 1,
  175. imgUrl: '../../static/index/banner.png',
  176. name: '01户型',
  177. price: '323.00',
  178. active: true
  179. },
  180. {
  181. id: 2,
  182. imgUrl: '../../static/index/banner.png',
  183. name: '02户型',
  184. price: '283.00',
  185. active: false
  186. },
  187. {
  188. id: 3,
  189. imgUrl: '../../static/index/banner.png',
  190. name: '03户型',
  191. price: '223.00',
  192. active: true
  193. }
  194. ],
  195. // 住几晚
  196. nightNum: 1,
  197. // 入住时间-月
  198. startTimeMonth: '',
  199. // 入住时间-日
  200. startTimeDay: '',
  201. // 入住时间-星期
  202. startTimeWeek: '',
  203. // 离店时间-月
  204. endTimeMonth: '',
  205. // 离店时间-日
  206. endTimeDay: '',
  207. // 离店时间-星期
  208. endTimeWeek: '',
  209. // 日历默认选择日期
  210. defaultDateMultiple: [],
  211. // 酒店信息
  212. info: {},
  213. // 房间信息
  214. roomInfo: {}
  215. }
  216. },
  217. onLoad(options) {
  218. // console.log(JSON.parse(options.info))
  219. this.info = JSON.parse(options.info)
  220. this.getTimes()
  221. },
  222. methods: {
  223. // 点击弹窗关闭图标回调
  224. handleClosePop() {
  225. this.showPage = false
  226. this.$refs.popup.close()
  227. },
  228. // 点击每一个户型回调
  229. handleLookDetail(item) {
  230. // console.log(item)
  231. this.roomInfo = item
  232. this.showPage = true
  233. this.$refs.popup.open('bottom')
  234. },
  235. // 点击设施详情回调
  236. goPageDetailInfo() {
  237. uni.navigateTo({
  238. url: '/pages/detailInfo/detailInfo'
  239. })
  240. },
  241. // 点击 订 按钮回调
  242. goPageAffOrder(item) {
  243. if (item.active) {
  244. this.$refs.popup.close()
  245. this.showPage = false
  246. let info = JSON.stringify({
  247. nightNum: this.nightNum,
  248. startTimeDay: this.startTimeDay,
  249. startTimeMonth: this.startTimeMonth,
  250. startTimeWeek: this.startTimeWeek,
  251. endTimeDay: this.endTimeDay,
  252. endTimeMonth: this.endTimeMonth,
  253. endTimeWeek: this.endTimeWeek,
  254. price: item.price
  255. })
  256. uni.navigateTo({
  257. url: `/pages/affirmOrder/affirmOrder?info=${info}`
  258. })
  259. } else {
  260. uni.showToast({
  261. title: '该房间已售罄',
  262. icon: 'none'
  263. })
  264. }
  265. },
  266. // 点击日期区域回调
  267. handleOpen() {
  268. this.$refs.calendar.open()
  269. },
  270. // 选择日历确定按钮回调
  271. handleConfirm(e) {
  272. // console.log(e)
  273. this.startTimeWeek = this.getWeek(e[0])
  274. this.endTimeWeek = this.getWeek(e[e.length - 1])
  275. let temStart = e[0].split('-')
  276. let temEnd = e[e.length - 1].split('-')
  277. this.startTimeMonth = temStart[1]
  278. this.startTimeDay = temStart[2]
  279. this.endTimeMonth = temEnd[1]
  280. this.endTimeDay = temEnd[2]
  281. this.nightNum = e.length - 1
  282. },
  283. // 获取今明两天的日期,星期
  284. getTimes() {
  285. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  286. //今天的日期
  287. let today = new Date()
  288. this.startTimeWeek = weekList[today.getDay()]
  289. this.startTimeMonth = (today.getMonth() + 1).toString().padStart(2, 0)
  290. this.startTimeDay = today.getDate().toString().padStart(2, 0)
  291. //明天的日期
  292. let tomorrow = new Date()
  293. tomorrow.setTime(tomorrow.getTime() + 24 * 60 * 60 * 1000)
  294. this.endTimeWeek = weekList[tomorrow.getDay()]
  295. this.endTimeMonth = (tomorrow.getMonth() + 1).toString().padStart(2, 0)
  296. this.endTimeDay = tomorrow.getDate().toString().padStart(2, 0)
  297. // 日历默认选择的日期
  298. this.defaultDateMultiple = [`${today.getFullYear()}-${this.startTimeMonth}-${this.startTimeDay}`, `${tomorrow.getFullYear()}-${this.endTimeMonth}-${this.endTimeDay}`]
  299. },
  300. // 传入参数获取当前是星期几
  301. getWeek(time) {
  302. let date = new Date(time)
  303. let week = date.getDay()
  304. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  305. return weekList[week]
  306. }
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. .container {
  312. display: flex;
  313. flex-direction: column;
  314. position: relative;
  315. min-height: 100vh;
  316. background-color: #ebeced;
  317. .banner {
  318. position: relative;
  319. margin-top: 20rpx;
  320. width: 750rpx;
  321. height: 422rpx;
  322. .img {
  323. width: 100%;
  324. height: 100%;
  325. }
  326. .slogan {
  327. position: absolute;
  328. top: 0;
  329. left: 0;
  330. display: flex;
  331. justify-content: center;
  332. align-items: center;
  333. width: 163rpx;
  334. height: 60rpx;
  335. background-color: rgba(255, 255, 255, 0.4);
  336. img {
  337. width: 125rpx;
  338. height: 44rpx;
  339. }
  340. }
  341. }
  342. .detail {
  343. position: absolute;
  344. top: 265rpx;
  345. left: 20rpx;
  346. box-sizing: border-box;
  347. padding: 0 30rpx;
  348. width: 710rpx;
  349. height: 254rpx;
  350. border-radius: 10rpx;
  351. background-color: #fff;
  352. .detail_name {
  353. margin-top: 25rpx;
  354. font-size: 34rpx;
  355. font-weight: bold;
  356. }
  357. .detail_info {
  358. display: flex;
  359. justify-content: space-between;
  360. margin-top: 10rpx;
  361. .info_left {
  362. color: #999999;
  363. font-size: 20rpx;
  364. }
  365. .info_right {
  366. display: flex;
  367. align-items: center;
  368. color: #096562;
  369. font-size: 24rpx;
  370. img {
  371. margin-left: 6rpx;
  372. width: 10rpx;
  373. height: 20rpx;
  374. }
  375. }
  376. }
  377. .detail_group {
  378. display: flex;
  379. flex-wrap: wrap;
  380. margin-top: 5rpx;
  381. .group_item {
  382. display: flex;
  383. align-items: center;
  384. margin-right: 10rpx;
  385. color: #999999;
  386. font-size: 20rpx;
  387. img {
  388. margin-right: 5rpx;
  389. width: 22rpx;
  390. height: 22rpx;
  391. }
  392. }
  393. }
  394. .address {
  395. display: flex;
  396. justify-content: space-between;
  397. margin-top: 8rpx;
  398. font-size: 28rpx;
  399. font-weight: bold;
  400. .address_left {
  401. width: 480rpx;
  402. overflow: hidden;
  403. text-overflow: ellipsis;
  404. white-space: nowrap;
  405. }
  406. .address_right {
  407. display: flex;
  408. .right_box {
  409. margin-left: 28rpx;
  410. width: 50rpx;
  411. height: 78rpx;
  412. img {
  413. width: 100%;
  414. height: 100%;
  415. }
  416. }
  417. }
  418. }
  419. .distance {
  420. margin-top: -35rpx;
  421. color: #999999;
  422. font-size: 24rpx;
  423. }
  424. }
  425. .body {
  426. position: absolute;
  427. top: 539rpx;
  428. left: 20rpx;
  429. padding-bottom: 30rpx;
  430. width: 710rpx;
  431. border-radius: 10rpx;
  432. background-color: #fff;
  433. .body_header {
  434. display: flex;
  435. justify-content: space-around;
  436. box-sizing: border-box;
  437. padding: 0 30rpx;
  438. height: 150rpx;
  439. .header_start {
  440. display: flex;
  441. flex-direction: column;
  442. justify-content: center;
  443. align-items: center;
  444. width: 213rpx;
  445. height: 150rpx;
  446. .header_top {
  447. margin-bottom: 10rpx;
  448. color: #999999;
  449. font-size: 24rpx;
  450. }
  451. .header_bottom {
  452. font-size: 34rpx;
  453. font-weight: bold;
  454. }
  455. }
  456. .header_night {
  457. display: flex;
  458. justify-content: center;
  459. align-items: center;
  460. .night_line {
  461. width: 17rpx;
  462. height: 1rpx;
  463. background-color: #296de3;
  464. }
  465. .night_box {
  466. display: flex;
  467. align-items: center;
  468. justify-content: center;
  469. width: 81rpx;
  470. height: 46rpx;
  471. font-size: 24rpx;
  472. border-radius: 66rpx;
  473. border: 1rpx solid #296de3;
  474. }
  475. }
  476. .header_end {
  477. display: flex;
  478. flex-direction: column;
  479. justify-content: center;
  480. align-items: center;
  481. width: 213rpx;
  482. height: 150rpx;
  483. .header_top {
  484. margin-bottom: 10rpx;
  485. color: #999999;
  486. font-size: 24rpx;
  487. }
  488. .header_bottom {
  489. font-size: 34rpx;
  490. font-weight: bold;
  491. }
  492. }
  493. }
  494. .body_content {
  495. .body_box {
  496. box-sizing: border-box;
  497. padding: 0 30rpx;
  498. margin-bottom: 30rpx;
  499. display: flex;
  500. height: 193rpx;
  501. border-bottom: 1rpx solid #cccccc;
  502. .box_left {
  503. width: 213rpx;
  504. height: 161rpx;
  505. border-radius: 5rpx;
  506. img {
  507. width: 100%;
  508. height: 100%;
  509. }
  510. }
  511. .box_center {
  512. margin-left: 16rpx;
  513. .center_top {
  514. font-size: 34rpx;
  515. font-weight: bold;
  516. }
  517. .center_center {
  518. display: flex;
  519. flex-wrap: wrap;
  520. margin-top: 10rpx;
  521. color: #999999;
  522. font-size: 24rpx;
  523. .center_item {
  524. margin-right: 15rpx;
  525. }
  526. }
  527. .center_bottom {
  528. margin-top: 25rpx;
  529. .img {
  530. margin-right: 15rpx;
  531. width: 30rpx;
  532. height: 30rpx;
  533. }
  534. }
  535. }
  536. .box_right {
  537. display: flex;
  538. flex-direction: column;
  539. align-items: flex-end;
  540. margin-left: auto;
  541. margin-top: 20rpx;
  542. .right_price {
  543. color: #ff5733;
  544. font-size: 42rpx;
  545. text {
  546. font-size: 24rpx;
  547. }
  548. }
  549. .right_btn {
  550. display: flex;
  551. justify-content: center;
  552. align-items: center;
  553. margin-top: 10rpx;
  554. width: 100rpx;
  555. height: 66rpx;
  556. color: #fff;
  557. font-size: 36rpx;
  558. border-radius: 11rpx;
  559. background-color: #096562;
  560. }
  561. .inactive {
  562. background-color: #cccccc;
  563. }
  564. }
  565. }
  566. .body_pop {
  567. position: relative;
  568. height: 955rpx;
  569. border-radius: 22rpx 22rpx 0 0;
  570. background-color: #fff;
  571. overflow-y: auto;
  572. .pop_swiper {
  573. height: 422rpx;
  574. border-radius: 22rpx 22rpx 0 0;
  575. .pop_swiper_item {
  576. width: 100%;
  577. height: 100%;
  578. .img {
  579. width: 100%;
  580. height: 100%;
  581. border-radius: 22rpx 22rpx 0 0;
  582. }
  583. }
  584. }
  585. .pop_icon {
  586. position: absolute;
  587. top: 20rpx;
  588. right: 30rpx;
  589. width: 58rpx;
  590. height: 58rpx;
  591. }
  592. .pop_body {
  593. box-sizing: border-box;
  594. padding: 0 20rpx 30rpx;
  595. .body_title {
  596. margin-top: 30rpx;
  597. font-size: 32rpx;
  598. font-weight: bold;
  599. }
  600. .body_tags {
  601. display: flex;
  602. flex-wrap: wrap;
  603. margin-top: 20rpx;
  604. .tags_item {
  605. display: flex;
  606. align-items: center;
  607. margin-right: 76rpx;
  608. margin-bottom: 20rpx;
  609. color: #383838;
  610. font-size: 24rpx;
  611. .img {
  612. margin-right: 5rpx;
  613. width: 28rpx;
  614. height: 28rpx;
  615. }
  616. }
  617. }
  618. .body_title2 {
  619. margin-top: 20rpx;
  620. font-size: 28rpx;
  621. }
  622. .body_detail {
  623. display: flex;
  624. flex-direction: column;
  625. justify-content: space-between;
  626. align-items: flex-end;
  627. box-sizing: border-box;
  628. padding: 20rpx 30rpx;
  629. margin-top: 18rpx;
  630. width: 710rpx;
  631. height: 215rpx;
  632. font-size: 28rpx;
  633. border-radius: 7rpx;
  634. background-color: #f2f2f2;
  635. text {
  636. color: #ff5733;
  637. }
  638. }
  639. .body_bottom {
  640. display: flex;
  641. justify-content: space-between;
  642. align-items: center;
  643. margin-top: 250rpx;
  644. height: 80rpx;
  645. .bottom_left {
  646. display: flex;
  647. align-items: center;
  648. color: #333333;
  649. font-size: 24rpx;
  650. .img {
  651. margin-right: 10rpx;
  652. width: 48rpx;
  653. height: 48rpx;
  654. }
  655. }
  656. .bottom_right {
  657. display: flex;
  658. align-items: center;
  659. color: #ff5733;
  660. font-size: 40rpx;
  661. font-weight: bold;
  662. text {
  663. font-size: 24rpx;
  664. }
  665. .btn {
  666. display: flex;
  667. justify-content: center;
  668. align-items: center;
  669. margin-left: 30rpx;
  670. width: 238rpx;
  671. height: 80rpx;
  672. color: #fff;
  673. font-size: 32rpx;
  674. font-weight: 400;
  675. border-radius: 64rpx;
  676. background-color: #096562;
  677. }
  678. }
  679. }
  680. }
  681. }
  682. }
  683. }
  684. }
  685. </style>