ticketlist.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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. console.log('performInfo',this.performInfo);
  307. let session = this.sessionList[this.sessionIndex];
  308. console.log('session',session);
  309. let performTimeStart = this.$u.timeFormat(session.performTimeStart, 'hh:MM');
  310. let performTimeEnd = this.$u.timeFormat(session.performTimeEnd, 'hh:MM');
  311. let dateOBJ = this.dateList[this.dateIndex];
  312. uni.$u.route('pages/chosenposition',{
  313. goodsId:item.id,
  314. performId:this.performId,
  315. performName:this.performInfo.name,
  316. day:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`,
  317. performTimeStart:session.performTimeStart,
  318. performTimeEnd:session.performTimeEnd,
  319. })
  320. },
  321. openShare(){
  322. this.shareShow = true;
  323. },
  324. // 海报相关开始
  325. getPoster(item){
  326. this.posterShow = true;
  327. this.shareShow = false;
  328. this.$u.api.performQrcode({performId:this.performId}).then(res=>{
  329. this.posterSrc = res.data.imageUrl;
  330. // console.log('getPoster',res.data);
  331. }).catch(err=>{
  332. console.log('getPoster',err);
  333. })
  334. },
  335. saveImage() {
  336. let that = this;
  337. uni.showLoading({
  338. title: '保存中'
  339. });
  340. uni.downloadFile({
  341. url: this.posterSrc,
  342. success(res) {
  343. if (res.statusCode === 200) {
  344. uni.saveImageToPhotosAlbum({
  345. filePath: res.tempFilePath,
  346. success() {
  347. uni.showToast({
  348. title: '保存到相册成功',
  349. icon: 'success'
  350. });
  351. },
  352. fail(err) {
  353. console.log('保存图片失败',err);
  354. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  355. uni.getSetting({
  356. success(res) {
  357. if (!res.authSetting['scope.writePhotosAlbum']) {
  358. uni.showModal({
  359. title: '提示',
  360. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  361. confirmText: '去设置',
  362. success(res) {
  363. if (res.confirm) {
  364. uni.openSetting();
  365. }
  366. }
  367. });
  368. } else {
  369. uni.showToast({
  370. title: '保存图片失败',
  371. icon: 'none'
  372. });
  373. }
  374. }
  375. });
  376. } else {
  377. uni.showToast({
  378. title: '保存图片失败',
  379. icon: 'none'
  380. });
  381. }
  382. },
  383. complete() {
  384. uni.hideLoading();
  385. that.posterShow = false;
  386. }
  387. });
  388. } else {
  389. uni.showToast({
  390. title: '下载图片失败',
  391. icon: 'none'
  392. });
  393. }
  394. },
  395. fail() {
  396. uni.showToast({
  397. title: '下载图片失败',
  398. icon: 'none'
  399. });
  400. }
  401. });
  402. },
  403. // 海报相关结束
  404. goMap(){
  405. uni.openLocation({
  406. latitude:Number(this.theatre.latitude), //维度
  407. longitude: Number(this.theatre.longitude), //经度
  408. name: this.theatre.name, //目的地定位名称
  409. scale: 15, //缩放比例
  410. address: this.theatre.address //导航详细地址
  411. })
  412. },
  413. }
  414. }
  415. </script>
  416. <style lang="scss" scoped>
  417. .banner{
  418. position: relative;
  419. .img{
  420. width: 750rpx;
  421. height: 554rpx;
  422. display: block;
  423. }
  424. .content{
  425. position: absolute;
  426. width: 100%;
  427. box-sizing: border-box;
  428. padding: 0 32rpx;
  429. left: 0;
  430. bottom: 100rpx;
  431. }
  432. .share{
  433. overflow: hidden;
  434. margin-bottom: 100rpx;
  435. .icon{
  436. float: right;
  437. display: block;
  438. width: 32rpx;
  439. height: 32rpx;
  440. padding: 10rpx;
  441. border-radius: 50%;
  442. background-color: rgba(0,0,0,0.4);
  443. }
  444. }
  445. .name{
  446. font-size: 44rpx;
  447. font-weight: 800;
  448. color: #FFFFFF;
  449. line-height: 66rpx;
  450. margin-bottom: 38rpx;
  451. }
  452. .addr{
  453. font-size: 24rpx;
  454. font-weight: 400;
  455. color: #FFFFFF;
  456. line-height: 36rpx;
  457. }
  458. }
  459. .tabs-wrap{
  460. position: relative;
  461. margin-bottom: 54rpx;
  462. &::after{
  463. content: '';
  464. width: 100%;
  465. height: 1px;
  466. background-color: #eee;
  467. position: absolute;
  468. left: 0;
  469. right: 0;
  470. bottom: -46rpx;
  471. }
  472. .inner{
  473. position: relative;
  474. padding-top: 50rpx;
  475. background-color: #FFFFFF;
  476. border-radius: 32rpx 32rpx 0rpx 0rpx;
  477. height: 46rpx;
  478. margin-top: -30px;
  479. }
  480. }
  481. .date-block{
  482. margin-bottom: 64rpx;
  483. }
  484. .title{
  485. font-size: 32rpx;
  486. font-weight: bold;
  487. color: #2D2D2D;
  488. line-height: 48rpx;
  489. margin-bottom: 38rpx;
  490. }
  491. .session-wrap{
  492. .empty{
  493. background-color: #636363;
  494. color: #979797;
  495. border-radius: 8rpx;
  496. padding: 24rpx;
  497. text-align: center;
  498. }
  499. }
  500. .session{
  501. display: grid;
  502. grid-template-columns: repeat(3, 1fr);
  503. gap: 20rpx;
  504. .session-item{
  505. height: 80rpx;
  506. line-height: 80rpx;
  507. border-radius: 12rpx;
  508. border: 2rpx solid #636363;
  509. text-align: center;
  510. font-size: 24rpx;
  511. font-weight: 400;
  512. color: #636363;
  513. &.active{
  514. color: #ED0000;
  515. border-color: #ED0000;
  516. }
  517. }
  518. }
  519. .ticket-type{
  520. .type-item{
  521. background: #FFFFFF;
  522. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(180,180,180,0.5);
  523. border-radius: 20rpx;
  524. margin-bottom: 20rpx;
  525. padding: 38rpx 40rpx;
  526. .name-price{
  527. margin-bottom: 26rpx;
  528. }
  529. .name{
  530. font-size: 28rpx;
  531. font-weight: 500;
  532. color: #363636;
  533. }
  534. .prices{
  535. font-size: 36rpx;
  536. font-weight: bold;
  537. color: #ED0000;
  538. }
  539. .ishave{
  540. margin-bottom: 26rpx;
  541. .text{
  542. height: 30rpx;
  543. line-height: 30rpx;
  544. padding: 0 22rpx;
  545. background: #FFC8C8;
  546. border-radius: 20rpx;
  547. font-size: 20rpx;
  548. font-weight: 400;
  549. color: #ED0000;
  550. }
  551. }
  552. .bottom{
  553. font-size: 22rpx;
  554. font-weight: 400;
  555. color: #7F7F7F;
  556. .btn{
  557. height: 60rpx;
  558. line-height: 60rpx;
  559. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  560. border-radius: 30rpx;
  561. padding: 0 36rpx;
  562. font-size: 28rpx;
  563. font-weight: 500;
  564. color: #FFFFFF;
  565. &.disabled{
  566. background: #979797;
  567. }
  568. }
  569. }
  570. }
  571. }
  572. .details{
  573. .title{}
  574. .details-block{
  575. background: #FFFFFF;
  576. box-shadow: 0rpx 2rpx 12rpx 2rpx rgba(221,221,221,0.5);
  577. border-radius: 20rpx;
  578. margin-bottom: 24rpx;
  579. padding: 36rpx;
  580. &.actors{
  581. .title{
  582. .right{
  583. font-size: 24rpx;
  584. font-weight: 400;
  585. color: #7F7F7F;
  586. }
  587. }
  588. }
  589. }
  590. .intro{
  591. font-size: 26rpx;
  592. font-weight: 400;
  593. color: #4E4E4E;
  594. line-height: 40rpx;
  595. }
  596. .actor-list{
  597. .item{
  598. flex-shrink: 0;
  599. width: 160rpx;
  600. text-align: center;
  601. margin-right: 24rpx;
  602. }
  603. .img{
  604. display: block;
  605. width: 100%;
  606. height: 200rpx;
  607. margin-bottom: 16rpx;
  608. }
  609. .name{
  610. font-size: 28rpx;
  611. font-weight: 500;
  612. color: #2D2D2D;
  613. line-height: 42rpx;
  614. margin-bottom: 4rpx;
  615. }
  616. .role{
  617. font-size: 24rpx;
  618. font-weight: 400;
  619. color: #7F7F7F;
  620. line-height: 36rpx;
  621. }
  622. }
  623. }
  624. </style>