movieDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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. if(uni.getStorageSync('token')){
  212. if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0&&JSON.parse(uni.getStorageSync('userInfo')).setMealCode){
  213. uni.navigateTo({
  214. url:`./chooseSeat?movieId=${this.query.movieId}&cinemaId=${this.cinemaId}&sessionId=${sessionId}`
  215. })
  216. }else{
  217. uni.showModal({
  218. title:'此商品需要开通会员才能购买',
  219. cancelText:'下次再说',
  220. confirmText:'立即开通',
  221. success(res) {
  222. if(res.confirm){
  223. uni.navigateTo({
  224. url:'/my/memberCenter/index'
  225. })
  226. }
  227. }
  228. })
  229. }
  230. }else{
  231. return uni.showModal({
  232. title:'请登录',
  233. confirmText:'去登录',
  234. success(res){
  235. if(res.confirm){
  236. uni.navigateTo({
  237. url:'/login/login/login?redirect=/special/water'
  238. })
  239. }
  240. }
  241. })
  242. }
  243. },
  244. handleItem(id){
  245. this.showMovie = true
  246. this.cinemaId = id
  247. this.cinema_shows(id)
  248. // uni.navigateTo({
  249. // url:'./chooseSeat'
  250. // })
  251. },
  252. handleTab(val){
  253. this.query.day = val
  254. this.showMovie = false
  255. this.movie_cinemas()
  256. },
  257. // 选择电影日期
  258. handleTab1(val){
  259. this.chooseDay = val
  260. },
  261. chooseTab(val){
  262. },
  263. movieDetail(movieId){
  264. movieDetail({movieId}).then(res=>{
  265. if(res.state == 'Success'){
  266. this.info = res.content.data
  267. if(this.optionsCinemaId){
  268. this.show = true
  269. this.handleItem(this.optionsCinemaId)
  270. }
  271. }
  272. })
  273. },
  274. // 获取某个电影的电影院列表
  275. movie_cinemas(){
  276. movie_cinemas(this.query).then(res=>{
  277. if(res.state == 'Success'){
  278. if(!(res.content.data.showDates.includes(this.query.day))&&res.content.data.showDates.length){
  279. this.query.day = res.content.data.showDates[0]
  280. this.movie_cinemas()
  281. }
  282. this.dayList = res.content.data.showDates
  283. this.cinemasList = res.content.data.cinemas
  284. }
  285. })
  286. },
  287. // 获取电影院某个电影的列表
  288. cinema_shows(cinemaId){
  289. cinema_shows({movieId:this.query.movieId,cinemaId}).then(res=>{
  290. if(res.state == 'Success'){
  291. let data = JSON.parse(JSON.stringify(res.content.data))
  292. let movieList = data.movieShows.filter(item=>item.shows.length)
  293. this.chooseDay = movieList[0].shows[0].showDate
  294. // this.movieList = movieList[0].shows.filter(item=>item.showDate == this.query.day)[0].sessions
  295. this.movieList = movieList[0].shows
  296. this.dayList1 = movieList[0].shows.map(item=>item.showDate)
  297. }
  298. })
  299. },
  300. },
  301. onLoad(options) {
  302. this.query.movieId = options.id
  303. this.optionsCinemaId = options.cinemaId
  304. this.movieDetail(options.id)
  305. let location = JSON.parse(uni.getStorageSync('location'))
  306. this.query.lat = location.latitude
  307. this.query.lng = location.longitude
  308. this.query.day =uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')
  309. this.tab =uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .movieDetail{
  315. background: #F9F9F9;
  316. padding: 20rpx 24rpx ;
  317. min-height: 100vh;
  318. .info-box{
  319. padding: 24rpx;
  320. background: #FFFFFF;
  321. border-radius: 16rpx 16rpx 16rpx 16rpx;
  322. .info{
  323. display: flex;
  324. .icon{
  325. width: 160rpx;
  326. height: 200rpx;
  327. background: #aaa;
  328. border-radius: 16rpx;
  329. }
  330. .box{
  331. display: flex;
  332. flex-direction: column;
  333. justify-content: space-between;
  334. margin-left: 20rpx;
  335. .name{
  336. font-weight: 600;
  337. font-size: 28rpx;
  338. color: #222222;
  339. width: 400rpx;
  340. white-space: nowrap;
  341. overflow: hidden;
  342. text-overflow: ellipsis;
  343. }
  344. .score-box{
  345. display: flex;
  346. font-size: 24rpx;
  347. color: #AAAAAA;
  348. .score{
  349. display: flex;
  350. align-items: center;
  351. .num{
  352. font-size: 28rpx;
  353. color: $uni-color-primary;
  354. padding: 0 12rpx;
  355. }
  356. }
  357. .want-num{
  358. padding: 0 12rpx;
  359. border-left: 2rpx solid #F0F0F0;
  360. align-self: flex-end;
  361. // font-size: 24rpx;
  362. // color: #AAAAAA;
  363. }
  364. }
  365. .type-box{
  366. display: flex;
  367. align-items: center;
  368. font-size: 24rpx;
  369. color: #AAAAAA;
  370. .tag{
  371. padding: 6rpx 10rpx;
  372. background: #F0F0F0;
  373. border-radius: 8rpx 8rpx 8rpx 8rpx;
  374. font-size: 24rpx;
  375. color: #AAAAAA;
  376. margin-left: 10rpx;
  377. }
  378. }
  379. .publish-info{
  380. font-size: 24rpx;
  381. color: #AAAAAA;
  382. }
  383. }
  384. }
  385. .title-box{
  386. display: flex;
  387. justify-content: space-between;
  388. margin-top: 28rpx;
  389. .title{
  390. font-weight: 600;
  391. font-size: 28rpx;
  392. color: #222222;
  393. }
  394. .open{
  395. display: flex;
  396. align-items: center;
  397. font-size: 24rpx;
  398. color: #AAAAAA;
  399. .icon{
  400. width: 24rpx;
  401. height: 24rpx;
  402. }
  403. }
  404. }
  405. .desc{
  406. font-size: 24rpx;
  407. color: #222222;
  408. font-weight: 300;
  409. margin-top: 20rpx;
  410. line-height: 40rpx;
  411. }
  412. }
  413. .actor-box{
  414. padding: 28rpx 24rpx;
  415. background: #FFFFFF;
  416. margin-top: 20rpx;
  417. border-radius: 16rpx;
  418. .title-box1{
  419. display: flex;
  420. align-items: center;
  421. justify-content: space-between;
  422. .title{
  423. font-weight: 600;
  424. font-size: 28rpx;
  425. color: #222222;
  426. }
  427. .total{
  428. font-weight: 300;
  429. font-size: 24rpx;
  430. display: flex;
  431. align-items: center;
  432. margin-right: -20rpx;
  433. .icon{
  434. width: 48rpx;
  435. height: 48rpx;
  436. }
  437. }
  438. }
  439. .actor-list {
  440. white-space: nowrap;
  441. width: 100%;
  442. padding-top: 20rpx;
  443. .item {
  444. display: inline-block;
  445. width: 120rpx;
  446. margin-right: 20rpx;
  447. text-align: center;
  448. .icon{
  449. width: 120rpx;
  450. height: 150rpx;
  451. border-radius: 16rpx;
  452. }
  453. .name{
  454. font-weight: 400;
  455. font-size: 24rpx;
  456. color: #222222;
  457. margin-top: 15rpx;
  458. }
  459. .sub-desc{
  460. font-weight: 300;
  461. font-size: 20rpx;
  462. color: #AAAAAA;
  463. margin-top: 12rpx;
  464. overflow: hidden;
  465. text-overflow: ellipsis;
  466. white-space: nowrap;
  467. }
  468. }
  469. }
  470. }
  471. .btn-box{
  472. position: fixed;
  473. left: 0%;
  474. bottom: 0%;
  475. width: 100%;
  476. padding: 10rpx 24rpx 76rpx;
  477. box-sizing: border-box;
  478. background: #FFFFFF;
  479. border-top: 1rpx solid #EEEEEE;
  480. .buy-btn{
  481. width: 702rpx;
  482. height: 80rpx;
  483. line-height: 80rpx;
  484. background: #EE4320;
  485. border-radius: 46rpx 46rpx 46rpx 46rpx;
  486. font-weight: 600;
  487. font-size: 28rpx;
  488. color: #FFFFFF;
  489. padding: 0;
  490. margin: 0;
  491. }
  492. }
  493. .content{
  494. padding: 24rpx;
  495. .tabList {
  496. white-space: nowrap;
  497. width: 100%;
  498. .tab {
  499. display: inline-block;
  500. padding: 0 12rpx 20rpx;
  501. font-weight: 400;
  502. font-size: 28rpx;
  503. color: #222222;
  504. }
  505. .tab.active{
  506. position: relative;
  507. &::after{
  508. content: '';
  509. position: absolute;
  510. bottom: 0%;
  511. left: 50%;
  512. transform: translateX(-50%);
  513. width: 60rpx;
  514. height: 8rpx;
  515. background: #EE4320;
  516. border-radius: 4rpx 4rpx 4rpx 4rpx;
  517. }
  518. }
  519. }
  520. .list{
  521. max-height: 900rpx;
  522. overflow: auto;
  523. .cinema-item{
  524. background: #FFFFFF;
  525. border-radius: 16rpx 16rpx 16rpx 16rpx;
  526. padding: 28rpx 0;
  527. border-top: 1rpx solid #F0F0F0;
  528. .name-box{
  529. display: flex;
  530. justify-content: space-between;
  531. .name{
  532. font-weight: 600;
  533. font-size: 28rpx;
  534. color: #222222;
  535. width: 450rpx;
  536. white-space: nowrap;
  537. overflow: hidden;
  538. text-overflow: ellipsis;
  539. }
  540. .price{
  541. display: flex;
  542. align-items: center;
  543. font-size: 28rpx;
  544. color: $uni-color-primary;
  545. .label{
  546. font-size: 24rpx;
  547. color: #AAAAAA;
  548. margin-left: 6rpx;
  549. }
  550. }
  551. }
  552. .address-box{
  553. display: flex;
  554. justify-content: space-between;
  555. font-size: 24rpx;
  556. color: #AAAAAA;
  557. margin-top: 16rpx;
  558. .address{
  559. width: 460rpx;
  560. white-space: nowrap;
  561. overflow: hidden;
  562. text-overflow: ellipsis;
  563. }
  564. .distance{
  565. }
  566. }
  567. .movie-name{
  568. font-size: 24rpx;
  569. color: #222222;
  570. margin-top: 16rpx;
  571. width: 100%;
  572. white-space: nowrap;
  573. overflow: hidden;
  574. text-overflow: ellipsis;
  575. }
  576. }
  577. .movie-item{
  578. display: flex;
  579. align-items: center;
  580. justify-content: space-between;
  581. padding: 34rpx 0;
  582. border-bottom: 1rpx solid #F0F0F0;
  583. .info{
  584. display: flex;
  585. .time-box{
  586. display: flex;
  587. flex-direction: column;
  588. justify-content: space-between;
  589. .start-time{
  590. font-weight: 600;
  591. font-size: 36rpx;
  592. color: #222222;
  593. }
  594. .end-time{
  595. font-size: 24rpx;
  596. color: #AAAAAA;
  597. margin-top: 20rpx;
  598. }
  599. }
  600. .type-box{
  601. display: flex;
  602. flex-direction: column;
  603. justify-content: space-between;
  604. margin-left: 80rpx;
  605. .type{
  606. font-size: 28rpx;
  607. color: #222222;
  608. }
  609. .room{
  610. font-size: 24rpx;
  611. color: #AAAAAA;
  612. }
  613. }
  614. }
  615. .price-box{
  616. display: flex;
  617. align-items: center;
  618. .price{
  619. font-size: 36rpx;
  620. color: #FF4D3A;
  621. }
  622. .btn{
  623. width: 120rpx;
  624. height: 52rpx;
  625. line-height: 52rpx;
  626. text-align: center;
  627. background: rgba(238,67,32,0.1);
  628. border-radius: 26rpx;
  629. margin-left: 20rpx;
  630. font-size: 28rpx;
  631. color: #EE4320;
  632. }
  633. }
  634. }
  635. }
  636. }
  637. }
  638. </style>