ticketlist.vue 30 KB

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