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

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
+28 -17
View File
@@ -80,26 +80,37 @@
</view>
<view wx:if="{{viewMode === 'week'}}" class="section">
<scroll-view class="week-strip" scroll-x enable-flex>
<view wx:for="{{weekDays}}" wx:key="date" class="week-day-card card {{item.date === currentDateText ? 'active' : ''}} {{item.statusClass}}" data-date="{{item.date}}" bindtap="selectDate">
<text class="week-name">{{item.weekName}}</text>
<text class="week-date">{{item.day}}</text>
</view>
</scroll-view>
<view class="card week-grid">
<view class="week-grid-head">
<text>本周排班密度</text>
<text class="muted">{{weekRange}}</text>
</view>
<view wx:for="{{weekDays}}" wx:key="date" class="week-line">
<view class="week-line-date">{{item.weekName}} {{item.day}}</view>
<view class="week-line-bars {{item.totalCount === 0 ? 'empty' : ''}}">
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="key" class="week-count-bar {{count.statusClass}}" style="background: {{count.color}}; width: {{count.barWidth}}%;">
<text>{{count.shortName}}{{count.count}}</text>
<view class="week-toolbar">
<text class="week-toolbar-title">周排班</text>
<text class="week-toolbar-range">{{weekRange}}</text>
</view>
<scroll-view class="week-board card" scroll-x scroll-y enable-flex>
<view class="week-calendar" style="width: {{weekGridWidth}}rpx;">
<view class="week-calendar-head">
<view class="week-time-corner">排班</view>
<view wx:for="{{weekDays}}" wx:key="date" class="week-date-column {{item.date === currentDateText ? 'active' : ''}}" data-date="{{item.date}}" bindtap="selectDate">
<text class="week-name">{{item.weekName}}</text>
<text class="week-date">{{item.day}}</text>
<text class="week-count">{{item.totalCount || 0}}</text>
</view>
</view>
<view class="week-calendar-body" style="height: {{weekTimelineHeight}}rpx;">
<view class="week-time-axis">
<view wx:for="{{weekHours}}" wx:key="value" class="week-time-label" style="top: {{item.top}}rpx;">{{item.label}}</view>
</view>
<view class="week-day-columns">
<view wx:for="{{weekDays}}" wx:key="date" class="week-day-column {{item.date === currentDateText ? 'active' : ''}}" style="height: {{weekTimelineHeight}}rpx;">
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="key" class="week-appointment-block {{block.statusClass}}" style="top: {{block.top}}rpx; height: {{block.height}}rpx; background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" bindtap="openAppointment">
<text class="week-block-time">{{block.timeText}}</text>
<text class="week-block-title">{{block.customerName}}</text>
<text class="week-block-meta">{{block.productTitle}}</text>
</view>
<view wx:if="{{item.blocks.length === 0}}" class="week-column-empty">—</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view wx:if="{{viewMode === 'month'}}" class="section">
+205
View File
@@ -576,6 +576,211 @@
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 100 100'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='%23c64e5b' stroke-opacity='.92' stroke-width='2' stroke-linecap='square' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}
.week-toolbar {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 16rpx;
margin: 20rpx 8rpx 14rpx;
}
.week-toolbar-title {
color: #4c4740;
font-size: 26rpx;
font-weight: 800;
}
.week-toolbar-range {
color: #9a9288;
font-size: 22rpx;
}
.week-board {
height: 900rpx;
margin-top: 0;
padding: 0;
overflow: hidden;
border-color: rgba(111, 143, 131, 0.1);
background: #fffdf8;
box-shadow: 0 8rpx 20rpx rgba(78, 96, 78, 0.04);
}
.week-calendar {
min-width: 904rpx;
}
.week-calendar-head {
position: sticky;
top: 0;
z-index: 6;
display: flex;
height: 104rpx;
border-bottom: 1rpx solid #eee8df;
background: rgba(255, 253, 248, 0.96);
}
.week-time-corner {
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 92rpx;
color: #9a9288;
font-size: 20rpx;
}
.week-date-column {
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 116rpx;
flex-direction: column;
gap: 4rpx;
border-left: 1rpx solid #f0ebe4;
color: #8f877e;
}
.week-date-column.active {
background: #eef7f0;
color: #2f6f62;
}
.week-date-column.active::after {
position: absolute;
right: 18rpx;
bottom: 10rpx;
left: 18rpx;
height: 5rpx;
border-radius: 999rpx;
background: #6f8f83;
content: "";
}
.week-name {
color: inherit;
font-size: 20rpx;
}
.week-date {
margin-top: 0;
color: #292520;
font-size: 30rpx;
font-weight: 800;
}
.week-date-column.active .week-date {
color: #2f6f62;
}
.week-count {
color: #aaa198;
font-size: 17rpx;
}
.week-calendar-body {
position: relative;
display: flex;
min-height: 560rpx;
}
.week-time-axis {
position: relative;
z-index: 3;
flex: 0 0 92rpx;
border-right: 1rpx solid #eee8df;
background: #fffdf8;
}
.week-time-label {
position: absolute;
right: 12rpx;
color: #aaa198;
font-size: 18rpx;
line-height: 1;
transform: translateY(-50%);
}
.week-day-columns {
display: flex;
flex: 1;
min-width: 0;
}
.week-day-column {
position: relative;
flex: 0 0 116rpx;
border-right: 1rpx solid #f0ebe4;
background-image: linear-gradient(to bottom, rgba(214, 207, 197, 0.32) 1rpx, transparent 1rpx);
background-size: 100% 60rpx;
}
.week-day-column.active {
background-color: rgba(238, 247, 240, 0.34);
}
.week-appointment-block {
position: absolute;
right: 10rpx;
left: 10rpx;
display: flex;
flex-direction: column;
gap: 2rpx;
overflow: hidden;
padding: 8rpx 8rpx;
border-left: 5rpx solid rgba(255, 255, 255, 0.78);
border-radius: 9rpx;
color: #355849;
box-shadow: 0 6rpx 12rpx rgba(70, 92, 75, 0.1);
}
.week-appointment-block.pending {
color: #986b2f;
}
.week-appointment-block.is-completed {
opacity: 0.74;
}
.week-appointment-block.is-cancelled {
opacity: 0.56;
}
.week-block-time,
.week-block-title,
.week-block-meta {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.week-block-time {
color: inherit;
font-size: 16rpx;
font-weight: 800;
}
.week-block-title {
color: #2f4d3d;
font-size: 22rpx;
font-weight: 900;
}
.week-block-meta {
color: rgba(47, 77, 61, 0.72);
font-size: 16rpx;
}
.week-column-empty {
position: absolute;
top: 40rpx;
right: 0;
left: 0;
color: #d3ccc3;
font-size: 22rpx;
text-align: center;
}
.month-card {
overflow: hidden;
}