Files
gxtyzx-uniapp/src/package/booking/confirm.vue
T
2026-10-24 13:33:43 +08:00

931 lines
30 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="container">
<!-- deBug信息 -->
<!-- <view >
{{ payPrice }}
{{ totalPrice }}
{{ orderInfo }}
</view> -->
<uni-card title="预约人信息" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell title="真实姓名" :cellStyle="{ padding: '10px 5px' }" :border="false">
<template v-slot:value>
<text v-if="form.name">{{ form.name }}</text>
<text v-else class="text-blue-500" @click="navTo(`/package/user/personal`)">点击完善</text>
</template>
</uv-cell>
<uv-cell title="手机号码" :cellStyle="{ padding: '10px 5px' }" :value="form.phone" :border="false"/>
</uv-cell-group>
</uni-card>
<uni-card title="订单信息" :border="false" :is-shadow="false" v-if="list.length">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block>
<uv-cell :title="`场馆`" :label="list[0].siteName" :cellStyle="{ padding: '10px 5px' }"/>
<block v-for="(item, index) in list" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.dateTime} ${getWeek(item.week)} ${item.timePeriod}`"
:value="form.sid === 37 ? '' : `¥${item.type === 0 ? item.price :item.halfPrice}`"
:cellStyle="{ padding: '10px 5px' }"
/>
<!-- <uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 0' }" :border="false" v-if="childrenPrice > 0">
<template v-slot:title>
<uv-radio-group v-model="radiovalue" :disabled="orderId > 0" @change="onRadiovalue">
<uv-radio
:customStyle="{margin: '8px'}"
v-for="(val, index) in radiolist"
:key="index"
:label="`${val.name}¥${index == 0 ? item.price : childrenPrice}`"
:name="val.name">
</uv-radio>
</uv-radio-group>
</template>
</uv-cell> -->
<template v-if="form.sid === 37">
<uv-cell @click="changeIsChildren(2)" iconStyle="checkbox-mark" :title="`成人票 ¥${item.price}`"
:cellStyle="{ padding: '10px 5px' }">
<template v-slot:right-icon>
<uv-icon v-if="parseInt(isChildren) === 2" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
<uv-cell @click="changeIsChildren(1)" iconStyle="checkbox-mark" :title="`儿童票 ¥${item.childrenPrice}`"
:cellStyle="{ padding: '10px 5px' }" :border="false">
<template v-slot:right-icon>
<uv-icon v-if="parseInt(isChildren) === 1" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
<uv-cell iconStyle="checkbox-mark" title="人数"
:cellStyle="{ padding: '10px 5px' }" :border="false">
<template v-slot:value>
<uv-number-box v-model="peopleNum" @change="reCalSwimAmount"/>
</template>
</uv-cell>
</template>
</block>
</block>
</uv-cell-group>
</uni-card>
<uni-card :title="`选择支付方式`" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in payment" :key="index">
<uv-cell
:title="`${item.name}`"
:icon="`${item.image}`"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: item.type === form.payType ? '#f6fff1' : '' }"
:border="false"
@click="onPayType(item.type)"
>
<template v-slot:right-icon>
<uv-icon v-if="item.type === form.payType" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</block>
<uv-cell
:title="balancePayTitle"
icon="https://oss.wsdns.cn/20240511/fae57a94fa0042b9bceb721421304db1.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: 19 === form.payType ? '#f6fff1' : '', opacity: canUseBalancePay ? 1 : 0.45 }"
:border="false"
@click="onPayType(19)"
>
<template v-slot:right-icon>
<text v-if="!canUseBalancePay" class="balance-tip">余额不足</text>
<uv-icon v-else-if="19 === form.payType" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</uv-cell-group>
<view slot="actions" class="card-actions">
<view class="card-actions-item">
<span class="web-text-danger">已优惠¥{{ reducePrice }}</span>
<span class="web-text-heading">¥{{ payPrice || 0.0 }}</span>
</view>
</view>
</uni-card>
<uni-card :title="`选择会员卡`" :border="false" :is-shadow="false" v-if="form.payType === 2">
<template v-if="vipCard.length > 0">
<uv-cell v-for="(v, vIndex) in vipCard" :key="vIndex"
:title="`${v.name}`"
:label="v.desc"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: form.vid === v.id ? '#f6fff1' : '' }"
:border="false"
@click="selectVipCard(v)"
>
<template v-slot:right-icon>
<uv-icon v-if="form.vid === v.id" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</template>
<uv-empty v-else text="暂无可用会员卡"/>
</uni-card>
<uni-card :title="`选择IC卡`" :border="false" :is-shadow="false" v-if="form.payType === 5">
<template v-if="userCard.length > 0">
<uv-cell v-for="(v, vIndex) in userCard" :key="vIndex"
:title="`${v.name}`"
:label="v.desc"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: form.code === v.code ? '#f6fff1' : '' }"
:border="false"
@click="selectUserCard(v)"
>
<template v-slot:right-icon>
<uv-icon v-if="form.code === v.code" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</template>
<uv-empty v-else text="暂无可用IC卡"/>
</uni-card>
<view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
<uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>
<view class="text" @click="onDisabled">
<text>同意以下服务条款</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《广西体育中心预定条款》</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》
</text>
</view>
</view>
</view>
<!-- 支付按钮 -->
<uv-gap height="50"></uv-gap>
<view class="checkout-car">
<view class="car-total">
<text style="color: #ebcf00">合计¥</text>
<uv-count-to decimals="2" duration="50" color="#ebcf00" bold :endVal="payPrice"></uv-count-to>
</view>
<uv-button
class="save-btn"
:disabled="!disabled"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="提交订单"
@click="save"
></uv-button>
</view>
</view>
<!-- 登录组件 -->
<!-- <ws-login ref="login" :logo="logo" @done="reload" />-->
<!-- 支付密码弹窗 -->
<uni-popup ref="payPasswordForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="请输入支付密码" :border="false" :is-shadow="false" :padding="0">
<view class="pay-password-card">
<uni-forms ref="form" :label-width="80">
<uni-forms-item label="支付密码" name="payPassword" required>
<uv-code-input mode="box" dot :space="0" :maxlength="6" hairline v-model="payPassword"
@finish="onPayPassword"></uv-code-input>
</uni-forms-item>
<!-- <uv-button
class="to-pay-btn"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="确定支付"
:disabled="disabledPayPayPassword"
@click="onPayPassword"
></uv-button> -->
</uni-forms>
<text @click="navTo(`/package/user/pay-password`)" class="web-text-primary">忘记支付密码?</text>
</view>
</uni-card>
</uni-popup>
</template>
<script>
import * as Api from '@/api/shop/order';
import * as UserApi from '@/api/booking/users';
import * as PaymentApi from '@/api/system/payment';
import {checkPayPassword} from '@/api/passport/login';
import {getWeek, getKey} from '@/utils/common';
import {useUserStore} from '@/store/modules/user';
import dayjs from "dayjs";
import {addThinkOrder, updateThinkOrder} from "@/api/think/thinkOrder";
import {listUserThinkCard} from "@/api/think/thinkCard";
import {listThinkUsersVip} from "@/api/think/thinkUsersVip";
import {number} from "@/uni_modules/uv-ui-tools/libs/function/test";
import md5 from 'md5'
const userStore = useUserStore();
// const carStore = useCarStore();
// const { merchantId, merchantCode, orderInfo, period, totalPrice, reducePrice, payPrice, childrenPrice, carNum, carNum2, merchant, type, dateTime } = storeToRefs(carStore);
export default {
computed: {
dayjs() {
return dayjs
},
currentBalance() {
return Number(this.userInfo?.balance || this.userInfo?.money || 0);
},
canUseBalancePay() {
return this.currentBalance >= Number(this.payPrice || 0);
},
balancePayTitle() {
return `余额支付(当前余额¥${this.currentBalance.toFixed(2)})`;
}
},
data() {
return {
orderId: 0,
userInfo: {},
// 表单信息
form: {
name: '',
phone: '',
sid: null,
cid: null,
vid: null,
code: null,
payType: null,
thinkOrderInfos: []
},
list: [],
// 支付方式
payment: [],
// 场馆信息
// merchant,
// merchantId,
// merchantCode,
// orderInfo,
// carNum,
carNum2: 0,
week: 0,
// totalPrice,
reducePrice: 0,
// payPrice,
// childrenPrice,
// period,
cardId: 0,
getWeek,
isLogin: false,
disabled: true,
cardList: [],
userCard: [],
allUserCard: [],
vipCard: [],
allVipCard: [],
// isRefresh: true,
// 支付密码是否正确
isPayPasswordCorrect: false,
disabledPayPayPassword: false,
payPassword: '',
// 折扣率
discount: 1,
radiovalue: '成人票',
originPrice: 0,
isChildren: null,
peopleNum: 1,
};
},
async onLoad() {
// if (option.id) {
// this.orderId = option.id;
// this.form.orderId = option.id;
// }
// this.reload();
// this.getUserCa"rd();
const eventChannel = this.getOpenerEventChannel();
const _this = this
this.userInfo = await userStore.fetchUserInfo();
eventChannel.on('data', async (data) => {
_this.list = data
if (data[0].isHalf === 1) _this.payPrice = data.reduce((a, b) => a + parseFloat(b.halfPrice), 0)
else _this.payPrice = data.reduce((a, b) => a + parseFloat(b.price), 0)
_this.originPrice = JSON.parse(JSON.stringify(_this.payPrice))
console.log(_this.list)
const thinkOrderInfos = []
data.forEach(item => {
const [startTime, endTime] = item.timePeriod.split(' - ')
const mergeData = dayjs(item.dateTime).format('YYYY-MM-DD') + `${startTime}${endTime}${item.sid}${item.fieldId}`
thinkOrderInfos.push({
sid: item.sid,
fid: item.fieldId,
siteName: item.siteName,
fieldName: item.fieldName,
dateTime: item.comments,
adultNum: item.adultNum,
childrenNum: item.childrenNum,
type: item.type,
mergeData,
startTime: item.startTime,
timePeriod: item.dateTime,
siteTimeId: item.siteTimeId,
})
_this.form = {
name: _this.userInfo.realName,
phone: _this.userInfo.phone,
sid: data[0].sid,
fid: data[0].fieldId,
cid: null,
vid: null,
code: null,
payType: 1,
thinkOrderInfos,
day: dayjs(item.dateTime).format('D') - 1,
startTime: thinkOrderInfos.map(item => item.startTime).join()
}
})
_this.isChildren = data[0].isChildren
// console.log(data)
// console.log(this.isChildren)
await this.getPayment()
await this.getUserCard()
await this.getUserVipCard()
console.log(this.form)
})
},
async onShow() {
this.userInfo = await userStore.fetchUserInfo();
this.form.name = this.userInfo.realName;
this.form.phone = this.userInfo.phone;
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
this.openLogin();
},
// computed: {
// payPrice(){
// console.log('this.payPrice: ',this.payPrice);
// },
// carNum(){
// console.log('orderInfo[0].adultNum: ',this.adultNum);
// return this.adultNum;
// // return carStore.payPrice;
// }
// },
methods: {
async reload() {
const app = this;
const {form, orderId, merchant, totalPrice, orderInfo} = this;
// 当前登录用户信息
app.userInfo = await userStore.fetchUserInfo();
// 获取用户副表信息
UserApi.getByPhone({
phone: app.userInfo.phone
}).then((data) => {
if (data) {
app.hideUser = false;
app.userInfo.money = data.money;
console.log('money', app.userInfo.money)
app.userInfo.ouid = data.userId;
app.userInfo = Object.assign({}, app.userInfo, data);
}
});
// 整理订单信息
form.type = 1; // 订单类型 0商城订单 1预定订单
form.payPrice = totalPrice;
form.orderInfo = orderInfo;
app.payPrice = totalPrice;
if (merchant) {
app.merchantId = merchant.merchantId;
form.merchantId = merchant.merchantId;
form.merchantName = merchant.merchantName;
form.merchantCode = merchant.merchantCode;
form.comments = merchant.merchantName + ' ' + orderInfo[0].fieldName + ' ' + orderInfo[0].dateTime;
}
console.log('重新赋值订单信息: ', orderId);
// 重新赋值订单信息
if (orderId > 0) {
Api.getOrder(orderId).then((data) => {
app.form = data;
app.orderInfo = data.orderInfo;
app.totalPrice = data.totalPrice;
app.reducePrice = data.reducePrice;
app.payPrice = data.payPrice;
app.merchantId = data.merchantId;
app.childrenPrice = data.orderInfo[0].childrenPrice;
if (data.orderInfo[0].adultNum > 0) {
app.radiovalue = '成人票'
app.carNum = data.orderInfo[0].adultNum
}
if (data.orderInfo[0].childrenNum > 0) {
app.radiovalue = '儿童票'
app.carNum = data.orderInfo[0].childrenNum
}
carStore.setOrderInfo(data.orderInfo)
});
}
// 请求数据
app.userCard = []
Promise.all([app.getUserCard(), app.getPayment()]).then((res) => {
const userCard = res[0];
const payment = res[1];
// 当前可用会员卡
if (userCard.length > 0) {
app.userCard = userCard.filter(card => {
const sid = card.sid.split(',');
return sid.includes(res[0].sid)
});
if (app.userCard.length > 0) app.form.vid = app.userCard[0].id;
}
// 支付方式列表
app.payment = payment.map((d) => {
if (d.type == 0) {
d.name = `${d.name} (余额¥${app.userInfo.money || 0})`;
}
if (d.type == 2 && userCard) {
d.name = `${userCard.name}(¥${userCard.remainingMoney})`;
}
return d;
});
});
},
// 读取可用的会员卡
async getUserCard() {
const res = await listUserThinkCard()
if (res.length) {
this.userCard = res
if (this.userCard.length > 0) {
this.userCard = this.userCard.filter(card => {
const sid = card.sid.split(',').map(Number);
return sid.includes(parseInt(this.form.sid))
});
this.allUserCard = JSON.parse(JSON.stringify(this.userCard))
this.allUserCard = this.allUserCard.map(item => {
item.desc += `${dayjs(item.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss')}过期`
if (item.type === 2) item.desc += `,剩余${item.num}次`
else if (item.type === 5) item.desc += `,剩余${item.remainingMoney}元`
return item
})
const newList = []
for (let i = 0; i < this.allUserCard.length; i++) {
const item = this.allUserCard[i]
if (item.type === 2) {
if (item.num > 0) newList.push(item)
} else if (item.type === 5) {
if (item.remainingMoney > 0) newList.push(item)
} else newList.push(item)
}
this.allUserCard = JSON.parse(JSON.stringify(newList))
this.makeUserCardList()
}
}
},
makeUserCardList() {
this.userCard = this.allUserCard.filter(item => dayjs(item.expireTime * 1000).isAfter(dayjs()))
if (this.isChildren === 2) {
this.userCard = this.userCard.filter(item => item.cardType !== 2)
} else {
this.userCard = this.userCard.filter(item => item.cardType === 2)
}
if (this.userCard.length) {
this.userCard.sort((a, b) => a.type - b.type)
this.form.payType = 5
this.form.vid = null
let card = null
for (let i = 0; i < this.userCard.length; i++) {
const item = this.userCard[i]
if (item.type === 1) {
this.form.code = item.code
card = item
break
}
if (item.type === 3) {
this.form.code = item.code
card = item
break
}
if (item.type === 2) {
this.form.code = item.code
card = item
break
}
this.form.code = item.code
card = item
break
}
if (card) this.selectUserCard(card)
}
},
async getUserVipCard() {
const res = await listThinkUsersVip()
if (res.length) {
// this.vipCard = res
this.vipCard = res.filter(card => {
const sid = card.sid.split(',').map(Number);
return sid.includes(parseInt(this.form.sid))
});
this.allVipCard = JSON.parse(JSON.stringify(this.vipCard))
this.allVipCard = this.allVipCard.map(item => {
item.desc += `,${dayjs(item.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss')}过期`
if (item.type === 2) item.desc += `,剩余${item.num}次`
else if (item.type === 5) item.desc += `,剩余${item.remainingMoney}元`
return item
})
const newList = []
for (let i = 0; i < this.allVipCard.length; i++) {
const item = this.allVipCard[i]
if (item.type === 2) {
if (item.num > 0) newList.push(item)
} else if (item.type === 5) {
if (item.remainingMoney > 0) newList.push(item)
} else newList.push(item)
}
this.allVipCard = JSON.parse(JSON.stringify(newList))
this.makeUserVipCardList()
}
},
makeUserVipCardList() {
this.vipCard = this.allVipCard.filter(item => dayjs(item.expireTime * 1000).isAfter(dayjs()))
if (this.isChildren === 2) {
this.vipCard = this.vipCard.filter(item => item.cardType !== 2)
} else {
this.vipCard = this.vipCard.filter(item => item.cardType === 2)
}
if (this.vipCard.length) {
this.vipCard.sort((a, b) => a.type - b.type)
this.form.payType = 2
this.form.code = null
let card = null
for (let i = 0; i < this.vipCard.length; i++) {
const item = this.vipCard[i]
if (item.type === 1) {
card = item
this.form.vid = item.id
break
}
if (item.type === 3) {
card = item
this.form.vid = item.id
break
}
if (item.type === 2) {
card = item
this.form.vid = item.id
break
}
card = item
this.form.vid = item.id
break
}
if (card) this.selectVipCard(card)
}
},
// 读取支付方式列表
async getPayment() {
this.payment = await PaymentApi.select({status: true})
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
});
},
// 切换支付方式
async onPayType(index) {
if (index === 19 && !this.canUseBalancePay) {
uni.showToast({
title: '当前余额不足',
icon: 'none'
});
return false;
}
// app.payType = index;
this.form.payType = index;
console.log(this.form.payType)
this.form.vid = null
this.form.code = null
this.reducePrice = 0
if (this.form.sid !== 37) this.payPrice = this.originPrice
else this.reCalSwimAmount({value: this.peopleNum})
if (this.form.payType === 2) this.makeUserVipCardList()
if (this.form.payType === 5) this.makeUserCardList()
},
openUrl(url) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
} else {
uni.navigateTo({
url
});
}
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
// 验证支付密码
onPayPassword() {
if (this.payPassword == '' || !this.payPassword) {
uni.showToast({
title: '请输入支付密码',
icon: 'none'
});
return false;
}
this.disabledPayPayPassword = true;
const {payPassword} = this;
checkPayPassword({payPassword})
.then((res) => {
this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true;
this.save();
})
.catch((err) => {
uni.showToast({
title: err.message,
icon: 'none'
});
this.disabledPayPayPassword = false;
});
},
save() {
const app = this;
const {form} = this;
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意服务协议',
icon: 'none'
});
return false;
}
if (!form.name) {
uni.showToast({
title: '请输入姓名',
icon: 'none'
});
return false;
}
if (form.payType === 2 && !app.form.vid) {
uni.showToast({
title: '请选择会员卡',
icon: 'none'
});
return false;
}
if (form.payType === 5 && !app.form.code) {
uni.showToast({
title: '请选择IC卡',
icon: 'none'
});
return false;
}
uni.showLoading({
title: '订单提交中.'
});
form.thinkOrderInfos = form.thinkOrderInfos.map(item => {
item.isChildren = app.isChildren
if (form.sid === 37) {
if (app.isChildren === 1) {
item.adultNum = 0
item.childrenNum = this.peopleNum
} else if (app.isChildren === 2) {
item.adultNum = this.peopleNum
item.childrenNum = 0
}
}
return item
})
const postTime = dayjs().valueOf()
form.postTime = postTime
form.sign = md5(postTime + "wxd38cc38c54fa7370" + form.startTime + this.userInfo.uid)
addThinkOrder(form)
.then((data) => {
const orderInfo = data;
console.log(data)
// 调起微信支付
if (form.payType === 1) {
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(() => {
app.disabled = false;
uni.switchTab({url: '/pages/order'})
}, 1500);
},
fail: async (err) => {
uni.showToast({
title: '取消支付',
icon: 'error'
});
await updateThinkOrder({
id: orderInfo.orderId,
orderStatus: 3
})
console.log('支付失败', err);
app.disabled = false;
uni.switchTab({
url: '/pages/order'
});
}
});
}
// 使用余额支付
if (form.payType === 19) {
if (!orderInfo) {
return uni.showToast({
title: '支付失败',
icon: 'error'
});
}
if (orderInfo) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
uni.switchTab({url: '/pages/order'})
}, 1500);
}
}
// 使用会员卡支付
if (form.payType === 2 || form.payType === 5) {
if (!orderInfo) {
return uni.showToast({
title: '支付失败',
icon: 'error'
});
}
if (orderInfo) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
uni.switchTab({url: '/pages/order'})
}, 1500);
}
}
uni.hideLoading();
})
.catch((res) => {
uni.hideLoading();
uni.showToast({
title: res.message || '请检查您的网络.',
icon: 'none'
});
if (res.message === '未绑定人脸') {
setTimeout(() => {
uni.switchTab({url: '/pages/user'})
}, 1500)
}
});
},
selectVipCard(card) {
this.form.vid = card.id;
this.reCalAmount(card)
},
selectUserCard(card) {
this.form.code = card.code;
this.reCalAmount(card)
},
reCalAmount(card) {
// 余额折扣卡
if (card.type === 5) {
this.reducePrice = this.originPrice * (1 - (card.discount / 10))
this.reducePrice = parseFloat(this.reducePrice.toFixed(2))
this.payPrice = this.originPrice - this.reducePrice
this.payPrice = parseFloat(this.payPrice.toFixed(2))
} else {
this.reducePrice = this.originPrice
this.payPrice = 0
}
},
changeIsChildren(val) {
this.isChildren = val
this.reCalSwimAmount({value: this.peopleNum})
this.makeUserCardList()
this.makeUserVipCardList()
},
reCalSwimAmount({value}) {
this.peopleNum = value
if (this.isChildren === 2) this.payPrice = this.list.reduce((a, b) => a + b.price, 0)
else this.payPrice = this.list.reduce((a, b) => a + b.childrenPrice, 0)
this.payPrice = this.payPrice * this.peopleNum
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss" scoped>
.container {
}
.balance-tip {
font-size: 24rpx;
color: #fa3534;
}
.checkout-car {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
display: flex;
justify-content: space-between;
background-color: #000000;
border-radius: 100px;
align-items: center;
.car-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
.web-text-heading {
font-size: 38rpx;
margin-left: 28rpx;
}
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.xieyi {
margin-bottom: 80rpx;
padding: 0 30rpx;
.text {
margin-left: 5rpx;
.link {
color: #0f80ff;
}
}
}
.pay-password-card {
width: 600rpx;
min-height: 300rpx;
margin: 30rpx auto;
background-color: #ffffff;
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
.web-text-primary {
line-height: 2rem;
padding: 20rpx 0;
}
}
.to-pay-btn {
width: 400rpx !important;
margin: 40rpx auto;
}
</style>