schedulelist.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <page-meta>
  3. <navigation-bar :title="filmList[filmId].name" background-color="#FFFFFF" front-color="#000000" />
  4. </page-meta>
  5. <view class="schedulelist">
  6. <loadSke :loading='listLoading'>
  7. <view class="des-box">
  8. <view class="address">
  9. {{cinemaName}}
  10. </view>
  11. <swiper class="swiper-box" :current="current" previous-margin='200rpx' next-margin='200rpx' @change='swiperChange'>
  12. <swiper-item v-for="(item,index) in scheduleListKey" :key='index' class="swiper-item">
  13. <image class="image" :class="{imgBig:current==index}" :src="filmList[item].pic" mode="heightFix" :draggable="false" />
  14. </swiper-item>
  15. </swiper>
  16. <view class="film-name">
  17. {{filmList[filmId].name}}
  18. </view>
  19. <view class="film-des">
  20. {{filmList[filmId].duration}}分钟 | {{filmList[filmId].filmTypes}} | {{filmList[filmId].cast}}
  21. </view>
  22. </view>
  23. <view class="schedule-box">
  24. <van-tabs v-if="tabShow" :active='tabActive' :swipe-threshold='3' bind:change="onChange" animated swipeable id="tabs">
  25. <van-tab class='schedule-tab' :title="index" v-for='(item,index) in scheduleItem' :key='item[0][0].showId'>
  26. <view v-for="(sonItem,sonIndex) in item" :key='sonItem.showId' class="schedule-des">
  27. <view class="left-box">
  28. <view class="item-box">
  29. <text>{{sonItem.showTime.slice(-5)}}</text>
  30. <text class="bottom-text">{{sonItem.duration}}分钟</text>
  31. </view>
  32. <view class="type-box">
  33. <text>{{sonItem.planType}}</text>
  34. <text class="bottom-text">{{sonItem.hallName}}</text>
  35. </view>
  36. </view>
  37. <view class="right-box">
  38. <view class="price-box">
  39. <text>{{(sonItem.netPrice/100*(sonItem.netPrice>3900?discountRule.upDiscountRate:discountRule.downDiscountRate)*filmDiscount).toFixed(2)}}元</text>
  40. <text class="bottom-text old-price">{{sonItem.netPrice/100}}元</text>
  41. </view>
  42. <button v-if='discontinued(sonItem.stopSellTime)' type="default" @click="goPage(`/pages/cinema/selectseat?showItem=${JSON.stringify(sonItem)}`)">购
  43. 票</button>
  44. <button v-else type="default" style="background: linear-gradient(90deg, #c0c0c0, #c0c0c0, #c0c0c0);">停 售</button>
  45. </view>
  46. </view>
  47. </van-tab>
  48. </van-tabs>
  49. </view>
  50. </loadSke>
  51. </view>
  52. </template>
  53. <script>
  54. import loadSke from '@/components/skeleton/index/index.vue'
  55. import {
  56. getScheduleList,
  57. getfilmInfo
  58. } from '@/api/cinema.js'
  59. export default {
  60. components: {
  61. loadSke
  62. },
  63. data: () => ({
  64. listLoading: true,
  65. tabActive: 0,
  66. current: 0,
  67. cinemaId: null,
  68. filmId: null,
  69. cinemaName: '',
  70. scheduleList: null,
  71. scheduleListKey: null,
  72. discountRule: {},
  73. tabShow: true
  74. }),
  75. computed: {
  76. filmList() {
  77. let list = {}
  78. this.$store.state.cinema.filmList.map((val) => {
  79. list[val.filmId] = val
  80. })
  81. return list;
  82. },
  83. filmDiscount() {
  84. return this.$store.state.cinema.filmDiscount;
  85. },
  86. scheduleItem() {
  87. return this.scheduleList[this.filmId]
  88. }
  89. },
  90. onLoad: function(option) {
  91. this.cinemaId = option.cinemaId;
  92. this.filmId = option.filmId;
  93. },
  94. mounted() {
  95. this.init()
  96. },
  97. methods: {
  98. init() {
  99. this.listLoading = true
  100. getScheduleList({
  101. cinemaId: this.cinemaId
  102. }).then(res => {
  103. this.scheduleList = {}
  104. this.discountRule = res.data.data.discountRule
  105. this.$store.commit('SET_DISCOUNTRULE', res.data.data.discountRule)
  106. this.cinemaName = res.data.data.list[0].cinemaName
  107. res.data.data.list.map((val) => {
  108. this.scheduleList[val.filmId] || (this.scheduleList[val.filmId] = {})
  109. this.scheduleList[val.filmId][val.showDate] || (this.scheduleList[val.filmId][val.showDate] = [])
  110. this.scheduleList[val.filmId][val.showDate].push(val)
  111. })
  112. this.scheduleListKey = Object.keys(this.scheduleList)
  113. //定位影片位置
  114. this.current = this.scheduleListKey.indexOf(this.filmId)
  115. this.listLoading = false
  116. })
  117. },
  118. discontinued(date) {
  119. let flag = (new Date(date.replace(/-/g, "/")).getTime() - new Date().getTime()) > 0
  120. return flag
  121. },
  122. swiperChange(e) {
  123. this.current = e.detail.current
  124. this.filmId = this.scheduleListKey[this.current]
  125. this.selectComponent('#tabs').resize();
  126. this.tabActive = 0
  127. this.tabShow = true
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .des-box {
  134. background-image: url(https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/filmBg.png);
  135. padding: 35rpx 30rpx;
  136. box-sizing: border-box;
  137. width: 100%;
  138. height: 690rpx;
  139. .address {
  140. font-size: 30rpx;
  141. font-weight: bold;
  142. color: #FFFFFF;
  143. }
  144. .swiper-box {
  145. margin: auto;
  146. margin-top: 60rpx;
  147. padding: 0 45rpx;
  148. box-sizing: border-box;
  149. width: 100%;
  150. height: 270rpx;
  151. .swiper-item {
  152. display: flex;
  153. justify-content: center;
  154. align-items: center;
  155. }
  156. .image {
  157. height: 86%;
  158. }
  159. .imgBig {
  160. height: 100% !important;
  161. }
  162. }
  163. .film-name {
  164. margin-top: 53rpx;
  165. text-align: center;
  166. font-size: 30rpx;
  167. font-weight: bold;
  168. color: #FFFFFF;
  169. }
  170. .film-des {
  171. margin-top: 19rpx;
  172. text-align: center;
  173. font-size: 22rpx;
  174. font-weight: 400;
  175. color: #FFFFFF;
  176. width: 100%;
  177. overflow: hidden;
  178. white-space: nowrap;
  179. text-overflow: ellipsis;
  180. }
  181. }
  182. .schedule-box {
  183. width: 100vw;
  184. min-height: calc(100vh - 690rpx + 122rpx - 10px - env(safe-area-inset-bottom)/2);
  185. padding-bottom: calc(10px + env(safe-area-inset-bottom)/2);
  186. background-color: #FFFFFF;
  187. border-radius: 50rpx 50rpx 0px 0px;
  188. margin-top: -122rpx;
  189. overflow: hidden;
  190. .schedule-tab {
  191. overflow-y: auto;
  192. }
  193. .schedule-des {
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. padding: 0 30rpx;
  198. margin-top: 50rpx;
  199. .bottom-text {
  200. font-size: 22rpx;
  201. font-weight: 400;
  202. color: #999999;
  203. width: 100rpx;
  204. text-align: center;
  205. white-space: nowrap;
  206. overflow: hidden;
  207. text-overflow: ellipsis;
  208. }
  209. .left-box {
  210. width: 50%;
  211. display: flex;
  212. justify-content: space-around;
  213. align-items: stretch;
  214. .item-box {
  215. display: flex;
  216. flex-direction: column;
  217. justify-content: space-between;
  218. align-items: center;
  219. &:first-child {
  220. font-size: 40rpx;
  221. font-weight: 400;
  222. color: #0F0404;
  223. }
  224. }
  225. .type-box {
  226. display: flex;
  227. flex-direction: column;
  228. justify-content: space-between;
  229. align-items: center;
  230. &:first-child {
  231. font-size: 26rpx;
  232. font-weight: 400;
  233. color: #0F0404;
  234. }
  235. :last-child {
  236. width: 220rpx !important;
  237. }
  238. }
  239. }
  240. .right-box {
  241. width: 45%;
  242. display: flex;
  243. justify-content: space-around;
  244. align-items: center;
  245. .price-box {
  246. display: flex;
  247. flex-direction: column;
  248. justify-content: space-between;
  249. align-items: center;
  250. &:first-child {
  251. font-size: 36rpx;
  252. font-weight: 400;
  253. color: #E31919;
  254. }
  255. .old-price {
  256. text-decoration: line-through;
  257. }
  258. }
  259. button {
  260. margin: 0;
  261. width: 126rpx;
  262. height: 60rpx;
  263. background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
  264. border-radius: 30rpx;
  265. font-size: 26rpx;
  266. font-weight: 400;
  267. color: #FFFFFF;
  268. white-space: nowrap;
  269. display: flex;
  270. justify-content: center;
  271. align-items: center;
  272. }
  273. }
  274. }
  275. }
  276. </style>