开启篮球预定

This commit is contained in:
wangxiaowei
2025-12-25 00:07:22 +08:00
parent ff99f9e189
commit 7a58939b65
9 changed files with 458 additions and 199 deletions

View File

@ -26,12 +26,22 @@
</view> </view>
</view> </view>
</view> </view>
<view >
<checkbox-group @change="checkboxChange">
<text class="" style="margin-right: 20rpx;" @click="see">我已阅读并同意充值协议</text>
<checkbox value="true" :checked="yxChekced"/>
</checkbox-group>
<!-- <text class="" style="margin-right: 20rpx;">我已阅读并同意充值协议</text>
<checkbox value="cb" class="checkbox" :checked="yxChekced" @change="yxChekced = !yxChekced" /> -->
</view>
</view> </view>
<view class="r-desc"> <view class="r-desc">
<view class="r-desc1">充值说明</view> <view class="r-desc1">充值说明</view>
<view class="r-desc2">a.账户充值仅限在线方式支付充值金额实时到账</view> <view class="r-desc2">a.账户充值仅限在线方式支付充值金额实时到账</view>
<view class="r-desc2">b.有问题请联系客服</view> <view class="r-desc2">b.有问题请联系客服</view>
<view class="r-desc2">c.充值前请先查看本协议<text style="color: #FF5951;" @click="see">充值协议</text></view>
</view> </view>
<view class="card-btn" @click="confirmCard">确定</view> <view class="card-btn" @click="confirmCard">确定</view>
@ -67,7 +77,8 @@
return { return {
cardPopup: false, cardPopup: false,
currentType: -1, currentType: -1,
balance: {} balance: {},
yxChekced: true
} }
}, },
@ -92,17 +103,55 @@
this.currentType = index; this.currentType = index;
}, },
checkboxChange(e) {
console.log("🚀 ~ e:", e)
this.yxChekced = e.detail.value[0]
console.log("🚀 ~ e:", this.yxChekced)
},
// 确认选择 // 确认选择
confirmCard() { confirmCard() {
if (this.currentType == -1) { if (!this.yxChekced) {
uni.showToast({ uni.showToast({
title: '请选择充值金额', title: '请同意充值协议',
icon: 'none' icon: 'none'
}); });
return; return;
} }
this.wxPay() let self = this;
uni.showLoading({
title: '加载中'
});
self._post('user.index/detail', {
source: self.getPlatform()
}, function(res) {
uni.hideLoading();
console.log("🚀 ~ res:", res)
if (res.data.userInfo.mobile == '') {
uni.showModal({
title: '提示',
content: '请先绑定手机号',
success: function(sm) {
if (sm.confirm) {
uni.switchTab({
url: '/pages/user/index/index'
});
}
}
});
}else {
if (self.currentType == -1) {
uni.showToast({
title: '请选择充值金额',
icon: 'none'
});
return;
}
self.wxPay()
}
});
}, },
// 微信支付 // 微信支付
@ -180,6 +229,12 @@
}, 500); }, 500);
} }
}, },
see() {
uni.navigateTo({
url: '/pages/webview/webview?url=https://xh.stnav.com/czxy.html'
});
}
} }
} }

View File

