movieDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. <template>
  2. <view class="movieDetail">
  3. <view class="info-box">
  4. <view class="info">
  5. <image class="icon":src="info.img" mode=""></image>
  6. <view class="box">
  7. <view class="name">
  8. {{info.nm}}
  9. </view>
  10. <view class="score-box">
  11. <view class="score">
  12. 评分 <view class="num">
  13. {{info.sc}}
  14. </view>
  15. </view>
  16. <view class="want-num">
  17. {{info.wish | filterNum}}人想看
  18. </view>
  19. </view>
  20. <view class="type-box">
  21. {{info.cat}}
  22. <view class="tag">
  23. {{info.ver}}
  24. </view>
  25. </view>
  26. <view class="publish-info">
  27. {{info.pubDesc}} {{info.dur}}分钟
  28. </view>
  29. </view>
  30. </view>
  31. <view class="title-box">
  32. <view class="title">
  33. 简介
  34. </view>
  35. <!-- <view class="open">
  36. 展开
  37. <image class="icon" src="@/static/shop-desc.png" mode=""></image>
  38. </view> -->
  39. </view>
  40. <view class="desc">
  41. {{info.desc}}
  42. </view>
  43. </view>
  44. <view class="actor-box" v-if="info.workerList.length">
  45. <view class="title-box1">
  46. <view class="title">
  47. 演员列表
  48. </view>
  49. <view class="total">
  50. 全部{{info.workerList.length}}
  51. <image class="icon" src="@/static/right.png" mode=""></image>
  52. </view>
  53. </view>
  54. <scroll-view class="actor-list" scroll-x="true">
  55. <view class="item" v-for="item in info.workerList" :key="item.id">
  56. <zs-img class="icon" :src="item.avatarUrl" radius="full" width="120rpx" height="150rpx" mode="widthFix" ></zs-img>
  57. <view class="name">
  58. {{item.characterName}}
  59. </view>
  60. <view class="sub-desc">
  61. {{item.actorName}}
  62. </view>
  63. </view>
  64. </scroll-view>
  65. </view>
  66. <view class="btn-box">
  67. <button class="buy-btn" type="default" @click="buy">特惠购票</button>
  68. </view>
  69. <u-popup :show="show" round="32rpx" mode="bottom" @close="close" @open="openPop">
  70. <view class="content">
  71. <!-- 拍片时间 -->
  72. <scroll-view v-if="showMovie||optionsCinemaId" class="tabList" scroll-x="true" scroll-with-animation :scroll-into-view="tab">
  73. <view id="demo1" class="tab" :class="[chooseDay == item?'active':'']" v-for="(item,index) in dayList1" :key="index" @click="handleTab1(item)"> {{ item | filterDay}} {{ new Date(item).getTime() | date('mm-dd')}}</view>
  74. </scroll-view>
  75. <!-- 影院时间 -->
  76. <scroll-view v-else class="tabList" scroll-x="true" scroll-with-animation :scroll-into-view="tab">
  77. <view id="demo1" class="tab" :class="[query.day == item?'active':'']" v-for="(item,index) in dayList" :key="index" @click="handleTab(item)"> {{ item | filterDay}} {{ new Date(item).getTime() | date('mm-dd')}}</view>
  78. </scroll-view>
  79. <!-- <zs-choose-tab position="relative" :showModal="false" @choose="chooseTab"></zs-choose-tab> -->
  80. <view class="list">
  81. <view v-if="showMovie||optionsCinemaId">
  82. <u-empty v-if="!list.length" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  83. <view class="movie-item" v-for="(item,index) in list" :key="index">
  84. <view class="info">
  85. <view class="time-box">
  86. <view class="start-time">
  87. {{ $u.timeFormat(new Date(item.showTime).getTime(), 'hh:MM')}}
  88. </view>
  89. <view class="end-time">
  90. {{ $u.timeFormat(new Date(item.endTime).getTime(), 'hh:MM')}}散场
  91. </view>
  92. </view>
  93. <view class="type-box">
  94. <view class="type">
  95. {{item.version}}
  96. </view>
  97. <view class="room">
  98. {{item.hall}}
  99. </view>
  100. </view>
  101. </view>
  102. <view class="price-box">
  103. <view class="price">
  104. ¥{{item.sellPrice}}
  105. </view>
  106. <view class="btn" @click="goChooseSeat(item.sessionId)">
  107. 购票
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view v-else >
  113. <u-empty v-if="!cinemasList.length" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  114. <view class="cinema-item" v-for="(item,index) in cinemasList" :key="index" @click="handleItem(item.cinemaId)">
  115. <view class="name-box">
  116. <view class="name">
  117. {{item.name}}
  118. </view>
  119. <view class="price">
  120. ¥{{item.sellPrice}} <view class="label">起</view>
  121. </view>
  122. </view>
  123. <view class="address-box">
  124. <view class="address">
  125. {{item.address}}
  126. </view>
  127. <view class="distance">
  128. {{item.dis}}
  129. </view>
  130. </view>
  131. <view class="movie-name">
  132. 近期场次:{{item.showInfo}}
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. </u-popup>
  139. </view>
  140. </template>
  141. <script>
  142. import {movieDetail,movie_cinemas,cinema_shows} from '@/api/movie.js'
  143. export default {
  144. data() {
  145. return {
  146. show: false,
  147. showMovie: false,
  148. info:{},
  149. query:{
  150. cityId:uni.getStorageSync('movieCityId'),
  151. day:'',
  152. lat:0,
  153. lng:0,
  154. movieId:0,
  155. },
  156. chooseDay:'',//电影的日期
  157. cinemaId:0,//选中影院id
  158. dayList:[],//影院时间列表
  159. dayList1:[],//电影拍片时间列表
  160. movieList:[],
  161. cinemasList:[],
  162. optionsCinemaId:0,//电影院跳转携带id
  163. }
  164. },
  165. filters: {
  166. filterNum: function(value) {
  167. if(value>10000){
  168. return (value/10000).toFixed(1)+'万';
  169. }else{
  170. return value;
  171. }
  172. },
  173. filterDay(val){
  174. if(val == uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')){
  175. return '今天'
  176. }else if(val == uni.$u.timeFormat(new Date().getTime()+1000*60*60*24, 'yyyy-mm-dd')){
  177. return '明天'
  178. }else if(val == uni.$u.timeFormat(new Date().getTime()+1000*60*60*24*2, 'yyyy-mm-dd')){
  179. return '后天'
  180. }else{
  181. let arr = ['日','一','二','三','四','五','六']
  182. let num = new Date(val).getDay()
  183. return `周${arr[num]}`
  184. }
  185. }
  186. },
  187. computed: {
  188. list() {
  189. let data = []
  190. this.movieList.map(item=>{
  191. if(item.showDate == this.chooseDay){
  192. data = item.sessions
  193. }
  194. })
  195. console.log(1111,data);
  196. return data
  197. }
  198. },
  199. methods: {
  200. openPop(){
  201. },
  202. close(){
  203. this.show = false
  204. this.showMovie = false
  205. },
  206. buy() {
  207. this.show = true
  208. this.movie_cinemas()
  209. },
  210. goChooseSeat(sessionId){
  211. console.log(sessionId);
  212. uni.navigateTo({
  213. url:`./chooseSeat?movieId=${this.query.movieId}&cinemaId=${this.cinemaId}&sessionId=${sessionId}`
  214. })
  215. },
  216. handleItem(id){
  217. this.showMovie = true
  218. this.cinemaId = id
  219. this.cinema_shows(id)
  220. // uni.navigateTo({
  221. // url:'./chooseSeat'
  222. // })
  223. },
  224. handleTab(val){
  225. this.query.day = val
  226. this.showMovie = false
  227. this.movie_cinemas()
  228. },
  229. // 选择电影日期
  230. handleTab1(val){
  231. this.chooseDay = val
  232. },
  233. chooseTab(val){
  234. },
  235. movieDetail(movieId){
  236. movieDetail({movieId}).then(res=>{
  237. if(res.state == 'Success'){
  238. this.info = res.content.data
  239. if(this.optionsCinemaId){
  240. this.show = true
  241. this.handleItem(this.optionsCinemaId)
  242. }
  243. }
  244. })
  245. },
  246. // 获取某个电影的电影院列表
  247. movie_cinemas(){
  248. movie_cinemas(this.query).then(res=>{
  249. if(res.state == 'Success'){
  250. if(!(res.content.data.showDates.includes(this.query.day))&&res.content.data.showDates.length){
  251. this.query.day = res.content.data.showDates[0]
  252. this.movie_cinemas()
  253. }
  254. this.dayList = res.content.data.showDates
  255. this.cinemasList = res.content.data.cinemas
  256. }
  257. })
  258. },
  259. // 获取电影院某个电影的列表
  260. cinema_shows(cinemaId){
  261. cinema_shows({movieId:this.query.movieId,cinemaId}).then(res=>{
  262. if(res.state == 'Success'){
  263. let data = JSON.parse(JSON.stringify(res.content.data))
  264. let movieList = data.movieShows.filter(item=>item.shows.length)
  265. this.chooseDay = movieList[0].shows[0].showDate
  266. // this.movieList = movieList[0].shows.filter(item=>item.showDate == this.query.day)[0].sessions
  267. this.movieList = movieList[0].shows
  268. this.dayList1 = movieList[0].shows.map(item=>item.showDate)
  269. }
  270. })
  271. },
  272. },
  273. onLoad(options) {
  274. this.query.movieId = options.id
  275. this.optionsCinemaId = options.cinemaId
  276. this.movieDetail(options.id)
  277. let location = JSON.parse(uni.getStorageSync('location'))
  278. this.query.lat = location.latitude
  279. this.query.lng = location.longitude
  280. this.query.day =uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')
  281. this.tab =uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. .movieDetail{
  287. background: #F9F9F9;
  288. padding: 20rpx 24rpx ;
  289. min-height: 100vh;
  290. .info-box{
  291. padding: 24rpx;
  292. background: #FFFFFF;
  293. border-radius: 16rpx 16rpx 16rpx 16rpx;
  294. .info{
  295. display: flex;
  296. .icon{
  297. width: 160rpx;
  298. height: 200rpx;
  299. background: #aaa;
  300. border-radius: 16rpx;
  301. }
  302. .box{
  303. display: flex;
  304. flex-direction: column;
  305. justify-content: space-between;
  306. margin-left: 20rpx;
  307. .name{
  308. font-weight: 600;
  309. font-size: 28rpx;
  310. color: #222222;
  311. width: 400rpx;
  312. white-space: nowrap;
  313. overflow: hidden;
  314. text-overflow: ellipsis;
  315. }
  316. .score-box{
  317. display: flex;
  318. font-size: 24rpx;
  319. color: #AAAAAA;
  320. .score{
  321. display: flex;
  322. align-items: center;
  323. .num{
  324. font-size: 28rpx;
  325. color: $uni-color-primary;
  326. padding: 0 12rpx;
  327. }
  328. }
  329. .want-num{
  330. padding: 0 12rpx;
  331. border-left: 2rpx solid #F0F0F0;
  332. align-self: flex-end;
  333. // font-size: 24rpx;
  334. // color: #AAAAAA;
  335. }
  336. }
  337. .type-box{
  338. display: flex;
  339. align-items: center;
  340. font-size: 24rpx;
  341. color: #AAAAAA;
  342. .tag{
  343. padding: 6rpx 10rpx;
  344. background: #F0F0F0;
  345. border-radius: 8rpx 8rpx 8rpx 8rpx;
  346. font-size: 24rpx;
  347. color: #AAAAAA;
  348. margin-left: 10rpx;
  349. }
  350. }
  351. .publish-info{
  352. font-size: 24rpx;
  353. color: #AAAAAA;
  354. }
  355. }
  356. }
  357. .title-box{
  358. display: flex;
  359. justify-content: space-between;
  360. margin-top: 28rpx;
  361. .title{
  362. font-weight: 600;
  363. font-size: 28rpx;
  364. color: #222222;
  365. }
  366. .open{
  367. display: flex;
  368. align-items: center;
  369. font-size: 24rpx;
  370. color: #AAAAAA;
  371. .icon{
  372. width: 24rpx;
  373. height: 24rpx;
  374. }
  375. }
  376. }
  377. .desc{
  378. font-size: 24rpx;
  379. color: #222222;
  380. font-weight: 300;
  381. margin-top: 20rpx;
  382. line-height: 40rpx;
  383. }
  384. }
  385. .actor-box{
  386. padding: 28rpx 24rpx;
  387. background: #FFFFFF;
  388. margin-top: 20rpx;
  389. border-radius: 16rpx;
  390. .title-box1{
  391. display: flex;
  392. align-items: center;
  393. justify-content: space-between;
  394. .title{
  395. font-weight: 600;
  396. font-size: 28rpx;
  397. color: #222222;
  398. }
  399. .total{
  400. font-weight: 300;
  401. font-size: 24rpx;
  402. display: flex;
  403. align-items: center;
  404. margin-right: -20rpx;
  405. .icon{
  406. width: 48rpx;
  407. height: 48rpx;
  408. }
  409. }
  410. }
  411. .actor-list {
  412. white-space: nowrap;
  413. width: 100%;
  414. padding-top: 20rpx;
  415. .item {
  416. display: inline-block;
  417. width: 120rpx;
  418. margin-right: 20rpx;
  419. text-align: center;
  420. .icon{
  421. width: 120rpx;
  422. height: 150rpx;
  423. border-radius: 16rpx;
  424. }
  425. .name{
  426. font-weight: 400;
  427. font-size: 24rpx;
  428. color: #222222;
  429. margin-top: 15rpx;
  430. }
  431. .sub-desc{
  432. font-weight: 300;
  433. font-size: 20rpx;
  434. color: #AAAAAA;
  435. margin-top: 12rpx;
  436. }
  437. }
  438. }
  439. }
  440. .btn-box{
  441. position: fixed;
  442. left: 0%;
  443. bottom: 0%;
  444. width: 100%;
  445. padding: 10rpx 24rpx 76rpx;
  446. box-sizing: border-box;
  447. background: #FFFFFF;
  448. border-top: 1rpx solid #EEEEEE;
  449. .buy-btn{
  450. width: 702rpx;
  451. height: 80rpx;
  452. line-height: 80rpx;
  453. background: #EE4320;
  454. border-radius: 46rpx 46rpx 46rpx 46rpx;
  455. font-weight: 600;
  456. font-size: 28rpx;
  457. color: #FFFFFF;
  458. padding: 0;
  459. margin: 0;
  460. }
  461. }
  462. .content{
  463. padding: 24rpx;
  464. .tabList {
  465. white-space: nowrap;
  466. width: 100%;
  467. .tab {
  468. display: inline-block;
  469. padding: 0 12rpx 20rpx;
  470. font-weight: 400;
  471. font-size: 28rpx;
  472. color: #222222;
  473. }
  474. .tab.active{
  475. position: relative;
  476. &::after{
  477. content: '';
  478. position: absolute;
  479. bottom: 0%;
  480. left: 50%;
  481. transform: translateX(-50%);
  482. width: 60rpx;
  483. height: 8rpx;
  484. background: #EE4320;
  485. border-radius: 4rpx 4rpx 4rpx 4rpx;
  486. }
  487. }
  488. }
  489. .list{
  490. max-height: 900rpx;
  491. overflow: auto;
  492. .cinema-item{
  493. background: #FFFFFF;
  494. border-radius: 16rpx 16rpx 16rpx 16rpx;
  495. padding: 28rpx 0;
  496. border-top: 1rpx solid #F0F0F0;
  497. .name-box{
  498. display: flex;
  499. justify-content: space-between;
  500. .name{
  501. font-weight: 600;
  502. font-size: 28rpx;
  503. color: #222222;
  504. width: 450rpx;
  505. white-space: nowrap;
  506. overflow: hidden;
  507. text-overflow: ellipsis;
  508. }
  509. .price{
  510. display: flex;
  511. align-items: center;
  512. font-size: 28rpx;
  513. color: $uni-color-primary;
  514. .label{
  515. font-size: 24rpx;
  516. color: #AAAAAA;
  517. margin-left: 6rpx;
  518. }
  519. }
  520. }
  521. .address-box{
  522. display: flex;
  523. justify-content: space-between;
  524. font-size: 24rpx;
  525. color: #AAAAAA;
  526. margin-top: 16rpx;
  527. .address{
  528. width: 460rpx;
  529. white-space: nowrap;
  530. overflow: hidden;
  531. text-overflow: ellipsis;
  532. }
  533. .distance{
  534. }
  535. }
  536. .movie-name{
  537. font-size: 24rpx;
  538. color: #222222;
  539. margin-top: 16rpx;
  540. width: 100%;
  541. white-space: nowrap;
  542. overflow: hidden;
  543. text-overflow: ellipsis;
  544. }
  545. }
  546. .movie-item{
  547. display: flex;
  548. align-items: center;
  549. justify-content: space-between;
  550. padding: 34rpx 0;
  551. border-bottom: 1rpx solid #F0F0F0;
  552. .info{
  553. display: flex;
  554. .time-box{
  555. display: flex;
  556. flex-direction: column;
  557. justify-content: space-between;
  558. .start-time{
  559. font-weight: 600;
  560. font-size: 36rpx;
  561. color: #222222;
  562. }
  563. .end-time{
  564. font-size: 24rpx;
  565. color: #AAAAAA;
  566. margin-top: 20rpx;
  567. }
  568. }
  569. .type-box{
  570. display: flex;
  571. flex-direction: column;
  572. justify-content: space-between;
  573. margin-left: 80rpx;
  574. .type{
  575. font-size: 28rpx;
  576. color: #222222;
  577. }
  578. .room{
  579. font-size: 24rpx;
  580. color: #AAAAAA;
  581. }
  582. }
  583. }
  584. .price-box{
  585. display: flex;
  586. align-items: center;
  587. .price{
  588. font-size: 36rpx;
  589. color: #FF4D3A;
  590. }
  591. .btn{
  592. width: 120rpx;
  593. height: 52rpx;
  594. line-height: 52rpx;
  595. text-align: center;
  596. background: rgba(238,67,32,0.1);
  597. border-radius: 26rpx;
  598. margin-left: 20rpx;
  599. font-size: 28rpx;
  600. color: #EE4320;
  601. }
  602. }
  603. }
  604. }
  605. }
  606. }
  607. </style>