调整周视图和客户页展示样式

This commit is contained in:
2026-07-25 18:12:02 +08:00
parent 87862a3c36
commit c24b2725be
11 changed files with 541 additions and 103 deletions
+52 -1
View File
@@ -255,6 +255,9 @@ Page({
shopRestDates: [],
monthDays: [],
weekDays: [],
weekHours: [],
weekTimelineHeight: 720,
weekGridWidth: 720,
dayLanes: [],
hours: [],
timelineHeight: 720,
@@ -599,6 +602,7 @@ Page({
prepareView() {
const current = this.data.currentDateText
const range = this.resolveRange()
const weekDays = this.buildWeekDays()
const title = this.data.viewMode === 'month'
? dateUtil.formatMonth(current)
: this.data.viewMode === 'week'
@@ -609,7 +613,7 @@ Page({
rangeText: this.data.viewMode === 'month' ? '月视图' : this.data.viewMode === 'week' ? '周视图' : '日视图',
weekRange: `${formatMonthDay(range.start)} - ${formatMonthDay(range.end)}`,
monthDays: this.buildMonthDays(),
weekDays: this.buildWeekDays(),
...this.buildWeekTimeline(weekDays),
...this.buildDayView()
})
},
@@ -650,6 +654,10 @@ Page({
buildWeekDays() {
const start = dateUtil.startOfWeek(this.data.currentDateText)
const summaryMap = this.summaryMap()
const artistMap = (this.data.artists || []).reduce((map, artist) => {
map[String(artist.id)] = artist
return map
}, {})
return this.data.weekLabels.map((label, index) => {
const target = dateUtil.addDays(start, index)
const date = dateUtil.formatDate(target)
@@ -662,6 +670,22 @@ Page({
day: target.getDate(),
totalCount: summary.totalCount || 0,
statusClass: resolveDayStatusClass(dayAppointments),
blocks: dayAppointments.map((item, appointmentIndex) => {
const startMinute = resolveAppointmentStartMinute(item)
const orderItemId = resolveAppointmentItemId(item)
const artist = artistMap[String(item.artistId)] || {}
return {
...item,
key: `${date}-${orderItemId || 'appointment'}-${appointmentIndex}`,
id: orderItemId,
orderItemId,
top: startMinute,
height: Math.max(76, Number(item.durationMinutes || 60)),
timeText: resolveAppointmentTimeText(item),
statusClass: appointmentStatusClass(item.status),
color: artist.color || item.color || '#B8B0A6'
}
}),
artistCounts: artistCounts.map(count => ({
...count,
width: Math.max(12, Math.min(100, count.count * 22)),
@@ -756,6 +780,33 @@ Page({
})
},
buildWeekTimeline(weekDays) {
const startMinute = dateUtil.minutesOfDay(this.data.businessStartTime)
const endMinute = dateUtil.minutesOfDay(this.data.businessEndTime)
const timelineHeight = Math.max(560, endMinute - startMinute)
const hours = []
for (let cursor = startMinute; cursor <= endMinute; cursor += 60) {
hours.push({
value: cursor,
label: dateUtil.timeFromMinutes(cursor),
top: cursor - startMinute
})
}
const timelineDays = weekDays.map(day => ({
...day,
blocks: day.blocks.map(block => ({
...block,
top: Math.max(0, block.top - startMinute)
}))
}))
return {
weekDays: timelineDays,
weekHours: hours,
weekTimelineHeight: timelineHeight,
weekGridWidth: 92 + (timelineDays.length * 116)
}
},
appointmentCountsByDate(date) {
const artistMap = (this.data.artists || []).reduce((map, artist) => {
map[String(artist.id)] = artist