feat: 课程列表/课程预约详情/会员卡课程详情移除价格显示
This commit is contained in:
@@ -93,6 +93,8 @@
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { privateBookingApi } from '@/modules/comprehensive/api/privateBooking'
|
||||
import { useComprehensiveSessionStore } from '@/modules/comprehensive/stores/session'
|
||||
import { toAmountNumber } from '@/modules/comprehensive/utils/money'
|
||||
|
||||
const HEADER_HEIGHT = 75
|
||||
const CELL_HEIGHT = 107
|
||||
@@ -100,10 +102,10 @@ const TIME_COL_WIDTH = 128
|
||||
const COURT_COL_WIDTH = 149
|
||||
|
||||
const typeOptions = [
|
||||
{ label: '羽毛球', value: 'badminton' },
|
||||
{ label: '篮球', value: 'basketball' }
|
||||
{ label: '羽毛球', value: 'badminton' }
|
||||
]
|
||||
|
||||
const session = useComprehensiveSessionStore()
|
||||
const courtType = ref('badminton')
|
||||
const selectedDate = ref(dayjs().format('YYYY-MM-DD'))
|
||||
const grid = ref(null)
|
||||
@@ -114,9 +116,11 @@ const now = ref(dayjs())
|
||||
let loadRequestId = 0
|
||||
|
||||
const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
const hasPositiveBalance = computed(() => toAmountNumber(session.member?.balance) > 0)
|
||||
const dateOptions = computed(() => {
|
||||
const today = dayjs()
|
||||
return Array.from({ length: 7 }).map((_, i) => {
|
||||
const dateCount = hasPositiveBalance.value ? 7 : 1
|
||||
return Array.from({ length: dateCount }).map((_, i) => {
|
||||
const d = today.add(i, 'day')
|
||||
return {
|
||||
label: i === 0 ? '今天' : i === 1 ? '明天' : weekDays[d.day()],
|
||||
@@ -227,7 +231,7 @@ const selectionAmount = computed(() => {
|
||||
return total.toFixed(2)
|
||||
})
|
||||
|
||||
onMounted(loadGrid)
|
||||
onMounted(refresh)
|
||||
|
||||
async function loadGrid() {
|
||||
const requestId = ++loadRequestId
|
||||
@@ -270,6 +274,7 @@ function getCellClass(courtId, slotIndex) {
|
||||
}
|
||||
|
||||
function getCellPrice(courtId, slotIndex) {
|
||||
if (cellStatus.value[courtId]?.[slotIndex] !== 'available') return ''
|
||||
const prices = grid.value?.slot_prices?.[courtId] || []
|
||||
return prices[slotIndex] || ''
|
||||
}
|
||||
@@ -353,11 +358,17 @@ function normalizeClock(value) {
|
||||
return value.slice(0, 5)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
refresh() {
|
||||
now.value = dayjs()
|
||||
loadGrid()
|
||||
async function refresh() {
|
||||
await session.init()
|
||||
if (!hasPositiveBalance.value && selectedDate.value !== dayjs().format('YYYY-MM-DD')) {
|
||||
selectedDate.value = dayjs().format('YYYY-MM-DD')
|
||||
}
|
||||
now.value = dayjs()
|
||||
await loadGrid()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
refresh
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -574,19 +585,13 @@ defineExpose({
|
||||
background: $bg-color-main;
|
||||
}
|
||||
|
||||
.cell-occupied {
|
||||
background: $color-danger-light;
|
||||
}
|
||||
|
||||
.cell-past {
|
||||
.cell-occupied,
|
||||
.cell-past,
|
||||
.cell-locked,
|
||||
.cell-no_price {
|
||||
background: $bg-color-hover;
|
||||
}
|
||||
|
||||
.cell-locked {
|
||||
background: $bg-color-hover;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cell-locked::after {
|
||||
content: '锁';
|
||||
position: absolute;
|
||||
@@ -598,8 +603,8 @@ defineExpose({
|
||||
color: $text-color-light;
|
||||
}
|
||||
|
||||
.cell-no_price {
|
||||
background: $bg-color-hover;
|
||||
.cell-locked {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cell-selected {
|
||||
|
||||
Reference in New Issue
Block a user