cinemalist.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. <van-tabs :active='active' :swipe-threshold='3' animated sticky id='tabs'>
  4. <van-tab :title="getDay(dateItem)+' '+dateItem.slice(5)" v-for='(dateItem,dateIndex) in showDate' :key='index'>
  5. <loadSke :loading='cinemaLoading' :list='cinemaList[dateItem]'>
  6. <view class="cinema-box" v-for="(item,index) in cinemaList[dateItem]" :key='index' @click='goPage(`/pages/cinema/schedulelist?cinemaId=${item.cinemaId}&filmId=${filmId}`)'>
  7. <view class="tit">
  8. <text>{{item.cinemaName}}</text>
  9. <text class="text-2">{{item.distance}}</text>
  10. </view>
  11. <text class="address">{{item.address}}</text>
  12. </view>
  13. </loadSke>
  14. </van-tab>
  15. </van-tabs>
  16. </view>
  17. </template>
  18. <script>
  19. import {
  20. getCinemaList,
  21. getShowList,
  22. getShowDate
  23. } from '@/api/cinema.js'
  24. export default {
  25. data: () => ({
  26. active: 0,
  27. cinemaList: {},
  28. cinemaLoading: true,
  29. dateLoading: true,
  30. filmId: null,
  31. cityId: null,
  32. location: null,
  33. showDate: []
  34. }),
  35. onLoad: function(option) {
  36. this.filmId = option.filmId
  37. this.cityId = option.cityId
  38. this.location = option.location.split(',')
  39. },
  40. mounted() {
  41. this.init()
  42. },
  43. methods: {
  44. async init() {
  45. let showDateRes = await getShowDate({
  46. cityId: this.cityId,
  47. filmId: this.filmId,
  48. })
  49. this.showDate = showDateRes.data.data.dateList
  50. this.dateLoading = false
  51. this.$nextTick(() => {
  52. this.selectComponent('#tabs').resize();
  53. })
  54. this.showDate.forEach(async val => {
  55. let showListRes = await getShowList({
  56. cityId: this.cityId,
  57. filmId: this.filmId,
  58. latitude: this.location[1],
  59. longitude: this.location[0],
  60. page: 1,
  61. limit: 30,
  62. date: val
  63. })
  64. this.$set(this.cinemaList, val, showListRes.data.data.list)
  65. this.cinemaLoading = false
  66. })
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. .cinema-box {
  73. padding: 30rpx;
  74. border-top: 1rpx solid #E8E8E8;
  75. background-color: #FFFFFF;
  76. display: flex;
  77. flex-direction: column;
  78. .tit {
  79. display: flex;
  80. justify-content: space-between;
  81. .text-1 {
  82. font-size: 30rpx;
  83. color: #0F0404;
  84. }
  85. .text-2 {
  86. font-size: 26rpx;
  87. color: #999999;
  88. white-space: nowrap;
  89. }
  90. }
  91. .address {
  92. margin-top: 20rpx;
  93. width: 600rpx;
  94. font-size: 26rpx;
  95. color: #666666;
  96. white-space: nowrap;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. }
  100. }
  101. </style>