detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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. if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0&&JSON.parse(uni.getStorageSync('userInfo')).setMealCode){
  254. let that = this
  255. uni.navigateTo({
  256. url:'/scenic/makeOut?id='+this.scenicId,
  257. success: function(res) {
  258. // 通过eventChannel向被打开页面传送数据
  259. let obj = that.ticketInfo
  260. obj.epId = that.epId
  261. obj.shopName = that.info.scenicName
  262. res.eventChannel.emit('pay', obj)
  263. }
  264. })
  265. }else{
  266. uni.showModal({
  267. title:'此商品需要开通会员才能购买',
  268. cancelText:'下次再说',
  269. confirmText:'立即开通',
  270. success(res) {
  271. if(res.confirm){
  272. uni.navigateTo({
  273. url:'/my/memberCenter/index'
  274. })
  275. }
  276. }
  277. })
  278. }
  279. },
  280. getScenicDetail(scenicId){
  281. this.loading = true
  282. getScenicDetail({scenicId}).then(res=>{
  283. this.loading = false
  284. if(res.state == 'Success'){
  285. this.info = res.content.data
  286. this.info.bookNotice = JSON.parse(this.info.bookNotice)
  287. this.info.scenicDescription = this.info.scenicDescription.replace(/<img/gi, '<img class="img_class" ')
  288. console.log(this.info.bookNotice);
  289. }
  290. })
  291. },
  292. getTicketDetail(productId){
  293. getTicketDetail({productId}).then(res=>{
  294. if(res.state == 'Success'){
  295. this.ticketInfo = res.content.data
  296. this.ticketInfo.mpLossInfo = this.ticketInfo.mpLossInfo.replace(/\n/g, "<br>")
  297. this.ticketInfo.info = this.ticketInfo.info.replace(/\n/g, "<br>")
  298. this.ticketInfo.bookNotice = this.ticketInfo.bookNotice.replace(/\n/g, "<br>")
  299. }
  300. })
  301. },
  302. },
  303. onPageScroll(e) {
  304. if (e.scrollTop >= 50) {
  305. this.background = true
  306. } else {
  307. this.background = false
  308. }
  309. },
  310. onReady() {
  311. this.map = uni.createMapContext("map", this);
  312. },
  313. onLoad(options) {
  314. this.getScenicDetail(options.id)
  315. this.scenicId = options.id
  316. this.epId = options.epId
  317. }
  318. }
  319. </script>
  320. <style lang="scss" >
  321. .scenic-detail{
  322. .img_class{
  323. max-width: 100% !important;
  324. }
  325. .top-banner{
  326. width: 750rpx;
  327. height: 382rpx;
  328. vertical-align: bottom;
  329. }
  330. .map{
  331. position: absolute;
  332. top: -9999rpx;
  333. left: -9999rpx;
  334. }
  335. .content{
  336. position: relative;
  337. top: -20rpx;
  338. z-index: 2;
  339. background: #FFFFFF;
  340. border-radius: 16rpx 16rpx 0rpx 0rpx;
  341. padding: 28rpx 24rpx;
  342. .info{
  343. .title{
  344. font-weight: 600;
  345. font-size: 32rpx;
  346. color: #222222;
  347. }
  348. .address-box{
  349. display: flex;
  350. align-items: center;
  351. font-weight: 300;
  352. font-size: 24rpx;
  353. color: #AAAAAA;
  354. margin-top: 26rpx;
  355. .province{
  356. padding-right: 12rpx;
  357. border-right: 2rpx solid #F0F0F0;
  358. }
  359. }
  360. .open-time{
  361. font-weight: 300;
  362. font-size: 24rpx;
  363. color: #AAAAAA;
  364. margin-top: 20rpx;
  365. }
  366. }
  367. .navigation-box{
  368. display: flex;
  369. align-items: center;
  370. justify-content: space-between;
  371. width: 702rpx;
  372. height: 140rpx;
  373. background-image: url('../static/white-map.png');
  374. background-repeat: repeat;
  375. background-size: 100% 140rpx;
  376. // background: linear-gradient( 101deg, rgba(246,246,246,0.89) 0%, #FFFFFF 100%);
  377. border-radius: 16rpx 16rpx 16rpx 16rpx;
  378. padding: 0 24rpx;
  379. box-sizing: border-box;
  380. margin-top: 20rpx;
  381. .address{
  382. font-weight: 600;
  383. font-size: 24rpx;
  384. color: #222222;
  385. width: 490rpx;
  386. white-space: nowrap;
  387. overflow: hidden;
  388. text-overflow: ellipsis;
  389. }
  390. .btn{
  391. width: 120rpx;
  392. height: 52rpx;
  393. line-height: 52rpx;
  394. text-align: center;
  395. background: #E2ECFF;
  396. border-radius: 26rpx 26rpx 26rpx 26rpx;
  397. font-weight: 300;
  398. font-size: 28rpx;
  399. color: #3879F9;
  400. }
  401. }
  402. .sub-title{
  403. font-weight: 600;
  404. font-size: 32rpx;
  405. color: #222222;
  406. margin: 20rpx 0;
  407. }
  408. .intro{
  409. font-weight: 300;
  410. font-size: 24rpx;
  411. color: #AAAAAA;
  412. line-height: 40rpx;
  413. padding-bottom: 24rpx;
  414. }
  415. .border-bottom{
  416. border-bottom: 1rpx solid #F0F0F0!important;
  417. }
  418. .list{
  419. .item{
  420. .ticket-list{
  421. background: #F9F9F9;
  422. border-radius: 16rpx 16rpx 16rpx 16rpx;
  423. padding: 0 24rpx;
  424. .ticket-item{
  425. padding: 28rpx 0;
  426. .top{
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. .title{
  431. font-weight: 400;
  432. font-size: 28rpx;
  433. color: #222222;
  434. overflow: hidden;
  435. text-overflow: ellipsis;
  436. /* 弹性伸缩盒子模型显示 */
  437. display: -webkit-box;
  438. /* 限制在一个块元素显示的文本的行数 */
  439. -webkit-line-clamp: 2;
  440. /* 设置或检索伸缩盒对象的子元素的排列方式 */
  441. -webkit-box-orient: vertical;
  442. }
  443. .price-box{
  444. display: flex;
  445. align-items: flex-end;
  446. margin-top: 12rpx;
  447. .unit{
  448. font-weight: 600;
  449. font-size: 20rpx;
  450. color: $uni-color-primary;
  451. }
  452. .price{
  453. font-weight: 600;
  454. font-size: 32rpx;
  455. color: $uni-color-primary;
  456. }
  457. .text{
  458. font-weight: 300;
  459. font-size: 24rpx;
  460. color: #AAAAAA;
  461. margin-left: 6rpx;
  462. }
  463. }
  464. }
  465. .bottom{
  466. display: flex;
  467. align-items: center;
  468. justify-content: space-between;
  469. margin-top: 20rpx;
  470. .left{
  471. display: flex;
  472. align-items: center;
  473. font-weight: 300;
  474. font-size: 24rpx;
  475. color: #AAAAAA;
  476. .notice-box{
  477. display: flex;
  478. align-items: center;
  479. .more{
  480. width: 48rpx;
  481. height: 48rpx;
  482. }
  483. }
  484. }
  485. .btn{
  486. width: 120rpx;
  487. height: 52rpx;
  488. line-height: 52rpx;
  489. text-align: center;
  490. background: #EE4320;
  491. border-radius: 26rpx 26rpx 26rpx 26rpx;
  492. font-weight: 400;
  493. font-size: 24rpx;
  494. color: #FFFFFF;
  495. }
  496. }
  497. }
  498. }
  499. }
  500. }
  501. }
  502. .u-popup__content{
  503. padding: 0 24rpx 28rpx;
  504. position: relative;
  505. .popup-title{
  506. font-weight: 600;
  507. font-size: 32rpx;
  508. color: #222222;
  509. padding: 28rpx 0;
  510. border-bottom: 1rpx solid #F0F0F0;
  511. }
  512. .box{
  513. max-height: 70vh;
  514. overflow: auto;
  515. .sub-title{
  516. font-weight: 600;
  517. font-size: 28rpx;
  518. color: #222222;
  519. margin: 20rpx 0;
  520. }
  521. .intro{
  522. font-weight: 300;
  523. font-size: 24rpx;
  524. color: #AAAAAA;
  525. line-height: 40rpx;
  526. padding-bottom: 24rpx;
  527. }
  528. .border-bottom{
  529. border-bottom: 1rpx solid #F0F0F0!important;
  530. }
  531. }
  532. .btn-box{
  533. // position: absolute;
  534. left: 0%;
  535. bottom: env(safe-area-inset-bottom);
  536. width: 100%;
  537. padding: 10rpx 24rpx;
  538. box-sizing: border-box;
  539. border-top: 1rpx solid #EEEEEE;
  540. display: flex;
  541. align-items: center;
  542. justify-content: space-between;
  543. .left{
  544. display: flex;
  545. align-items: flex-end;
  546. .num{
  547. font-weight: 300;
  548. font-size: 24rpx;
  549. color: #AAAAAA;
  550. }
  551. .total{
  552. font-weight: 300;
  553. font-size: 24rpx;
  554. color: #222222;
  555. display: flex;
  556. align-items: flex-end;
  557. margin-left: 6rpx;
  558. .price-box{
  559. display: flex;
  560. align-items: flex-end;
  561. font-weight: 400;
  562. font-size: 32rpx;
  563. color: #222222;
  564. .unit{
  565. font-size: 20rpx;
  566. }
  567. .price{
  568. font-weight: bold;
  569. }
  570. }
  571. }
  572. }
  573. .buy-btn{
  574. width: 240rpx;
  575. height: 80rpx;
  576. line-height: 80rpx;
  577. text-align: center;
  578. background: #EE4320;
  579. border-radius: 40rpx 40rpx 40rpx 40rpx;
  580. font-weight: 600;
  581. font-size: 28rpx;
  582. color: #FFFFFF;
  583. }
  584. }
  585. }
  586. }
  587. </style>