完善功能
This commit is contained in:
@ -1,14 +1,106 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<!-- 费用明细弹窗 -->
|
||||
<Popup :show="billPopup" :width='750' :padding="0" type="bottom" backgroundColor="#FBFBFB" radius="32rpx 32rpx 0 0">
|
||||
<view class="ww100 box-s-b pop-improt typeof pr time-popup">
|
||||
<image style="width: 64rpx;height: 64rpx;position: absolute; top: 26rpx;right: 30rpx;" src="@/static/icon/close2.png" mode="" @click="closeBillPopup"></image>
|
||||
|
||||
<view class="d-c-c pt42">
|
||||
<text class="f34 fb">费用明细</text>
|
||||
</view>
|
||||
|
||||
<view class="bg-white bill-info">
|
||||
<!-- 网球场 -->
|
||||
<view v-if="typeId == 1">
|
||||
<view class="title1 d-b-c">
|
||||
<view>场地费</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.cdf.total"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<view>场地费(¥{{ bill.cdf.price }}元/小时)</view>
|
||||
<view>x{{ bill.cdf.nums }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 篮球场 -->
|
||||
<view v-if="typeId == 2">
|
||||
<view class="title1 d-b-c">
|
||||
<view>使用费</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.cdf.total"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<view>¥{{ bill.cdf.price }}元/人</view>
|
||||
<view>x1</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="margin-top: 52rpx;" v-if="typeId == 1">
|
||||
<view class="title1 d-b-c">
|
||||
<view>灯光费</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.dgf.total"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<view>灯光费(¥{{ bill.dgf.price }}元/小时)</view>
|
||||
<view>x{{ bill.dgf.nums }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="line"></view>
|
||||
|
||||
<view class="title3 d-b-c">
|
||||
<view>实付金额</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.total"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="price2 bg-white" style="margin: 0; padding: 56rpx 22rpx 42rpx;">
|
||||
<view class="d-b-c price-block" style="margin: 0;">
|
||||
<view class="d-f d-c j-c-b">
|
||||
<view class="">
|
||||
合计: <price-format color="#FF5951" :subscript-size="26" :first-size="40" :second-size="40" :price="bill.total"></price-format>
|
||||
</view>
|
||||
<view class="d-f j-c-c a-i-c" style="margin-top: 10rpx;" @click="closeBillPopup">
|
||||
<view class="price-detail">费用明细</view>
|
||||
<image style="width: 14rpx;height: 8rpx;margin-left: 10rpx;" src="@/static/icon/up.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price-btn" @tap="toConfirm">立即支付<text class="" v-if="countSelectedTime > 0">({{countSelectedTime}}小时)</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</Popup>
|
||||
|
||||
<navbar title="确认订单"></navbar>
|
||||
|
||||
<!-- 预约信息 -->
|
||||
<view class="bg-white box pr">
|
||||
<view class="current"></view>
|
||||
<view class="title">预约信息</view>
|
||||
<view class="desc">预约场地:这里是场地的名称</view>
|
||||
<view class="desc">预约时间:2025-03-18 09:00-12:00</view>
|
||||
<view class="desc">预约时长:3小时</view>
|
||||
|
||||
<template v-if="typeId == 1">
|
||||
<view class="desc">预约场地:{{ room.title }}</view>
|
||||
<view class="desc">
|
||||
预约时间:{{ date && date.dayLabel ? date.dayLabel : '' }}
|
||||
{{ date && date.hour ? date.hour : '' }}:{{ date && date.minute ? date.minute : '' }}
|
||||
</view>
|
||||
<view class="desc">预约时长:{{ date && date.duration ? date.duration : 0 }}小时</view>
|
||||
</template>
|
||||
|
||||
<template v-if="typeId == 2">
|
||||
<view class="desc">预约场地:{{ room.title }}</view>
|
||||
<view class="desc">
|
||||
预约时间:{{ basketballDate }}
|
||||
</view>
|
||||
<view class="desc">预约人数:1人</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- 其他须知 -->
|
||||
@ -17,14 +109,22 @@
|
||||
<view class="title">
|
||||
其他须知
|
||||
</view>
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">17点前预约100元/小时</view>
|
||||
</view>
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">17点后需要加收灯光费,120元/小时</view>
|
||||
</view>
|
||||
<template v-if="typeId == 1">
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">17点前预约100元/小时</view>
|
||||
</view>
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">17点后需要加收灯光费,120元/小时</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="typeId == 2">
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">默认选择4小时,注意闭馆时间</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- 退订规则 -->
|
||||
@ -50,79 +150,16 @@
|
||||
<view class="d-b-c price-block">
|
||||
<view class="d-f d-c j-c-b">
|
||||
<view class="">
|
||||
合计: <price-format color="#FF5951" :subscript-size="26" :first-size="40" :second-size="40" price="100"></price-format>
|
||||
合计: <price-format color="#FF5951" :subscript-size="26" :first-size="40" :second-size="40" :price="bill.total"></price-format>
|
||||
</view>
|
||||
<view class="d-f j-c-c a-i-c" style="margin-top: 10rpx;" @tap="handleShowBill">
|
||||
<view class="price-detail">费用明细</view>
|
||||
<image style="width: 14rpx;height: 8rpx;margin-left: 10rpx;" src="@/static/icon/down.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price-btn" @tap="toConfirm">立即预定<text class="" v-if="countSelectedTime > 0">({{countSelectedTime}}小时)</text></view>
|
||||
<view class="price-btn" @tap="toConfirm">立即支付<text class="" v-if="countSelectedTime > 0">({{countSelectedTime}}小时)</text></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 费用明细弹窗 -->
|
||||
<Popup :show="billPopup" :width='750' :padding="0" type="bottom" backgroundColor="#FBFBFB" radius="32rpx 32rpx 0 0">
|
||||
<view class="ww100 box-s-b pop-improt typeof pr time-popup">
|
||||
<image style="width: 64rpx;height: 64rpx;position: absolute; top: 26rpx;right: 30rpx;" src="@/static/icon/close2.png" mode="" @click="closeBillPopup"></image>
|
||||
|
||||
<view class="d-c-c pt42">
|
||||
<text class="f34 fb">费用明细</text>
|
||||
</view>
|
||||
|
||||
<view class="bg-white bill-info">
|
||||
<view class="">
|
||||
<view class="title1 d-b-c">
|
||||
<view>场地费</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" price="100"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<view>场地费(¥100元/小时)</view>
|
||||
<view>x3</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="margin-top: 52rpx;">
|
||||
<view class="title1 d-b-c">
|
||||
<view>灯光费</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" price="100"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<view>灯光费(¥50元/小时)</view>
|
||||
<view>x3</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="line"></view>
|
||||
|
||||
<view class="title3 d-b-c">
|
||||
<view>实付金额</view>
|
||||
<view>
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" price="100"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="price2 bg-white" style="margin: 0; padding: 56rpx 22rpx 42rpx;">
|
||||
<view class="d-b-c price-block" style="margin: 0;">
|
||||
<view class="d-f d-c j-c-b">
|
||||
<view class="">
|
||||
合计: <price-format color="#FF5951" :subscript-size="26" :first-size="40" :second-size="40" price="100"></price-format>
|
||||
</view>
|
||||
<view class="d-f j-c-c a-i-c" style="margin-top: 10rpx;" @click="closeBillPopup">
|
||||
<view class="price-detail">费用明细</view>
|
||||
<image style="width: 14rpx;height: 8rpx;margin-left: 10rpx;" src="@/static/icon/up.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price-btn">立即预定<text class="" v-if="countSelectedTime > 0">({{countSelectedTime}}小时)</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</Popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -138,12 +175,124 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
venueId: 0,
|
||||
roomId: 0,
|
||||
typeId: 1, // 网球场1 篮球场2
|
||||
billPopup: false,
|
||||
showPrice: true
|
||||
showPrice: true,
|
||||
adding: true,
|
||||
basketballDate: null,
|
||||
venue: {},
|
||||
room: {},
|
||||
countSelectedTime: 0,
|
||||
bill: {
|
||||
cdf: {
|
||||
nums: 0, // 场地费小时数
|
||||
price: 0, // 场地费单价
|
||||
total: 0 // 场地费总价
|
||||
},
|
||||
dgf: {
|
||||
nums: 0, // 灯光数量
|
||||
price: 0, // 灯光单价
|
||||
total: 0 // 灯光总价
|
||||
},
|
||||
total: 0 // 总价
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
onLoad(args) {
|
||||
this.venueId = args.venueId || 0;
|
||||
this.roomId = args.roomId || 0;
|
||||
this.typeId = args.typeId || 1;
|
||||
this.basketballDate = args.date || null;
|
||||
console.log("🚀 ~ this.date:", this.date)
|
||||
this.getData();
|
||||
},
|
||||
|
||||
methods: {
|
||||
getData() {
|
||||
let self = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
|
||||
const reserveDate = uni.getStorageSync('reserveDate') || null
|
||||
self.date = reserveDate
|
||||
self.countSelectedTime = reserveDate && reserveDate.duration ? reserveDate.duration : 0
|
||||
if (self.typeId == 2) {
|
||||
self.countSelectedTime = 4
|
||||
}
|
||||
|
||||
// 获取场馆详情
|
||||
self._post(
|
||||
'ground.ground/groundDetails',
|
||||
{
|
||||
app_id: self.getAppId(),
|
||||
id: self.venueId,
|
||||
latitude: uni.getStorageSync('latitude') || '',
|
||||
longitude: uni.getStorageSync('longitude') || '',
|
||||
},
|
||||
function (res) {
|
||||
if (res.code) {
|
||||
self.loadding = false;
|
||||
self.venue = res.data.lists
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 获取场馆包间详情
|
||||
self._post(
|
||||
'ground.ground/groundRoomDetails',
|
||||
{
|
||||
app_id: self.getAppId(),
|
||||
id: self.roomId, // 场馆包间ID
|
||||
},
|
||||
function(res) {
|
||||
console.log("🚀 ~ res:", res)
|
||||
if (res.code) {
|
||||
self.room = res.data.lists;
|
||||
}
|
||||
|
||||
self.loadding = false;
|
||||
}
|
||||
)
|
||||
|
||||
// 计算费用明细
|
||||
if (self.countSelectedTime > 0) {
|
||||
self._post(
|
||||
'ground.ground/countPrice',
|
||||
{
|
||||
app_id: self.getAppId(),
|
||||
room_id: self.roomId,
|
||||
nums: self.countSelectedTime,
|
||||
type_id: self.typeId,
|
||||
},
|
||||
function(res) {
|
||||
const result = res.data.lists
|
||||
self.bill = {
|
||||
total: result.order_amount,
|
||||
cdf: {
|
||||
nums: result.nums,
|
||||
price: result.room_price,
|
||||
total: result.room_all_price
|
||||
},
|
||||
dgf: {
|
||||
nums: result.nums,
|
||||
price: result.light_price,
|
||||
total: result.light_all_price
|
||||
}
|
||||
}
|
||||
console.log("🚀 ~ self.bill:", self.bill)
|
||||
|
||||
self.loadding = false;
|
||||
}
|
||||
)
|
||||
} else {
|
||||
self.loadding = false;
|
||||
}
|
||||
},
|
||||
|
||||
// 显示费用明细
|
||||
handleShowBill() {
|
||||
this.showPrice = false;
|
||||
@ -154,6 +303,62 @@
|
||||
this.billPopup = false;
|
||||
this.showPrice = true;
|
||||
},
|
||||
|
||||
// 去支付
|
||||
toConfirm() {
|
||||
if (this.countSelectedTime === 0) {
|
||||
uni.showToast({title: '请选择时间后再预定', icon: 'none'});
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
self._post(
|
||||
'order.groundOrder/submitStoreOrder',
|
||||
{
|
||||
app_id: self.getAppId(),
|
||||
ground_id: self.venueId,
|
||||
room_id: self.roomId,
|
||||
hours: 1,
|
||||
day_time: self.date ? self.date.date : '',
|
||||
start_time: self.date ? self.date.startTime : '',
|
||||
end_time: self.date ? self.date.endTime : '',
|
||||
},
|
||||
function(res) {
|
||||
console.log("🚀 ~ order res:", res)
|
||||
self._post(
|
||||
'user.groundOrder/pay',
|
||||
{
|
||||
app_id: self.getAppId(),
|
||||
order_id: res.data.lists.id
|
||||
},
|
||||
function(res) {
|
||||
const data = res.data
|
||||
console.log("🚀 ~ pay data:", data)
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: data.payment.timeStamp,
|
||||
nonceStr: data.payment.nonceStr,
|
||||
package: 'prepay_id=' + data.payment.prepay_id,
|
||||
signType: 'MD5',
|
||||
paySign: data.payment.paySign,
|
||||
success: res => {
|
||||
console.log("🚀 ~ pay success res:", res)
|
||||
},
|
||||
fail: res => {
|
||||
console.log("🚀 ~ pay fail res:", res)
|
||||
uni.reLaunch({
|
||||
url: '/pages/order/cg-my-order',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
)
|
||||
self.loadding = false;
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user