ticketlist.vue 32 KB

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