123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- <template>
- <page-meta>
- <navigation-bar :title="showItem.filmName" background-color="#FFFFFF" front-color="#000000" />
- </page-meta>
- <view>
- <view class="seatSelection-box">
- <view class="top-box">
- <view class="address">
- {{showItem.cinemaName}}
- </view>
- <view class="logo-box">
- <view class="item">
- <view class="seat selectable"></view>可选
- </view>
- <view class="item">
- <view class="seat selected"></view>已选
- </view>
- <view class="item">
- <view class="seat notSelect"></view>已售
- </view>
- </view>
- </view>
- <movable-area scale-area class="movable-area">
- <movable-view scale out-of-bounds direction='all' scale-max="3" @scale='scaleChange'>
- <view class="movable-box">
- <view class="screen-box">
- <image class="screen" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E9%93%B6%E5%B9%95.png"
- mode="widthFix"></image>
- <text class="screen-name">{{showItem.hallName}}</text>
- </view>
- <loadSke :loading='loading'>
- <view class="seat-box" :style="{'--col':collong}">
- <van-checkbox-group :value="seatResult" @change="groupOnChange" :max="max">
- <view class="col" v-for="(rowitem,rowindex) in rowlong" :key='rowindex'>
- <view v-for="(colitem,colindex) in collong" :key='colindex'>
- <van-checkbox use-icon-slot v-if="seatSet(rowindex,colindex,seatList)==='N'" :name="JSON.stringify(seatList[rowindex+1][colindex+1])">
- <view class="seat" :class="{selected:selected(rowindex,colindex,seatResult)}" slot="icon"></view>
- </van-checkbox>
- <view v-else-if="seatSet(rowindex,colindex,seatList)==='LK'" class="seat notSelect"></view>
- <view v-else class="seat noneSeat"></view>
- </view>
- </view>
- </van-checkbox-group>
- </view>
- </loadSke>
- </view>
- </movable-view>
- </movable-area>
- </view>
- <view class="bottom-box">
- <view class="buy-des">
- <view class="film-des">
- {{showItem.showTime}}
- </view>
- <view class="item-box">
- <view class="seat-item" v-for="(item,index) in seatResult" :key='index'>
- <view class="">
- {{JSON.parse(item).seatNo}}
- </view>
- <van-icon name="cross" @click='remove(item)' />
- </view>
- </view>
- </view>
- <view class="price-box">
- <view class="left-box">
- 总共:{{seatResult.length}}张
- </view>
- <button v-if="seatResult.length>0" class="btn" type="default" @click="goPage(`/pages/cinema/placeorder?seatResult=${JSON.stringify(seatResult)}&showItem=${JSON.stringify(showItem)}`)">下一步</button>
- <button v-else class="btn" style="background: linear-gradient(90deg, #c0c0c0, #c0c0c0, #c0c0c0);" type="default">下一步</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getSeat
- } from '@/api/cinema.js'
- export default {
- data: () => ({
- showItem: null,
- seatList: null,
- rowlong: 0,
- collong: 0,
- seatResult: [],
- max: null,
- loading: true
- }),
- onLoad: function(option) {
- this.showItem = JSON.parse(option.showItem)
- },
- mounted() {
- this.init()
- },
- methods: {
- scaleChange(e) {
- console.log(e)
- },
- groupOnChange(e) {
- this.seatResult = e.detail
- },
- remove(item) {
- this.seatResult.splice(this.seatResult.indexOf(item), 1)
- },
- seatSet(row, col, list) {
- if (!list) {
- return false
- } else if (list[row + 1]) {
- if (list[row + 1][col + 1])
- return list[row + 1][col + 1].status
- }
- },
- selected(row, col, seatResult) {
- let flag = false
- seatResult.forEach((val) => {
- if (JSON.parse(val).columnNo == col + 1 && JSON.parse(val).rowNo == row + 1)
- flag = true
- })
- return flag
- },
- loveSeat(row, col, list) {
- return ''
- },
- async init() {
- let seatRes = await getSeat({
- showId: this.showItem.showId
- })
- console.log(seatRes)
- this.max = seatRes.data.data.seatData.restrictions
- seatRes.data.data.seatData.seats.forEach((val) => {
- this.seatList || (this.seatList = {})
- this.seatList[val.rowNo] || (this.seatList[val.rowNo] = {})
- // this.$set(this.seatList[val.rowNo], val.columnNo, val)
- if (parseInt(val.rowNo) > this.rowlong) {
- this.rowlong = parseInt(val.rowNo)
- }
- if (parseInt(val.columnNo) > this.collong) {
- this.collong = parseInt(val.columnNo)
- }
- this.seatList[val.rowNo][val.columnNo] = val
- })
- this.$nextTick(() => {
- this.loading = false
- })
- console.log(this.seatList)
- }
- }
- }
- </script>
- <style lang="scss">
- .movable-area {
- width: 100vw;
- min-height: 500rpx;
- }
- .movable-box {
- width: 100vw;
- min-height: 500rpx;
- }
- .seatSelection-box {
- box-sizing: border-box;
- .top-box {
- padding: 30rpx;
- box-sizing: border-box;
- .address {
- font-size: 30rpx;
- font-weight: 400;
- color: #0F0404;
- }
- .logo-box {
- margin-top: 43rpx;
- width: 50%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .item {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- .seat {
- width: 26rpx;
- height: 26rpx;
- border: 1rpx solid #D9D9D9;
- border-radius: 4rpx;
- background: #FFFFFF;
- }
- .noneSeat {
- opacity: 0;
- }
- .notSelect {
- opacity: 1;
- background: #FB3D46;
- }
- .selected {
- opacity: 1;
- background: #47CB79;
- }
- .screen-box {
- position: relative;
- margin-top: 47rpx;
- .screen {
- width: 100%;
- }
- .screen-name {
- position: absolute;
- left: 50%;
- top: 30rpx;
- transform: translateX(-50%);
- white-space: nowrap;
- font-size: 22rpx;
- font-weight: 400;
- color: #999999;
- }
- }
- .seat-box {
- margin-top: 50rpx;
- width: calc(var(--col) * 30rpx);
- margin: auto;
- .col {
- display: flex;
- justify-content: space-around;
- align-items: center;
- margin-top: 15rpx;
- }
- }
- }
- .bottom-box {
- position: fixed;
- width: 100vw;
- bottom: 0;
- .buy-des {
- background-color: #FFFFFF;
- padding: 30rpx;
- .film-des {
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- }
- .item-box {
- display: flex;
- justify-content: flex-start;
- flex-wrap: wrap;
- .seat-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 200rpx;
- background: #E6E6E6;
- border-radius: 10rpx;
- margin: 20rpx 20rpx 0rpx 0rpx;
- padding: 20rpx;
- box-sizing: border-box;
- }
- }
- }
- .price-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #FFFFFF;
- padding: 15rpx 30rpx;
- padding-bottom: calc(15rpx + 10px + env(safe-area-inset-bottom)/2);
- margin-top: 20rpx;
- .left-box {
- font-size: 26rpx;
- font-weight: 400;
- color: #0F0404;
- }
- .btn {
- margin: 0;
- width: 200rpx;
- height: 80rpx;
- background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
- border-radius: 40rpx;
- font-size: 30rpx;
- font-weight: 400;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- white-space: nowrap;
- }
- }
- }
- </style>
|