ticketlist.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601
  1. <template>
  2. <view class="pages">
  3. <view class="navbar-box">
  4. <u-navbar title=" " :safeAreaInsetTop="true" @leftClick="leftClick" :titleStyle="{color:'#fff'}" leftIconColor="#fff" bgColor="transparent"></u-navbar>
  5. </view>
  6. <view class="banner">
  7. <!-- <image class="img" :src="staticUrl+'/img/bookticket-banner.png'" alt=""> -->
  8. <!-- <image class="img" :src="theatre.showImg" alt=""> -->
  9. <u-swiper
  10. :list="performInfo.photoList"
  11. height="554rpx"
  12. indicatorMode="dot"
  13. :indicatorStyle="{bottom:'100rpx'}"
  14. keyName="imageUrl"
  15. radius="0"
  16. @click="previewBanner"
  17. :indicator="false"
  18. circular
  19. ></u-swiper>
  20. <!-- <view class="content">
  21. <view class="share" @click="openShare()">
  22. <image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
  23. </view>
  24. </view> -->
  25. </view>
  26. <view class="base-info">
  27. <view class="inner">
  28. <view class="name">{{performInfo.name}}</view>
  29. <view class="addr u-flex u-row-between">
  30. <view class="text">演出地址:{{theatre.address||''}}</view>
  31. <view class="menu u-flex">
  32. <view class="item" @click="goMap">
  33. <image class="icon" :src="staticUrl+'/img/map-ico.png'" ></image>
  34. <text>导航</text>
  35. </view>
  36. <view class="item" @click="phoneCall">
  37. <image class="icon" :src="staticUrl+'/img/phone-call-ico.png'" ></image>
  38. <text>电话</text>
  39. </view>
  40. <view class="item" @click="openShare()">
  41. <image class="icon" :src="staticUrl+'/img/share-ico-v2.png'" ></image>
  42. <text>分享</text>
  43. </view>
  44. <!-- <u-icon name="arrow-right" color="#ffffff" size="36rpx" @click="goMap"></u-icon>
  45. <u-icon name="arrow-right" color="#ffffff" size="36rpx" @click="goMap"></u-icon> -->
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="tabs-wrap">
  51. <view class="inner">
  52. <u-tabs
  53. :list="tabsArr"
  54. @click="tabsClick"
  55. lineColor="#ED0000"
  56. lineWidth="82rpx"
  57. :activeStyle="{color: '#2D2D2D',fontWeight: 'bold'}"
  58. itemStyle="width:33%; height: 46px;box-sizing:border-box"
  59. >
  60. </u-tabs>
  61. </view>
  62. </view>
  63. <view class="page-wrap">
  64. <view class="ticket" v-if="tabsIndex==0">
  65. <view class="date-block">
  66. <view class="title">演出日期</view>
  67. <view class="date-list u-flex">
  68. <view class="date-item"
  69. :class="{active:dateIndex==index,dot:performDateList.find(item => item.performDate === `${date.year}-${date.month}-${date.day}`) !== undefined}"
  70. @click="dateClick(index)"
  71. v-for="(date,index) in dateList" :key="index">
  72. <!-- <view class="name">{{ date.name || ' ' }}</view> -->
  73. <!-- <view class="name">
  74. {{ performDateList.find(item => item.performDate === date.fullDay ) !== undefined?'有演出':'无演出' }}
  75. </view> -->
  76. <view class="name">
  77. {{date.fullDay|checkWeekDate}}
  78. </view>
  79. <view class="date">{{ date.month }} - {{ date.day }}</view>
  80. <image class="selected-img" :src="staticUrl+'/img/selected.png'"></image>
  81. </view>
  82. <view class="date-item more-date u-flex u-row-center" @click="calendarShow = true">
  83. <view class="text">
  84. <view class="">更多</view>
  85. <view class="">日期</view>
  86. </view>
  87. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="date-block auditorium generic-block" v-show="false">
  92. <view class="title">演出厅</view>
  93. <view class="date-list u-flex u-flex-wrap">
  94. <view class="date-item" :class="{active:auditoriumIndex==index}" @click="auditoriumClick(index)" v-for="(date,index) in auditoriumList" :key="index">
  95. <view class="name">{{ date.name }}</view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="date-block session-wrap generic-block">
  100. <view class="title">演出场次</view>
  101. <view class="empty" v-if="auditoriumList.length>=1&&sessionList.length<1">
  102. 当前日期暂无演出场次,请重新选择
  103. </view>
  104. <view class="date-list u-flex u-flex-wrap" v-else>
  105. <view class="date-item" :class="{active:sessionIndex==index,disabled:!date.ifVaild}" @click="sessionClick(index,date)" v-for="(date,index) in sessionList" :key="index">
  106. <view class="name">{{ date.performTimeStart}} - {{date.performTimeEnd}}</view>
  107. </view>
  108. </view>
  109. </view>
  110. <!-- <view class="date-block generic-block session-wrap">
  111. <view class="title">演出场次</view>
  112. <view class="session">
  113. <view class="session-item" :class="{active:sessionIndex==index}" @click="sessionClick(index)" v-for="(date,index) in sessionList" :key="index">
  114. {{ date.performTimeStart}} - {{date.performTimeEnd}}
  115. </view>
  116. </view>
  117. <view class="empty" v-if="auditoriumList.length>=1&&sessionList.length<1">
  118. 当前日期暂无演出场次,请重新选择
  119. </view>
  120. </view> -->
  121. <view class="date-block ticket-type generic-block" v-if="sessionList.length>=1">
  122. <view class="title">票档</view>
  123. <view class="empty" v-if="ticketTypeList.length<1">
  124. 暂无门票
  125. </view>
  126. <view class="date-list u-flex u-flex-wrap">
  127. <view class="date-item" :class="{active:ticketTypeIndex==index,'disabled':date.stockNum<1&&date.stockNum!==-1}" @click="ticketTypeClick(index,date)" v-for="(date,index) in ticketTypeList" :key="index">
  128. <view class="name">{{ date.name }}</view>
  129. <view class="sold-out" v-if="date.stockNum<1&&date.stockNum!==-1">售罄</view>
  130. </view>
  131. </view>
  132. <view class="goodsSnapshot" v-if="ticketTypeList.length>0&&goodsSnapshot">
  133. 票务说明:{{goodsSnapshot}}
  134. </view>
  135. <!-- <view class="type-item" :class="{active:sessionIndex==index}" v-for="(item,index) in ticketTypeList" :key="index">
  136. <view class="name-price u-flex u-row-between">
  137. <view class="name">{{item.goodsName}}</view>
  138. <view class="prices">¥ {{item.salePrice}} 起</view>
  139. </view>
  140. <view class="bottom u-flex u-row-between">
  141. <view class="left u-flex" v-html="item.goodsSnapshot||''">
  142. </view>
  143. <view class="btn" @click="book(item)" v-if="item.quantity!==0&&sessionList.length>=1">预定</view>
  144. <view class="btn disabled" v-else>无票</view>
  145. </view>
  146. </view> -->
  147. </view>
  148. <view class="date-block position-select generic-block" v-if="sessionList.length>=1">
  149. <view class="title u-flex u-row-between">
  150. <view class="">票种</view>
  151. <view v-if="positionData.seatImg" class="" style="font-size: 24rpx;color: #aaa" @click="showSeatImg">票区图</view>
  152. </view>
  153. <view class="empty" v-if="positionArr.length<1">
  154. 没有座位信息
  155. </view>
  156. <!-- <view class="date-list u-flex u-flex-wrap">
  157. <view class="date-item" :class="{active:positionIndex==index,'stock-over':date.stockNum<1&&date.stockNum!==-1}" @click="positionClick(index,date)" v-for="(date,index) in positionArr" :key="index">
  158. <view class="name">{{ date.seatTypeName }} <br />¥ {{date.salePrice}}</view>
  159. <view class="sold-out" v-if="date.stockNum<1&&date.stockNum!==-1">售罄</view>
  160. </view>
  161. </view> -->
  162. <view class="ticket-type-list">
  163. <view class="ticket-type-item" v-for="(item, index) in positionArr" :key="index">
  164. <view class="type-info u-flex u-row-between">
  165. <view class="type-name">{{item.goodsName}}</view>
  166. <view class="type-price">
  167. <text class="salePrice-price">¥{{item.salePrice}}</text>
  168. <text class="original-price" v-if="item.originalPrice">¥{{item.originalPrice}}</text>
  169. </view>
  170. </view>
  171. <view class="type-desc" v-if="item.goodsSnapshot">{{item.goodsSnapshot}}</view>
  172. <view class="ticket-control u-flex u-row-right">
  173. <view class="minus" :class="{disabled: !item.saleNum||fromPage=='rebook'}"
  174. @click.stop="changeTicketNum(item, 'minus')">-</view>
  175. <!-- <view class="num">{{item.saleNum || 0}}</view> -->
  176. <input
  177. border="none"
  178. type="number"
  179. style="width: 40px;text-align: center;"
  180. v-model="item.saleNum"
  181. :disabled="fromPage=='rebook'"
  182. >
  183. <view class="plus" :class="{disabled: item.stockNum === item.saleNum||fromPage=='rebook'}"
  184. @click.stop="changeTicketNum(item, 'plus')">+</view>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. <!-- <view class="book-btn full-btn" v-if="positionArr.length>=1&&sessionList.length>=1&&(positionIndex||positionIndex===0)" @click="book()">确定</view>
  190. <view class="full-btn gray" v-else>确定</view> -->
  191. <!-- 底部浮动条 -->
  192. <view class="bottom-bar">
  193. <view class="inner">
  194. <view class="price-info">
  195. <view class="total-price">
  196. <text>¥{{totalPrice}}</text>
  197. <text class="original">¥{{originalPrice}}</text>
  198. </view>
  199. </view>
  200. <view v-if="fromPage=='rebook'" class="submit-btn" :class="{active: hasSelectedTicket}" @click="handelRebook">
  201. {{hasSelectedTicket ? '确认改签并支付' : '请选择票'}}
  202. </view>
  203. <view v-else class="submit-btn" :class="{active: hasSelectedTicket}" @click="book">
  204. {{hasSelectedTicket ? '去支付' : '请选择票'}}
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. <!-- ticket end -->
  210. <view class="details" v-if="tabsIndex==1">
  211. <view class="details-block">
  212. <view class="title">剧情简介</view>
  213. <view class="intro parse-content">
  214. <u-parse :content="performInfo.performSnapshot"></u-parse>
  215. </view>
  216. </view>
  217. <view class="details-block actors">
  218. <view class="title u-flex u-row-between">
  219. 演职人员
  220. <view class="right u-flex" @click="$u.route('pages/actors',{performId:performId})">
  221. <text>更多</text>
  222. <u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
  223. </view>
  224. </view>
  225. <view class="actor-list">
  226. <u-scroll-list :indicator="false">
  227. <view class="item" v-for="(item, index) in actorsArr" :key="index" @click="$u.route('/pages/actorsinfo',{id:item.id})">
  228. <image class="img" :src="item.performerHead||staticUrl+'/img/actors.png'"></image>
  229. <view class="text">
  230. <view class="name">{{item.performerName}}</view>
  231. <view class="role u-line-1">{{item.performerRole}}</view>
  232. </view>
  233. </view>
  234. </u-scroll-list>
  235. <u-empty text="暂无" v-if="actorsArr.length<1"></u-empty>
  236. </view>
  237. </view>
  238. </view>
  239. <view class="viewingTips parse-content" v-if="tabsIndex==2">
  240. <u-parse :content="formerNotice"></u-parse>
  241. </view>
  242. </view>
  243. <!-- :maxDate="maxDate" -->
  244. <u-calendar
  245. ref="calendar"
  246. :formatter="formatter"
  247. :maxDate="maxDate"
  248. monthNum="12"
  249. :show="calendarShow"
  250. color="#EF1010"
  251. :closeOnClickOverlay="true"
  252. @close="closeCalendar"
  253. @confirm="confirmCalendar">
  254. </u-calendar>
  255. <!-- 分享选择弹出内容 -->
  256. <view class="share-option" :class="{shareShow:shareShow}">
  257. <view class="overlay" v-if="shareShow" @click="shareShow=false"></view>
  258. <!-- #ifdef MP-WEIXIN -->
  259. <button class="share-option-item wx-share" data-name="shareBtn" open-type="share">
  260. 发送给朋友
  261. </button>
  262. <!-- #endif -->
  263. <view class="share-option-item" @click="getPoster">生成海报</view>
  264. <view class="share-option-item" @click="shareShow=false">取消</view>
  265. </view>
  266. <u-popup :show="posterShow" @close="posterShow=false" ref="uni-popup">
  267. <view class="poster-wrap u-flex u-col-center">
  268. <view class="poster-inner">
  269. <view class="close-wrap" @click="posterShow=false">
  270. <u-icon name="close-circle" color="#fff" size="56rpx"></u-icon>
  271. </view>
  272. <view class="poster" id="poster" ref="poster" >
  273. <u--image :showLoading="false" :src="posterSrc" width="100%" height="65vh" mode="aspectFit"></u--image>
  274. </view>
  275. <!-- savePoster -->
  276. <view class="poster-btn" @click="saveImage">保存图片</view>
  277. </view>
  278. </view>
  279. </u-popup>
  280. <canvas canvas-id="canvas" class="canvas" style="width: 574px; height: 1042px;"></canvas>
  281. </view>
  282. </template>
  283. <script>
  284. import moment from 'moment';
  285. import { systemInfo } from "@/mixin.js";
  286. // 日历
  287. const d = new Date()
  288. const year = d.getFullYear()
  289. let month = d.getMonth() + 1
  290. month = month < 10 ? `0${month}` : month
  291. const date = d.getDate()
  292. // 日历
  293. // 算最大日期
  294. const maxd = new Date()
  295. maxd.setMonth(maxd.getMonth() + 12) // 将月份加3
  296. const maxdyear = maxd.getFullYear()
  297. let maxdmonth = maxd.getMonth() + 1
  298. maxdmonth = maxdmonth < 10 ? `0${maxdmonth}` : maxdmonth
  299. const maxddate = maxd.getDate()
  300. const theMaxDate = `${maxdyear}-${maxdmonth}-${maxddate}`
  301. // console.log('theMaxDate=============================',theMaxDate) //输出:
  302. //算最大日期
  303. let parentThis= null;
  304. let sharePath = '/pages/index/index';
  305. export default {
  306. onShareAppMessage(res) {
  307. if (res.from === 'button') {// 来自页面内分享按钮
  308. console.log(res.target)
  309. }
  310. return {
  311. title: this.$isDevelop?'剧场票务':'伟大转折演艺',
  312. path: sharePath
  313. }
  314. },
  315. onShareTimeline(res) {
  316. if (res.from === 'button') {// 来自页面内分享按钮
  317. console.log(res.target)
  318. }
  319. return {
  320. title: this.$isDevelop?'剧场票务':'伟大转折演艺',
  321. path: '/pages/ticketlist'
  322. }
  323. },
  324. mixins:[systemInfo],
  325. data() {
  326. return {
  327. performId:'',
  328. staticUrl:this.$commonConfig.staticUrl,
  329. tabsArr:[
  330. {name:'票务购买'},
  331. {name:'演出详情'},
  332. {name:'观影须知'}
  333. ],
  334. theatre:{},
  335. tabsIndex:0,
  336. dateList:[],
  337. dateIndex:0,
  338. calendarShow:false,//日历
  339. // maxDate:`${year}-${month}-${date + 30}`,
  340. maxDate:theMaxDate,
  341. auditoriumList:[],//演艺厅
  342. auditoriumIndex:0,
  343. sessionList:[],//演出场次
  344. sessionIndex:0,
  345. ticketTypeList:[],//门票
  346. actorsArr:[],
  347. shareShow:false,
  348. posterShow:false,
  349. posterSrc:'',
  350. posterSrcType:null,
  351. performInfo:{},//节目详情
  352. formerNotice:{},//节目观影须知
  353. performDateList:[],//有票的日期
  354. // firstGet:0,
  355. ticketTypeIndex:0,
  356. positionData:{},//座位信息接口
  357. positionArr:[],
  358. positionIndex:null,
  359. scene:null,
  360. retailId:null,//分销码
  361. label:null,//scene解析出来的
  362. goodsSnapshot:null,//票务说明
  363. retailId:null,
  364. fromPage:null,
  365. payResult:{},
  366. cansubmit: true,
  367. newOrderId:'',
  368. }
  369. },
  370. onShow() {
  371. if(this.auditoriumList.length>=1){
  372. this.getPositionData();
  373. }
  374. },
  375. onLoad(page) {
  376. console.log('ticketlist page',page);
  377. parentThis = this;
  378. const scene = decodeURIComponent(page.scene);
  379. if(scene&&scene!='undefined'){
  380. uni.setStorage({
  381. key:'scene',
  382. data:scene
  383. });
  384. }
  385. // console.log('scene=========',scene);
  386. if(scene&&scene!='undefined'){
  387. this.$u.api.uncompress({scene:scene}).then(res=>{
  388. this.performId = res.data.performId;
  389. sharePath=`/pages/ticketlist?id=${res.data.performId}`;
  390. this.getPerformData();
  391. // this.getSystemInfo();
  392. let today = new Date();
  393. this.setDate(today);
  394. this.getPerformInfo();
  395. this.getPerformerNotice();
  396. // this.label = res.data.label;
  397. // console.log('uncompress',res.data);
  398. }).catch(err=>{
  399. console.log('uncompress',err);
  400. })
  401. }else if(page.fromPage=='rebook'){
  402. this.performId = page.performId;
  403. this.orderId = page.orderId;
  404. this.fromPage = page.fromPage;
  405. sharePath=`/pages/ticketlist?id=${page.id}`;
  406. this.getPerformData();
  407. // this.getSystemInfo();
  408. let today = new Date();
  409. this.setDate(today);
  410. this.getPerformInfo();
  411. this.getPerformerNotice();
  412. }
  413. else{
  414. this.performId = page.id;
  415. sharePath=`/pages/ticketlist?id=${page.id}`;
  416. this.getPerformData();
  417. // this.getSystemInfo();
  418. let today = new Date();
  419. this.setDate(today);
  420. this.getPerformInfo();
  421. this.getPerformerNotice();
  422. }
  423. },
  424. onReady() {
  425. // 如果需要兼容微信小程序的话,需要用此写法
  426. this.$refs.calendar.setFormatter(this.formatter);
  427. },
  428. methods: {
  429. leftClick(e){
  430. let pages = getCurrentPages();
  431. if(pages.length==1){
  432. uni.$u.route('/pages/index/index')
  433. }else{
  434. uni.navigateBack()
  435. };
  436. },
  437. uncompress(scene){
  438. this.$u.api.uncompress({scene:scene}).then(res=>{
  439. this.performId = res.data.performId;
  440. // this.label = res.data.label;
  441. // console.log('uncompress',res.data);
  442. }).catch(err=>{
  443. console.log('uncompress',err);
  444. })
  445. },
  446. getPerformData(){
  447. this.$u.api.performSell({performId:this.performId}).then(res=>{
  448. // console.log('getPerformData',res.data);
  449. this.theatre = res.data.theatreList[0];
  450. this.auditoriumList = res.data.theatreList[0].auditoriumList;
  451. // this.ticketTypeList = res.data.goodsList;
  452. // this.goodsSnapshot = this.ticketTypeList[this.ticketTypeIndex]?.goodsSnapshot;
  453. this.performDateList = this.auditoriumList[this.auditoriumIndex].performDateList;
  454. this.getDate()
  455. // console.log('auditoriumList',this.auditoriumList);
  456. }).catch(err=>{
  457. console.log('getPoster',err);
  458. })
  459. },
  460. getPerformInfo(){
  461. this.$u.api.performInfo({id:this.performId}).then(res=>{
  462. // console.log('getPerformInfo',res.data);
  463. this.performInfo = res.data;
  464. this.actorsArr = res.data.performerList;
  465. }).catch(err=>{
  466. console.log('getPerformInfo',err);
  467. })
  468. },
  469. getPerformerNotice(){
  470. this.$u.api.performerNotice({performId:this.performId}).then(res=>{
  471. // console.log('getPerformerNotice',res.data);
  472. this.formerNotice = res.data.performNotice;
  473. }).catch(err=>{
  474. console.log('getPerformerNotice',err);
  475. })
  476. },
  477. getDate(){
  478. let param = {
  479. auditoriumId:this.auditoriumList[this.auditoriumIndex]?.id,//演艺厅ID(演艺厅列表)
  480. performId:this.performId,
  481. };
  482. this.$u.api.getAuditoriumDate(param).then(res=>{
  483. // console.log('getDate',res.data);
  484. this.performDateList = res.data.list||[];
  485. this.setDate();
  486. // this.getTimes();
  487. }).catch(err=>{
  488. console.log('getDate',err);
  489. })
  490. },
  491. getTimes(){
  492. // this.firstGet++;
  493. uni.showLoading();
  494. let auditoriumId= this.auditoriumList[this.auditoriumIndex]?.id;
  495. if(!auditoriumId){return}
  496. // console.log('this.dateList',this.dateList);
  497. // console.log('this.dateIndex',this.dateIndex);
  498. let dateOBJ = this.dateList[this.dateIndex];
  499. let param = {
  500. auditoriumId:auditoriumId,//演艺厅ID(演艺厅列表)
  501. performId:this.performId,
  502. date:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`
  503. };
  504. // console.log('param',param);
  505. this.$u.api.getAuditoriumTimes(param).then(res=>{
  506. // console.log('getTimes',res.data);
  507. this.sessionList = res.data.list.map(item=>{
  508. item.performTimeStart = item.performTimeStart;
  509. item.performTimeEnd = item.performTimeEnd;
  510. return item
  511. });
  512. console.log('this.sessionList',this.sessionList);
  513. // this.sessionIndex = 0;
  514. this.sessionIndex = this.sessionList.findIndex(item => item.ifVaild === 1);
  515. if (this.sessionIndex !== -1) {
  516. this.getPositionData();
  517. }
  518. // let session = this.sessionList[this.sessionIndex];
  519. }).catch(err=>{
  520. console.log('getPoster',err);
  521. })
  522. },
  523. formatter: (day) => {
  524. if(!parentThis){
  525. return
  526. }
  527. day.date = moment(day.date).format("YYYY-MM-DD HH:mm:ss")
  528. // console.log('day',day);
  529. // console.log('thisthisthisthisthisthisthisthisthis',parentThis);
  530. // console.log('==================================',day.date.toISOString().split('T')[0]);
  531. let ticket = parentThis.performDateList.find(item => item.performDate === day.date.split(' ')[0]);
  532. if(ticket){
  533. day.dot = true
  534. }
  535. // if(ticket&&ticket.ishave){
  536. // day.bottomInfo = '有票'
  537. // day.dot = true
  538. // }else if(ticket){
  539. // day.dot = true
  540. // }
  541. return day
  542. },
  543. setDate(firstDay,isSelect){
  544. // console.log('this.performDateList',this.performDateList);
  545. if(this.performDateList[0]?.performDate&&!isSelect){
  546. // firstDay = new Date(this.performDateList[0].performDate);
  547. const uniquePerformDateList = Array.from(new Set(this.performDateList.map(JSON.stringify))).map(JSON.parse);//去重
  548. // console.log('uniquePerformDateList',uniquePerformDateList);
  549. let arr = uniquePerformDateList.slice(0, 3);//只要前三项
  550. this.dateList = arr.map(item=>{
  551. // console.log('uniquePerformDateList item',item);
  552. let day = item.performDate.split('-');
  553. // console.log('setDate day',day);
  554. return { year:day[0],month:String(day[1]),day:String(day[2]), fullDay:`${day[0]}-${String(day[1])}-${String(day[2])}`}
  555. });
  556. // console.log('this.dateList',this.dateList);
  557. this.dateIndex = 0;
  558. this.getTimes();
  559. //
  560. return
  561. }
  562. // console.log('this.dateListthis.dateListthis.dateListthis.dateList',this.dateList);
  563. // 前端写演出日期(今天,明天,后天)
  564. let today = firstDay||new Date();
  565. // console.log('today=========',today);
  566. let tomorrow = new Date(today.getTime());
  567. tomorrow.setDate(today.getDate() + 1);
  568. let afterTomorrow = new Date(today.getTime());
  569. afterTomorrow.setDate(today.getDate() + 2);
  570. this.dateList = [
  571. {
  572. year: today.getFullYear(),
  573. month: String(today.getMonth() + 1).padStart(2, '0'),
  574. day: String(today.getDate()).padStart(2, '0'),
  575. name: '日期',
  576. fullDay:`${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${ String(today.getDate()).padStart(2, '0')}`
  577. },
  578. {
  579. year: tomorrow.getFullYear(),
  580. month: String(tomorrow.getMonth() + 1).padStart(2, '0'),
  581. day: String(tomorrow.getDate()).padStart(2, '0'),
  582. name: '日期',
  583. fullDay:`${tomorrow.getFullYear()}-${String(tomorrow.getMonth() + 1).padStart(2, '0')}-${ String(tomorrow.getDate()).padStart(2, '0')}`
  584. },
  585. {
  586. year: afterTomorrow.getFullYear(),
  587. month: String(afterTomorrow.getMonth() + 1).padStart(2, '0'),
  588. day: String(afterTomorrow.getDate()).padStart(2, '0'),
  589. name: '日期',
  590. fullDay:`${afterTomorrow.getFullYear()}-${String(afterTomorrow.getMonth() + 1).padStart(2, '0')}-${ String(afterTomorrow.getDate()).padStart(2, '0')}`
  591. }
  592. ];
  593. this.getTimes()
  594. // console.log('this.dateList ',this.dateList);
  595. },
  596. dateClick(index){
  597. this.dateIndex = index;
  598. this.ticketTypeIndex = 0;
  599. this.positionIndex = 0;
  600. this.getTimes()
  601. },
  602. auditoriumClick(index){
  603. this.auditoriumIndex = index;
  604. this.getDate();
  605. },
  606. confirmCalendar(e){
  607. // console.log('confirmCalendar',e);
  608. // this.getDate(e)
  609. this.dateIndex = 0;
  610. this.setDate( new Date(e),true );
  611. // console.log('maxDate',this.maxDate);
  612. // console.log('dateList',this.dateList);
  613. this.calendarShow = false;
  614. },
  615. closeCalendar(){
  616. this.calendarShow = false;
  617. },
  618. tabsClick(e){
  619. // console.log('tabsClick',e);
  620. this.tabsIndex = e.index;
  621. },
  622. sessionClick(index,data){
  623. // console.log('sessionClick index',index);
  624. console.log('sessionClick data',data);
  625. if(!data.ifVaild){
  626. uni.showToast({
  627. title:'该场次不可用',
  628. icon:'none'
  629. })
  630. return
  631. }
  632. if(this.sessionIndex==index){
  633. // console.log('不变');
  634. return
  635. }
  636. this.sessionIndex = index;
  637. let session = this.sessionList[this.sessionIndex];
  638. this.getPositionData();
  639. this.ticketTypeIndex = 0;
  640. this.positionIndex = 0;
  641. let sellableTicketTypeIndex = this.findFirstSellableTicketTypeIndex();
  642. this.ticketTypeIndex = sellableTicketTypeIndex;
  643. // console.log('sessionClick',this.sessionList[this.sessionIndex]);
  644. },
  645. async getPositionData() {
  646. try {
  647. uni.showLoading();
  648. // 获取 retailId
  649. let retailId = null;
  650. try {
  651. const res = await uni.getStorage({ key: 'retailId' });
  652. retailId = res.data;
  653. } catch (error) {
  654. console.log('获取 retailId 失败:', error);
  655. }
  656. this.retailId = retailId;
  657. // 构建请求参数
  658. const session = this.sessionList[this.sessionIndex] || {};
  659. const params = {
  660. performId: this.performId,
  661. auditoriumId: this.auditoriumList[this.auditoriumIndex].id,
  662. performTimeId: session.id,
  663. label: this.label,
  664. retailId: this.retailId,
  665. timeId: session.id,
  666. orderId: this.orderId
  667. };
  668. // 根据不同场景调用不同接口
  669. const api = this.fromPage === 'rebook' ?
  670. this.$u.api.selectRegionRebook :
  671. this.$u.api.selectRegionV2;
  672. const res = await api(params,{custom:{toast:false,noload:true}});
  673. // 处理响应数据
  674. this.positionData = res.data;
  675. this.ticketTypeList = res.data.seatList || [];
  676. // 设置默认选中的票档
  677. const sellableTicketTypeIndex = this.findFirstSellableTicketTypeIndex();
  678. this.ticketTypeIndex = sellableTicketTypeIndex;
  679. // 设置票务说明
  680. this.goodsSnapshot = this.ticketTypeList[this.ticketTypeIndex]?.goodsSnapshot;
  681. // 初始化座位数据
  682. this.positionArr = (this.ticketTypeList[this.ticketTypeIndex]?.goodsList || [])
  683. .map(obj => ({
  684. ...obj,
  685. saleNum: obj.saleNum||0 // 初始化选择数量为0
  686. }));
  687. } catch (error) {
  688. console.error('获取座位数据失败:', error);
  689. uni.showModal({
  690. title: '提示',
  691. content: error.msg||'获取座位数据失败',
  692. showCancel:false,
  693. success: function (res) {
  694. console.log('获取座位数据失败 提示',res);
  695. }
  696. })
  697. // uni.showToast({
  698. // title: error.msg||'获取座位数据失败',
  699. // icon: 'none'
  700. // });
  701. } finally {
  702. uni.hideLoading();
  703. }
  704. },
  705. // 改变票数
  706. changeTicketNum(item, type) {
  707. // console.log('changeTicketNum===',item, type);
  708. if(this.fromPage=='rebook'){
  709. return
  710. }
  711. const currentNum = item.saleNum;
  712. if(type === 'minus' && currentNum > 0) {
  713. item.saleNum=item.saleNum-1
  714. // 直接修改数值
  715. // console.log('item.saleNum',item.saleNum)
  716. }
  717. if(type === 'plus') {
  718. // && currentNum < item.stockNum
  719. // console.log('item.saleNum',item.saleNum)
  720. item.saleNum=item.saleNum+1
  721. // console.log('item.saleNum',item.saleNum)
  722. }
  723. console.log('this.positionArr',this.positionArr)
  724. },
  725. ticketTypeClick(index,date){
  726. if(this.ticketTypeIndex==index){
  727. // console.log('不变');
  728. return
  729. }else if(date.stockNum<1&&date.stockNum!==-1){
  730. uni.showToast({
  731. title:'已售罄',
  732. icon:'none'
  733. })
  734. return
  735. }
  736. this.ticketTypeIndex = index;
  737. this.goodsSnapshot = this.ticketTypeList[this.ticketTypeIndex]?.goodsSnapshot;
  738. this.positionArr = this.ticketTypeList[this.ticketTypeIndex]?.goodsList||[];
  739. this.positionArr = this.positionArr.map(obj => {
  740. return {
  741. ...obj, // 保留原有的字段
  742. saleNum: 0 // 新增的字段
  743. };
  744. });
  745. // let sellableProductIndex = this.findFirstSellableProductIndex();
  746. // this.positionIndex = sellableProductIndex;
  747. // this.getPositionData()
  748. },
  749. positionClick(index,date){
  750. if(this.positionIndex==index){
  751. // console.log('不变');
  752. return
  753. }else if(date.stockNum<1&&date.stockNum!==-1){
  754. uni.showToast({
  755. title:'已售罄',
  756. icon:'none'
  757. })
  758. return
  759. }
  760. this.positionIndex = index;
  761. },
  762. findFirstSellableProductIndex(){
  763. console.log('this.positionArr',this.positionArr);
  764. // 检查数组是否为空
  765. if (!Array.isArray(this.positionArr) || this.positionArr.length === 0) {
  766. return null;
  767. }
  768. // 遍历数组,找到第一个可售的产品
  769. for (let i = 0; i < this.positionArr.length; i++) {
  770. if (this.positionArr[i].stockNum > 0 || this.positionArr[i].stockNum === -1) {
  771. return i; // 返回第一个可售产品的索引
  772. }
  773. }
  774. return null;
  775. },
  776. findFirstSellableTicketTypeIndex(){
  777. console.log('this.ticketTypeList',this.ticketTypeList);
  778. // 检查数组是否为空
  779. if (!Array.isArray(this.ticketTypeList) || this.ticketTypeList.length === 0) {
  780. return null;
  781. }
  782. // 遍历数组,找到第一个可售的产品
  783. for (let i = 0; i < this.ticketTypeList.length; i++) {
  784. if (this.ticketTypeList[i].stockNum > 0 || this.ticketTypeList[i].stockNum === -1) {
  785. return i; // 返回第一个可售产品的索引
  786. }
  787. }
  788. return null;
  789. },
  790. book(item){
  791. if(!this.hasSelectedTicket){
  792. return
  793. }
  794. // console.log('book',item);
  795. // console.log('performInfo',this.performInfo);
  796. let session = this.sessionList[this.sessionIndex];
  797. // console.log('session',session);
  798. let performTimeStart = session.performTimeStart;
  799. let performTimeEnd = session.performTimeEnd;
  800. let dateOBJ = this.dateList[this.dateIndex];
  801. let ticketType = this.ticketTypeList[this.ticketTypeIndex];
  802. console.log('this.positionArr',this.positionArr);
  803. console.log('this.positionIndex',this.positionIndex);
  804. let seatType = this.ticketTypeList[this.ticketTypeIndex];
  805. // console.log('ticketType',ticketType);
  806. let params ={
  807. performId:this.performId,
  808. goodsId:ticketType.id,
  809. auditoriumId:this.auditoriumList[this.auditoriumIndex].id,
  810. performTimeId:session.id,
  811. seatTypeId:seatType.seatTypeId,
  812. salePrice:seatType.salePrice
  813. }
  814. let selectGoodsList = this.positionArr.reduce((acc, item) => {
  815. if (item.saleNum > 0) {
  816. acc.push({
  817. goodsId: item.goodsId,
  818. saleNum: item.saleNum
  819. });
  820. }
  821. return acc;
  822. }, []);
  823. // console.log('selectGoodsList',selectGoodsList)
  824. uni.setStorage({
  825. key:'selectGoodsList',
  826. data:JSON.stringify(selectGoodsList)
  827. });
  828. // console.log('book params',params);
  829. uni.$u.route('pages/bookticket',params)
  830. // 调整选择位置类型页面
  831. // uni.$u.route('pages/chosenposition',{
  832. // goodsId:item.id,
  833. // performId:this.performId,
  834. // performName:this.performInfo.name,
  835. // day:`${dateOBJ.year}-${dateOBJ.month}-${dateOBJ.day}`,
  836. // performTimeStart:session.performTimeStart,
  837. // performTimeEnd:session.performTimeEnd,
  838. // performTimeId:session.id,
  839. // auditoriumId:this.auditoriumList[this.auditoriumIndex].id
  840. // })
  841. },
  842. getUserLocation() {
  843. return new Promise((resolve, reject) => {
  844. uni.getLocation({
  845. type: 'gcj02',
  846. success: (res) => {
  847. resolve(res);
  848. },
  849. fail: (err) => {
  850. reject(err);
  851. }
  852. });
  853. });
  854. },
  855. async handelRebook(){
  856. const location = await this.getUserLocation();
  857. let session = this.sessionList[this.sessionIndex];
  858. let params = {
  859. orderId:this.orderId,
  860. performTimeId:session.id,
  861. longitude:location.longitude,
  862. latitude:location.latitude
  863. }
  864. console.log('handelRebook params',params);
  865. uni.showModal({
  866. title: '温馨提示',
  867. content: '每张票仅限改签一次,改签成功后原订单费用将会原路退还,您确定要改签吗?',
  868. success: res => {
  869. if (res.confirm) {
  870. this.cansubmit = false;
  871. this.$u.api.rebookApi(params)
  872. .then(res => {
  873. this.newOrderId = res.data.orderId;
  874. // if(!res.data.needPay){
  875. // //this.payQuery();
  876. // uni.$u.route('/center/orderdetails', {
  877. // type:'redirectTo',
  878. // id: this.orderId
  879. // });
  880. // }else {
  881. // this.payResult = res.data.payInfo;
  882. // this.payResult.package = res.data.payInfo.packageValue;
  883. // this.wxPay()
  884. // }
  885. this.gotoPay();
  886. // uni.redirectTo({
  887. // url: '/center/order'
  888. // });
  889. })
  890. .catch(err => {
  891. uni.showToast({
  892. title: err.msg||'改签失败',
  893. icon: 'none'
  894. })
  895. });
  896. }
  897. }
  898. })
  899. },
  900. gotoPay() {
  901. this.$u.api.gotoPayV2({
  902. orderId: this.newOrderId,
  903. openid: ''
  904. }).then(res => {
  905. // this.payResult = res.data.payInfo;
  906. // this.payResult.package = res.data.payInfo.packageValue;
  907. // ygh
  908. if(!res.data.needPay){
  909. //this.payQuery();
  910. uni.$u.route('/center/orderdetails', {
  911. type:'redirectTo',
  912. id: this.newOrderId
  913. });
  914. }else {
  915. this.payResult = res.data.payInfo;
  916. this.payResult.package = res.data.payInfo.packageValue;
  917. this.wxPay()
  918. }
  919. }).catch(err => {
  920. this.cansubmit = true;
  921. console.log('gotoPay', err);
  922. })
  923. },
  924. wxPay() {
  925. let that = this;
  926. uni.requestPayment({
  927. ...this.payResult,
  928. "provider": "wxpay",
  929. "orderInfo": {
  930. // "appid": "wx499********7c70e", // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  931. // "noncestr": "c5sEwbaNPiXAF3iv", // 随机字符串
  932. // "package": "Sign=WXPay", // 固定值
  933. // "partnerid": "148*****52", // 微信支付商户号
  934. // "prepayid": "wx202254********************fbe90000", // 统一下单订单号
  935. // "timestamp": 1597935292, // 时间戳(单位:秒)
  936. // "sign": "A842B45937F6EFF60DEC7A2EAA52D5A0" // 签名,这里用的 MD5/RSA 签名
  937. },
  938. success(res) {
  939. that.payQuery();
  940. },
  941. fail(e) {
  942. uni.$u.route('/center/order', {
  943. status: 0
  944. });
  945. console.log('wxPayfail', e);
  946. },
  947. complete() {
  948. this.cansubmit = true;
  949. }
  950. })
  951. },
  952. payQuery() {
  953. let that = this;
  954. let retryCount = 0;
  955. let maxRetryCount = 5; // 设置最大重试次数
  956. let interval = 2000; // 设置间隔时间为2秒
  957. let timeout = 10000; // 设置超时时间为10秒
  958. let timer;
  959. uni.showLoading({
  960. title: '支付结果查询中'
  961. })
  962. timer = setInterval(() => {
  963. retryCount++;
  964. if (retryCount > maxRetryCount || retryCount * interval > timeout) {
  965. clearInterval(timer);
  966. uni.hideLoading();
  967. console.log("支付查询超时或达到最大重试次数");
  968. // 在这里添加超时或达到最大重试次数的处理逻辑
  969. uni.redirectTo({
  970. url: '/center/order'
  971. });
  972. } else {
  973. console.log("第" + retryCount + "次查询");
  974. // 调用查询支付状态的方法
  975. // 如果支付状态为成功,则清除定时器并处理成功的逻辑
  976. // 如果支付状态为失败,则清除定时器并处理失败的逻辑
  977. this.$u.api.payQueryV2({
  978. orderId: this.newOrderId
  979. }).then(res => {
  980. // 0-未支付 1-已支付 2-支付中 3-支付失败 4-支付退款
  981. let payStatus = res.data.payStatus;
  982. if (payStatus === 1) {
  983. // uni.$u.route('/center/orderdetails', {
  984. // type:'redirectTo',
  985. // id: res.data.orderId
  986. // });
  987. uni.redirectTo({
  988. url: '/center/order?status=3'
  989. });
  990. // uni.$u.route('/center/paysuccess');
  991. } else if (payStatus === 0 || payStatus === 2) {
  992. this.payQuery()
  993. } else if (payStatus === 3) {
  994. uni.toast('支付失败')
  995. }
  996. clearInterval(timer);
  997. }).catch(err => {
  998. console.log('payQuery', err);
  999. }).finally(() => {
  1000. uni.hideLoading()
  1001. this.cansubmit = true;
  1002. })
  1003. }
  1004. }, interval);
  1005. },
  1006. openShare(){
  1007. if(!this.performInfo.posterImg){
  1008. uni.$u.toast('没有节目信息');
  1009. return false
  1010. }
  1011. this.shareShow = true;
  1012. },
  1013. // 海报相关开始
  1014. getPoster(item){
  1015. this.posterShow = true;
  1016. this.shareShow = false;
  1017. // 后端生成海报
  1018. // this.$u.api.performQrcode({performId:this.performId}).then(res=>{
  1019. // this.posterSrc = res.data.imageUrl;
  1020. // // console.log('getPoster',res.data);
  1021. // }).catch(err=>{
  1022. // console.log('getPoster',err);
  1023. // })
  1024. //前端生成海报
  1025. uni.showLoading({
  1026. title: '生成海报中'
  1027. });
  1028. // 前端生成海报开始
  1029. let that = this;
  1030. const ctx = uni.createCanvasContext('canvas', this);
  1031. // 加载海报背景图
  1032. uni.getImageInfo({
  1033. src: this.performInfo.posterImg,
  1034. success: res1 => {
  1035. const img1 = res1.path;
  1036. // 加载海报二维码
  1037. uni.getImageInfo({
  1038. src: this.performInfo.appletQrcode,
  1039. success: res2 => {
  1040. const img2 = res2.path;
  1041. // 绘制海报背景图
  1042. ctx.drawImage(img1, 0, 0, 574, 1042);
  1043. // 绘制海报二维码
  1044. ctx.drawImage(img2, 428, 888, 114, 114);
  1045. // 绘制完成后导出图片并显示
  1046. ctx.draw(false, () => {
  1047. uni.canvasToTempFilePath({
  1048. canvasId: 'canvas',
  1049. success: res3 => {
  1050. this.posterSrc = res3.tempFilePath;
  1051. this.posterSrcType = 'local';
  1052. },
  1053. fail: err => {
  1054. console.error(err);
  1055. },
  1056. }, this);
  1057. });
  1058. },
  1059. fail: err2 => {
  1060. console.error(err2);
  1061. },
  1062. });
  1063. },
  1064. fail: err1 => {
  1065. console.error(err1);
  1066. },
  1067. complete: () => {
  1068. uni.hideLoading()
  1069. }
  1070. });
  1071. // 前端生成海报结束
  1072. },
  1073. saveImage() {
  1074. let that = this;
  1075. uni.showLoading({
  1076. title: '保存中'
  1077. });
  1078. if(this.posterSrcType == 'local'){
  1079. let params = {
  1080. tempFilePath:that.posterSrc
  1081. }
  1082. that.saveImageToPhotosAlbum(params);
  1083. return
  1084. }
  1085. uni.downloadFile({
  1086. url: this.posterSrc,
  1087. success(res) {
  1088. if (res.statusCode === 200) {
  1089. that.saveImageToPhotosAlbum(res)
  1090. } else {
  1091. uni.showToast({
  1092. title: '下载图片失败',
  1093. icon: 'none'
  1094. });
  1095. }
  1096. },
  1097. fail(e) {
  1098. console.log('下载图片失败', e);
  1099. console.log('posterSrc',that.posterSrc);
  1100. uni.showToast({
  1101. title: '下载图片失败',
  1102. icon: 'none'
  1103. });
  1104. }
  1105. });
  1106. },
  1107. saveImageToPhotosAlbum(res){
  1108. let that = this;
  1109. uni.saveImageToPhotosAlbum({
  1110. filePath: res.tempFilePath,
  1111. success() {
  1112. uni.showToast({
  1113. title: '保存相册成功!',
  1114. icon: 'success'
  1115. });
  1116. },
  1117. fail(err) {
  1118. console.log('保存图片失败',err);
  1119. if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
  1120. uni.getSetting({
  1121. success(res) {
  1122. if (!res.authSetting['scope.writePhotosAlbum']) {
  1123. uni.showModal({
  1124. title: '提示',
  1125. content: '您还没有授权访问相册,请前往设置页面打开权限。',
  1126. confirmText: '去设置',
  1127. success(res) {
  1128. if (res.confirm) {
  1129. uni.openSetting();
  1130. }
  1131. }
  1132. });
  1133. } else {
  1134. uni.showToast({
  1135. title: '保存图片失败',
  1136. icon: 'none'
  1137. });
  1138. }
  1139. }
  1140. });
  1141. } else {
  1142. uni.showToast({
  1143. title: '保存图片失败',
  1144. icon: 'none'
  1145. });
  1146. }
  1147. },
  1148. complete() {
  1149. setTimeout(()=>{
  1150. uni.hideLoading();
  1151. that.posterShow = false;
  1152. },1500)
  1153. }
  1154. });
  1155. },
  1156. // 海报相关结束
  1157. goMap(){
  1158. uni.openLocation({
  1159. latitude:Number(this.theatre.latitude), //维度
  1160. longitude: Number(this.theatre.longitude), //经度
  1161. name: this.theatre.name, //目的地定位名称
  1162. scale: 15, //缩放比例
  1163. address: this.theatre.address //导航详细地址
  1164. })
  1165. },
  1166. phoneCall(){
  1167. // console.log('this.theatre',this.theatre);
  1168. uni.makePhoneCall({
  1169. phoneNumber: this.theatre.customerServiceMobile,
  1170. success() {
  1171. console.log('success');
  1172. },
  1173. fail() {
  1174. console.log('fail');
  1175. }
  1176. });
  1177. },
  1178. showSeatImg(){
  1179. if(!this.positionData.seatImg){
  1180. uni.$u.toast('没有图片')
  1181. return
  1182. }
  1183. let urls = [];
  1184. urls.push(this.positionData.seatImg)
  1185. uni.previewImage({
  1186. urls: urls,
  1187. })
  1188. },
  1189. previewBanner(index){
  1190. let urls = this.performInfo.photoList.map(item=>{
  1191. return item.imageUrl
  1192. });
  1193. // console.log('urls',urls);
  1194. uni.previewImage({
  1195. urls: urls,
  1196. current:index
  1197. })
  1198. }
  1199. },
  1200. computed: {
  1201. // 是否已选择票
  1202. hasSelectedTicket() {
  1203. return this.positionArr.some(item => item.saleNum > 0);
  1204. },
  1205. // 总价
  1206. totalPrice() {
  1207. return this.positionArr.reduce((total, item) => {
  1208. return total + (item.saleNum * item.salePrice);
  1209. }, 0).toFixed(2);
  1210. },
  1211. // 原价
  1212. originalPrice() {
  1213. return this.positionArr.reduce((total, item) => {
  1214. // 如果有原价就用原价,没有就用售价
  1215. const price = item.originalPrice || item.salePrice;
  1216. return total + (item.saleNum * price);
  1217. }, 0).toFixed(2);
  1218. }
  1219. }
  1220. }
  1221. </script>
  1222. <style lang="scss" scoped>
  1223. .banner{
  1224. position: relative;
  1225. .img{
  1226. width: 750rpx;
  1227. height: 554rpx;
  1228. display: block;
  1229. }
  1230. .content{
  1231. position: absolute;
  1232. // width: 100%;
  1233. box-sizing: border-box;
  1234. padding: 0 32rpx;
  1235. right: 0;
  1236. bottom: 200rpx;
  1237. }
  1238. .share{
  1239. overflow: hidden;
  1240. margin-bottom: 100rpx;
  1241. float: right;
  1242. .icon{
  1243. float: right;
  1244. display: block;
  1245. width: 32rpx;
  1246. height: 32rpx;
  1247. padding: 10rpx;
  1248. border-radius: 50%;
  1249. background-color: rgba(0,0,0,0.4);
  1250. }
  1251. }
  1252. }
  1253. .base-info{
  1254. position: relative;
  1255. // margin-bottom: 54rpx;
  1256. .inner{
  1257. position: relative;
  1258. padding: 50rpx 38rpx 58rpx 40rpx;
  1259. background-color: #FFFFFF;
  1260. border-radius: 32rpx 32rpx 0rpx 0rpx;
  1261. margin-top: -30px;
  1262. border-bottom: 12rpx solid #F7F8F9;
  1263. }
  1264. .name{
  1265. font-size: 40rpx;
  1266. font-weight: 800;
  1267. color: #2D2D2D;
  1268. margin-bottom: 26rpx;
  1269. }
  1270. .addr{
  1271. font-size: 26rpx;
  1272. font-weight: 400;
  1273. color: #606060;
  1274. }
  1275. .menu{
  1276. .item{
  1277. margin-left: 18rpx;
  1278. font-size: 18rpx;
  1279. font-weight: 400;
  1280. color: #999999;
  1281. text-align: center;
  1282. }
  1283. .icon{
  1284. width: 62rpx;
  1285. height: 64rpx;
  1286. display: block;
  1287. margin-bottom: 4rpx;
  1288. }
  1289. }
  1290. }
  1291. .tabs-wrap{
  1292. position: relative;
  1293. margin-bottom: 54rpx;
  1294. &::after{
  1295. content: '';
  1296. width: 100%;
  1297. height: 1px;
  1298. background-color: #eee;
  1299. position: absolute;
  1300. left: 0;
  1301. right: 0;
  1302. bottom: -46rpx;
  1303. }
  1304. .inner{
  1305. position: relative;
  1306. padding-top: 48rpx;
  1307. background-color: #FFFFFF;
  1308. // border-radius: 32rpx 32rpx 0rpx 0rpx;
  1309. height: 46rpx;
  1310. // margin-top: -30px;
  1311. }
  1312. }
  1313. .date-block{
  1314. margin-bottom: 64rpx;
  1315. }
  1316. .title{
  1317. font-size: 32rpx;
  1318. font-weight: bold;
  1319. color: #2D2D2D;
  1320. line-height: 48rpx;
  1321. margin-bottom: 38rpx;
  1322. }
  1323. .empty{
  1324. background-color: #636363;
  1325. color: #979797;
  1326. border-radius: 8rpx;
  1327. padding: 24rpx;
  1328. text-align: center;
  1329. }
  1330. .session-wrap{
  1331. }
  1332. .session{
  1333. display: grid;
  1334. grid-template-columns: repeat(3, 1fr);
  1335. gap: 20rpx;
  1336. .session-item{
  1337. height: 80rpx;
  1338. line-height: 80rpx;
  1339. border-radius: 12rpx;
  1340. border: 2rpx solid #636363;
  1341. text-align: center;
  1342. font-size: 24rpx;
  1343. font-weight: 400;
  1344. color: #636363;
  1345. &.active{
  1346. color: #ED0000;
  1347. border-color: #ED0000;
  1348. }
  1349. }
  1350. }
  1351. .ticket-type{
  1352. .type-item{
  1353. background: #FFFFFF;
  1354. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(180,180,180,0.5);
  1355. border-radius: 20rpx;
  1356. margin-bottom: 20rpx;
  1357. padding: 38rpx 40rpx;
  1358. .name-price{
  1359. margin-bottom: 26rpx;
  1360. }
  1361. .name{
  1362. font-size: 28rpx;
  1363. font-weight: 500;
  1364. color: #363636;
  1365. }
  1366. .prices{
  1367. font-size: 36rpx;
  1368. font-weight: bold;
  1369. color: #ED0000;
  1370. }
  1371. .ishave{
  1372. margin-bottom: 26rpx;
  1373. .text{
  1374. height: 30rpx;
  1375. line-height: 30rpx;
  1376. padding: 0 22rpx;
  1377. background: #FFC8C8;
  1378. border-radius: 20rpx;
  1379. font-size: 20rpx;
  1380. font-weight: 400;
  1381. color: #ED0000;
  1382. }
  1383. }
  1384. .bottom{
  1385. font-size: 22rpx;
  1386. font-weight: 400;
  1387. color: #7F7F7F;
  1388. .btn{
  1389. height: 60rpx;
  1390. line-height: 60rpx;
  1391. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  1392. border-radius: 30rpx;
  1393. padding: 0 36rpx;
  1394. font-size: 28rpx;
  1395. font-weight: 500;
  1396. color: #FFFFFF;
  1397. &.disabled{
  1398. background: #979797;
  1399. }
  1400. }
  1401. }
  1402. }
  1403. .goodsSnapshot{
  1404. font-size: 24rpx;
  1405. color: #750000;
  1406. line-height: 1.5;
  1407. margin-top: 24rpx;
  1408. padding-bottom: 24rpx;
  1409. // border-bottom: 1px solid #750000;
  1410. }
  1411. }
  1412. .details{
  1413. .title{}
  1414. .details-block{
  1415. background: #FFFFFF;
  1416. box-shadow: 0rpx 2rpx 12rpx 2rpx rgba(221,221,221,0.5);
  1417. border-radius: 20rpx;
  1418. margin-bottom: 24rpx;
  1419. padding: 36rpx;
  1420. &.actors{
  1421. .title{
  1422. .right{
  1423. font-size: 24rpx;
  1424. font-weight: 400;
  1425. color: #7F7F7F;
  1426. }
  1427. }
  1428. }
  1429. }
  1430. .intro{
  1431. font-size: 26rpx;
  1432. font-weight: 400;
  1433. color: #4E4E4E;
  1434. line-height: 40rpx;
  1435. }
  1436. .actor-list{
  1437. .item{
  1438. flex-shrink: 0;
  1439. width: 160rpx;
  1440. text-align: center;
  1441. margin-right: 24rpx;
  1442. }
  1443. .img{
  1444. display: block;
  1445. width: 100%;
  1446. height: 200rpx;
  1447. margin-bottom: 16rpx;
  1448. }
  1449. .name{
  1450. font-size: 28rpx;
  1451. font-weight: 500;
  1452. color: #2D2D2D;
  1453. line-height: 42rpx;
  1454. margin-bottom: 4rpx;
  1455. }
  1456. .role{
  1457. font-size: 24rpx;
  1458. font-weight: 400;
  1459. color: #7F7F7F;
  1460. line-height: 36rpx;
  1461. }
  1462. }
  1463. }
  1464. .canvas{
  1465. position: fixed;
  1466. left: -99999px;
  1467. }
  1468. .ticket-type-list{
  1469. .ticket-type-item{
  1470. border-radius: 10rpx;
  1471. border:1px solid #7F7F7F;
  1472. padding: 20rpx;
  1473. margin-bottom: 24rpx;
  1474. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(211,211,211,0.5);
  1475. }
  1476. .type-info{
  1477. margin-bottom: 40rpx;
  1478. .type-name{
  1479. font-size: 28rpx;
  1480. }
  1481. .salePrice-price{
  1482. color: #ED0000;
  1483. }
  1484. .original-price{
  1485. color: #7F7F7F;
  1486. text-decoration: line-through;
  1487. margin-left: 10rpx;
  1488. }
  1489. }
  1490. .type-desc{
  1491. color: #7F7F7F;
  1492. font-size: 26rpx;
  1493. }
  1494. .ticket-control {
  1495. display: flex;
  1496. align-items: center;
  1497. .minus, .plus {
  1498. width: 50rpx;
  1499. height: 50rpx;
  1500. line-height: 46rpx;
  1501. text-align: center;
  1502. border: 1px solid #ddd;
  1503. border-radius: 50%;
  1504. &.disabled {
  1505. color: #ccc;
  1506. background: #f5f5f5;
  1507. }
  1508. }
  1509. .num {
  1510. min-width: 60rpx;
  1511. text-align: center;
  1512. margin: 0 20rpx;
  1513. }
  1514. }
  1515. }
  1516. /* 底部浮动条样式 */
  1517. .bottom-bar {
  1518. height: 100rpx;
  1519. .inner{
  1520. position: fixed;
  1521. left: 0;
  1522. right: 0;
  1523. bottom: 0;
  1524. height: 100rpx;
  1525. background: #fff;
  1526. display: flex;
  1527. align-items: center;
  1528. padding: 0 30rpx;
  1529. box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.05);
  1530. z-index: 100;
  1531. }
  1532. .price-info {
  1533. flex: 1;
  1534. .total-price {
  1535. font-size: 36rpx;
  1536. color: #f00;
  1537. font-weight: bold;
  1538. .original {
  1539. font-size: 24rpx;
  1540. color: #999;
  1541. text-decoration: line-through;
  1542. margin-left: 10rpx;
  1543. font-weight: normal;
  1544. }
  1545. }
  1546. }
  1547. .submit-btn {
  1548. // width: 200rpx;
  1549. padding: 0 24rpx;
  1550. height: 80rpx;
  1551. line-height: 80rpx;
  1552. text-align: center;
  1553. background: #eee;
  1554. color: #999;
  1555. border-radius: 40rpx;
  1556. &.active {
  1557. background: #f00;
  1558. color: #fff;
  1559. }
  1560. }
  1561. }
  1562. </style>