ticketlist.vue 32 KB

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