fix: correct card status values and booking display issues
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<text class="item-meta">{{ getItemDesc(item) }}</text>
|
||||
<view class="card-bottom">
|
||||
<text class="item-meta">{{ isMembershipCourse ? '次卡预约' : '订单金额' }}</text>
|
||||
<text v-if="isMembershipCourse" class="amount tag-amount">次卡预约</text>
|
||||
<text v-if="isMembershipCourse" class="amount tag-amount">{{ item.card?.plan_name || '次卡预约' }}</text>
|
||||
<text v-else class="amount">¥{{ item.order?.amount || '--' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -70,7 +70,7 @@ const courseSubTabs = [
|
||||
const isMembershipCourse = computed(() => businessType.value === 'course' && courseSubType.value === 'membership')
|
||||
|
||||
const bookedItems = computed(() => {
|
||||
return items.value.filter((item) => ['booked', 'available'].includes(item.status))
|
||||
return items.value.filter((item) => ['booked', 'available', 'checked_in'].includes(item.status))
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -269,4 +269,13 @@ const goDetail = (item) => {
|
||||
font-size: 30rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.tag-amount {
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: $border-radius-base;
|
||||
background: $color-primary-light;
|
||||
color: $color-primary;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -101,7 +101,11 @@ const loadSessions = async (reset) => {
|
||||
items = items.filter((item) => item.available_card_ids.includes(Number(preselectedCardId.value)))
|
||||
}
|
||||
sessions.value = reset ? items : [...sessions.value, ...items]
|
||||
if (preselectedCardId.value && data.items.length < data.page_size) {
|
||||
total.value = sessions.value.length
|
||||
} else {
|
||||
total.value = data.total
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
isLoadingMore.value = false
|
||||
@@ -110,7 +114,7 @@ const loadSessions = async (reset) => {
|
||||
|
||||
const loadCards = async () => {
|
||||
const data = await membershipApi.getCards({ page: 1, pageSize: 50 })
|
||||
cards.value = data.items.filter((card) => card.status === 'active' && card.remaining_count > 0)
|
||||
cards.value = data.items.filter((card) => card.status === 'available' && card.remaining_count > 0)
|
||||
}
|
||||
|
||||
const onSessionTap = (session) => {
|
||||
|
||||
@@ -104,6 +104,8 @@ onPullDownRefresh(() => {
|
||||
const loadBooking = async () => {
|
||||
try {
|
||||
booking.value = await membershipApi.getCardBookingDetail(bookingId.value)
|
||||
} catch {
|
||||
// request layer already shows toast; ensure loaded state is set
|
||||
} finally {
|
||||
loaded.value = true
|
||||
}
|
||||
|
||||
@@ -159,9 +159,8 @@ const goBooking = () => {
|
||||
}
|
||||
|
||||
const statusBadgeClass = (status) => {
|
||||
if (status === 'active') return 'success'
|
||||
if (status === 'available') return 'success'
|
||||
if (status === 'exhausted') return 'warning'
|
||||
if (status === 'expired') return 'muted'
|
||||
return 'muted'
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -93,9 +93,8 @@ const goDetail = (id) => {
|
||||
}
|
||||
|
||||
const statusBadgeClass = (status) => {
|
||||
if (status === 'active') return 'success'
|
||||
if (status === 'available') return 'success'
|
||||
if (status === 'exhausted') return 'warning'
|
||||
if (status === 'expired') return 'muted'
|
||||
return 'muted'
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user