日程页周视图改为本周安排卡片纵向列表并同步月视图条色
自动发布开发环境 Nacos 配置 / publish (push) Successful in 18s

周视图从七列卡片改为单卡片七行列表,行高 108rpx,行内依次为周几与日期、营业状态、396x28rpx 单量量轨、单量与待分配徽标;量轨按美甲师分段,1 单 75.2rpx、段间 4rpx,段内显示姓名与单量并单行裁切。

三色条更新为 #43789E/#96684B/#587959,旧默认员工色统一映射,月视图条与筛选 chip 色点同步;今日行浅绿底加左侧竖条,待分配使用琥珀徽标;顶部保留标题、日期范围、图例与周汇总。仅呈现层调整,接口、字段与状态流转未改动。
This commit is contained in:
2026-11-06 17:07:17 +08:00
parent c9ff29d048
commit 380e7b42de
4 changed files with 269 additions and 86 deletions
+65 -16
View File
@@ -20,6 +20,35 @@ function resolveCalendarErrorMessage(error) {
const LANE_TINTS = ['#EAF3FA', '#FBF1EB', '#EEF5EF']
const DESIGN_ARTIST_COLORS = {
张小雨: '#43789E',
林小满: '#96684B',
陈小桃: '#587959'
}
const LEGACY_ARTIST_COLORS = {
'#7BA7C7': '#43789E',
'#D7A86E': '#96684B',
'#8FB89A': '#587959'
}
function resolveDisplayColor(artist = {}, fallback) {
const name = String(artist.nickname || artist.name || artist.artistName || '')
const matchedName = Object.keys(DESIGN_ARTIST_COLORS).find(key => name.includes(key))
if (matchedName) return DESIGN_ARTIST_COLORS[matchedName]
const color = String(artist.color || fallback || '')
return LEGACY_ARTIST_COLORS[color.toUpperCase()] || color || '#B8B0A6'
}
function buildWeekSegments(artistCounts) {
const counts = (artistCounts || []).map(count => ({ ...count, width: Math.round(count.count * 75.2) }))
const usable = 396 - Math.max(0, counts.length - 1) * 4
const rawTotal = counts.reduce((total, count) => total + count.width, 0)
if (rawTotal <= usable || rawTotal === 0) return counts
const scale = usable / rawTotal
return counts.map(count => ({ ...count, width: Math.max(8, Math.floor(count.width * scale)) }))
}
function toLocalDate(value) {
return value instanceof Date ? new Date(value.getTime()) : new Date(String(value).replace(/-/g, '/'))
}
@@ -166,6 +195,10 @@ Page({
artists: [],
monthDays: [],
weekDays: [],
weekTotalCount: 0,
weekUnassignedTotal: 0,
weekLegend: [],
todayText: dateUtil.formatDate(new Date()),
dayLanes: [],
hours: [],
hasTimedAppointments: false,
@@ -449,6 +482,9 @@ Page({
artists: [],
monthDays: [],
weekDays: [],
weekTotalCount: 0,
weekUnassignedTotal: 0,
weekLegend: [],
dayLanes: [],
hours: [],
hasTimedAppointments: false,
@@ -484,7 +520,10 @@ Page({
businessStartTime: businessHours ? businessHours.start : '',
businessEndTime: businessHours ? businessHours.end : '',
businessHoursConfigured: hasBusinessHours(calendar),
artists: Array.isArray(calendar.artists) ? calendar.artists : [],
artists: (Array.isArray(calendar.artists) ? calendar.artists : []).map(artist => ({
...artist,
color: resolveDisplayColor({ name: artist.name || artist.nickname, color: artist.color })
})),
appointments: Array.isArray(calendar.appointments) ? calendar.appointments : [],
daySummaries: Array.isArray(calendar.daySummaries) ? calendar.daySummaries : []
}
@@ -536,7 +575,22 @@ Page({
return state
}
if (this.data.viewMode === 'week') {
state.weekDays = this.buildWeekDays(calendar)
const weekDays = this.buildWeekDays(calendar)
const legendMap = {}
weekDays.forEach(day => {
day.artistCounts.forEach(count => {
if (!count.artistId || count.artistId === '__unassigned__' || legendMap[count.artistId]) return
legendMap[count.artistId] = {
artistId: count.artistId,
name: count.artistName || count.shortName || '?',
color: count.color
}
})
})
state.weekDays = weekDays
state.weekTotalCount = weekDays.reduce((total, day) => total + Number(day.totalCount || 0), 0)
state.weekUnassignedTotal = weekDays.reduce((total, day) => total + Number(day.unassignedCount || 0), 0)
state.weekLegend = Object.keys(legendMap).map(key => legendMap[key])
return state
}
return { ...state, ...this.buildDayView(calendar) }
@@ -576,15 +630,13 @@ Page({
buildWeekDays(calendar) {
const start = dateUtil.startOfWeek(this.data.currentDateText)
const summaryMap = this.summaryMap(calendar)
return this.data.weekLabels.map((label, index) => {
const days = this.data.weekLabels.map((label, index) => {
const target = dateUtil.addDays(start, index)
const date = dateUtil.formatDate(target)
const summary = summaryMap[date] || { artistCounts: [], totalCount: 0 }
const unassignedCount = Number(summary.unassignedCount || 0)
const artistCounts = this.withUnassignedCount(
this.normalizeArtistCounts(summary.artistCounts || [], calendar),
unassignedCount
).filter(count => count.count > 0)
const artistCounts = this.normalizeArtistCounts(summary.artistCounts || [], calendar)
.filter(count => count.count > 0 && count.artistId !== '__unassigned__')
return {
date,
weekName: `周${label}`,
@@ -592,16 +644,11 @@ Page({
totalCount: summary.totalCount || 0,
unassignedCount,
shopOpen: summary.shopOpen !== false,
statusText: this.resolveDisplayStatus(summary, artistCounts) === 'rest'
? '休'
: this.resolveDisplayStatus(summary, artistCounts) === 'full' ? '满' : '营业',
artistCounts: artistCounts.map(count => ({
...count,
width: Math.max(12, Math.min(100, count.count * 22)),
barWidth: Math.max(14, Math.min(100, count.count * 18))
}))
statusText: this.resolveDisplayStatus(summary, artistCounts) === 'rest' ? '休' : '营业',
artistCounts: buildWeekSegments(artistCounts)
}
})
return days
},
buildDayView(calendar) {
@@ -775,10 +822,12 @@ Page({
}, {})
return (counts || []).map(count => {
const artist = colorMap[count.artistId] || {}
const artistName = count.artistName || artist.name || artist.nickname || ''
return {
...count,
color: count.color || artist.color || '#B8B0A6',
color: resolveDisplayColor({ name: artistName, color: count.color || artist.color }),
shortName: count.shortName || artist.shortName || '?',
artistName,
count: Number(count.count || 0)
}
})