ticketlist.vue 29 KB

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