@ -217,9 +217,9 @@
</template> </template>
<template v-if="typeId == 2"> <template v-if="typeId == 2">
<view class="desc">预约场地{{ room.title }}</view> <view class="desc">预约场地{{ order.room_name }}</view>
<view class="desc"> <view class="desc">
预约时间{{ basketballDate }} 预约时间{{ order.dtime }}
</view> </view>
<view class="desc">预约人数1</view> <view class="desc">预约人数1</view>
</template> </template>
@ -272,7 +272,7 @@
</view> </view>
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view> <view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
</view> </view>
<view :class="payType == 'balance' ? 'item active' : 'item'" @tap="payTypeFunc('balance')"> <view v-if="typeId == 1" :class="payType == 'balance' ? 'item active' : 'item'" @tap="payTypeFunc('balance')">
<view class="d-s-c"> <view class="d-s-c">
<view class="icon-box d-c-c mr10"><span class="icon iconfont icon-yue"></span></view> <view class="icon-box d-c-c mr10"><span class="icon iconfont icon-yue"></span></view>
<text class="key">平台余额</text> <text class="key">平台余额</text>
@ -376,8 +376,7 @@
this.orderId = args.orderId || 0; // 订单ID this.orderId = args.orderId || 0; // 订单ID
this.venueId = args.venueId || 0; // 场馆ID this.venueId = args.venueId || 0; // 场馆ID
this.typeId = args.typeId || 1; // 网球场1 篮球场2 this.typeId = args.typeId || 1; // 网球场1 篮球场2
this.basketballDate = args.date || null; // 篮球场预约时间 // this.basketballDate = args.date || null; // 篮球场预约时间
console.log("🚀 ~ this.date:", this.date)
this.getData(); this.getData();
this.getRecharge() this.getRecharge()
}, },
@ -592,7 +591,7 @@
if (this._submitting) return; if (this._submitting) return;
this._submitting = true; this._submitting = true;
if (this.countSelectedTime === 0) { if (this.countSelectedTime === 0 && this.typeId == 1) {
uni.showToast({title: '请选择时间后再预定', icon: 'none'}); uni.showToast({title: '请选择时间后再预定', icon: 'none'});
this._submitting = false; this._submitting = false;
return; return;

View File

@ -37,7 +37,7 @@
<view class="title1 d-b-c"> <view class="title1 d-b-c">
<view>使用费</view> <view>使用费</view>
<view> <view>
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.cdf.total"></price-format> <price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.cdf.price"></price-format>
</view> </view>
</view> </view>
<view class="title2 d-b-c"> <view class="title2 d-b-c">
@ -136,7 +136,7 @@
<view class="tag"> <view class="tag">
<view class="tag1">可预约</view> <view class="tag1">可预约</view>
<view class="tag2">已选中</view> <view class="tag2">已选中</view>
<view class="tag3">不可约</view> <view class="tag3">约</view>
</view> </view>
</view> </view>
@ -158,23 +158,28 @@
{{ item.t }} {{ item.t }}
</view> </view>
</view> </view>
<view class="d-f cg-info" style="width: 800rpx; overflow-x: auto;" v-if="timeList.length > 0"> <view class="d-f cg-info pr" style="" v-if="timeList.length > 0">
<view style="width: 120rpx;margin-right: 10rpx;" v-for="(item2, index2) in cdList" :key="index2"> <!-- <view class="cg-border"></view> -->
<view class="" style="margin-bottom: 6rpx; text-align: center;">{{ item2.title }}</view> <view class="" style="width: 120rpx;margin-right: 20rpx;" v-for="(item2, index2) in cdList" :key="index2">
<view <view class="" style="margin-bottom: 20rpx; text-align: center;">{{ item2.title }}</view>
v-for="(item3, index3) in item2.time" :key="index3"
@click="handleSelectTime(item2.title, item3.t, item3.status, item2.room_id, item3.price, item3.light_price)" <view class="pr" style="padding-bottom: 30rpx;">
class="cg-info-time" :class="[ <!-- <view class="cg-right-border" :class="{ 'no-border': index2 === cdList.length - 1 }"></view> -->
item3.status == 1 <view
? 'cg-info-time-none' ref="cgInfoTime"
: selectedTime[item2.title] && selectedTime[item2.title].includes(item3.t) v-for="(item3, index3) in item2.time" :key="index3"
? 'cg-info-time-select' @click="handleSelectTime(item2.title, item3.t, item3.status, item2.room_id, item3.price, item3.light_price)"
: 'cg-info-time-normal' class="cg-info-time" :class="[
]" > item3.status == 1
<!-- <template v-if="item3.t != '22:00'"> --> ? 'cg-info-time-none'
<template v-if="item3.price > 0">{{ item3.price }}</template> : selectedTime[item2.title] && selectedTime[item2.title].includes(item3.t)
<template v-else>免费</template> ? 'cg-info-time-select'
<!-- </template> --> : 'cg-info-time-normal'
]" >
<template v-if="item3.price > 0">{{ item3.price }}</template>
<template v-if="item3.status == 1">已约</template>
<template v-else>免费</template>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -198,7 +203,7 @@
<view class="mx-30rpx"> <view class="mx-30rpx">
<view class="reserve-time">预定时间</view> <view class="reserve-time">预定时间</view>
<view class="reserve-desc" @click="timePopup = true"> <view class="reserve-desc" @click="timePopup = true">
<view class="reserve-desc-title">默认4小时注意闭馆时间</view> <view class="reserve-desc-title">场地时间营业至22:00注意闭馆时间</view>
<view class="reserve-desc-info"> <view class="reserve-desc-info">
<view class="">{{ date || '请选择' }}</view> <view class="">{{ date || '请选择' }}</view>
<view class=""> <view class="">
@ -262,7 +267,11 @@ export default {
venueRoomLists: [], venueRoomLists: [],
loadding: true, loadding: true,
timePopup: false, timePopup: false,
date: '', date: '', // 选择的篮球场管预约时间
dayTitle: '', // 选择的篮球场管预约日期标题
dayTime: '', // 选择的篮球场管预约日期
datetimestamp: '', // 选择的篮球场管预约时间戳
dateEndTimestamp: '', // 选择的篮球场管预约结束时间戳
showPrice: true, showPrice: true,
bill: { bill: {
cdf: { cdf: {
@ -353,6 +362,10 @@ export default {
// 篮球场场馆-切换tab // 篮球场场馆-切换tab
handleTabClick(idx) { handleTabClick(idx) {
this.selectedRoomIndex = idx this.selectedRoomIndex = idx
this.date = ''
this.datetimestamp = ''
this.bill.cdf.price = 0
this.bill.total = 0
}, },
// 切换tab // 切换tab
@ -386,14 +399,17 @@ export default {
}); });
}, },
// 确认选择时间 // 篮球场-确认选择时间
confirmSelectTime(e) { confirmSelectTime(e) {
console.log("🚀 ~ e:", e)
let self = this
this.date = e.value this.date = e.value
this.datetimestamp = e.timestamp
// 计算费用明细 this.dateEndTimestamp = e.endtimestamp
uni.showLoading({ const price = self.venueRoomLists[self.selectedRoomIndex].price
title: '加载中' console.log("🚀 ~ price:", price)
}); this.bill.cdf.price = price
this.bill.total = price
}, },
// 计算费用明细 // 计算费用明细
@ -445,94 +461,6 @@ export default {
this.showPrice = true; this.showPrice = true;
}, },
// 立即预约
toReserve() {
let self = this
// 一进来就锁定,彻底防止高频点击
if (self.typeId == 1) {
if (self.selectedReserveTime.length === 0) {
uni.showToast({
title: '请选择预约时间',
icon: 'none'
});
return;
}
uni.showLoading({
title: '提交中',
mask: true,
});
try {
const start = self.selectedReserveTime[0].day_time + ' ' + self.selectedReserveTime[0].end_time;
const end = self.selectedReserveTime[self.selectedReserveTime.length -1].day_time + ' ' + self.selectedReserveTime[self.selectedReserveTime.length -1].end_time;
// 转换为时间戳
const startTimestamp = Math.floor(Date.parse(start.replace(/-/g, '/')) / 1000);;
const endTimestamp = Math.floor(Date.parse(end.replace(/-/g, '/')) / 1000);;
// 订单提交
self._post(
'order.groundOrder/submitStoreOrder',
{
app_id: self.getAppId(),
ground_id: self.id,
room_list: JSON.stringify(self.selectedReserveTime),
type: self.typeId,
start_end: startTimestamp + '-' + endTimestamp,
amount_price: self.bill.total
},
function(res) {
self.loadding = false;
if(res.code) {
// 记录费用明细到缓存中
// uni.setStorageSync('billDetail', JSON.stringify(self.bill));
uni.$on('payment', params => {
console.log("🚀 ~ params:", params)
uni.showLoading({
title: '加载中',
mask: true,
});
setTimeout(() => {
self.loadding = false
uni.$off("payment")
if (params.result) {
uni.redirectTo({
url: `/bundle/reserve/notice?order_id=${params.order_id}`
})
} else {
uni.redirectTo({
url: '/pages/order/cg-my-order'
})
}
}, 500)
})
uni.navigateTo({
url: `/bundle/reserve/confirm?venueId=${self.venue.id}&roomId=${self.id}&typeId=${self.typeId}&orderId=${res.data.lists.id}`
});
}
}
)
} catch (error) {
console.error('订单提交失败:', error);
uni.showToast({
title: '订单提交失败,请重试',
icon: 'none'
});
self.loadding = false;
}
} else {
if (!self.date) {
uni.showToast({
title: '请选择预约时间',
icon: 'none'
});
return;
}
uni.navigateTo({
url: `/bundle/reserve/confirm?venueId=${self.venue.id}&roomId=${self.id}&typeId=${self.typeId}`
});
}
},
/** /**
* *
@ -705,7 +633,161 @@ export default {
} }
} }
) )
} },
// 立即预约-提交订单
toReserve() {
let self = this
// 一进来就锁定,彻底防止高频点击
if (self.typeId == 1) {
if (self.selectedReserveTime.length === 0) {
uni.showToast({
title: '请选择预约时间',
icon: 'none'
});
return;
}
uni.showLoading({
title: '提交中',
mask: true,
});
try {
const start = self.selectedReserveTime[0].day_time + ' ' + self.selectedReserveTime[0].end_time;
const end = self.selectedReserveTime[self.selectedReserveTime.length -1].day_time + ' ' + self.selectedReserveTime[self.selectedReserveTime.length -1].end_time;
// 转换为时间戳
const startTimestamp = Math.floor(Date.parse(start.replace(/-/g, '/')) / 1000);;
const endTimestamp = Math.floor(Date.parse(end.replace(/-/g, '/')) / 1000);;
// 订单提交
self._post(
'order.groundOrder/submitStoreOrder',
{
app_id: self.getAppId(),
ground_id: self.id,
room_list: JSON.stringify(self.selectedReserveTime),
type: self.typeId,
start_end: startTimestamp + '-' + endTimestamp,
amount_price: self.bill.total
},
function(res) {
self.loadding = false;
if(res.code) {
// 记录费用明细到缓存中
// uni.setStorageSync('billDetail', JSON.stringify(self.bill));
uni.$on('payment', params => {
console.log("🚀 ~ params:", params)
uni.showLoading({
title: '加载中',
mask: true,
});
setTimeout(() => {
self.loadding = false
uni.$off("payment")
if (params.result) {
uni.redirectTo({
url: `/bundle/reserve/notice?order_id=${params.order_id}`
})
} else {
uni.redirectTo({
url: '/pages/order/cg-my-order'
})
}
}, 500)
})
uni.navigateTo({
url: `/bundle/reserve/confirm?venueId=${self.venue.id}&roomId=${self.id}&typeId=${self.typeId}&orderId=${res.data.lists.id}`
});
}
}
)
} catch (error) {
console.error('订单提交失败:', error);
uni.showToast({
title: '订单提交失败,请重试',
icon: 'none'
});
self.loadding = false;
}
} else {
const room = self.venueRoomLists[self.selectedRoomIndex]
if (!self.date) {
uni.showToast({
title: '请选择预约时间',
icon: 'none'
});
return;
}
try {
self.loadding = true;
const roomList = [
{
room_id: room.id,
day_time: self.datetimestamp,
day_title: self.datetimestamp,
start_time: self.datetimestamp,
end_time: self.datetimestamp,
room_price: self.bill.cdf.price,
}
]
self._post(
'order.GroundOrder/addBskStoreOrder',
{
app_id: self.getAppId(),
room_id: room.id,
ground_id: self.id,
room_list: JSON.stringify(roomList),
type: self.typeId,
start_end: self.datetimestamp + '-' + self.dateEndTimestamp,
},
function(res) {
self.loadding = false;
if(res.code) {
// 记录费用明细到缓存中
// uni.setStorageSync('billDetail', JSON.stringify(self.bill));
uni.$on('payment', params => {
console.log("🚀 ~ params:", params)
uni.showLoading({
title: '加载中',
mask: true,
});
setTimeout(() => {
self.loadding = false
uni.$off("payment")
if (params.result) {
uni.redirectTo({
url: `/bundle/reserve/notice?order_id=${params.order_id}`
})
} else {
uni.redirectTo({
url: '/pages/order/cg-my-order'
})
}
}, 500)
})
console.log("🚀 ~ res.data.lists.id:", res.data)
console.log("🚀 ~ res.data.lists.id:", res.data.lists.id)
uni.navigateTo({
url: `/bundle/reserve/confirm?venueId=${self.venue.id}&roomId=${self.id}&typeId=${self.typeId}&orderId=${res.data.lists.id}`
});
}
}
)
} catch (error) {
console.error('订单提交失败:', error);
uni.showToast({
title: '订单提交失败,请重试',
icon: 'none'
});
self.loadding = false;
}
}
},
} }
}; };
</script> </script>
@ -844,8 +926,8 @@ page {
width: 20rpx; width: 20rpx;
height: 20rpx; height: 20rpx;
border-radius: 100%; border-radius: 100%;
background: #F7F7F7; background: #41C95D;
border: 2rpx solid #E9ECF4; border: 2rpx solid #41C95D;
margin-right: 10rpx; margin-right: 10rpx;
} }
@ -1111,24 +1193,50 @@ page {
} }
.cg-time-block { .cg-time-block {
margin-top: 76rpx; margin-top: 85rpx;
.cg-time { .cg-time {
font-size: 26rpx; font-size: 26rpx;
color: #303133; color: #303133;
height: 60rpx; height: 60rpx;
line-height: 60rpx; // line-height: 60rpx;
border: 2rpx solid transparent; border: 2rpx solid transparent;
margin: 4rpx; margin: 4rpx 4rpx 14rpx;
position: relative;
} }
} }
.cg-info { .cg-info {
margin-left: 54rpx; margin-left: 54rpx;
margin-top: 38rpx; margin-top: 38rpx;
display: flex;
overflow-x: auto;
position: relative;
.cg-border {
position: absolute;
left: 0;
right: 0;
width: 100%;
border-bottom: 2rpx solid #FFC880;
top: 38rpx;
}
.cg-right-border {
position: absolute;
right: -8px;
top: -12rpx;
height: 100%;
border-right: 4rpx solid #FFC880;
}
.cg-right-border:last-of-type {
border-right: none;
}
.cg-info-time { .cg-info-time {
margin: 4rpx; margin: 4rpx;
margin-bottom: 14rpx;
width: 120rpx; width: 120rpx;
height: 60rpx; height: 60rpx;
text-align: center; text-align: center;
@ -1137,15 +1245,20 @@ page {
font-size: 26rpx; font-size: 26rpx;
} }
.cg-right-border.no-border {
border-right: none;
}
.cg-info-time-none { .cg-info-time-none {
background: #D4DAE6; background: #BBBFC7;
border: 2rpx solid #D4DAE6; border: 2rpx solid #BBBFC7;
color: #fff;
} }
.cg-info-time-normal { .cg-info-time-normal {
background: #F7F7F7; background: #41C95D;
border: 2rpx solid #E9ECF4; border: 2rpx solid #41C95D;
color: #303133; color: #fff;
} }
.cg-info-time-select { .cg-info-time-select {

View File

@ -29,10 +29,19 @@
data: function () { data: function () {
const date = new Date(); const date = new Date();
const weekMap = ['日', '一', '二', '三', '四', '五', '六']; const weekMap = ['日', '一', '二', '三', '四', '五', '六'];
// 生成前天、昨天、今天、明天、后 // 生成今天起未来7天若当天已过22:00则不加入当
const dateList = []; const dateList = [];
for (let i = -2; i <= 2; i++) { for (let i = 0; i < 7; i++) {
const d = new Date(date.getFullYear(), date.getMonth(), date.getDate() + i); const d = new Date(date.getFullYear(), date.getMonth(), date.getDate() + i);
// 判断当天是否已过22:00
if (i === 0) {
const now = new Date();
if (now.getFullYear() === d.getFullYear() && now.getMonth() === d.getMonth() && now.getDate() === d.getDate()) {
if (now.getHours() > 21 || (now.getHours() === 21 && now.getMinutes() >= 60)) {
continue; // 跳过当天
}
}
}
const mm = (d.getMonth() + 1).toString().padStart(2, '0'); const mm = (d.getMonth() + 1).toString().padStart(2, '0');
const dd = d.getDate().toString().padStart(2, '0'); const dd = d.getDate().toString().padStart(2, '0');
const week = weekMap[d.getDay()]; const week = weekMap[d.getDay()];
@ -41,64 +50,99 @@
date: d date: d
}); });
} }
// 小时 6-22 // 默认选中今天、当前小时、当前分钟
const hourList = [];
for (let i = 6; i <= 22; i++) {
hourList.push(i < 10 ? `0${i}` : `${i}`);
}
// 分钟 00\10\20\30\40\50
const minuteList = [];
for (let i = 0; i < 60; i += 10) {
minuteList.push(i < 10 ? `0${i}` : `${i}`);
}
// 默认选中今天
let dateIndex = 2;
// 当前小时和分钟
const now = new Date();
let hourIndex = hourList.findIndex(h => parseInt(h) === now.getHours());
if (hourIndex === -1) hourIndex = 0;
let minuteIndex = minuteList.findIndex(m => parseInt(m) === now.getMinutes());
if (minuteIndex === -1) minuteIndex = 0;
return { return {
title: 'picker-view', title: 'picker-view',
dateList, dateList,
hourList, hourList: [],
minuteList, minuteList: [],
value: [dateIndex, hourIndex, minuteIndex], // 默认选中今天、当前小时、当前分钟 value: [0, 0, 0],
visible: true, visible: true,
indicatorStyle: `height: 50px;` indicatorStyle: `height: 50px;`
} }
}, },
mounted() { mounted() {
this.updateHourAndMinuteList(0, 0);
}, },
methods: { methods: {
bindChange: function (e) { bindChange: function (e) {
const val = e.detail.value; const val = e.detail.value;
// 选中项索引分别为dateList、hourList、minuteList // 选中项索引分别为dateList、hourList、minuteList
this.value = val; this.value = val;
// 联动更新小时和分钟
this.updateHourAndMinuteList(val[0], val[1]);
},
// 联动生成小时和分钟列表
updateHourAndMinuteList(dateIdx, hourIdx) {
const now = new Date();
const selectedDate = this.dateList[dateIdx]?.date;
let hourList = [];
let minuteList = [];
// 判断是否为今天
const isToday = selectedDate &&
selectedDate.getFullYear() === now.getFullYear() &&
selectedDate.getMonth() === now.getMonth() &&
selectedDate.getDate() === now.getDate();
if (isToday) {
// 如果当前时间已超过 22:00则不显示任何可选时间
if (now.getHours() > 21 || (now.getHours() === 21 && now.getMinutes() >= 60)) {
hourList = [];
minuteList = [];
} else {
for (let i = 6; i <= 21; i++) {
if (i > now.getHours()) {
hourList.push(i < 10 ? `0${i}` : `${i}`);
} else if (i === now.getHours()) {
// 当前小时,分钟要过滤
let hasValidMinute = false;
for (let m = 0; m < 60; m += 10) {
if (m >= now.getMinutes()) {
hasValidMinute = true;
break;
}
}
if (hasValidMinute) {
hourList.push(i < 10 ? `0${i}` : `${i}`);
}
}
}
}
} else {
for (let i = 6; i <= 21; i++) {
hourList.push(i < 10 ? `0${i}` : `${i}`);
}
}
// 选中的小时
let selectedHour = hourList[hourIdx] ? parseInt(hourList[hourIdx]) : parseInt(hourList[0]);
if (isToday && hourList.length > 0 && selectedHour === now.getHours()) {
for (let m = 0; m < 60; m += 10) {
if (m >= now.getMinutes()) {
minuteList.push(m < 10 ? `0${m}` : `${m}`);
}
}
} else if (hourList.length > 0) {
for (let m = 0; m < 60; m += 10) {
minuteList.push(m < 10 ? `0${m}` : `${m}`);
}
} else {
minuteList = [];
}
// 修正value
let value = [...this.value];
// hourIdx/minuteIdx 越界修正
if (value[1] >= hourList.length) value[1] = 0;
if (value[2] >= minuteList.length) value[2] = 0;
this.hourList = hourList;
this.minuteList = minuteList;
this.value = [dateIdx, value[1], value[2]];
}, },
// 重置 // 重置
reset: function () { reset: function () {
const now = new Date(); // 重置为今天、可选的第一个小时和分钟
// 日期始终选中“今天” this.updateHourAndMinuteList(0, 0);
let dateIndex = 2;
// 重新生成小时列表,确保与当前小时对齐
const hourList = [];
for (let i = 6; i <= 21; i++) {
hourList.push(i < 10 ? `0${i}` : `${i}`);
}
let hourIndex = hourList.findIndex(h => parseInt(h) === now.getHours());
if (hourIndex === -1) hourIndex = 0;
// 重新生成分钟列表,确保与当前分钟对齐
const minuteList = [];
for (let i = 0; i < 60; i += 10) {
minuteList.push(i < 10 ? `0${i}` : `${i}`);
}
let minuteIndex = minuteList.findIndex(m => parseInt(m) === now.getMinutes());
if (minuteIndex === -1) minuteIndex = 0;
this.value = [dateIndex, hourIndex, minuteIndex];
}, },
// 确认 // 确认
@ -106,15 +150,36 @@
// 获取选中索引 // 获取选中索引
const [dateIdx, hourIdx, minuteIdx] = this.value; const [dateIdx, hourIdx, minuteIdx] = this.value;
const dateObj = this.dateList[dateIdx]; const dateObj = this.dateList[dateIdx];
console.log("🚀 ~ dateObj:", this.value)
const hour = this.hourList[hourIdx]; const hour = this.hourList[hourIdx];
const minute = this.minuteList[minuteIdx]; const minute = this.minuteList[minuteIdx];
// 组装时间戳
let ts = 0;
let endts = 0;
if (dateObj && hour !== undefined && minute !== undefined) {
// 构造 yyyy-mm-dd hh:mm:00 字符串
const d = dateObj.date;
const yyyy = d.getFullYear();
const mm = (d.getMonth() + 1).toString().padStart(2, '0');
const dd = d.getDate().toString().padStart(2, '0');
const hh = hour.toString().padStart(2, '0');
const mi = minute.toString().padStart(2, '0');
const dateStr = `${yyyy}-${mm}-${dd} ${hh}:${mi}:00`;
const endStr = `${yyyy}-${mm}-${dd} 22:00:00`;
console.log("🚀 ~ endStr:", endStr)
ts = Math.floor(new Date(dateStr.replace(/-/g, '/')).getTime() / 1000);
endts = Math.floor(new Date(endStr.replace(/-/g, '/')).getTime() / 1000);
}
// 传递给父组件 // 传递给父组件
this.$emit('confirm', { this.$emit('confirm', {
date: dateObj.date, date: dateObj.date,
dateLabel: dateObj.label, dateLabel: dateObj.label,
hour, hour,
minute, minute,
value: `${dateObj.label} ${hour}:${minute}` value: `${dateObj.label} ${hour}:${minute}`,
timestamp: ts,
endtimestamp: endts
}); });
this.$emit('close'); this.$emit('close');
}, },
@ -141,6 +206,7 @@
.item { .item {
line-height: 100rpx; line-height: 100rpx;
text-align: center; text-align: center;
font-size: 32rpx;
} }
.line { .line {

View File

@ -637,16 +637,41 @@ export default {
// 场馆预约 // 场馆预约
handleToReserve(id, typeId) { handleToReserve(id, typeId) {
if (typeId == 2) { // if (typeId == 2) {
uni.showToast({ // uni.showToast({
title: '场馆暂未开放', // title: '场馆暂未开放',
duration: 2000, // duration: 2000,
icon: 'none' // icon: 'none'
}); // });
return; // return;
} // }
uni.navigateTo({ /*是否有手机号码*/
url: `/bundle/reserve/details?id=${id}&typeId=${typeId}` let self = this;
uni.showLoading({
title: '加载中'
});
self._post('user.index/detail', {
source: self.getPlatform()
}, function(res) {
uni.hideLoading();
console.log("🚀 ~ res:", res)
if (res.data.userInfo.mobile == '') {
uni.showModal({
title: '提示',
content: '请先绑定手机号',
success: function(sm) {
if (sm.confirm) {
uni.switchTab({
url: '/pages/user/index/index'
});
}
}
});
}else {
uni.navigateTo({
url: `/bundle/reserve/details?id=${id}&typeId=${typeId}`
});
}
}); });
}, },

