detail.vue 13 KB

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