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