ticketlist.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  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 params ={
  560. performId:this.performId,
  561. goodsId:ticketType.id,
  562. auditoriumId:this.auditoriumList[this.auditoriumIndex].id,
  563. performTimeId:session.id,
  564. seatTypeId:seatType.seatTypeId,
  565. salePrice:seatType.salePrice
  566. }
  567. // console.log('book params',params);
  568. uni.$u.route('pages/bookticket',params)
  569. // 调整选择位置类型页面
  570. // uni.$u.route('pages/chosenposition',{
  571. // goodsId:item.id,
  572. // performId:this.performId,
  573. // performName:this.performInfo.name,
  574. // day:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`,
  575. // performTimeStart:session.performTimeStart,
  576. // performTimeEnd:session.performTimeEnd,
  577. // performTimeId:session.id,
  578. // auditoriumId:this.auditoriumList[this.auditoriumIndex].id
  579. // })
  580. },
  581. openShare(){
  582. if(!this.performInfo.posterImg){
  583. uni.$u.toast('没有节目信息');
  584. return false
  585. }
  586. this.shareShow = true;
  587. },
  588. // 海报相关开始
  589. getPoster(item){
  590. this.posterShow = true;
  591. this.shareShow = false;
  592. // 后端生成海报
  593. // this.$u.api.performQrcode({performId:this.performId}).then(res=>{
  594. // this.posterSrc = res.data.imageUrl;
  595. // // console.log('getPoster',res.data);
  596. // }).catch(err=>{
  597. // console.log('getPoster',err);
  598. // })
  599. //前端生成海报
  600. uni.showLoading({
  601. title: '生成海报中'
  602. });
  603. // 前端生成海报开始
  604. let that = this;
  605. const ctx = uni.createCanvasContext('canvas', this);
  606. // 加载海报背景图
  607. uni.getImageInfo({
  608. src: this.performInfo.posterImg,
  609. success: res1 => {
  610. const img1 = res1.path;
  611. // 加载海报二维码
  612. uni.getImageInfo({
  613. src: this.performInfo.appletQrcode,
  614. success: res2 => {
  615. const img2 = res2.path;
  616. // 绘制海报背景图
  617. ctx.drawImage(img1, 0, 0, 574, 1042);
  618. // 绘制海报二维码
  619. ctx.drawImage(img2, 398, 868, 114, 114);
  620. // 绘制完成后导出图片并显示
  621. ctx.draw(false, () => {
  622. uni.canvasToTempFilePath({
  623. canvasId: 'canvas',
  624. success: res3 => {
  625. this.posterSrc = res3.tempFilePath;
  626. this.posterSrcType = 'local';
  627. },
  628. fail: err => {
  629. console.error(err);
  630. },
  631. }, this);
  632. });
  633. },
  634. fail: err2 => {
  635. console.error(err2);
  636. },
  637. });
  638. },
  639. fail: err1 => {
  640. console.error(err1);
  641. },
  642. complete: () => {
  643. uni.hideLoading()
  644. }
  645. });
  646. // 前端生成海报结束
  647. },
  648. saveImage() {
  649. let that = this;
  650. uni.showLoading({
  651. title: '保存中'
  652. });
  653. if(this.posterSrcType == 'local'){
  654. let params = {
  655. tempFilePath:that.posterSrc
  656. }
  657. that.saveImageToPhotosAlbum(params);
  658. return
  659. }
  660. uni.downloadFile({
  661. url: this.posterSrc,
  662. success(res) {
  663. if (res.statusCode === 200) {
  664. that.saveImageToPhotosAlbum(res)
  665. } else {
  666. uni.showToast({
  667. title: '下载图片失败',
  668. icon: 'none'
  669. });
  670. }
  671. },
  672. fail(e) {
  673. console.log('下载图片失败', e);
  674. console.log('posterSrc',that.posterSrc);
  675. uni.showToast({
  676. title: '下载图片失败',
  677. icon: 'none'
  678. });
  679. }
  680. });
  681. },
  682. saveImageToPhotosAlbum(res){
  683. let that = this;
  684. uni.saveImageToPhotosAlbum({
  685. filePath: res.tempFilePath,
  686. success() {
  687. uni.showToast({
  688. title: '保存到相册成功',
  689. icon: 'success'
  690. });
  691. },
  692. fail(err) {
  693. console.log('保存图片失败',err);
  694. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  695. uni.getSetting({
  696. success(res) {
  697. if (!res.authSetting['scope.writePhotosAlbum']) {
  698. uni.showModal({
  699. title: '提示',
  700. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  701. confirmText: '去设置',
  702. success(res) {
  703. if (res.confirm) {
  704. uni.openSetting();
  705. }
  706. }
  707. });
  708. } else {
  709. uni.showToast({
  710. title: '保存图片失败',
  711. icon: 'none'
  712. });
  713. }
  714. }
  715. });
  716. } else {
  717. uni.showToast({
  718. title: '保存图片失败',
  719. icon: 'none'
  720. });
  721. }
  722. },
  723. complete() {
  724. uni.hideLoading();
  725. that.posterShow = false;
  726. }
  727. });
  728. },
  729. // 海报相关结束
  730. goMap(){
  731. uni.openLocation({
  732. latitude:Number(this.theatre.latitude), //维度
  733. longitude: Number(this.theatre.longitude), //经度
  734. name: this.theatre.name, //目的地定位名称
  735. scale: 15, //缩放比例
  736. address: this.theatre.address //导航详细地址
  737. })
  738. },
  739. phoneCall(){
  740. // console.log('this.theatre',this.theatre);
  741. uni.makePhoneCall({
  742. phoneNumber: this.theatre.customerServiceMobile,
  743. success() {
  744. console.log('success');
  745. },
  746. fail() {
  747. console.log('fail');
  748. }
  749. });
  750. },
  751. showSeatImg(){
  752. if(!this.positionData.seatImg){
  753. uni.$u.toast('没有图片')
  754. return
  755. }
  756. let urls = [];
  757. urls.push(this.positionData.seatImg)
  758. uni.previewImage({
  759. urls: urls,
  760. })
  761. }
  762. }
  763. }
  764. </script>
  765. <style lang="scss" scoped>
  766. .banner{
  767. position: relative;
  768. .img{
  769. width: 750rpx;
  770. height: 554rpx;
  771. display: block;
  772. }
  773. .content{
  774. position: absolute;
  775. width: 100%;
  776. box-sizing: border-box;
  777. padding: 0 32rpx;
  778. left: 0;
  779. bottom: 200rpx;
  780. }
  781. .share{
  782. overflow: hidden;
  783. margin-bottom: 100rpx;
  784. .icon{
  785. float: right;
  786. display: block;
  787. width: 32rpx;
  788. height: 32rpx;
  789. padding: 10rpx;
  790. border-radius: 50%;
  791. background-color: rgba(0,0,0,0.4);
  792. }
  793. }
  794. }
  795. .base-info{
  796. position: relative;
  797. // margin-bottom: 54rpx;
  798. .inner{
  799. position: relative;
  800. padding: 50rpx 38rpx 58rpx 40rpx;
  801. background-color: #FFFFFF;
  802. border-radius: 32rpx 32rpx 0rpx 0rpx;
  803. margin-top: -30px;
  804. border-bottom: 12rpx solid #F7F8F9;
  805. }
  806. .name{
  807. font-size: 40rpx;
  808. font-weight: 800;
  809. color: #2D2D2D;
  810. margin-bottom: 26rpx;
  811. }
  812. .addr{
  813. font-size: 26rpx;
  814. font-weight: 400;
  815. color: #606060;
  816. }
  817. .menu{
  818. .item{
  819. margin-left: 18rpx;
  820. font-size: 18rpx;
  821. font-weight: 400;
  822. color: #999999;
  823. text-align: center;
  824. }
  825. .icon{
  826. width: 62rpx;
  827. height: 64rpx;
  828. display: block;
  829. margin-bottom: 4rpx;
  830. }
  831. }
  832. }
  833. .tabs-wrap{
  834. position: relative;
  835. margin-bottom: 54rpx;
  836. &::after{
  837. content: '';
  838. width: 100%;
  839. height: 1px;
  840. background-color: #eee;
  841. position: absolute;
  842. left: 0;
  843. right: 0;
  844. bottom: -46rpx;
  845. }
  846. .inner{
  847. position: relative;
  848. padding-top: 48rpx;
  849. background-color: #FFFFFF;
  850. // border-radius: 32rpx 32rpx 0rpx 0rpx;
  851. height: 46rpx;
  852. // margin-top: -30px;
  853. }
  854. }
  855. .date-block{
  856. margin-bottom: 64rpx;
  857. }
  858. .title{
  859. font-size: 32rpx;
  860. font-weight: bold;
  861. color: #2D2D2D;
  862. line-height: 48rpx;
  863. margin-bottom: 38rpx;
  864. }
  865. .empty{
  866. background-color: #636363;
  867. color: #979797;
  868. border-radius: 8rpx;
  869. padding: 24rpx;
  870. text-align: center;
  871. }
  872. .session-wrap{
  873. }
  874. .session{
  875. display: grid;
  876. grid-template-columns: repeat(3, 1fr);
  877. gap: 20rpx;
  878. .session-item{
  879. height: 80rpx;
  880. line-height: 80rpx;
  881. border-radius: 12rpx;
  882. border: 2rpx solid #636363;
  883. text-align: center;
  884. font-size: 24rpx;
  885. font-weight: 400;
  886. color: #636363;
  887. &.active{
  888. color: #ED0000;
  889. border-color: #ED0000;
  890. }
  891. }
  892. }
  893. .ticket-type{
  894. .type-item{
  895. background: #FFFFFF;
  896. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(180,180,180,0.5);
  897. border-radius: 20rpx;
  898. margin-bottom: 20rpx;
  899. padding: 38rpx 40rpx;
  900. .name-price{
  901. margin-bottom: 26rpx;
  902. }
  903. .name{
  904. font-size: 28rpx;
  905. font-weight: 500;
  906. color: #363636;
  907. }
  908. .prices{
  909. font-size: 36rpx;
  910. font-weight: bold;
  911. color: #ED0000;
  912. }
  913. .ishave{
  914. margin-bottom: 26rpx;
  915. .text{
  916. height: 30rpx;
  917. line-height: 30rpx;
  918. padding: 0 22rpx;
  919. background: #FFC8C8;
  920. border-radius: 20rpx;
  921. font-size: 20rpx;
  922. font-weight: 400;
  923. color: #ED0000;
  924. }
  925. }
  926. .bottom{
  927. font-size: 22rpx;
  928. font-weight: 400;
  929. color: #7F7F7F;
  930. .btn{
  931. height: 60rpx;
  932. line-height: 60rpx;
  933. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  934. border-radius: 30rpx;
  935. padding: 0 36rpx;
  936. font-size: 28rpx;
  937. font-weight: 500;
  938. color: #FFFFFF;
  939. &.disabled{
  940. background: #979797;
  941. }
  942. }
  943. }
  944. }
  945. }
  946. .details{
  947. .title{}
  948. .details-block{
  949. background: #FFFFFF;
  950. box-shadow: 0rpx 2rpx 12rpx 2rpx rgba(221,221,221,0.5);
  951. border-radius: 20rpx;
  952. margin-bottom: 24rpx;
  953. padding: 36rpx;
  954. &.actors{
  955. .title{
  956. .right{
  957. font-size: 24rpx;
  958. font-weight: 400;
  959. color: #7F7F7F;
  960. }
  961. }
  962. }
  963. }
  964. .intro{
  965. font-size: 26rpx;
  966. font-weight: 400;
  967. color: #4E4E4E;
  968. line-height: 40rpx;
  969. }
  970. .actor-list{
  971. .item{
  972. flex-shrink: 0;
  973. width: 160rpx;
  974. text-align: center;
  975. margin-right: 24rpx;
  976. }
  977. .img{
  978. display: block;
  979. width: 100%;
  980. height: 200rpx;
  981. margin-bottom: 16rpx;
  982. }
  983. .name{
  984. font-size: 28rpx;
  985. font-weight: 500;
  986. color: #2D2D2D;
  987. line-height: 42rpx;
  988. margin-bottom: 4rpx;
  989. }
  990. .role{
  991. font-size: 24rpx;
  992. font-weight: 400;
  993. color: #7F7F7F;
  994. line-height: 36rpx;
  995. }
  996. }
  997. }
  998. .canvas{
  999. position: fixed;
  1000. left: -99999px;
  1001. }
  1002. </style>