ticketlist.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  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. <u-swiper
  10. :list="performInfo.photoList"
  11. height="554rpx"
  12. indicatorMode="dot"
  13. :indicatorStyle="{bottom:'100rpx'}"
  14. keyName="imageUrl"
  15. radius="0"
  16. :indicator="false"
  17. circular
  18. ></u-swiper>
  19. <view class="content">
  20. <view class="share" @click="openShare()">
  21. <image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="base-info">
  26. <view class="inner">
  27. <view class="name">{{performInfo.name}}</view>
  28. <view class="addr u-flex u-row-between">
  29. <view class="text">演出地址:{{theatre.address||''}}</view>
  30. <view class="menu u-flex">
  31. <view class="item" @click="goMap">
  32. <image class="icon" :src="staticUrl+'/img/map-ico.png'" ></image>
  33. <text>导航</text>
  34. </view>
  35. <view class="item" @click="phoneCall">
  36. <image class="icon" :src="staticUrl+'/img/phone-call-ico.png'" ></image>
  37. <text>电话</text>
  38. </view>
  39. <!-- <u-icon name="arrow-right" color="#ffffff" size="36rpx" @click="goMap"></u-icon>
  40. <u-icon name="arrow-right" color="#ffffff" size="36rpx" @click="goMap"></u-icon> -->
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="tabs-wrap">
  46. <view class="inner">
  47. <u-tabs
  48. :list="tabsArr"
  49. @click="tabsClick"
  50. lineColor="#ED0000"
  51. lineWidth="82rpx"
  52. :activeStyle="{color: '#2D2D2D',fontWeight: 'bold'}"
  53. itemStyle="width:33%; height: 46px;box-sizing:border-box"
  54. >
  55. </u-tabs>
  56. </view>
  57. </view>
  58. <view class="page-wrap">
  59. <view class="ticket" v-if="tabsIndex==0">
  60. <view class="date-block">
  61. <view class="title">演出日期</view>
  62. <view class="date-list u-flex">
  63. <view class="date-item"
  64. :class="{active:dateIndex==index,dot:performDateList.find(item => item.performDate === `${date.year}-${date.month}-${date.day}`) !== undefined}"
  65. @click="dateClick(index)"
  66. v-for="(date,index) in dateList" :key="index">
  67. <!-- <view class="name">{{ date.name || ' ' }}</view> -->
  68. <!-- <view class="name">
  69. {{ performDateList.find(item => item.performDate === date.fullDay ) !== undefined?'有演出':'无演出' }}
  70. </view> -->
  71. <view class="name">
  72. {{date.fullDay|checkWeekDate}}
  73. </view>
  74. <view class="date">{{ date.month }} - {{ date.day }}</view>
  75. <image class="selected-img" :src="staticUrl+'/img/selected.png'"></image>
  76. </view>
  77. <view class="date-item more-date u-flex u-row-center" @click="calendarShow = true">
  78. <view class="text">
  79. <view class="">更多</view>
  80. <view class="">日期</view>
  81. </view>
  82. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="date-block auditorium generic-block">
  87. <view class="title">演出厅</view>
  88. <view class="date-list u-flex u-flex-wrap">
  89. <view class="date-item" :class="{active:auditoriumIndex==index}" @click="auditoriumClick(index)" v-for="(date,index) in auditoriumList" :key="index">
  90. <view class="name">{{ date.name }}</view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="date-block session-wrap">
  95. <view class="title">演出场次</view>
  96. <view class="session">
  97. <view class="session-item" :class="{active:sessionIndex==index}" @click="sessionClick(index)" v-for="(date,index) in sessionList" :key="index">
  98. {{ date.performTimeStart}} - {{date.performTimeEnd}}
  99. </view>
  100. </view>
  101. <view class="empty" v-if="auditoriumList.length>=1&&sessionList.length<1">
  102. 当前日期暂无演出场次,请重新选择
  103. </view>
  104. </view>
  105. <view class="date-block ticket-type generic-block">
  106. <view class="title">票务信息</view>
  107. <view class="empty" v-if="ticketTypeList.length<1">
  108. 暂无门票
  109. </view>
  110. <view class="date-list u-flex u-flex-wrap">
  111. <view class="date-item" :class="{active:ticketTypeIndex==index}" @click="ticketTypeClick(index)" v-for="(date,index) in ticketTypeList" :key="index">
  112. <view class="name">{{ date.goodsName }}</view>
  113. </view>
  114. </view>
  115. <!-- <view class="type-item" :class="{active:sessionIndex==index}" v-for="(item,index) in ticketTypeList" :key="index">
  116. <view class="name-price u-flex u-row-between">
  117. <view class="name">{{item.goodsName}}</view>
  118. <view class="prices">¥ {{item.salePrice}} 起</view>
  119. </view>
  120. <view class="bottom u-flex u-row-between">
  121. <view class="left u-flex" v-html="item.goodsSnapshot||''">
  122. </view>
  123. <view class="btn" @click="book(item)" v-if="item.quantity!==0&&sessionList.length>=1">预定</view>
  124. <view class="btn disabled" v-else>无票</view>
  125. </view>
  126. </view> -->
  127. </view>
  128. <view class="date-block position-select generic-block">
  129. <view class="title u-flex u-row-between">
  130. <view class="">类型选择</view>
  131. <view v-if="positionData.seatImg" class="" style="font-size: 24rpx;color: #aaa" @click="showSeatImg">票区图</view>
  132. </view>
  133. <view class="empty" v-if="positionArr.length<1">
  134. 没有座位信息
  135. </view>
  136. <view class="date-list u-flex u-flex-wrap">
  137. <view class="date-item" :class="{active:positionIndex==index}" @click="positionClick(index)" v-for="(date,index) in positionArr" :key="index">
  138. <view class="name">{{ date.seatTypeName }} <br />¥ {{date.salePrice}}</view>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="book-btn full-btn" v-if="positionArr.length>=1&&sessionList.length>=1" @click="book()">确定</view>
  143. <view class="full-btn gray" v-else>确定</view>
  144. </view>
  145. <!-- ticket end -->
  146. <view class="details" v-if="tabsIndex==1">
  147. <view class="details-block">
  148. <view class="title">剧情简介</view>
  149. <view class="intro parse-content">
  150. <u-parse :content="performInfo.performSnapshot"></u-parse>
  151. </view>
  152. </view>
  153. <view class="details-block actors">
  154. <view class="title u-flex u-row-between">
  155. 演职人员
  156. <view class="right u-flex" @click="$u.route('pages/actors',{performId:performId})">
  157. <text>更多</text>
  158. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  159. </view>
  160. </view>
  161. <view class="actor-list">
  162. <u-scroll-list :indicator="false">
  163. <view class="item" v-for="(item, index) in actorsArr" :key="index">
  164. <image class="img" :src="item.performerHead||staticUrl+'/img/actors.png'"></image>
  165. <view class="text">
  166. <view class="name">{{item.performerName}}</view>
  167. <view class="role u-line-1">{{item.performerRole}}</view>
  168. </view>
  169. </view>
  170. </u-scroll-list>
  171. <u-empty text="暂无" v-if="actorsArr.length<1"></u-empty>
  172. </view>
  173. </view>
  174. </view>
  175. <view class="viewingTips parse-content" v-if="tabsIndex==2">
  176. <u-parse :content="formerNotice"></u-parse>
  177. </view>
  178. </view>
  179. <!-- :maxDate="maxDate" -->
  180. <u-calendar
  181. ref="calendar"
  182. :formatter="formatter"
  183. :maxDate="maxDate"
  184. monthNum="12"
  185. :show="calendarShow"
  186. color="#EF1010"
  187. :closeOnClickOverlay="true"
  188. @close="closeCalendar"
  189. @confirm="confirmCalendar">
  190. </u-calendar>
  191. <!-- 分享选择弹出内容 -->
  192. <view class="share-option" :class="{shareShow:shareShow}">
  193. <view class="overlay" v-if="shareShow" @click="shareShow=false"></view>
  194. <!-- #ifdef MP-WEIXIN -->
  195. <button class="share-option-item wx-share" data-name="shareBtn" open-type="share">
  196. 发送给朋友
  197. </button>
  198. <!-- #endif -->
  199. <view class="share-option-item" @click="getPoster">生成海报</view>
  200. <view class="share-option-item" @click="shareShow=false">取消</view>
  201. </view>
  202. <u-popup :show="posterShow" @close="posterShow=false" ref="uni-popup">
  203. <view class="poster-wrap u-flex u-col-center">
  204. <view class="poster-inner">
  205. <view class="close-wrap" @click="posterShow=false">
  206. <u-icon name="close-circle" color="#fff" size="56rpx"></u-icon>
  207. </view>
  208. <view class="poster" id="poster" ref="poster" >
  209. <u--image :showLoading="false" :src="posterSrc" width="100%" height="65vh" mode="aspectFit"></u--image>
  210. </view>
  211. <!-- savePoster -->
  212. <view class="poster-btn" @click="saveImage">保存图片</view>
  213. </view>
  214. </view>
  215. </u-popup>
  216. <canvas canvas-id="canvas" class="canvas" style="width: 574px; height: 1042px;"></canvas>
  217. </view>
  218. </template>
  219. <script>
  220. import moment from 'moment';
  221. import { systemInfo } from "@/mixin.js";
  222. // 日历
  223. const d = new Date()
  224. const year = d.getFullYear()
  225. let month = d.getMonth() + 1
  226. month = month < 10 ? `0${month}` : month
  227. const date = d.getDate()
  228. // 日历
  229. // 算最大日期
  230. const maxd = new Date()
  231. maxd.setMonth(maxd.getMonth() + 12) // 将月份加3
  232. const maxdyear = maxd.getFullYear()
  233. let maxdmonth = maxd.getMonth() + 1
  234. maxdmonth = maxdmonth < 10 ? `0${maxdmonth}` : maxdmonth
  235. const maxddate = maxd.getDate()
  236. const theMaxDate = `${maxdyear}-${maxdmonth}-${maxddate}`
  237. // console.log('theMaxDate=============================',theMaxDate) //输出:
  238. //算最大日期
  239. let parentThis= null;
  240. export default {
  241. mixins:[systemInfo],
  242. data() {
  243. return {
  244. performId:'',
  245. staticUrl:this.$commonConfig.staticUrl,
  246. tabsArr:[
  247. {name:'票务购买'},
  248. {name:'演出详情'},
  249. {name:'观影须知'}
  250. ],
  251. theatre:{},
  252. tabsIndex:0,
  253. dateList:[],
  254. dateIndex:0,
  255. calendarShow:false,//日历
  256. // maxDate:`${year}-${month}-${date + 30}`,
  257. maxDate:theMaxDate,
  258. auditoriumList:[],//演艺厅
  259. auditoriumIndex:0,
  260. sessionList:[],//演出场次
  261. sessionIndex:0,
  262. ticketTypeList:[],//门票
  263. actorsArr:[],
  264. shareShow:false,
  265. posterShow:false,
  266. posterSrc:'',
  267. posterSrcType:null,
  268. performInfo:{},//节目详情
  269. formerNotice:{},//节目观影须知
  270. performDateList:[],//有票的日期
  271. // firstGet:0,
  272. ticketTypeIndex:0,
  273. positionData:{},//座位信息接口
  274. positionArr:[],
  275. positionIndex:0,
  276. }
  277. },
  278. onShow() {
  279. },
  280. onLoad(page) {
  281. // console.log('ticketlist page',page);
  282. parentThis = this;
  283. const scene = decodeURIComponent(page.scene);
  284. scene&&uni.setStorage({
  285. key:'scene',
  286. data:scene
  287. });
  288. // console.log('scene=========',scene);
  289. if(scene&&scene!='undefined'){
  290. this.$u.api.uncompress({scene:scene}).then(res=>{
  291. this.performId = res.data.performId;
  292. this.getPerformData();
  293. // this.getSystemInfo();
  294. let today = new Date();
  295. this.setDate(today);
  296. this.getPerformInfo();
  297. this.getPerformerNotice();
  298. // this.label = res.data.label;
  299. // console.log('uncompress',res.data);
  300. }).catch(err=>{
  301. console.log('uncompress',err);
  302. })
  303. }else{
  304. this.performId = page.id;
  305. this.getPerformData();
  306. // this.getSystemInfo();
  307. let today = new Date();
  308. this.setDate(today);
  309. this.getPerformInfo();
  310. this.getPerformerNotice();
  311. }
  312. },
  313. onReady() {
  314. // 如果需要兼容微信小程序的话,需要用此写法
  315. this.$refs.calendar.setFormatter(this.formatter);
  316. },
  317. methods: {
  318. leftClick(e){
  319. let pages = getCurrentPages();
  320. if(pages.length==1){
  321. uni.$u.route('/pages/index/index')
  322. }else{
  323. uni.navigateBack()
  324. };
  325. },
  326. uncompress(scene){
  327. this.$u.api.uncompress({scene:scene}).then(res=>{
  328. this.performId = res.data.performId;
  329. // this.label = res.data.label;
  330. // console.log('uncompress',res.data);
  331. }).catch(err=>{
  332. console.log('uncompress',err);
  333. })
  334. },
  335. getPerformData(){
  336. this.$u.api.performSell({performId:this.performId}).then(res=>{
  337. // console.log('getPerformData',res.data);
  338. this.theatre = res.data.theatreList[0];
  339. this.auditoriumList = res.data.theatreList[0].auditoriumList;
  340. this.ticketTypeList = res.data.goodsList;
  341. this.performDateList = this.auditoriumList[this.auditoriumIndex].performDateList;
  342. this.getDate()
  343. // console.log('auditoriumList',this.auditoriumList);
  344. }).catch(err=>{
  345. console.log('getPoster',err);
  346. })
  347. },
  348. getPerformInfo(){
  349. this.$u.api.performInfo({id:this.performId}).then(res=>{
  350. // console.log('getPerformInfo',res.data);
  351. this.performInfo = res.data;
  352. this.actorsArr = res.data.performerList;
  353. }).catch(err=>{
  354. console.log('getPerformInfo',err);
  355. })
  356. },
  357. getPerformerNotice(){
  358. this.$u.api.performerNotice({performId:this.performId}).then(res=>{
  359. // console.log('getPerformerNotice',res.data);
  360. this.formerNotice = res.data.performNotice;
  361. }).catch(err=>{
  362. console.log('getPerformerNotice',err);
  363. })
  364. },
  365. getDate(){
  366. let param = {
  367. auditoriumId:this.auditoriumList[this.auditoriumIndex]?.id,//演艺厅ID(演艺厅列表)
  368. performId:this.performId,
  369. };
  370. this.$u.api.getAuditoriumDate(param).then(res=>{
  371. // console.log('getDate',res.data);
  372. this.performDateList = res.data.list||[];
  373. this.setDate();
  374. // this.getTimes();
  375. }).catch(err=>{
  376. console.log('getDate',err);
  377. })
  378. },
  379. getTimes(){
  380. // this.firstGet++;
  381. uni.showLoading();
  382. let auditoriumId= this.auditoriumList[this.auditoriumIndex]?.id;
  383. if(!auditoriumId){return}
  384. // console.log('this.dateList',this.dateList);
  385. // console.log('this.dateIndex',this.dateIndex);
  386. let dateOBJ = this.dateList[this.dateIndex];
  387. let param = {
  388. auditoriumId:auditoriumId,//演艺厅ID(演艺厅列表)
  389. performId:this.performId,
  390. date:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`
  391. };
  392. // console.log('param',param);
  393. this.$u.api.getAuditoriumTimes(param).then(res=>{
  394. // console.log('getTimes',res.data);
  395. this.sessionList = res.data.list.map(item=>{
  396. item.performTimeStart = item.performTimeStart;
  397. item.performTimeEnd = item.performTimeEnd;
  398. return item
  399. });
  400. this.sessionIndex = 0;
  401. let session = this.sessionList[this.sessionIndex];
  402. this.getPositionData();
  403. }).catch(err=>{
  404. console.log('getPoster',err);
  405. })
  406. },
  407. formatter: (day) => {
  408. if(!parentThis){
  409. return
  410. }
  411. day.date = moment(day.date).format("YYYY-MM-DD HH:mm:ss")
  412. // console.log('day',day);
  413. // console.log('thisthisthisthisthisthisthisthisthis',parentThis);
  414. // console.log('==================================',day.date.toISOString().split('T')[0]);
  415. let ticket = parentThis.performDateList.find(item => item.performDate === day.date.split(' ')[0]);
  416. if(ticket){
  417. day.dot = true
  418. }
  419. // if(ticket&&ticket.ishave){
  420. // day.bottomInfo = '有票'
  421. // day.dot = true
  422. // }else if(ticket){
  423. // day.dot = true
  424. // }
  425. return day
  426. },
  427. setDate(firstDay,isSelect){
  428. // console.log('this.performDateList',this.performDateList);
  429. if(this.performDateList[0]?.performDate&&!isSelect){
  430. // firstDay = new Date(this.performDateList[0].performDate);
  431. const uniquePerformDateList = Array.from(new Set(this.performDateList.map(JSON.stringify))).map(JSON.parse);//去重
  432. // console.log('uniquePerformDateList',uniquePerformDateList);
  433. let arr = uniquePerformDateList.slice(0, 3);//只要前三项
  434. this.dateList = arr.map(item=>{
  435. // console.log('uniquePerformDateList item',item);
  436. let day = item.performDate.split('-');
  437. // console.log('setDate day',day);
  438. return { year:day[0],month:String(day[1]),day:String(day[2]), fullDay:`${day[0]}-${String(day[1])}-${String(day[2])}`}
  439. });
  440. // console.log('this.dateList',this.dateList);
  441. this.dateIndex = 0;
  442. this.getTimes();
  443. //
  444. return
  445. }
  446. // console.log('this.dateListthis.dateListthis.dateListthis.dateList',this.dateList);
  447. // 前端写演出日期(今天,明天,后天)
  448. let today = firstDay||new Date();
  449. // console.log('today=========',today);
  450. let tomorrow = new Date();
  451. tomorrow.setDate(today.getDate() + 1);
  452. let afterTomorrow = new Date();
  453. afterTomorrow.setDate(today.getDate() + 2);
  454. this.dateList = [
  455. {
  456. year: today.getFullYear(),
  457. month: String(today.getMonth() + 1).padStart(2, '0'),
  458. day: String(today.getDate()).padStart(2, '0'),
  459. name: '日期',
  460. fullDay:`${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${ String(today.getDate()).padStart(2, '0')}`
  461. },
  462. {
  463. year: tomorrow.getFullYear(),
  464. month: String(tomorrow.getMonth() + 1).padStart(2, '0'),
  465. day: String(tomorrow.getDate()).padStart(2, '0'),
  466. name: '日期',
  467. fullDay:`${tomorrow.getFullYear()}-${String(tomorrow.getMonth() + 1).padStart(2, '0')}-${ String(tomorrow.getDate()).padStart(2, '0')}`
  468. },
  469. {
  470. year: afterTomorrow.getFullYear(),
  471. month: String(afterTomorrow.getMonth() + 1).padStart(2, '0'),
  472. day: String(afterTomorrow.getDate()).padStart(2, '0'),
  473. name: '日期',
  474. fullDay:`${afterTomorrow.getFullYear()}-${String(afterTomorrow.getMonth() + 1).padStart(2, '0')}-${ String(afterTomorrow.getDate()).padStart(2, '0')}`
  475. }
  476. ];
  477. this.getTimes()
  478. // console.log('this.dateList ',this.dateList);
  479. },
  480. dateClick(index){
  481. this.dateIndex = index;
  482. this.getTimes()
  483. },
  484. auditoriumClick(index){
  485. this.auditoriumIndex = index;
  486. this.getDate();
  487. },
  488. confirmCalendar(e){
  489. // console.log('confirmCalendar',e);
  490. // this.getDate(e)
  491. this.dateIndex = 0;
  492. this.setDate( new Date(e),true );
  493. // console.log('maxDate',this.maxDate);
  494. // console.log('dateList',this.dateList);
  495. this.calendarShow = false;
  496. },
  497. closeCalendar(){
  498. this.calendarShow = false;
  499. },
  500. tabsClick(e){
  501. // console.log('tabsClick',e);
  502. this.tabsIndex = e.index;
  503. },
  504. sessionClick(index){
  505. if(this.sessionIndex==index){
  506. // console.log('不变');
  507. return
  508. }
  509. this.sessionIndex = index;
  510. let session = this.sessionList[this.sessionIndex];
  511. this.getPositionData();
  512. console.log('sessionClick',this.sessionList[this.sessionIndex]);
  513. },
  514. getPositionData(){
  515. let session = this.sessionList[this.sessionIndex]||{};
  516. let ticketType = this.ticketTypeList[this.ticketTypeIndex];
  517. let params ={
  518. performId:this.performId,
  519. goodsId:ticketType.id,
  520. auditoriumId:this.auditoriumList[this.auditoriumIndex].id,
  521. performTimeId:session.id,
  522. }
  523. this.$u.api.selectRegion(params).then(res=>{
  524. // console.log('getPositionData',res.data);
  525. this.positionData = res.data;
  526. this.positionArr = res.data.regionPriceList||[];
  527. uni.hideLoading();
  528. }).catch(err=>{
  529. uni.hideLoading();
  530. console.log('getPositionData',err);
  531. })
  532. },
  533. ticketTypeClick(index){
  534. if(this.ticketTypeIndex==index){
  535. // console.log('不变');
  536. return
  537. }
  538. this.ticketTypeIndex = index;
  539. this.getPositionData()
  540. },
  541. positionClick(index){
  542. if(this.positionIndex==index){
  543. // console.log('不变');
  544. return
  545. }
  546. this.positionIndex = index;
  547. },
  548. book(item){
  549. // console.log('book',item);
  550. // console.log('performInfo',this.performInfo);
  551. let session = this.sessionList[this.sessionIndex];
  552. // console.log('session',session);
  553. let performTimeStart = session.performTimeStart;
  554. let performTimeEnd = session.performTimeEnd;
  555. let dateOBJ = this.dateList[this.dateIndex];
  556. let ticketType = this.ticketTypeList[this.ticketTypeIndex];
  557. let seatType = this.positionArr[this.positionIndex];
  558. // console.log('ticketType',ticketType);
  559. let theatre = this.theatre;
  560. let params ={
  561. performId:this.performId,
  562. goodsId:ticketType.id,
  563. auditoriumId:this.auditoriumList[this.auditoriumIndex].id,
  564. performTimeId:session.id,
  565. seatTypeId:seatType.seatTypeId,
  566. salePrice:seatType.salePrice,
  567. theatreId:theatre.id,
  568. theatreName:theatre.name
  569. }
  570. // console.log('book params',params);
  571. uni.$u.route('pages/bookticket',params)
  572. // 调整选择位置类型页面
  573. // uni.$u.route('pages/chosenposition',{
  574. // goodsId:item.id,
  575. // performId:this.performId,
  576. // performName:this.performInfo.name,
  577. // day:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`,
  578. // performTimeStart:session.performTimeStart,
  579. // performTimeEnd:session.performTimeEnd,
  580. // performTimeId:session.id,
  581. // auditoriumId:this.auditoriumList[this.auditoriumIndex].id
  582. // })
  583. },
  584. openShare(){
  585. if(!this.performInfo.posterImg){
  586. uni.$u.toast('没有节目信息');
  587. return false
  588. }
  589. this.shareShow = true;
  590. },
  591. // 海报相关开始
  592. getPoster(item){
  593. this.posterShow = true;
  594. this.shareShow = false;
  595. // 后端生成海报
  596. // this.$u.api.performQrcode({performId:this.performId}).then(res=>{
  597. // this.posterSrc = res.data.imageUrl;
  598. // // console.log('getPoster',res.data);
  599. // }).catch(err=>{
  600. // console.log('getPoster',err);
  601. // })
  602. //前端生成海报
  603. uni.showLoading({
  604. title: '生成海报中'
  605. });
  606. // 前端生成海报开始
  607. let that = this;
  608. const ctx = uni.createCanvasContext('canvas', this);
  609. // 加载海报背景图
  610. uni.getImageInfo({
  611. src: this.performInfo.posterImg,
  612. success: res1 => {
  613. const img1 = res1.path;
  614. // 加载海报二维码
  615. uni.getImageInfo({
  616. src: this.performInfo.appletQrcode,
  617. success: res2 => {
  618. const img2 = res2.path;
  619. // 绘制海报背景图
  620. ctx.drawImage(img1, 0, 0, 574, 1042);
  621. // 绘制海报二维码
  622. ctx.drawImage(img2, 398, 868, 114, 114);
  623. // 绘制完成后导出图片并显示
  624. ctx.draw(false, () => {
  625. uni.canvasToTempFilePath({
  626. canvasId: 'canvas',
  627. success: res3 => {
  628. this.posterSrc = res3.tempFilePath;
  629. this.posterSrcType = 'local';
  630. },
  631. fail: err => {
  632. console.error(err);
  633. },
  634. }, this);
  635. });
  636. },
  637. fail: err2 => {
  638. console.error(err2);
  639. },
  640. });
  641. },
  642. fail: err1 => {
  643. console.error(err1);
  644. },
  645. complete: () => {
  646. uni.hideLoading()
  647. }
  648. });
  649. // 前端生成海报结束
  650. },
  651. saveImage() {
  652. let that = this;
  653. uni.showLoading({
  654. title: '保存中'
  655. });
  656. if(this.posterSrcType == 'local'){
  657. let params = {
  658. tempFilePath:that.posterSrc
  659. }
  660. that.saveImageToPhotosAlbum(params);
  661. return
  662. }
  663. uni.downloadFile({
  664. url: this.posterSrc,
  665. success(res) {
  666. if (res.statusCode === 200) {
  667. that.saveImageToPhotosAlbum(res)
  668. } else {
  669. uni.showToast({
  670. title: '下载图片失败',
  671. icon: 'none'
  672. });
  673. }
  674. },
  675. fail(e) {
  676. console.log('下载图片失败', e);
  677. console.log('posterSrc',that.posterSrc);
  678. uni.showToast({
  679. title: '下载图片失败',
  680. icon: 'none'
  681. });
  682. }
  683. });
  684. },
  685. saveImageToPhotosAlbum(res){
  686. let that = this;
  687. uni.saveImageToPhotosAlbum({
  688. filePath: res.tempFilePath,
  689. success() {
  690. uni.showToast({
  691. title: '保存到相册成功',
  692. icon: 'success'
  693. });
  694. },
  695. fail(err) {
  696. console.log('保存图片失败',err);
  697. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  698. uni.getSetting({
  699. success(res) {
  700. if (!res.authSetting['scope.writePhotosAlbum']) {
  701. uni.showModal({
  702. title: '提示',
  703. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  704. confirmText: '去设置',
  705. success(res) {
  706. if (res.confirm) {
  707. uni.openSetting();
  708. }
  709. }
  710. });
  711. } else {
  712. uni.showToast({
  713. title: '保存图片失败',
  714. icon: 'none'
  715. });
  716. }
  717. }
  718. });
  719. } else {
  720. uni.showToast({
  721. title: '保存图片失败',
  722. icon: 'none'
  723. });
  724. }
  725. },
  726. complete() {
  727. uni.hideLoading();
  728. that.posterShow = false;
  729. }
  730. });
  731. },
  732. // 海报相关结束
  733. goMap(){
  734. uni.openLocation({
  735. latitude:Number(this.theatre.latitude), //维度
  736. longitude: Number(this.theatre.longitude), //经度
  737. name: this.theatre.name, //目的地定位名称
  738. scale: 15, //缩放比例
  739. address: this.theatre.address //导航详细地址
  740. })
  741. },
  742. phoneCall(){
  743. // console.log('this.theatre',this.theatre);
  744. uni.makePhoneCall({
  745. phoneNumber: this.theatre.customerServiceMobile,
  746. success() {
  747. console.log('success');
  748. },
  749. fail() {
  750. console.log('fail');
  751. }
  752. });
  753. },
  754. showSeatImg(){
  755. if(!this.positionData.seatImg){
  756. uni.$u.toast('没有图片')
  757. return
  758. }
  759. let urls = [];
  760. urls.push(this.positionData.seatImg)
  761. uni.previewImage({
  762. urls: urls,
  763. })
  764. }
  765. }
  766. }
  767. </script>
  768. <style lang="scss" scoped>
  769. .banner{
  770. position: relative;
  771. .img{
  772. width: 750rpx;
  773. height: 554rpx;
  774. display: block;
  775. }
  776. .content{
  777. position: absolute;
  778. width: 100%;
  779. box-sizing: border-box;
  780. padding: 0 32rpx;
  781. left: 0;
  782. bottom: 200rpx;
  783. }
  784. .share{
  785. overflow: hidden;
  786. margin-bottom: 100rpx;
  787. .icon{
  788. float: right;
  789. display: block;
  790. width: 32rpx;
  791. height: 32rpx;
  792. padding: 10rpx;
  793. border-radius: 50%;
  794. background-color: rgba(0,0,0,0.4);
  795. }
  796. }
  797. }
  798. .base-info{
  799. position: relative;
  800. // margin-bottom: 54rpx;
  801. .inner{
  802. position: relative;
  803. padding: 50rpx 38rpx 58rpx 40rpx;
  804. background-color: #FFFFFF;
  805. border-radius: 32rpx 32rpx 0rpx 0rpx;
  806. margin-top: -30px;
  807. border-bottom: 12rpx solid #F7F8F9;
  808. }
  809. .name{
  810. font-size: 40rpx;
  811. font-weight: 800;
  812. color: #2D2D2D;
  813. margin-bottom: 26rpx;
  814. }
  815. .addr{
  816. font-size: 26rpx;
  817. font-weight: 400;
  818. color: #606060;
  819. }
  820. .menu{
  821. .item{
  822. margin-left: 18rpx;
  823. font-size: 18rpx;
  824. font-weight: 400;
  825. color: #999999;
  826. text-align: center;
  827. }
  828. .icon{
  829. width: 62rpx;
  830. height: 64rpx;
  831. display: block;
  832. margin-bottom: 4rpx;
  833. }
  834. }
  835. }
  836. .tabs-wrap{
  837. position: relative;
  838. margin-bottom: 54rpx;
  839. &::after{
  840. content: '';
  841. width: 100%;
  842. height: 1px;
  843. background-color: #eee;
  844. position: absolute;
  845. left: 0;
  846. right: 0;
  847. bottom: -46rpx;
  848. }
  849. .inner{
  850. position: relative;
  851. padding-top: 48rpx;
  852. background-color: #FFFFFF;
  853. // border-radius: 32rpx 32rpx 0rpx 0rpx;
  854. height: 46rpx;
  855. // margin-top: -30px;
  856. }
  857. }
  858. .date-block{
  859. margin-bottom: 64rpx;
  860. }
  861. .title{
  862. font-size: 32rpx;
  863. font-weight: bold;
  864. color: #2D2D2D;
  865. line-height: 48rpx;
  866. margin-bottom: 38rpx;
  867. }
  868. .empty{
  869. background-color: #636363;
  870. color: #979797;
  871. border-radius: 8rpx;
  872. padding: 24rpx;
  873. text-align: center;
  874. }
  875. .session-wrap{
  876. }
  877. .session{
  878. display: grid;
  879. grid-template-columns: repeat(3, 1fr);
  880. gap: 20rpx;
  881. .session-item{
  882. height: 80rpx;
  883. line-height: 80rpx;
  884. border-radius: 12rpx;
  885. border: 2rpx solid #636363;
  886. text-align: center;
  887. font-size: 24rpx;
  888. font-weight: 400;
  889. color: #636363;
  890. &.active{
  891. color: #ED0000;
  892. border-color: #ED0000;
  893. }
  894. }
  895. }
  896. .ticket-type{
  897. .type-item{
  898. background: #FFFFFF;
  899. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(180,180,180,0.5);
  900. border-radius: 20rpx;
  901. margin-bottom: 20rpx;
  902. padding: 38rpx 40rpx;
  903. .name-price{
  904. margin-bottom: 26rpx;
  905. }
  906. .name{
  907. font-size: 28rpx;
  908. font-weight: 500;
  909. color: #363636;
  910. }
  911. .prices{
  912. font-size: 36rpx;
  913. font-weight: bold;
  914. color: #ED0000;
  915. }
  916. .ishave{
  917. margin-bottom: 26rpx;
  918. .text{
  919. height: 30rpx;
  920. line-height: 30rpx;
  921. padding: 0 22rpx;
  922. background: #FFC8C8;
  923. border-radius: 20rpx;
  924. font-size: 20rpx;
  925. font-weight: 400;
  926. color: #ED0000;
  927. }
  928. }
  929. .bottom{
  930. font-size: 22rpx;
  931. font-weight: 400;
  932. color: #7F7F7F;
  933. .btn{
  934. height: 60rpx;
  935. line-height: 60rpx;
  936. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  937. border-radius: 30rpx;
  938. padding: 0 36rpx;
  939. font-size: 28rpx;
  940. font-weight: 500;
  941. color: #FFFFFF;
  942. &.disabled{
  943. background: #979797;
  944. }
  945. }
  946. }
  947. }
  948. }
  949. .details{
  950. .title{}
  951. .details-block{
  952. background: #FFFFFF;
  953. box-shadow: 0rpx 2rpx 12rpx 2rpx rgba(221,221,221,0.5);
  954. border-radius: 20rpx;
  955. margin-bottom: 24rpx;
  956. padding: 36rpx;
  957. &.actors{
  958. .title{
  959. .right{
  960. font-size: 24rpx;
  961. font-weight: 400;
  962. color: #7F7F7F;
  963. }
  964. }
  965. }
  966. }
  967. .intro{
  968. font-size: 26rpx;
  969. font-weight: 400;
  970. color: #4E4E4E;
  971. line-height: 40rpx;
  972. }
  973. .actor-list{
  974. .item{
  975. flex-shrink: 0;
  976. width: 160rpx;
  977. text-align: center;
  978. margin-right: 24rpx;
  979. }
  980. .img{
  981. display: block;
  982. width: 100%;
  983. height: 200rpx;
  984. margin-bottom: 16rpx;
  985. }
  986. .name{
  987. font-size: 28rpx;
  988. font-weight: 500;
  989. color: #2D2D2D;
  990. line-height: 42rpx;
  991. margin-bottom: 4rpx;
  992. }
  993. .role{
  994. font-size: 24rpx;
  995. font-weight: 400;
  996. color: #7F7F7F;
  997. line-height: 36rpx;
  998. }
  999. }
  1000. }
  1001. .canvas{
  1002. position: fixed;
  1003. left: -99999px;
  1004. }
  1005. </style>