View File

@ -59,7 +59,7 @@
<image :src="item.image" mode="aspectFill" style="width: 200rpx; height: 200rpx; border-radius: 10rpx;"></image> <image :src="item.image" mode="aspectFill" style="width: 200rpx; height: 200rpx; border-radius: 10rpx;"></image>
<view class="flex-1"> <view class="flex-1">
<view class="pro-info cg-info2">订单号:{{ item.order_sn }}</view> <view class="pro-info cg-info2">订单号:{{ item.order_sn }}</view>
<view class="pro-info cg-info3">预约时间:{{ item.trade[0].day_title }}</view> <view class="pro-info cg-info3">预约时间:{{ ballType == 1 ? item.trade[0].day_title : item.times }}</view>
</view> </view>
<!-- <view class="total-count"> <!-- <view class="total-count">

View File

@ -15,7 +15,7 @@
<!-- 已预约 --> <!-- 已预约 -->
<view class="" style="width: 100%;" v-if="detail.order_status == 1"> <view class="" style="width: 100%;" v-if="detail.order_status == 1">
<view class="status-text" style="width: 100%;text-align: center;"> <view class="status-text" style="width: 100%;text-align: center;">
使用过程中有任何问题,请联系商家 使用过程中有任何问题,请联系客服
</view> </view>
<!-- <view class="face d-f a-i-c"> <!-- <view class="face d-f a-i-c">
<view class="d-f a-i-c"> <view class="d-f a-i-c">
@ -80,8 +80,8 @@
</view> </view>
</view> </view>
<view class="d-b-c" style="margin-top:18rpx;" v-if="ballType == 2"> <view class="d-b-c" style="margin-top:18rpx;" v-if="ballType == 2">
<view class="cg-hour">¥100/小时</view> <view class="cg-hour">¥{{ detail.order_amount }}/人</view>
<view class="cg-num">x{{ item.hours }}</view> <view class="cg-num">x1</view>
</view> </view>
<view class="d-f a-i-c" style="text-align: right;justify-content: end;margin-top:18rpx;"> <view class="d-f a-i-c" style="text-align: right;justify-content: end;margin-top:18rpx;">
@ -97,7 +97,7 @@
<view class="cg-title">预约信息</view> <view class="cg-title">预约信息</view>
<!-- todo 这里的状态如果是交易完成、订单取消、退款成功则将下面的预约改为使用 --> <!-- todo 这里的状态如果是交易完成、订单取消、退款成功则将下面的预约改为使用 -->
<view class="cg-desc1">预约时间:{{ detail.day_time }}</view> <view class="cg-desc1">预约时间:{{ detail.day_time }}</view>
<view class="cg-desc2">预约时长:{{ detail.hours }}小时</view> <view class="cg-desc2" v-if="ballType == 1">预约时长:{{ detail.hours }}小时</view>
<template v-if="ballType == 1"> <template v-if="ballType == 1">
<view class="cg-desc2">场地信息:</view> <view class="cg-desc2">场地信息:</view>
<view class="desc" v-for="(item, index) in detail.trade" :key="index"> <view class="desc" v-for="(item, index) in detail.trade" :key="index">
@ -196,13 +196,13 @@
<templte class="ww100" v-if="detail.order_status == 1"> <templte class="ww100" v-if="detail.order_status == 1">
<view class="d-b-c ww100"> <view class="d-b-c ww100">
<view class="cancle-reserve-btn" @click="showCancleReservePopup">取消预约</view> <view class="cancle-reserve-btn" @click="showCancleReservePopup">取消预约</view>
<view class="contact-btn" @click="contactStore">联系商家</view> <view class="contact-btn" @click="contactStore">联系客服</view>
</view> </view>
</templte> </templte>
<!-- 进行中 --> <!-- 进行中 -->
<templte class="ww100" v-if="detail.order_status == 2"> <templte class="ww100" v-if="detail.order_status == 2">
<view class="ww100 again-btn" @click="contactStore">联系商家</view> <view class="ww100 again-btn" @click="contactStore">联系客服</view>
</templte> </templte>
<!-- 订单取消退款成功 --> <!-- 订单取消退款成功 -->

