detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <view class="scenic-detail">
  3. <zs-skeleton type="scenicDetail" :loading="loading"></zs-skeleton>
  4. <zs-header :background="background"></zs-header>
  5. <image class="top-banner" :src="info.defaultPic" mode=""></image>
  6. <view class="content">
  7. <view class="info">
  8. <view class="title">
  9. {{info.scenicName}}
  10. </view>
  11. <view class="address-box">
  12. <view class="province">
  13. {{info.cityName}}
  14. </view>
  15. <view class="address">
  16. {{info.scenicAddress}}
  17. </view>
  18. </view>
  19. <view class="open-time">
  20. 营业时间:{{info.openTime}}
  21. </view>
  22. </view>
  23. <view class="navigation-box">
  24. <view class="address">
  25. {{info.scenicAddress}}
  26. </view>
  27. <view class="btn" @click="handleNavigation">
  28. 导航
  29. </view>
  30. </view>
  31. <view class="list">
  32. <view class="item">
  33. <view class="sub-title">
  34. <!-- {{item.title}} -->
  35. </view>
  36. <view class="ticket-list">
  37. <view class="ticket-item" :class="[index != info.ticketList.length-1?'border-bottom':'']" v-for="(item,index) in info.ticketList" :key="index">
  38. <view class="top">
  39. <view class="title">
  40. {{item.productName}}
  41. </view>
  42. <view class="price-box">
  43. <view class="unit">
  44. </view>
  45. <view class="price">
  46. {{item.salePrice}}
  47. </view>
  48. <view class="text">
  49. </view>
  50. </view>
  51. </view>
  52. <view class="bottom">
  53. <view class="left">
  54. <!-- <view class="desc">
  55. {{i.desc}}
  56. </view> -->
  57. <view class="notice-box" @click="handleBuy(item)">
  58. 预定须知
  59. <image class="more" src="../static/right.png" mode=""></image>
  60. </view>
  61. </view>
  62. <view class="btn" @click="handleBuy(item)">
  63. 立即预订
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="sub-title">
  71. 景区简介
  72. </view>
  73. <view class="intro border-bottom">
  74. {{info.recommend|| '-'}}
  75. </view>
  76. <view class="sub-title">
  77. 交通信息
  78. </view>
  79. <view class="intro">
  80. {{info.trafficBus || '-'}}
  81. </view>
  82. </view>
  83. <u-popup :show="show" round="16rpx" mode="bottom" @close="close">
  84. <view class="popup-title">
  85. {{info.scenicName}}
  86. </view>
  87. <view class="box">
  88. <template v-if="ticketInfo.drawAddress">
  89. <view class="sub-title">
  90. 取票地点
  91. </view>
  92. <view class="intro">
  93. {{ticketInfo.drawAddress}}
  94. </view>
  95. </template>
  96. <view class="sub-title">
  97. 入园方式
  98. </view>
  99. <view class="intro">
  100. {{ticketInfo.admissionVoucher.admissionVoucherCode | filterVoucherType}}
  101. </view>
  102. <view class="sub-title">
  103. 有效期
  104. </view>
  105. <view class="intro">
  106. {{ticketInfo.indate || '-'}}
  107. </view>
  108. <view class="sub-title">
  109. 预定截止
  110. </view>
  111. <view class="intro">
  112. {{ticketInfo.advanceDay}}天 {{ticketInfo.advanceHour}}小时
  113. </view>
  114. <view class="sub-title">
  115. 退改规则
  116. </view>
  117. <rich-text class="intro" :nodes="ticketInfo.mpLossInfo"></rich-text>
  118. <view class="sub-title">
  119. 预定须知
  120. </view>
  121. <rich-text class="intro" :nodes="ticketInfo.bookNotice"></rich-text>
  122. <view class="sub-title">
  123. 其他说明
  124. </view>
  125. <rich-text class="intro" :nodes="ticketInfo.info"></rich-text>
  126. <!-- <template v-for="item in info.bookNotice">
  127. <view class="sub-title">
  128. {{item.name}}
  129. </view>
  130. <rich-text class="intro" :nodes="item.value"></rich-text>
  131. </template> -->
  132. </view>
  133. <view class="btn-box">
  134. <view class="left">
  135. <view class="num">
  136. 共1件
  137. </view>
  138. <view class="total">
  139. 合计 <view class="price-box">
  140. <view class="unit">
  141. </view>
  142. <view class="price">
  143. {{total}}
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <view class="buy-btn" @click="handleBtn">
  149. 立即预订
  150. </view>
  151. </view>
  152. </u-popup>
  153. <map class="map" id="map"></map>
  154. </view>
  155. </template>
  156. <script>
  157. import {getScenicDetail,getTicketDetail} from '@/api/scenic.js'
  158. export default {
  159. data() {
  160. return {
  161. show:false,
  162. background: false,
  163. loading:false,
  164. map:null,
  165. total:0,
  166. info:{
  167. "scenicName": "",
  168. "glocation": "",
  169. "scenicId": 0,
  170. "recommend": "",
  171. "scenicDescription": "",
  172. "scenicAddress": "",
  173. "trafficBus": "",
  174. "bookNotice": "",
  175. "cityName": "",
  176. "blocation": "",
  177. "defaultPic": "",
  178. "provinceName": "",
  179. "openTime": "",
  180. "disTickets": []
  181. },
  182. ticketInfo:{},
  183. scenicId:0,
  184. epId:''
  185. }
  186. },
  187. filters: {
  188. filterVoucherType: function(val) {
  189. if(val == 1){
  190. return '实体票入园'
  191. }else if(val == 201){
  192. return '换票入园短信'
  193. }else if(val == 202){
  194. return '换票入园二维码'
  195. }else if(val == 203){
  196. return '换票入园数字码'
  197. }else if(val == 204){
  198. return '换票入园换票证'
  199. }else if(val == 205){
  200. return '换票入园邮件'
  201. }else if(val == 206){
  202. return '换票入园身份证'
  203. }else if(val == 207){
  204. return '换票入园护照'
  205. }else if(val == 208){
  206. return '换票入园港澳通行证'
  207. }else if(val == 209){
  208. return '换票入园军官证'
  209. }else if(val == 210){
  210. return '换票入园台胞证'
  211. }else if(val == 301){
  212. return '直接验证入园二维码'
  213. }else if(val == 302){
  214. return '直接验证入园邮件'
  215. }else if(val == 303){
  216. return '直接验证入园身份证'
  217. }else if(val == 304){
  218. return '直接验证入园护照'
  219. }else if(val == 305){
  220. return '直接验证入园港澳通行证'
  221. }else if(val == 306){
  222. return '直接验证入园军官证'
  223. }else if(val == 307){
  224. return '直接验证入园台胞证'
  225. }
  226. }
  227. },
  228. methods: {
  229. close(){
  230. this.show = false
  231. },
  232. handleBuy(item){
  233. console.log(item);
  234. this.show = true
  235. this.total = item.salePrice
  236. this.getTicketDetail(item.productId)
  237. },
  238. handleNavigation() {
  239. let blocation = this.info.glocation.split(',')
  240. console.log(blocation);
  241. uni.openLocation({
  242. latitude: Number(blocation[0]) ,
  243. longitude: Number(blocation[1]),
  244. name:this.info.scenicName,
  245. address:this.info.scenicAddress,
  246. success: function () {
  247. console.log('success');
  248. }
  249. });
  250. },
  251. handleBtn(){
  252. let that = this
  253. uni.navigateTo({
  254. url:'/scenic/makeOut?id='+this.scenicId,
  255. success: function(res) {
  256. // 通过eventChannel向被打开页面传送数据
  257. let obj = that.ticketInfo
  258. obj.epId = that.epId
  259. obj.shopName = that.info.scenicName
  260. res.eventChannel.emit('pay', obj)
  261. }
  262. })
  263. },
  264. getScenicDetail(scenicId){
  265. this.loading = true
  266. getScenicDetail({scenicId}).then(res=>{
  267. this.loading = false
  268. if(res.state == 'Success'){
  269. this.info = res.content.data
  270. this.info.bookNotice = JSON.parse(this.info.bookNotice)
  271. console.log(this.info.bookNotice);
  272. }
  273. })
  274. },
  275. getTicketDetail(productId){
  276. getTicketDetail({productId}).then(res=>{
  277. if(res.state == 'Success'){
  278. this.ticketInfo = res.content.data
  279. this.ticketInfo.mpLossInfo = this.ticketInfo.mpLossInfo.replace(/\n/g, "<br>")
  280. this.ticketInfo.info = this.ticketInfo.info.replace(/\n/g, "<br>")
  281. this.ticketInfo.bookNotice = this.ticketInfo.bookNotice.replace(/\n/g, "<br>")
  282. }
  283. })
  284. },
  285. },
  286. onPageScroll(e) {
  287. if (e.scrollTop >= 50) {
  288. this.background = true
  289. } else {
  290. this.background = false
  291. }
  292. },
  293. onReady() {
  294. this.map = uni.createMapContext("map", this);
  295. },
  296. onLoad(options) {
  297. this.getScenicDetail(options.id)
  298. this.scenicId = options.id
  299. this.epId = options.epId
  300. }
  301. }
  302. </script>
  303. <style lang="scss" >
  304. .scenic-detail{
  305. .top-banner{
  306. width: 750rpx;
  307. height: 382rpx;
  308. vertical-align: bottom;
  309. }
  310. .map{
  311. position: absolute;
  312. top: -9999rpx;
  313. left: -9999rpx;
  314. }
  315. .content{
  316. position: relative;
  317. top: -20rpx;
  318. z-index: 2;
  319. background: #FFFFFF;
  320. border-radius: 16rpx 16rpx 0rpx 0rpx;
  321. padding: 28rpx 24rpx;
  322. .info{
  323. .title{
  324. font-weight: 600;
  325. font-size: 32rpx;
  326. color: #222222;
  327. }
  328. .address-box{
  329. display: flex;
  330. align-items: center;
  331. font-weight: 300;
  332. font-size: 24rpx;
  333. color: #AAAAAA;
  334. margin-top: 26rpx;
  335. .province{
  336. padding-right: 12rpx;
  337. border-right: 2rpx solid #F0F0F0;
  338. }
  339. }
  340. .open-time{
  341. font-weight: 300;
  342. font-size: 24rpx;
  343. color: #AAAAAA;
  344. margin-top: 20rpx;
  345. }
  346. }
  347. .navigation-box{
  348. display: flex;
  349. align-items: center;
  350. justify-content: space-between;
  351. width: 702rpx;
  352. height: 140rpx;
  353. background-image: url('../static/white-map.png');
  354. background-repeat: repeat;
  355. background-size: 100% 140rpx;
  356. // background: linear-gradient( 101deg, rgba(246,246,246,0.89) 0%, #FFFFFF 100%);
  357. border-radius: 16rpx 16rpx 16rpx 16rpx;
  358. padding: 0 24rpx;
  359. box-sizing: border-box;
  360. margin-top: 20rpx;
  361. .address{
  362. font-weight: 600;
  363. font-size: 24rpx;
  364. color: #222222;
  365. width: 490rpx;
  366. white-space: nowrap;
  367. overflow: hidden;
  368. text-overflow: ellipsis;
  369. }
  370. .btn{
  371. width: 120rpx;
  372. height: 52rpx;
  373. line-height: 52rpx;
  374. text-align: center;
  375. background: #E2ECFF;
  376. border-radius: 26rpx 26rpx 26rpx 26rpx;
  377. font-weight: 300;
  378. font-size: 28rpx;
  379. color: #3879F9;
  380. }
  381. }
  382. .sub-title{
  383. font-weight: 600;
  384. font-size: 32rpx;
  385. color: #222222;
  386. margin: 20rpx 0;
  387. }
  388. .intro{
  389. font-weight: 300;
  390. font-size: 24rpx;
  391. color: #AAAAAA;
  392. line-height: 40rpx;
  393. padding-bottom: 24rpx;
  394. }
  395. .border-bottom{
  396. border-bottom: 1rpx solid #F0F0F0!important;
  397. }
  398. .list{
  399. .item{
  400. .ticket-list{
  401. background: #F9F9F9;
  402. border-radius: 16rpx 16rpx 16rpx 16rpx;
  403. padding: 0 24rpx;
  404. .ticket-item{
  405. padding: 28rpx 0;
  406. .top{
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. .title{
  411. font-weight: 400;
  412. font-size: 28rpx;
  413. color: #222222;
  414. overflow: hidden;
  415. text-overflow: ellipsis;
  416. /* 弹性伸缩盒子模型显示 */
  417. display: -webkit-box;
  418. /* 限制在一个块元素显示的文本的行数 */
  419. -webkit-line-clamp: 2;
  420. /* 设置或检索伸缩盒对象的子元素的排列方式 */
  421. -webkit-box-orient: vertical;
  422. }
  423. .price-box{
  424. display: flex;
  425. align-items: flex-end;
  426. margin-top: 12rpx;
  427. .unit{
  428. font-weight: 600;
  429. font-size: 20rpx;
  430. color: $uni-color-primary;
  431. }
  432. .price{
  433. font-weight: 600;
  434. font-size: 32rpx;
  435. color: $uni-color-primary;
  436. }
  437. .text{
  438. font-weight: 300;
  439. font-size: 24rpx;
  440. color: #AAAAAA;
  441. margin-left: 6rpx;
  442. }
  443. }
  444. }
  445. .bottom{
  446. display: flex;
  447. align-items: center;
  448. justify-content: space-between;
  449. margin-top: 20rpx;
  450. .left{
  451. display: flex;
  452. align-items: center;
  453. font-weight: 300;
  454. font-size: 24rpx;
  455. color: #AAAAAA;
  456. .notice-box{
  457. display: flex;
  458. align-items: center;
  459. .more{
  460. width: 48rpx;
  461. height: 48rpx;
  462. }
  463. }
  464. }
  465. .btn{
  466. width: 120rpx;
  467. height: 52rpx;
  468. line-height: 52rpx;
  469. text-align: center;
  470. background: #EE4320;
  471. border-radius: 26rpx 26rpx 26rpx 26rpx;
  472. font-weight: 400;
  473. font-size: 24rpx;
  474. color: #FFFFFF;
  475. }
  476. }
  477. }
  478. }
  479. }
  480. }
  481. }
  482. .u-popup__content{
  483. padding: 0 24rpx 28rpx;
  484. position: relative;
  485. .popup-title{
  486. font-weight: 600;
  487. font-size: 32rpx;
  488. color: #222222;
  489. padding: 28rpx 0;
  490. border-bottom: 1rpx solid #F0F0F0;
  491. }
  492. .box{
  493. max-height: 70vh;
  494. overflow: auto;
  495. .sub-title{
  496. font-weight: 600;
  497. font-size: 28rpx;
  498. color: #222222;
  499. margin: 20rpx 0;
  500. }
  501. .intro{
  502. font-weight: 300;
  503. font-size: 24rpx;
  504. color: #AAAAAA;
  505. line-height: 40rpx;
  506. padding-bottom: 24rpx;
  507. }
  508. .border-bottom{
  509. border-bottom: 1rpx solid #F0F0F0!important;
  510. }
  511. }
  512. .btn-box{
  513. // position: absolute;
  514. left: 0%;
  515. bottom: env(safe-area-inset-bottom);
  516. width: 100%;
  517. padding: 10rpx 24rpx;
  518. box-sizing: border-box;
  519. border-top: 1rpx solid #EEEEEE;
  520. display: flex;
  521. align-items: center;
  522. justify-content: space-between;
  523. .left{
  524. display: flex;
  525. align-items: flex-end;
  526. .num{
  527. font-weight: 300;
  528. font-size: 24rpx;
  529. color: #AAAAAA;
  530. }
  531. .total{
  532. font-weight: 300;
  533. font-size: 24rpx;
  534. color: #222222;
  535. display: flex;
  536. align-items: flex-end;
  537. margin-left: 6rpx;
  538. .price-box{
  539. display: flex;
  540. align-items: flex-end;
  541. font-weight: 400;
  542. font-size: 32rpx;
  543. color: #222222;
  544. .unit{
  545. font-size: 20rpx;
  546. }
  547. }
  548. }
  549. }
  550. .buy-btn{
  551. width: 240rpx;
  552. height: 80rpx;
  553. line-height: 80rpx;
  554. text-align: center;
  555. background: #EE4320;
  556. border-radius: 40rpx 40rpx 40rpx 40rpx;
  557. font-weight: 600;
  558. font-size: 28rpx;
  559. color: #FFFFFF;
  560. }
  561. }
  562. }
  563. }
  564. </style>