detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  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. let flag = uni.getStorageSync('login')
  271. if (flag) {
  272. if (item.active) {
  273. this.$refs.popup.close()
  274. this.showPage = false
  275. let info = JSON.stringify({
  276. nightNum: this.nightNum,
  277. startTimeDay: this.startTimeDay,
  278. startTimeMonth: this.startTimeMonth,
  279. startTimeWeek: this.startTimeWeek,
  280. endTimeDay: this.endTimeDay,
  281. endTimeMonth: this.endTimeMonth,
  282. endTimeWeek: this.endTimeWeek,
  283. price: item.price
  284. })
  285. uni.navigateTo({
  286. url: `/pages/affirmOrder/affirmOrder?info=${info}`
  287. })
  288. } else {
  289. uni.showToast({
  290. title: '该房间已售罄',
  291. icon: 'none'
  292. })
  293. }
  294. } else {
  295. uni.showToast({
  296. title: '请先登录',
  297. icon: 'none',
  298. mask: true
  299. })
  300. setTimeout(() => {
  301. uni.navigateTo({
  302. url: '/pages/login/login'
  303. })
  304. }, 1500)
  305. }
  306. },
  307. // 点击日期区域回调
  308. handleOpen() {
  309. this.$refs.calendar.open()
  310. },
  311. // 选择日历确定按钮回调
  312. handleConfirm(e) {
  313. // console.log(e)
  314. this.startTimeWeek = this.getWeek(e[0])
  315. this.endTimeWeek = this.getWeek(e[e.length - 1])
  316. let temStart = e[0].split('-')
  317. let temEnd = e[e.length - 1].split('-')
  318. this.startTimeMonth = temStart[1]
  319. this.startTimeDay = temStart[2]
  320. this.endTimeMonth = temEnd[1]
  321. this.endTimeDay = temEnd[2]
  322. this.nightNum = e.length - 1
  323. },
  324. // 获取今明两天的日期,星期
  325. getTimes() {
  326. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  327. //今天的日期
  328. let today = new Date()
  329. this.startTimeWeek = weekList[today.getDay()]
  330. this.startTimeMonth = (today.getMonth() + 1).toString().padStart(2, 0)
  331. this.startTimeDay = today.getDate().toString().padStart(2, 0)
  332. //明天的日期
  333. let tomorrow = new Date()
  334. tomorrow.setTime(tomorrow.getTime() + 24 * 60 * 60 * 1000)
  335. this.endTimeWeek = weekList[tomorrow.getDay()]
  336. this.endTimeMonth = (tomorrow.getMonth() + 1).toString().padStart(2, 0)
  337. this.endTimeDay = tomorrow.getDate().toString().padStart(2, 0)
  338. // 日历默认选择的日期
  339. this.defaultDateMultiple = [`${today.getFullYear()}-${this.startTimeMonth}-${this.startTimeDay}`, `${tomorrow.getFullYear()}-${this.endTimeMonth}-${this.endTimeDay}`]
  340. },
  341. // 传入参数获取当前是星期几
  342. getWeek(time) {
  343. let date = new Date(time)
  344. let week = date.getDay()
  345. let weekList = ['日', '一', '二', '三', '四', '五', '六']
  346. return weekList[week]
  347. }
  348. }
  349. }
  350. </script>
  351. <style lang="scss" scoped>
  352. .container {
  353. display: flex;
  354. flex-direction: column;
  355. position: relative;
  356. min-height: 100vh;
  357. background-color: #ebeced;
  358. .banner {
  359. position: relative;
  360. margin-top: 20rpx;
  361. width: 750rpx;
  362. height: 422rpx;
  363. .img {
  364. width: 100%;
  365. height: 100%;
  366. }
  367. .slogan {
  368. position: absolute;
  369. top: 0;
  370. left: 0;
  371. display: flex;
  372. justify-content: center;
  373. align-items: center;
  374. width: 163rpx;
  375. height: 60rpx;
  376. background-color: rgba(255, 255, 255, 0.4);
  377. img {
  378. width: 125rpx;
  379. height: 44rpx;
  380. }
  381. }
  382. }
  383. .detail {
  384. position: absolute;
  385. top: 265rpx;
  386. left: 20rpx;
  387. box-sizing: border-box;
  388. padding: 0 30rpx;
  389. width: 710rpx;
  390. height: 254rpx;
  391. border-radius: 10rpx;
  392. background-color: #fff;
  393. .detail_name {
  394. margin-top: 25rpx;
  395. font-size: 34rpx;
  396. font-weight: bold;
  397. }
  398. .detail_info {
  399. display: flex;
  400. justify-content: space-between;
  401. margin-top: 10rpx;
  402. .info_left {
  403. color: #999999;
  404. font-size: 20rpx;
  405. }
  406. .info_right {
  407. display: flex;
  408. align-items: center;
  409. color: #096562;
  410. font-size: 24rpx;
  411. img {
  412. margin-left: 6rpx;
  413. width: 10rpx;
  414. height: 20rpx;
  415. }
  416. }
  417. }
  418. .detail_group {
  419. display: flex;
  420. flex-wrap: wrap;
  421. margin-top: 5rpx;
  422. .group_item {
  423. display: flex;
  424. align-items: center;
  425. margin-right: 10rpx;
  426. color: #999999;
  427. font-size: 20rpx;
  428. img {
  429. margin-right: 5rpx;
  430. width: 22rpx;
  431. height: 22rpx;
  432. }
  433. }
  434. }
  435. .address {
  436. display: flex;
  437. justify-content: space-between;
  438. margin-top: 8rpx;
  439. font-size: 28rpx;
  440. font-weight: bold;
  441. .address_left {
  442. width: 480rpx;
  443. overflow: hidden;
  444. text-overflow: ellipsis;
  445. white-space: nowrap;
  446. }
  447. .address_right {
  448. display: flex;
  449. .right_box {
  450. margin-left: 28rpx;
  451. width: 50rpx;
  452. height: 78rpx;
  453. img {
  454. width: 100%;
  455. height: 100%;
  456. }
  457. }
  458. }
  459. }
  460. .distance {
  461. margin-top: -35rpx;
  462. color: #999999;
  463. font-size: 24rpx;
  464. }
  465. }
  466. .body {
  467. position: absolute;
  468. top: 539rpx;
  469. left: 20rpx;
  470. padding-bottom: 30rpx;
  471. width: 710rpx;
  472. border-radius: 10rpx;
  473. background-color: #fff;
  474. .body_header {
  475. display: flex;
  476. justify-content: space-around;
  477. box-sizing: border-box;
  478. padding: 0 30rpx;
  479. height: 150rpx;
  480. .header_start {
  481. display: flex;
  482. flex-direction: column;
  483. justify-content: center;
  484. align-items: center;
  485. width: 213rpx;
  486. height: 150rpx;
  487. .header_top {
  488. margin-bottom: 10rpx;
  489. color: #999999;
  490. font-size: 24rpx;
  491. }
  492. .header_bottom {
  493. font-size: 34rpx;
  494. font-weight: bold;
  495. }
  496. }
  497. .header_night {
  498. display: flex;
  499. justify-content: center;
  500. align-items: center;
  501. .night_line {
  502. width: 17rpx;
  503. height: 1rpx;
  504. background-color: #296de3;
  505. }
  506. .night_box {
  507. display: flex;
  508. align-items: center;
  509. justify-content: center;
  510. width: 81rpx;
  511. height: 46rpx;
  512. font-size: 24rpx;
  513. border-radius: 66rpx;
  514. border: 1rpx solid #296de3;
  515. }
  516. }
  517. .header_end {
  518. display: flex;
  519. flex-direction: column;
  520. justify-content: center;
  521. align-items: center;
  522. width: 213rpx;
  523. height: 150rpx;
  524. .header_top {
  525. margin-bottom: 10rpx;
  526. color: #999999;
  527. font-size: 24rpx;
  528. }
  529. .header_bottom {
  530. font-size: 34rpx;
  531. font-weight: bold;
  532. }
  533. }
  534. }
  535. .body_content {
  536. .body_box {
  537. box-sizing: border-box;
  538. padding: 0 30rpx;
  539. margin-bottom: 30rpx;
  540. display: flex;
  541. height: 193rpx;
  542. border-bottom: 1rpx solid #cccccc;
  543. .box_left {
  544. width: 213rpx;
  545. height: 161rpx;
  546. border-radius: 5rpx;
  547. img {
  548. width: 100%;
  549. height: 100%;
  550. }
  551. }
  552. .box_center {
  553. margin-left: 16rpx;
  554. .center_top {
  555. font-size: 34rpx;
  556. font-weight: bold;
  557. }
  558. .center_center {
  559. display: flex;
  560. flex-wrap: wrap;
  561. margin-top: 10rpx;
  562. color: #999999;
  563. font-size: 24rpx;
  564. .center_item {
  565. margin-right: 15rpx;
  566. }
  567. }
  568. .center_bottom {
  569. margin-top: 25rpx;
  570. .img {
  571. margin-right: 15rpx;
  572. width: 30rpx;
  573. height: 30rpx;
  574. }
  575. }
  576. }
  577. .box_right {
  578. display: flex;
  579. flex-direction: column;
  580. align-items: flex-end;
  581. margin-left: auto;
  582. margin-top: 20rpx;
  583. .right_price {
  584. color: #ff5733;
  585. font-size: 42rpx;
  586. text {
  587. font-size: 24rpx;
  588. }
  589. }
  590. .right_btn {
  591. display: flex;
  592. justify-content: center;
  593. align-items: center;
  594. margin-top: 10rpx;
  595. width: 100rpx;
  596. height: 66rpx;
  597. color: #fff;
  598. font-size: 36rpx;
  599. border-radius: 11rpx;
  600. background-color: #096562;
  601. }
  602. .inactive {
  603. background-color: #cccccc;
  604. }
  605. }
  606. }
  607. .body_pop {
  608. position: relative;
  609. height: 955rpx;
  610. border-radius: 22rpx 22rpx 0 0;
  611. background-color: #fff;
  612. overflow-y: auto;
  613. .pop_swiper {
  614. height: 422rpx;
  615. border-radius: 22rpx 22rpx 0 0;
  616. .pop_swiper_item {
  617. width: 100%;
  618. height: 100%;
  619. .img {
  620. width: 100%;
  621. height: 100%;
  622. border-radius: 22rpx 22rpx 0 0;
  623. }
  624. }
  625. }
  626. .pop_icon {
  627. position: absolute;
  628. top: 20rpx;
  629. right: 30rpx;
  630. width: 58rpx;
  631. height: 58rpx;
  632. }
  633. .pop_body {
  634. box-sizing: border-box;
  635. padding: 0 20rpx 30rpx;
  636. .body_title {
  637. margin-top: 30rpx;
  638. font-size: 32rpx;
  639. font-weight: bold;
  640. }
  641. .body_tags {
  642. display: flex;
  643. flex-wrap: wrap;
  644. margin-top: 20rpx;
  645. .tags_item {
  646. display: flex;
  647. align-items: center;
  648. margin-right: 76rpx;
  649. margin-bottom: 20rpx;
  650. color: #383838;
  651. font-size: 24rpx;
  652. .img {
  653. margin-right: 5rpx;
  654. width: 28rpx;
  655. height: 28rpx;
  656. }
  657. }
  658. }
  659. .body_title2 {
  660. margin-top: 20rpx;
  661. font-size: 28rpx;
  662. }
  663. .body_detail {
  664. display: flex;
  665. flex-direction: column;
  666. justify-content: space-between;
  667. // align-items: flex-end;
  668. box-sizing: border-box;
  669. padding: 20rpx 30rpx;
  670. margin-top: 18rpx;
  671. width: 710rpx;
  672. height: 266rpx;
  673. font-size: 24rpx;
  674. border-radius: 7rpx;
  675. background-color: #f2f2f2;
  676. .detail_old {
  677. text-align: end;
  678. text-decoration: line-through;
  679. }
  680. .detail_box {
  681. display: flex;
  682. justify-content: space-between;
  683. color: #808080;
  684. text {
  685. color: #ff5733;
  686. }
  687. }
  688. .detail_new {
  689. display: flex;
  690. justify-content: flex-end;
  691. align-items: center;
  692. font-size: 24rpx;
  693. .color {
  694. color: #ff5733;
  695. }
  696. .price {
  697. font-size: 36rpx;
  698. }
  699. .ml_10 {
  700. margin-left: 10rpx;
  701. }
  702. }
  703. }
  704. .body_bottom {
  705. display: flex;
  706. justify-content: space-between;
  707. align-items: center;
  708. margin-top: 250rpx;
  709. height: 80rpx;
  710. .bottom_left {
  711. display: flex;
  712. align-items: center;
  713. color: #333333;
  714. font-size: 24rpx;
  715. .img {
  716. margin-right: 10rpx;
  717. width: 48rpx;
  718. height: 48rpx;
  719. }
  720. }
  721. .bottom_right {
  722. display: flex;
  723. align-items: center;
  724. color: #ff5733;
  725. font-size: 40rpx;
  726. font-weight: bold;
  727. text {
  728. font-size: 24rpx;
  729. }
  730. .btn {
  731. display: flex;
  732. justify-content: center;
  733. align-items: center;
  734. margin-left: 30rpx;
  735. width: 238rpx;
  736. height: 80rpx;
  737. color: #fff;
  738. font-size: 32rpx;
  739. font-weight: 400;
  740. border-radius: 64rpx;
  741. background-color: #096562;
  742. }
  743. }
  744. }
  745. }
  746. }
  747. }
  748. }
  749. }
  750. </style>