View File

@ -614,15 +614,16 @@
border-radius: 16rpx; border-radius: 16rpx;
height: 100%; height: 100%;
padding: 0 20rpx; padding: 0 20rpx;
font-size: 32rpx;
} }
.bind_txt {} .bind_txt {}
.bind_btn { .bind_btn {
width: 134rpx; width: 150rpx;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
font-size: 22rpx; font-size: 28rpx;
border-radius: 25rpx; border-radius: 25rpx;
text-align: center; text-align: center;
color: #FFFFFF; color: #FFFFFF;

View File

@ -33,7 +33,7 @@
<text class="icon iconfont icon-jiantou"></text> <text class="icon iconfont icon-jiantou"></text>
</view> </view>
</view> </view>
<view class="d-b-c p-30-0"> <!-- <view class="d-b-c p-30-0">
<text class="key-name">手机号码</text> <text class="key-name">手机号码</text>
<view class="d-e-c" v-if="userInfo.mobile"> <view class="d-e-c" v-if="userInfo.mobile">
<text class="mr20">{{ userInfo.mobile }}</text> <text class="mr20">{{ userInfo.mobile }}</text>
@ -42,7 +42,7 @@
<text class="mr20">未绑定</text> <text class="mr20">未绑定</text>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
</view> </view> -->
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<view class="d-b-c p-30-0"> <view class="d-b-c p-30-0">
<text class="key-name">当前版本</text> <text class="key-name">当前版本</text>