ticketlist.vue 47 KB

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