schedulelist.vue 9.2 KB

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