ticketlist.vue 33 KB

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