123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490 |
- <template>
- <view>
- <view class="film-des">
- <image class="left-img" :src="filmDes.pic" mode="widthFix"></image>
- <view class="right-box">
- <view class="film-name">
- {{showItem.filmName}}
- </view>
- <view class="film-time">
- {{showItem.showTime}}<br />
- {{showItem.cinemaName}}<br />
- {{showItem.hallName}}
- </view>
- <view class="film-caveat">
- <view class="item">
- <van-icon name="clear" color='#E31818' />
- 不支持退票
- </view>
- <view class="item">
- <van-icon name="clear" color='#E31818' />
- 不支持改签
- </view>
- </view>
- </view>
- </view>
- <view class="select-des">
- <view class="tit-text">
- 选择购票方式
- </view>
- <van-radio-group :value="radioType" @change="radioOnChange">
- <view class="options-box">
- <view class="left-box">
- <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E7%89%B9%E6%83%A0%E8%B4%AD%E7%A5%A8.png"
- mode="widthFix"></image>
- <view class="text-box">
- <text class="top">特惠购票</text>
- <text class="bottom">固定折扣,快速出票</text>
- </view>
- </view>
- <view class="right-box">
- <view class="text-box">
- <text class="top">¥{{aPrice}}/张</text>
- <text class="bottom">优惠 ¥{{aDiscount}}元</text>
- </view>
- <van-radio :name="1" checked-color="#07c160"></van-radio>
- </view>
- </view>
- <view class="options-box">
- <view class="left-box">
- <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E5%BF%AB%E9%80%9F%E8%B4%AD%E7%A5%A8.png"
- mode="widthFix"></image>
- <view class="text-box">
- <text class="top">快速购票</text>
- <text class="bottom">无需等待,即买即兑</text>
- </view>
- </view>
- <view class="right-box">
- <view class="text-box">
- <text class="top">¥{{(showItem.netPrice/100).toFixed(2)}}/张</text>
- </view>
- <van-radio :name="2" checked-color="#07c160"></van-radio>
- </view>
- </view>
- <view class="options-box">
- <view class="left-box">
- <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E7%AB%9E%E4%BB%B7.png"
- mode="widthFix"></image>
- <view class="text-box">
- <text class="top">竞价购买</text>
- <text class="bottom">为您网罗最低的折扣,约耗时几分钟</text>
- </view>
- </view>
- <view class="right-box">
- <view class="text-box">
- <text class="top">等待竞价</text>
- </view>
- <van-radio :name="3" checked-color="#07c160" disabled></van-radio>
- </view>
- </view>
- </van-radio-group>
- </view>
- <view class="seat-select">
- <text class="tit-text">无座时接受系统调座</text>
- <van-switch :checked="acceptChangeSeat==1" @change="onChange" size="24px" />
- </view>
- <view class="seat-des">
- <view class="tit-text">
- 购票须知
- </view>
- <view class="seat-box">
- <view class="left">
- 座位:
- </view>
- <view class="right">
- <view class="item" v-for="(item,index) in seatResult" :key='index'>
- <text class="top">{{item.seatNo}}</text>
- <text class="bottom">¥{{aPrice}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="buy-des">
- <view class="left">
- <text class="one">总价:</text>
- <text class="two">¥{{allPrice}}</text>
- <text class="three">优惠¥{{allDiscount}}元</text>
- </view>
- <view class="right">
- <text class="text">{{seatResult.length}}张</text>
- <button class="btn" type="default" @click="buy">去支付</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- prepareOrder
- } from '@/api/cinema.js'
- export default {
- data: () => ({
- showItem: {},
- seatResult: [],
- radioType: 1,
- acceptChangeSeat: 0,
- orderRes: {}
- }),
- onLoad: async function(option) {
- let data = await this.goPageGetData()
- this.showItem = data.showItem
- this.seatResult = data.seatResult.map((val) => {
- return JSON.parse(val)
- })
- },
- computed: {
- filmDes() {
- let des = {}
- this.$store.state.cinema.filmList.forEach((val) => {
- if (val.filmId == this.showItem.filmId) {
- des = val
- }
- })
- return des;
- },
- filmDiscount() {
- return this.$store.state.cinema.filmDiscount;
- },
- discountRule() {
- return this.$store.state.cinema.discountRule;
- },
- aPrice() {
- let discountRule = (this.showItem.netPrice > 3900 ? this.discountRule.upDiscountRate : this.discountRule.downDiscountRate)
- let filmDiscount = this.filmDiscount
- let netPrice = this.showItem.netPrice / 100
- return (netPrice * discountRule * filmDiscount).toFixed(2)
- },
- aDiscount() {
- let discountRule = (this.showItem.netPrice > 3900 ? this.discountRule.upDiscountRate : this.discountRule.downDiscountRate)
- let filmDiscount = this.filmDiscount
- let netPrice = this.showItem.netPrice / 100
- return (netPrice - netPrice * discountRule * filmDiscount).toFixed(2)
- },
- allPrice() {
- let discountRule = (this.showItem.netPrice > 3900 ? this.discountRule.upDiscountRate : this.discountRule.downDiscountRate)
- let filmDiscount = this.filmDiscount
- let netPrice = this.showItem.netPrice / 100
- if (this.radioType == 1) {
- return (this.seatResult.length * netPrice * discountRule * filmDiscount).toFixed(2)
- }
- if (this.radioType == 2) {
- return (this.seatResult.length * netPrice).toFixed(2)
- }
- },
- allDiscount() {
- let discountRule = (this.showItem.netPrice > 3900 ? this.discountRule.upDiscountRate : this.discountRule.downDiscountRate)
- let filmDiscount = this.filmDiscount
- let netPrice = this.showItem.netPrice / 100
- if (this.radioType == 1) {
- return (this.seatResult.length * (netPrice - netPrice * discountRule * filmDiscount)).toFixed(2)
- }
- if (this.radioType == 2) {
- return (this.seatResult.length * (netPrice - netPrice)).toFixed(2)
- }
- },
- },
- methods: {
- radioOnChange(e) {
- this.orderRes = {}
- this.radioType = e.detail
- },
- onChange({
- detail
- }) {
- // 需要手动对 checked 状态进行更新
- if (detail) {
- this.acceptChangeSeat = 1
- } else {
- this.acceptChangeSeat = 0
- }
- },
- async buy() {
- //已有订单则直接请求历史数据
- if (this.orderRes.code == 200) {
- let payRes = await wx.requestPayment(this.orderRes.data)
- console.log(payRes)
- return false
- }
- let seat = [],
- seatId = [],
- seatNo = []
- this.seatResult.forEach(val => {
- seat.push(val.seatNo)
- seatNo.push(val.seatNo)
- seatId.push(val.seatId)
- })
- prepareOrder({
- acceptChangeSeat: this.acceptChangeSeat,
- seat: seat.join(','),
- seatId: seatId.join('|'),
- seatNo: seatNo.join('|'),
- showId: this.showItem.showId,
- cinemaId: this.showItem.cinemaId,
- goodsPictureUrl: this.filmDes.pic,
- goodsType: '1',
- ticketType: this.radioType
- }).then(async res => {
- this.orderRes = res
- let payRes = await wx.requestPayment(this.orderRes.data)
- if (payRes.errMsg == 'requestPayment:ok') {
- this.goPage(`/pages/cinema/orderdes?outTradeNo=${this.orderRes.data.outTradeNo}`, 'reLaunch')
- }
- console.log(payRes)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .film-des {
- padding: 40rpx 30rpx;
- margin-top: 20rpx;
- background-color: #FFFFFF;
- display: flex;
- .left-img {
- width: 170rpx;
- height: 236rpx;
- margin-right: 20rpx;
- }
- .right-box {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .film-name {
- font-size: 30rpx;
- font-weight: 400;
- color: #0F0404;
- }
- .film-time {
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- line-height: 39rpx;
- }
- .film-caveat {
- display: flex;
- .item {
- display: flex;
- align-items: center;
- margin-right: 33rpx;
- font-size: 26rpx;
- font-weight: 400;
- color: #0F0404;
- }
- }
- }
- }
- .select-des {
- background-color: #FFFFFF;
- margin-top: 20rpx;
- padding-bottom: 1rpx;
- .tit-text {
- padding: 30rpx;
- font-size: 26rpx;
- font-weight: 400;
- color: #0F0404;
- border-bottom: 1rpx solid #E8E8E8;
- }
- .options-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 30rpx;
- .left-box {
- display: flex;
- .img {
- width: 66rpx;
- height: 66rpx;
- margin-right: 20rpx;
- }
- .text-box {
- display: flex;
- flex-direction: column;
- .top {
- font-size: 26rpx;
- font-weight: 400;
- color: #0F0404;
- }
- .bottom {
- font-size: 22rpx;
- font-weight: 400;
- color: #666666;
- }
- }
- }
- .right-box {
- display: flex;
- align-items: center;
- .text-box {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- align-items: flex-end;
- margin-right: 23rpx;
- .top {
- font-size: 26rpx;
- font-weight: 400;
- color: #E31818;
- }
- .bottom {
- font-size: 20rpx;
- font-weight: 400;
- color: #605A5A;
- }
- }
- }
- }
- }
- .seat-select {
- background-color: #FFFFFF;
- margin-top: 20rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 30rpx;
- .tit-text {
- font-size: 26rpx;
- font-weight: 400;
- color: #E31818;
- }
- }
- .seat-des {
- background-color: #FFFFFF;
- margin-top: 20rpx;
- .tit-text {
- font-size: 26rpx;
- font-weight: 400;
- color: #0F0404;
- padding: 30rpx;
- border-bottom: 1rpx solid #E8E8E8;
- }
- .seat-box {
- display: flex;
- justify-content: flex-start;
- padding: 10rpx 30rpx;
- .left {
- white-space: nowrap;
- height: 96rpx;
- margin-top: 10rpx;
- }
- .right {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- align-items: center;
- .item {
- width: 134rpx;
- height: 96rpx;
- margin: 10rpx;
- background: #EBEBEB;
- border-radius: 10rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .top {
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- }
- .bottom {
- font-size: 22rpx;
- font-weight: 400;
- color: #E31923;
- }
- }
- }
- }
- }
- .buy-des {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #FFFFFF;
- width: 100vw;
- box-sizing: border-box;
- position: fixed;
- bottom: 0;
- padding: 15rpx 30rpx;
- padding-bottom: calc(10px + env(safe-area-inset-bottom)/2);
- .left {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 50%;
- .one {
- font-size: 26rpx;
- color: #0F0404;
- }
- .two {
- font-size: 36rpx;
- color: #E31919;
- }
- .three {
- font-size: 22rpx;
- color: #E86125;
- }
- }
- .right {
- width: 40%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .text {
- font-size: 26rpx;
- color: #0F0404;
- }
- .btn {
- margin: 0;
- width: 200rpx;
- height: 80rpx;
- background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
- border-radius: 40rpx;
- font-size: 30rpx;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- white-space: nowrap;
- }
- }
- }
- </style>
|