index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <script setup lang="ts">
  2. import { ref, watch } from 'vue'
  3. import selectTime from '../components/choose-time.vue'
  4. import { timeFormat } from '../utils/index'
  5. import { StaticUrl } from '@/config'
  6. interface brand {
  7. id: number
  8. brandId: string
  9. brandName: string
  10. }
  11. const router = useRouter()
  12. definePage({
  13. name: 'film-choose-film',
  14. islogin: false,
  15. style: {
  16. navigationStyle: 'custom',
  17. navigationBarTitleText: '我的订单',
  18. backgroundColorBottom: '#fff',
  19. },
  20. })
  21. onLoad((options) => {
  22. console.log('onload', options)
  23. })
  24. const addressStore = useAddressStore()
  25. const { Location } = storeToRefs(addressStore)
  26. const query = ref({
  27. cityId: '103',
  28. showDates: timeFormat(new Date().getTime(), 'yyyy-MM-dd'),
  29. lat: Location.value.latitude,
  30. lng: Location.value.longitude,
  31. districtId: '',
  32. brandId: '',
  33. hall: '',
  34. movieId: '',
  35. })
  36. // const tab = ref(timeFormat(new Date().getTime(), 'yyyy-mm-dd'))
  37. const dayList = ref([])
  38. const active = ref<number | null>(null)
  39. const filmList = ref<Api.filmList[]>([])
  40. const cityList = ref<Api.filmCityList>([])
  41. const brandList = ref<brand[]>()
  42. const currentCity = ref(0)
  43. const show = ref(false)
  44. const info = ref<Api.filmMovieList>({})
  45. watch(() => show.value, (val) => {
  46. if (!val) {
  47. active.value = null
  48. }
  49. })
  50. function handleChoose(index: number) {
  51. show.value = true
  52. active.value = index
  53. }
  54. function close() {
  55. show.value = false
  56. }
  57. function choose(cityId: string, index?: number, districtId?: string) {
  58. if (active.value === 0) {
  59. query.value.cityId = cityId
  60. query.value.districtId = districtId || ''
  61. if (index) {
  62. currentCity.value = index
  63. }
  64. }
  65. else if (active.value === 1) {
  66. query.value.brandId = cityId
  67. }
  68. // else if (active.value === 2) {
  69. // }
  70. show.value = false
  71. getData()
  72. }
  73. function handleFilm(title: string = '保利万和学府影城', cinemaId: string) {
  74. console.log(title)
  75. router.push({
  76. name: 'film-select-time',
  77. params: {
  78. cinemaId,
  79. movieId: query.value.movieId,
  80. title,
  81. },
  82. })
  83. }
  84. async function getData() {
  85. uni.showLoading({ title: '加载中' })
  86. const res = await Apis.film.getFilmList({ data: query.value })
  87. uni.hideLoading()
  88. if (res.data) {
  89. filmList.value = res.data
  90. }
  91. }
  92. async function getDate(movieId: string) {
  93. const res = await Apis.film.getFilmDateList({ data: { movieId } })
  94. dayList.value = res.data
  95. }
  96. function changeTime() {
  97. getData()
  98. }
  99. async function getCityList() {
  100. const res = await Apis.film.getCityList({})
  101. cityList.value = res.data
  102. res.data.forEach((item: any, index: number) => {
  103. if (item.name.includes('贵阳')) {
  104. currentCity.value = index
  105. }
  106. })
  107. }
  108. getCityList()
  109. async function getFilmBrandList() {
  110. const res = await Apis.film.getFilmBrandList({})
  111. brandList.value = res.data
  112. }
  113. getFilmBrandList()
  114. onLoad((options) => {
  115. query.value.movieId = options?.movieId
  116. info.value = JSON.parse(options?.info)
  117. getDate(options?.movieId)
  118. getData()
  119. })
  120. </script>
  121. <template>
  122. <view class="choose-film">
  123. <wd-navbar
  124. title="" custom-style="background-color: transparent;" :bordered="false" :z-index="99"
  125. safe-area-inset-top left-arrow fixed @click-left="router.back()"
  126. />
  127. <view class="bg-box">
  128. <image class="img" :src="info.posterUrl" mode="scaleToFill" />
  129. </view>
  130. <view class="info-box">
  131. <view class="info">
  132. <image class="icon" :src="info.posterUrl" />
  133. <view class="box">
  134. <view class="name">
  135. {{ info.name }}
  136. </view>
  137. <view class="score-box">
  138. <view class="score">
  139. 评分 <view class="num">
  140. {{ info.score }}
  141. </view>
  142. </view>
  143. <view class="want-num">
  144. {{ info.wish }}人想看
  145. </view>
  146. </view>
  147. <view class="type-box">
  148. {{ info.category }}
  149. <view class="tag">
  150. {{ info.version }}
  151. </view>
  152. </view>
  153. <view class="publish-info">
  154. 时长: {{ info.duration }}分钟
  155. </view>
  156. <view class="publish-info">
  157. 上映:{{ info.releaseTime }}
  158. </view>
  159. <view class="publish-info">
  160. 导演:{{ info.director }}
  161. </view>
  162. <view class="publish-info">
  163. 演员:{{ info.star }}
  164. </view>
  165. </view>
  166. </view>
  167. </view>
  168. <view class="px-24rpx">
  169. <!-- 影院时间 -->
  170. <selectTime v-model="query.showDates" :data="dayList" @change="changeTime" />
  171. <view class="choose-list">
  172. <view class="choose-item" :class="[active == 0 ? 'active' : '']" @click="handleChoose(0)">
  173. <view class="choose-item-title">
  174. 全城
  175. </view>
  176. <image
  177. class="icon" :src="StaticUrl + (active == 0 ? '/film-choose-active.png' : '/film-choose.png')"
  178. mode="scaleToFill"
  179. />
  180. </view>
  181. <view class="choose-item" :class="[active == 1 ? 'active' : '']" @click="handleChoose(1)">
  182. <view class="choose-item-title">
  183. 品牌
  184. </view>
  185. <image
  186. class="icon" :src="StaticUrl + (active == 1 ? '/film-choose-active.png' : '/film-choose.png')"
  187. mode="scaleToFill"
  188. />
  189. </view>
  190. <view class="choose-item" :class="[active == 2 ? 'active' : '']" @click="handleChoose(2)">
  191. <view class="choose-item-title">
  192. 特色
  193. </view>
  194. <image
  195. class="icon" :src="StaticUrl + (active == 2 ? '/film-choose-active.png' : '/film-choose.png')"
  196. mode="scaleToFill"
  197. />
  198. </view>
  199. </view>
  200. </view>
  201. <view class="film-list">
  202. <view
  203. v-for="(item, index) in filmList" :key="index" class="film-item"
  204. @click="handleFilm(item.name, item.cinemaId)"
  205. >
  206. <view class="name-box">
  207. <view class="name w-450rpx overflow-hidden text-ellipsis whitespace-nowrap">
  208. {{ item.name }}
  209. </view>
  210. <view class="price-box">
  211. <view class="num">
  212. ¥{{ item.sellPrice }}
  213. </view>
  214. <div class="label">
  215. </div>
  216. </view>
  217. </view>
  218. <view class="address-box">
  219. <view class="address overflow-hidden text-ellipsis whitespace-nowrap">
  220. {{ item.address }}
  221. </view>
  222. <view class="distance">
  223. {{ item.distance }}km
  224. </view>
  225. </view>
  226. <div class="cantact">
  227. {{ item.phone || '暂无联系方式' }}
  228. </div>
  229. <div class="time-box">
  230. 近期场次:{{ item.showInfo }}
  231. </div>
  232. </view>
  233. </view>
  234. <wd-loadmore state="finished" :loading-props="{ color: '#9ED605', size: 20 }" />
  235. <!-- 弹窗 -->
  236. <wd-action-sheet v-if="show" v-model="show" @close="close">
  237. <view class="content">
  238. <!-- 影院时间 -->
  239. <selectTime v-model="query.showDates" :data="dayList" @change="changeTime" />
  240. <view class="choose-list">
  241. <view class="choose-item" :class="[active == 0 ? 'active' : '']" @click="handleChoose(0)">
  242. <view class="choose-item-title">
  243. 全城
  244. </view>
  245. <image
  246. class="icon" :src="StaticUrl + (active == 0 ? '/film-choose-active.png' : '/film-choose.png')"
  247. mode="scaleToFill"
  248. />
  249. </view>
  250. <view class="choose-item" :class="[active == 1 ? 'active' : '']" @click="handleChoose(1)">
  251. <view class="choose-item-title">
  252. 品牌
  253. </view>
  254. <image
  255. class="icon" :src="StaticUrl + (active == 1 ? '/film-choose-active.png' : '/film-choose.png')"
  256. mode="scaleToFill"
  257. />
  258. </view>
  259. <view class="choose-item" :class="[active == 2 ? 'active' : '']" @click="handleChoose(2)">
  260. <view class="choose-item-title">
  261. 特色
  262. </view>
  263. <image
  264. class="icon" :src="StaticUrl + (active == 2 ? '/film-choose-active.png' : '/film-choose.png')"
  265. mode="scaleToFill"
  266. />
  267. </view>
  268. </view>
  269. <view v-if="active == 0" class="choose-box">
  270. <view class="city-content">
  271. <view
  272. v-for="(item, index) in cityList" :key="index" class="name"
  273. :class="[query.cityId == item.cityId ? 'active' : '']" @click="choose(item.cityId, index as number)"
  274. >
  275. {{ item.name }}
  276. </view>
  277. </view>
  278. <view class="choose-content">
  279. <view class="choose-item" @click="choose(query.cityId)">
  280. <view class="name">
  281. 全城
  282. </view>
  283. <image
  284. v-if="query.districtId === ''" class="icon" :src="`${StaticUrl}/film-choose-icon.png`"
  285. mode="scaleToFill"
  286. />
  287. </view>
  288. <view
  289. v-for="(item, index) in cityList[currentCity].districts" :key="index" class="choose-item"
  290. @click="choose(item.cityId, item.districtId)"
  291. >
  292. <view class="name" :class="[query.districtId == item.districtId ? 'active' : '']">
  293. {{ item.districtName }}
  294. </view>
  295. <image
  296. v-if="query.districtId == item.districtId" class="icon" :src="`${StaticUrl}/film-choose-icon.png`"
  297. mode="scaleToFill"
  298. />
  299. </view>
  300. </view>
  301. </view>
  302. <view v-if="active == 1" class="choose-box">
  303. <view class="choose-content">
  304. <view class="choose-item" @click="choose('')">
  305. <view class="name">
  306. 全部
  307. </view>
  308. <image
  309. v-if="query.brandId === ''" class="icon" :src="`${StaticUrl}/film-choose-icon.png`"
  310. mode="scaleToFill"
  311. />
  312. </view>
  313. <view v-for="(item, index) in brandList" :key="index" class="choose-item" @click="choose(item.brandId)">
  314. <view class="name" :class="[query.brandId == item.brandId ? 'active' : '']">
  315. {{ item.brandName }}
  316. </view>
  317. <image
  318. v-if="query.brandId == item.brandId" class="icon" :src="`${StaticUrl}/film-choose-icon.png`"
  319. mode="scaleToFill"
  320. />
  321. </view>
  322. </view>
  323. </view>
  324. </view>
  325. </wd-action-sheet>
  326. </view>
  327. </template>
  328. <style lang="scss" scoped>
  329. .choose-film{
  330. background: #fff;
  331. min-height: 100vh;
  332. .bg-box {
  333. width: 100%;
  334. height: 596rpx;
  335. position: relative;
  336. .img {
  337. width: 100%;
  338. height: 596rpx;
  339. vertical-align: top;
  340. }
  341. }
  342. .info-box {
  343. padding: 24rpx;
  344. padding-top: 300rpx;
  345. border-radius: 16rpx 16rpx 16rpx 16rpx;
  346. margin-top: -400rpx;
  347. position: relative;
  348. background: linear-gradient(179deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.8) 29.54%, #FFFFFF 46.99%, #FFFFFF 100%);
  349. .info {
  350. display: flex;
  351. position: relative;
  352. .icon {
  353. width: 218rpx;
  354. height: 298rpx;
  355. background: #aaa;
  356. border-radius: 16rpx;
  357. flex-shrink: 0;
  358. }
  359. .box {
  360. display: flex;
  361. flex-direction: column;
  362. justify-content: space-between;
  363. margin-left: 20rpx;
  364. .name {
  365. font-weight: 600;
  366. font-size: 28rpx;
  367. color: #222222;
  368. width: 400rpx;
  369. white-space: nowrap;
  370. overflow: hidden;
  371. text-overflow: ellipsis;
  372. }
  373. .score-box {
  374. font-size: 24rpx;
  375. color: #AAAAAA;
  376. position: absolute;
  377. top: 0;
  378. right: 0;
  379. text-align: right;
  380. .score {
  381. display: flex;
  382. align-items: center;
  383. justify-content: flex-end;
  384. .num {
  385. font-size: 28rpx;
  386. color: #FF4D3A;
  387. padding: 0 12rpx;
  388. }
  389. }
  390. .want-num {
  391. padding: 0 12rpx;
  392. align-self: flex-end;
  393. margin-top: 24rpx;
  394. // font-size: 24rpx;
  395. // color: #AAAAAA;
  396. }
  397. }
  398. .type-box {
  399. display: flex;
  400. align-items: center;
  401. font-size: 24rpx;
  402. color: #AAAAAA;
  403. .tag {
  404. padding: 6rpx 10rpx;
  405. background: #F0F0F0;
  406. border-radius: 8rpx 8rpx 8rpx 8rpx;
  407. font-size: 24rpx;
  408. color: #AAAAAA;
  409. margin-left: 10rpx;
  410. }
  411. }
  412. .publish-info {
  413. font-size: 24rpx;
  414. color: #AAAAAA;
  415. white-space: nowrap;
  416. text-overflow: ellipsis;
  417. overflow: hidden;
  418. max-width: 460rpx;
  419. }
  420. }
  421. }
  422. .title-box {
  423. display: flex;
  424. justify-content: space-between;
  425. margin-top: 28rpx;
  426. .title {
  427. font-weight: 600;
  428. font-size: 28rpx;
  429. color: #222222;
  430. }
  431. .open {
  432. display: flex;
  433. align-items: center;
  434. font-size: 24rpx;
  435. color: #AAAAAA;
  436. .icon {
  437. width: 24rpx;
  438. height: 24rpx;
  439. }
  440. }
  441. }
  442. .desc {
  443. font-size: 24rpx;
  444. color: #222222;
  445. font-weight: 300;
  446. margin-top: 20rpx;
  447. line-height: 40rpx;
  448. }
  449. }
  450. .choose-list{
  451. display: flex;
  452. padding: 24rpx 0;
  453. background: #fff;
  454. .choose-item{
  455. display: flex;
  456. align-items: center;
  457. margin-right: 80rpx;
  458. .choose-item-title{
  459. font-weight: bold;
  460. font-size: 32rpx;
  461. color: #222222;
  462. }
  463. .icon{
  464. width: 30rpx;
  465. height: 30rpx;
  466. margin-left: 12rpx;
  467. }
  468. &.active{
  469. .choose-item-title{
  470. color: #9ED605;
  471. }
  472. }
  473. }
  474. }
  475. .film-list{
  476. padding: 0 24rpx;
  477. .film-item{
  478. background: #F9F9F9;
  479. border-radius: 16rpx 16rpx 16rpx 16rpx;
  480. padding: 24rpx;
  481. margin-bottom: 20rpx;
  482. .name-box{
  483. display: flex;
  484. justify-content: space-between;
  485. margin-bottom: 16rpx;
  486. .name{
  487. font-weight: bold;
  488. font-size: 28rpx;
  489. color: #222222;
  490. }
  491. .price-box{
  492. display: flex;
  493. align-items: center;
  494. .num{
  495. font-weight: bold;
  496. font-size: 36rpx;
  497. color: #FF4D3A;
  498. }
  499. .label{
  500. font-size: 24rpx;
  501. color: #AAAAAA;
  502. }
  503. }
  504. }
  505. .address-box{
  506. display: flex;
  507. justify-content: space-between;
  508. font-size: 24rpx;
  509. color: #AAAAAA;
  510. margin-bottom: 16rpx;
  511. .address {
  512. font-size: 24rpx;
  513. color: #AAAAAA;
  514. }
  515. .distance{
  516. }
  517. }
  518. .cantact{
  519. font-size: 24rpx;
  520. color: #AAAAAA;
  521. margin-bottom: 16rpx;
  522. }
  523. .time-box{
  524. font-size: 24rpx;
  525. color: #222222;
  526. }
  527. }
  528. }
  529. .content{
  530. padding: 0 24rpx;
  531. .choose-box{
  532. min-height: 500rpx;
  533. display: flex;
  534. .city-content{
  535. width: 30%;
  536. .name{
  537. font-size: 28rpx;
  538. color: #222222;
  539. padding: 14rpx 0;
  540. }
  541. }
  542. .choose-content{
  543. flex: 1;
  544. .choose-item{
  545. display: flex;
  546. justify-content: space-between;
  547. padding: 14rpx 0;
  548. .name{
  549. font-size: 28rpx;
  550. color: #222222;
  551. }
  552. .icon{
  553. width: 30rpx;
  554. height: 30rpx;
  555. }
  556. }
  557. }
  558. .name.active{
  559. color: #9ED605;
  560. }
  561. }
  562. }
  563. }
  564. </style>