ticketlist.vue 16 KB

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