From 380e7b42de43b6d71cfa7b0f05abfe6dfa94feb5 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Fri, 6 Nov 2026 17:07:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E7=A8=8B=E9=A1=B5=E5=91=A8=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=94=B9=E4=B8=BA=E6=9C=AC=E5=91=A8=E5=AE=89=E6=8E=92?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E7=BA=B5=E5=90=91=E5=88=97=E8=A1=A8=E5=B9=B6?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=9C=88=E8=A7=86=E5=9B=BE=E6=9D=A1=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 周视图从七列卡片改为单卡片七行列表,行高 108rpx,行内依次为周几与日期、营业状态、396x28rpx 单量量轨、单量与待分配徽标;量轨按美甲师分段,1 单 75.2rpx、段间 4rpx,段内显示姓名与单量并单行裁切。 三色条更新为 #43789E/#96684B/#587959,旧默认员工色统一映射,月视图条与筛选 chip 色点同步;今日行浅绿底加左侧竖条,待分配使用琥珀徽标;顶部保留标题、日期范围、图例与周汇总。仅呈现层调整,接口、字段与状态流转未改动。 --- JC-Salon-WeChat/pages/planning/index.js | 81 +++++-- JC-Salon-WeChat/pages/planning/index.test.js | 10 +- JC-Salon-WeChat/pages/planning/index.wxml | 44 +++- JC-Salon-WeChat/pages/planning/index.wxss | 220 ++++++++++++++----- 4 files changed, 269 insertions(+), 86 deletions(-) diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js index 86a46111..7555af70 100644 --- a/JC-Salon-WeChat/pages/planning/index.js +++ b/JC-Salon-WeChat/pages/planning/index.js @@ -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) } }) diff --git a/JC-Salon-WeChat/pages/planning/index.test.js b/JC-Salon-WeChat/pages/planning/index.test.js index fde24878..c779b2b1 100644 --- a/JC-Salon-WeChat/pages/planning/index.test.js +++ b/JC-Salon-WeChat/pages/planning/index.test.js @@ -111,7 +111,7 @@ async function run() { daySummaries: [{ date: weekStart, totalCount: 2, unassignedCount: 2, artistCounts: [] }] }) assert.strictEqual(weekDays[0].unassignedCount, 2) - assert.strictEqual(weekDays[0].artistCounts[0].artistId, '__unassigned__') + assert.strictEqual(weekDays[0].artistCounts.some(count => count.artistId === '__unassigned__'), false) const dayPage = createPage({ currentDateText: '2026-10-12', selectedArtistId: '' }) const dayState = dayPage.buildDayView({ @@ -196,7 +196,11 @@ async function run() { assert.match(planningWxml, /class="lane-unassigned-tag">不占档期/) assert.match(planningWxml, /门店营业时间未设置/) assert.match(planningWxml, /bindtap="openShopSettings"/) - assert.match(planningWxml, /class="week-unassigned-count">待 \{\{item\.unassignedCount\}\}/) + assert.match(planningWxml, /class="week-card card"/) + assert.match(planningWxml, /class="week-row-pending">待分配 \{\{item\.unassignedCount\}\}/) + assert.match(planningWxml, /class="week-segment" style="width: \{\{count\.width\}\}rpx;/) + assert.match(planningWxss, /\.week-track\s*\{[^}]*width:\s*396rpx;[^}]*height:\s*28rpx;/) + assert.match(planningWxss, /\.week-row\s*\{[^}]*height:\s*108rpx;/) assert.match(planningWxml, /wx:if="\{\{canCreateAppointment && businessHoursConfigured && !calendarError && \(viewMode !== 'day' \|\| currentShopOpen\)\}\}" class="fab" bindtap="createAppointment"/) assert.match(planningWxml, /class="month-unassigned-count">待 \{\{item\.unassignedCount\}\}/) assert.doesNotMatch(planningWxss, /background-size:\s*100% 240rpx/) @@ -287,7 +291,7 @@ async function run() { assert.match(planningWxml, /bindtap="selectMonthDate" aria-label="查看\{\{item\.date\}\}日程"/) assert.match(planningWxml, /bindtap="selectWeekDate" aria-label="查看\{\{item\.date\}\}日程"/) - assert.match(planningWxss, /grid-template-columns:\s*repeat\(7,\s*minmax\(0,\s*1fr\)\)/) + assert.match(planningWxss, /\.week-list\s*\{/) } run().catch(error => { diff --git a/JC-Salon-WeChat/pages/planning/index.wxml b/JC-Salon-WeChat/pages/planning/index.wxml index 092e4dd7..cba76bb2 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxml +++ b/JC-Salon-WeChat/pages/planning/index.wxml @@ -132,18 +132,38 @@ - - 本周概览 - {{weekRange}} - - - - {{item.weekName}}{{item.statusText}} - {{item.day}} - {{item.totalCount}}单 - 待 {{item.unassignedCount}} - - + + + + 本周安排 + {{weekRange}} + + 共 {{weekTotalCount}} 单 · 待分配 {{weekUnassignedTotal}} + + + + + {{item.name}} + + 暂无美甲师单量 + + + + + {{item.weekName}} + {{item.day}} + 日 + + {{item.statusText}} + + + {{count.artistName || count.shortName}}{{count.count}} + + + + {{item.totalCount}}单 + 待分配 {{item.unassignedCount}} + diff --git a/JC-Salon-WeChat/pages/planning/index.wxss b/JC-Salon-WeChat/pages/planning/index.wxss index 2245e481..5561a99e 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxss +++ b/JC-Salon-WeChat/pages/planning/index.wxss @@ -555,77 +555,187 @@ font-size: 22rpx; } -.week-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12rpx; } -.week-head-title { color: #17211f; font-size: 25rpx; font-weight: 600; } -.week-head-range { color: #71807a; font-size: 20rpx; } - -.week-strip { - display: grid; - grid-template-columns: repeat(7, minmax(0, 1fr)); - gap: 6rpx; - width: 100%; +.week-card { + padding: 20rpx; } -.week-day-card { +.week-card-head { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12rpx; +} + +.week-card-title { display: flex; - flex-direction: column; min-width: 0; - min-height: 104rpx; - margin: 0; - padding: 8rpx 4rpx; - align-items: center; + align-items: baseline; + gap: 10rpx; } -.week-day-card.active { - background: #e5f4ed; - border-color: #cfe4d9; -} - -.week-name, -.week-total { - color: #8f877e; - font-size: 18rpx; -} - -.week-card-head { display:flex; width:100%; align-items:center; justify-content:space-between; gap:2rpx; } -.week-status { color:#247b63; font-size:17rpx; font-weight:800; } -.week-status.rest { color:#a08a78; } - -.week-unassigned-count { - display: inline-flex; - align-self: flex-start; - margin-top: 4rpx; - padding: 2rpx 4rpx; - border-radius: 6rpx; - background: #fff1dc; - color: #a56b24; - font-size: 15rpx; - font-weight: 800; -} - -.week-date { - margin: 3rpx 0; +.week-title { color: #17211f; - font-size: 24rpx; + font-size: 28rpx; font-weight: 800; } -.week-bars { +.week-range { + color: #71807a; + font-size: 20rpx; +} + +.week-summary { + flex: none; + color: #71807a; + font-size: 20rpx; +} + +.week-legend { display: flex; + flex-wrap: wrap; + gap: 8rpx 18rpx; + margin-top: 12rpx; +} + +.week-legend-item { + display: flex; + align-items: center; + gap: 8rpx; +} + +.week-legend-dot { + width: 14rpx; + height: 14rpx; + flex: none; + border-radius: 50%; +} + +.week-legend-name { + color: #71807a; + font-size: 20rpx; +} + +.week-legend-empty { + color: #a1aca6; + font-size: 20rpx; +} + +.week-list { + margin-top: 8rpx; +} +.week-row { + display: flex; + align-items: center; + gap: 8rpx; + box-sizing: border-box; + height: 108rpx; + border-bottom: 1rpx solid #f0f3f1; +} + +.week-row:last-child { + border-bottom: none; +} + +.week-row.today { + margin: 0 -20rpx; + padding: 0 20rpx 0 14rpx; + border-left: 6rpx solid #247b63; + background: #e5f4ed; +} + +.week-row-date { + display: flex; + width: 92rpx; + flex: none; + align-items: baseline; + gap: 4rpx; +} + +.week-row-name { + color: #71807a; + font-size: 20rpx; +} + +.week-row-day { + color: #17211f; + font-size: 30rpx; + font-weight: 800; +} + +.week-row-suffix { + color: #71807a; + font-size: 16rpx; +} + +.week-row-status { + width: 40rpx; + flex: none; + color: #247b63; + font-size: 18rpx; + font-weight: 800; +} + +.week-row-status.rest { + color: #a1aca6; +} + +.week-track { + display: flex; + width: 396rpx; + height: 28rpx; + flex: none; + gap: 4rpx; + box-sizing: border-box; + overflow: hidden; + border-radius: 14rpx; + background: #eef3f0; +} + +.week-segment { + display: flex; + height: 28rpx; + flex: none; + align-items: center; + justify-content: center; + overflow: hidden; + border-radius: 14rpx; +} + +.week-segment-text { + box-sizing: border-box; + max-width: 100%; + padding: 0 6rpx; + overflow: hidden; + color: #ffffff; + font-size: 18rpx; + line-height: 28rpx; + white-space: nowrap; + text-overflow: ellipsis; +} + +.week-row-tail { + display: flex; + min-width: 0; + flex: 1; flex-direction: column; - gap: 3rpx; - width: 90%; - margin-top: 3rpx; - min-height: 10rpx; + align-items: flex-end; + gap: 2rpx; } -.week-bars.empty { - min-height: 10rpx; +.week-row-total { + color: #17211f; + font-size: 20rpx; + font-weight: 800; } -.week-bar { - height: 5rpx; - border-radius: 999rpx; +.week-row-pending { + padding: 2rpx 8rpx; + border-radius: 8rpx; + background: #fff1dc; + color: #8b5e24; + font-size: 16rpx; + font-weight: 700; + white-space: nowrap; } .week-grid {