ticketlist.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. <template>
  2. <view class="pages">
  3. <view class="navbar-box">
  4. <u-navbar title="订单详情" :safeAreaInsetTop="true" @leftClick="leftClick" :titleStyle="{color:'#fff'}" leftIconColor="#fff" bgColor="transparent"></u-navbar>
  5. </view>
  6. <view class="banner">
  7. <!-- <image class="img" :src="staticUrl+'/img/bookticket-banner.png'" alt=""> -->
  8. <image class="img" :src="theatre.showImg" alt="">
  9. <view class="content">
  10. <view class="share" @click="openShare(item)">
  11. <image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
  12. </view>
  13. <view class="name">{{theatre.name}}</view>
  14. <view class="addr u-flex u-row-between">
  15. <view class="text">{{theatre.address}}</view>
  16. <u-icon name="arrow-right" color="#ffffff" size="36rpx" @click="goMap"></u-icon>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="tabs-wrap">
  21. <view class="inner">
  22. <u-tabs
  23. :list="tabsArr"
  24. @click="tabsClick"
  25. lineColor="#ED0000"
  26. lineWidth="82rpx"
  27. :activeStyle="{color: '#2D2D2D',fontWeight: 'bold'}"
  28. itemStyle="width:33%; height: 46px;box-sizing:border-box"
  29. >
  30. </u-tabs>
  31. </view>
  32. </view>
  33. <view class="page-wrap">
  34. <view class="ticket" v-if="tabsIndex==0">
  35. <view class="date-block auditorium">
  36. <view class="title">演出厅</view>
  37. <view class="date-list u-flex u-flex-wrap">
  38. <view class="date-item" :class="{active:auditoriumIndex==index}" @click="auditoriumClick(index)" v-for="(date,index) in auditoriumList" :key="index">
  39. <view class="name">{{ date.name }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="date-block">
  44. <view class="title">游玩日期</view>
  45. <view class="date-list u-flex">
  46. <view class="date-item" :class="{active:dateIndex==index}" @click="dateClick(index)" v-for="(date,index) in dateList" :key="index">
  47. <view class="name">{{ date.name }}</view>
  48. <view class="date">{{ date.month }} - {{ date.day }}</view>
  49. </view>
  50. <view class="date-item more-date u-flex u-row-center" @click="calendarShow = true">
  51. <view class="text">
  52. <view class="">更多</view>
  53. <view class="">日期</view>
  54. </view>
  55. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="date-block session-wrap">
  60. <view class="title">演出场次</view>
  61. <view class="session">
  62. <view class="session-item" :class="{active:sessionIndex==index}" @click="sessionClick(index)" v-for="(date,index) in sessionList" :key="index">
  63. {{ $u.timeFormat(date.performTimeStart, 'hh:MM') }} - {{ $u.timeFormat(date.performTimeEnd, 'hh:MM') }}
  64. </view>
  65. </view>
  66. <view class="empty" v-if="auditoriumList>=1&&sessionList.length<1">
  67. 当前日期暂无演出场次,请重新选择
  68. </view>
  69. </view>
  70. <view class="date-block ticket-type">
  71. <view class="title">门票</view>
  72. <view class="type-item" :class="{active:sessionIndex==index}" v-for="(item,index) in ticketTypeList" :key="index">
  73. <view class="name-price u-flex u-row-between">
  74. <view class="name">{{item.goodsName}}</view>
  75. <view class="prices">¥ {{item.salePrice}}</view>
  76. </view>
  77. <view class="ishave">
  78. <text class="text">{{(item.quantity>0&&sessionList.length>=1)?'有票':'无票'}}</text>
  79. </view>
  80. <view class="bottom u-flex u-row-between">
  81. <view class="left u-flex">
  82. 购票须知
  83. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  84. </view>
  85. <view class="btn" @click="book(item)" v-if="item.quantity>0&&sessionList.length>=1">预定</view>
  86. <view class="btn disabled" v-else>暂无余票</view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- ticket end -->
  92. <view class="details" v-if="tabsIndex==1">
  93. <view class="details-block">
  94. <view class="title">剧情简介</view>
  95. <view class="intro">
  96. <u-parse :content="performInfo.performSnapshot"></u-parse>
  97. </view>
  98. </view>
  99. <view class="details-block actors">
  100. <view class="title u-flex u-row-between">
  101. 演职人员
  102. <view class="right u-flex" @click="$u.route('pages/actors')">
  103. <text>更多</text>
  104. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  105. </view>
  106. </view>
  107. <view class="actor-list">
  108. <u-scroll-list :indicator="false">
  109. <view class="item" v-for="(item, index) in actorsArr" :key="index">
  110. <image class="img" :src="item.performerHead"></image>
  111. <view class="text">
  112. <view class="name">{{item.performerName}}</view>
  113. <view class="role u-line-1">{{item.performerRole}}</view>
  114. </view>
  115. </view>
  116. </u-scroll-list>
  117. <u-empty text="暂无" v-if="actorsArr.length<1"></u-empty>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="viewingTips" v-if="tabsIndex==2">
  122. </view>
  123. </view>
  124. <u-calendar
  125. ref="calendar"
  126. :maxDate="maxDate"
  127. :show="calendarShow"
  128. :closeOnClickOverlay="true"
  129. @close="closeCalendar"
  130. @confirm="confirmCalendar">
  131. </u-calendar>
  132. <!-- 分享选择弹出内容 -->
  133. <view class="share-option" :class="{shareShow:shareShow}">
  134. <view class="overlay" v-if="shareShow" @click="shareShow=false"></view>
  135. <button class="share-option-item wx-share" data-name="shareBtn" open-type="share">
  136. 发送给朋友
  137. </button>
  138. <view class="share-option-item" @click="getPoster">生成海报</view>
  139. <view class="share-option-item" @click="shareShow=false">取消</view>
  140. </view>
  141. <u-popup :show="posterShow" @close="posterShow=false" ref="uni-popup">
  142. <view class="poster-wrap u-flex u-col-center">
  143. <view class="poster-inner">
  144. <view class="close-wrap" @click="posterShow=false">
  145. <u-icon name="close-circle" color="#fff" size="56rpx"></u-icon>
  146. </view>
  147. <view class="poster" id="poster" ref="poster" >
  148. <u--image :showLoading="true" :src="posterSrc" width="100%" height="65vh" mode="aspectFit"></u--image>
  149. </view>
  150. <!-- savePoster -->
  151. <view class="poster-btn" @click="saveImage">保存图片</view>
  152. </view>
  153. </view>
  154. </u-popup>
  155. </view>
  156. </template>
  157. <script>
  158. import { systemInfo } from "@/mixin.js";
  159. // 日历
  160. const d = new Date()
  161. const year = d.getFullYear()
  162. let month = d.getMonth() + 1
  163. month = month < 10 ? `0${month}` : month
  164. const date = d.getDate()
  165. // 日历
  166. export default {
  167. mixins:[systemInfo],
  168. data() {
  169. return {
  170. performId:'',
  171. staticUrl:this.$commonConfig.staticUrl,
  172. tabsArr:[
  173. {name:'票务购买'},
  174. {name:'演出详情'},
  175. {name:'观影须知'}
  176. ],
  177. theatre:{},
  178. tabsIndex:0,
  179. dateList:[],
  180. dateIndex:0,
  181. calendarShow:false,//日历
  182. maxDate:`${year}-${month}-${date + 10}`,
  183. auditoriumList:[],//演艺厅
  184. auditoriumIndex:0,
  185. sessionList:[],//演出场次
  186. sessionIndex:0,
  187. ticketTypeList:[],//门票
  188. actorsArr:[],
  189. shareShow:false,
  190. posterShow:false,
  191. posterSrc:'',
  192. performInfo:{},//节目详情
  193. }
  194. },
  195. onShow() {
  196. },
  197. onLoad(page) {
  198. console.log('page',page);
  199. this.performId = page.id;
  200. this.getPerformData();
  201. // this.getSystemInfo();
  202. let today = new Date();
  203. this.setDate(today);
  204. this.getPerformInfo();
  205. },
  206. methods: {
  207. leftClick(e){
  208. let pages = getCurrentPages();
  209. if(pages.length==1){
  210. uni.$u.route('/pages/index/index')
  211. }else{
  212. uni.navigateBack()
  213. };
  214. },
  215. getPerformData(){
  216. this.$u.api.performSell({performId:this.performId}).then(res=>{
  217. // console.log('getPerformData',res.data);
  218. this.theatre = res.data.theatreList[0];
  219. this.auditoriumList = res.data.theatreList[0].auditoriumList;
  220. this.ticketTypeList = res.data.goodsList;
  221. this.getTimes()
  222. console.log('auditoriumList',this.auditoriumList);
  223. }).catch(err=>{
  224. console.log('getPoster',err);
  225. })
  226. },
  227. getPerformInfo(){
  228. this.$u.api.performInfo({id:this.performId}).then(res=>{
  229. console.log('getPerformInfo',res.data);
  230. this.performInfo = res.data;
  231. this.actorsArr = res.data.performerList;
  232. }).catch(err=>{
  233. console.log('getPerformInfo',err);
  234. })
  235. },
  236. getTimes(){
  237. let auditoriumId= this.auditoriumList[this.auditoriumIndex]?.id;
  238. if(!auditoriumId){return}
  239. let dateOBJ = this.dateList[this.dateIndex];
  240. let param = {
  241. auditoriumId:auditoriumId,//演艺厅ID(演艺厅列表)
  242. performId:this.performId,
  243. date:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`
  244. };
  245. // console.log('param',param);
  246. this.$u.api.getAuditoriumTimes(param).then(res=>{
  247. console.log('getTimes',res.data);
  248. this.sessionList = res.data.list;
  249. }).catch(err=>{
  250. console.log('getPoster',err);
  251. })
  252. },
  253. setDate(firstDay){
  254. let today = firstDay;
  255. let tomorrow = new Date();
  256. tomorrow.setDate(today.getDate() + 1);
  257. let afterTomorrow = new Date();
  258. afterTomorrow.setDate(today.getDate() + 2);
  259. this.dateList = [
  260. { year: today.getFullYear(), month: today.getMonth() + 1, day: today.getDate(),name:'今天' },
  261. { year: tomorrow.getFullYear(), month: tomorrow.getMonth() + 1, day: tomorrow.getDate() ,name:'明天'},
  262. { year: afterTomorrow.getFullYear(), month: afterTomorrow.getMonth() + 1, day: afterTomorrow.getDate(),name:'后天' }
  263. ];
  264. this.getTimes()
  265. },
  266. dateClick(index){
  267. this.dateIndex = index;
  268. this.getTimes()
  269. },
  270. auditoriumClick(index){
  271. this.auditoriumIndex = index;
  272. },
  273. confirmCalendar(e){
  274. console.log('confirmCalendar',e);
  275. this.setDate( new Date(e) );
  276. this.dateIndex = 0;
  277. console.log('maxDate',this.maxDate);
  278. console.log('dateList',this.dateList);
  279. this.calendarShow = false;
  280. },
  281. closeCalendar(){
  282. this.calendarShow = false;
  283. },
  284. tabsClick(e){
  285. console.log('tabsClick',e);
  286. this.tabsIndex = e.index;
  287. },
  288. sessionClick(index){
  289. this.sessionIndex = index;
  290. },
  291. book(item){
  292. console.log('book',item);
  293. uni.$u.route('pages/bookticket',{
  294. id:item.id
  295. })
  296. },
  297. openShare(){
  298. this.shareShow = true;
  299. },
  300. // 海报相关开始
  301. getPoster(item){
  302. this.posterShow = true;
  303. this.shareShow = false;
  304. this.$u.api.performQrcode({performId:this.performId}).then(res=>{
  305. this.posterSrc = res.data.imageUrl;
  306. // console.log('getPoster',res.data);
  307. }).catch(err=>{
  308. console.log('getPoster',err);
  309. })
  310. },
  311. saveImage() {
  312. let that = this;
  313. uni.showLoading({
  314. title: '保存中'
  315. });
  316. uni.downloadFile({
  317. url: this.posterSrc,
  318. success(res) {
  319. if (res.statusCode === 200) {
  320. uni.saveImageToPhotosAlbum({
  321. filePath: res.tempFilePath,
  322. success() {
  323. uni.showToast({
  324. title: '保存到相册成功',
  325. icon: 'success'
  326. });
  327. },
  328. fail(err) {
  329. console.log('保存图片失败',err);
  330. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  331. uni.getSetting({
  332. success(res) {
  333. if (!res.authSetting['scope.writePhotosAlbum']) {
  334. uni.showModal({
  335. title: '提示',
  336. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  337. confirmText: '去设置',
  338. success(res) {
  339. if (res.confirm) {
  340. uni.openSetting();
  341. }
  342. }
  343. });
  344. } else {
  345. uni.showToast({
  346. title: '保存图片失败',
  347. icon: 'none'
  348. });
  349. }
  350. }
  351. });
  352. } else {
  353. uni.showToast({
  354. title: '保存图片失败',
  355. icon: 'none'
  356. });
  357. }
  358. },
  359. complete() {
  360. uni.hideLoading();
  361. that.posterShow = false;
  362. }
  363. });
  364. } else {
  365. uni.showToast({
  366. title: '下载图片失败',
  367. icon: 'none'
  368. });
  369. }
  370. },
  371. fail() {
  372. uni.showToast({
  373. title: '下载图片失败',
  374. icon: 'none'
  375. });
  376. }
  377. });
  378. },
  379. // 海报相关结束
  380. goMap(){
  381. uni.openLocation({
  382. latitude:Number(this.theatre.latitude), //维度
  383. longitude: Number(this.theatre.longitude), //经度
  384. name: this.theatre.name, //目的地定位名称
  385. scale: 15, //缩放比例
  386. address: this.theatre.address //导航详细地址
  387. })
  388. },
  389. }
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. .banner{
  394. position: relative;
  395. .img{
  396. width: 750rpx;
  397. height: 554rpx;
  398. display: block;
  399. }
  400. .content{
  401. position: absolute;
  402. width: 100%;
  403. box-sizing: border-box;
  404. padding: 0 32rpx;
  405. left: 0;
  406. bottom: 100rpx;
  407. }
  408. .share{
  409. overflow: hidden;
  410. margin-bottom: 100rpx;
  411. .icon{
  412. float: right;
  413. display: block;
  414. width: 32rpx;
  415. height: 32rpx;
  416. padding: 10rpx;
  417. border-radius: 50%;
  418. background-color: rgba(0,0,0,0.4);
  419. }
  420. }
  421. .name{
  422. font-size: 44rpx;
  423. font-weight: 800;
  424. color: #FFFFFF;
  425. line-height: 66rpx;
  426. margin-bottom: 38rpx;
  427. }
  428. .addr{
  429. font-size: 24rpx;
  430. font-weight: 400;
  431. color: #FFFFFF;
  432. line-height: 36rpx;
  433. }
  434. }
  435. .tabs-wrap{
  436. position: relative;
  437. margin-bottom: 54rpx;
  438. &::after{
  439. content: '';
  440. width: 100%;
  441. height: 1px;
  442. background-color: #eee;
  443. position: absolute;
  444. left: 0;
  445. right: 0;
  446. bottom: -46rpx;
  447. }
  448. .inner{
  449. position: relative;
  450. padding-top: 50rpx;
  451. background-color: #FFFFFF;
  452. border-radius: 32rpx 32rpx 0rpx 0rpx;
  453. height: 46rpx;
  454. margin-top: -30px;
  455. }
  456. }
  457. .date-block{
  458. margin-bottom: 64rpx;
  459. }
  460. .title{
  461. font-size: 32rpx;
  462. font-weight: bold;
  463. color: #2D2D2D;
  464. line-height: 48rpx;
  465. margin-bottom: 38rpx;
  466. }
  467. .session-wrap{
  468. .empty{
  469. background-color: #636363;
  470. color: #979797;
  471. border-radius: 8rpx;
  472. padding: 24rpx;
  473. text-align: center;
  474. }
  475. }
  476. .session{
  477. display: grid;
  478. grid-template-columns: repeat(3, 1fr);
  479. gap: 20rpx;
  480. .session-item{
  481. height: 80rpx;
  482. line-height: 80rpx;
  483. border-radius: 12rpx;
  484. border: 2rpx solid #636363;
  485. text-align: center;
  486. font-size: 24rpx;
  487. font-weight: 400;
  488. color: #636363;
  489. &.active{
  490. color: #ED0000;
  491. border-color: #ED0000;
  492. }
  493. }
  494. }
  495. .ticket-type{
  496. .type-item{
  497. background: #FFFFFF;
  498. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(180,180,180,0.5);
  499. border-radius: 20rpx;
  500. margin-bottom: 20rpx;
  501. padding: 38rpx 40rpx;
  502. .name-price{
  503. margin-bottom: 26rpx;
  504. }
  505. .name{
  506. font-size: 28rpx;
  507. font-weight: 500;
  508. color: #363636;
  509. }
  510. .prices{
  511. font-size: 36rpx;
  512. font-weight: bold;
  513. color: #ED0000;
  514. }
  515. .ishave{
  516. margin-bottom: 26rpx;
  517. .text{
  518. height: 30rpx;
  519. line-height: 30rpx;
  520. padding: 0 22rpx;
  521. background: #FFC8C8;
  522. border-radius: 20rpx;
  523. font-size: 20rpx;
  524. font-weight: 400;
  525. color: #ED0000;
  526. }
  527. }
  528. .bottom{
  529. font-size: 22rpx;
  530. font-weight: 400;
  531. color: #7F7F7F;
  532. .btn{
  533. height: 60rpx;
  534. line-height: 60rpx;
  535. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  536. border-radius: 30rpx;
  537. padding: 0 36rpx;
  538. font-size: 28rpx;
  539. font-weight: 500;
  540. color: #FFFFFF;
  541. &.disabled{
  542. background: #979797;
  543. }
  544. }
  545. }
  546. }
  547. }
  548. .details{
  549. .title{}
  550. .details-block{
  551. background: #FFFFFF;
  552. box-shadow: 0rpx 2rpx 12rpx 2rpx rgba(221,221,221,0.5);
  553. border-radius: 20rpx;
  554. margin-bottom: 24rpx;
  555. padding: 36rpx;
  556. &.actors{
  557. .title{
  558. .right{
  559. font-size: 24rpx;
  560. font-weight: 400;
  561. color: #7F7F7F;
  562. }
  563. }
  564. }
  565. }
  566. .intro{
  567. font-size: 26rpx;
  568. font-weight: 400;
  569. color: #4E4E4E;
  570. line-height: 40rpx;
  571. }
  572. .actor-list{
  573. .item{
  574. flex-shrink: 0;
  575. width: 160rpx;
  576. text-align: center;
  577. margin-right: 24rpx;
  578. }
  579. .img{
  580. display: block;
  581. width: 100%;
  582. height: 200rpx;
  583. margin-bottom: 16rpx;
  584. }
  585. .name{
  586. font-size: 28rpx;
  587. font-weight: 500;
  588. color: #2D2D2D;
  589. line-height: 42rpx;
  590. margin-bottom: 4rpx;
  591. }
  592. .role{
  593. font-size: 24rpx;
  594. font-weight: 400;
  595. color: #7F7F7F;
  596. line-height: 36rpx;
  597. }
  598. }
  599. }
  600. </style>