ticketlist.vue 30 KB

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