修正多处问题
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
</view>
|
||||
<!-- 预约按钮 -->
|
||||
<view :class="['booking-btn', { disabled: !canBook }]" @click.stop="handleBooking">
|
||||
<text>{{ canBook ? '立即预约' : (course.currentMembers >= course.maxMembers ? '已满员' : '已结束') }}</text>
|
||||
<text>{{ buttonText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -123,6 +123,10 @@ const props = defineProps({
|
||||
courseTypeLabels: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
booked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -147,7 +151,14 @@ const statusClass = computed(() => {
|
||||
const canBook = computed(() => {
|
||||
const status = props.course.status
|
||||
const isFull = props.course.currentMembers >= props.course.maxMembers
|
||||
return status === '0' && !isFull
|
||||
return status === '0' && !isFull && !props.booked
|
||||
})
|
||||
|
||||
const buttonText = computed(() => {
|
||||
if (props.booked) return '已预约'
|
||||
if (!canBook.value && props.course.currentMembers >= props.course.maxMembers) return '已满员'
|
||||
if (!canBook.value && Number(props.course.status) !== 0) return '已结束'
|
||||
return '立即预约'
|
||||
})
|
||||
|
||||
const formatTime = (dateStr) => {
|
||||
@@ -191,7 +202,7 @@ const formatDuration = (startStr, endStr) => {
|
||||
}
|
||||
|
||||
const goDetail = () => {
|
||||
emit('detail', props.course.id)
|
||||
emit('detail', Number(props.course.id))
|
||||
}
|
||||
|
||||
const handleBooking = () => {
|
||||
|
||||
Reference in New Issue
Block a user