ticketlist.vue 17 KB

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