优化店务小程序月视图展示

This commit is contained in:
2026-07-23 12:26:25 +08:00
parent b14a97578e
commit e443db55bb
6 changed files with 35 additions and 66 deletions
+6 -16
View File
@@ -233,13 +233,12 @@ Page({
{ value: 'week', label: '周' },
{ value: 'day', label: '日' }
],
monthDisplayMode: 'count',
monthDisplayMode: 'rows',
monthDisplayModes: [
{ value: 'count', label: '单量' },
{ value: 'blocks', label: '点阵' },
{ value: 'blocks', label: '点状' },
{ value: 'rows', label: '横条' }
],
monthRowLabelVisible: false,
monthRowLabelVisible: true,
weekLabels: ['一', '二', '三', '四', '五', '六', '日'],
currentDate: new Date(),
currentDateText: dateUtil.formatDate(new Date()),
@@ -716,6 +715,7 @@ Page({
return (appointments || []).map((item, index) => {
const artist = artistMap[String(item.artistId)] || {}
const artistName = item.artistName || artist.name || ''
const customerName = item.customerName || item.customerUserName || item.customerPhone || ''
const orderItemId = resolveAppointmentItemId(item)
return {
key: `${mode}-${orderItemId || item.artistId || 'appointment'}-${index}`,
@@ -725,6 +725,7 @@ Page({
color: item.color || artist.color || '#B8B0A6',
shortName: artist.shortName || String(artistName || '?').slice(0, 1),
artistName: artistName || '?',
customerName: customerName || '客户',
statusClass: completedOrCancelledClass(item.status)
}
})
@@ -813,6 +814,7 @@ Page({
color: count.color,
shortName: count.shortName,
artistName: count.artistName || count.shortName,
customerName: count.customerName || '客户',
statusClass: count.statusClass
})
}
@@ -891,18 +893,6 @@ Page({
},
openAppointment(event) {
const currentDataset = event && event.currentTarget && event.currentTarget.dataset ? event.currentTarget.dataset : {}
const count = Number(currentDataset.count || 1)
if (this.data.viewMode === 'month' && this.data.monthDisplayMode === 'count' && count > 1) {
const date = normalizeReturnTargetDate(currentDataset.date)
this.setData({
currentDate: toLocalDate(date),
currentDateText: date,
monthDisplayMode: 'blocks'
})
wx.showToast({ title: '请点击具体预约块查看详情', icon: 'none' })
return
}
const id = resolveAppointmentEventId(event)
if (!id) {
wx.showToast({ title: '缺少预约详情ID', icon: 'none' })
+2 -8
View File
@@ -128,20 +128,14 @@
<text wx:if="{{!item.isPast && item.shopRest}}" class="day-mark rest">休</text>
<text wx:elif="{{!item.isPast && item.dayStatus === 'full'}}" class="day-mark full">满</text>
</view>
<view wx:if="{{monthDisplayMode === 'count'}}" class="month-bars">
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="key" wx:if="{{count.count > 0}}" class="month-artist-bar {{count.statusClass}}" style="background: {{count.color}};" data-id="{{count.orderItemId || count.id}}" data-order-item-id="{{count.orderItemId || count.id}}" data-count="{{count.count}}" data-date="{{item.date}}" catchtap="openAppointment">
<text data-id="{{count.orderItemId || count.id}}" data-order-item-id="{{count.orderItemId || count.id}}">{{count.shortName}}{{count.count}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</view>
<view wx:else class="month-blocks">
<view class="month-blocks">
<block wx:if="{{monthDisplayMode === 'blocks'}}">
<view wx:for="{{item.expandedBlocks}}" wx:for-item="block" wx:key="key" class="month-order-block {{block.statusClass}}" style="background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" catchtap="openAppointment"></view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
<block wx:else>
<view wx:for="{{item.rowBlocks}}" wx:for-item="block" wx:key="key" class="month-row-block {{monthRowLabelVisible ? 'named' : ''}} {{block.statusClass}}" style="background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" catchtap="openAppointment">
<text wx:if="{{monthRowLabelVisible}}" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}">{{block.artistName}}</text>
<text wx:if="{{monthRowLabelVisible}}" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}">{{block.customerName}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
+2 -31
View File
@@ -532,8 +532,6 @@
.week-bar.is-cancelled::after,
.week-count-bar.is-completed::after,
.week-count-bar.is-cancelled::after,
.month-artist-bar.is-completed::after,
.month-artist-bar.is-cancelled::after,
.month-order-block.is-completed::after,
.month-order-block.is-cancelled::after,
.month-row-block.is-completed::after,
@@ -554,8 +552,6 @@
.week-bar.is-cancelled::before,
.week-count-bar.is-completed::before,
.week-count-bar.is-cancelled::before,
.month-artist-bar.is-completed::before,
.month-artist-bar.is-cancelled::before,
.month-order-block.is-completed::before,
.month-order-block.is-cancelled::before,
.month-row-block.is-completed::before,
@@ -574,7 +570,6 @@
.week-bar.is-completed::before,
.week-count-bar.is-completed::before,
.month-artist-bar.is-completed::before,
.month-order-block.is-completed::before,
.month-row-block.is-completed::before {
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='%2345825b' stroke-opacity='.9' stroke-width='2' stroke-linecap='square' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
@@ -582,7 +577,6 @@
.week-bar.is-cancelled::before,
.week-count-bar.is-cancelled::before,
.month-artist-bar.is-cancelled::before,
.month-order-block.is-cancelled::before,
.month-row-block.is-cancelled::before {
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");
@@ -764,30 +758,6 @@
color: #8aaeca;
}
.month-bars {
display: flex;
flex-direction: column;
gap: 5rpx;
margin-top: 7rpx;
}
.month-artist-bar {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: 24rpx;
min-width: 0;
overflow: hidden;
border-radius: 6rpx;
color: #fff;
font-size: 17rpx;
font-weight: 800;
line-height: 1;
white-space: nowrap;
transition: transform 160ms ease;
}
.month-blocks {
display: flex;
flex-wrap: wrap;
@@ -823,7 +793,8 @@
}
.month-row-block.named {
height: 20rpx;
height: 28rpx;
font-size: 16rpx;
}
.month-blocks .month-empty {