schedulelist.vue 7.9 KB

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