修复预约改派与员工统计展示

This commit is contained in:
2026-07-25 13:36:04 +08:00
parent 219870a67b
commit 858f28be26
14 changed files with 421 additions and 18 deletions
@@ -208,6 +208,7 @@ Page({
timeText: '',
priceText: '未定',
detailTags: [],
artistChangeRequests: [],
productImageUrls: [],
productImageFileIds: '',
imageUploading: false,
@@ -244,6 +245,7 @@ Page({
timeText: '',
priceText: '未定',
detailTags: [],
artistChangeRequests: [],
productImageUrls: [],
productImageFileIds: '',
canEditAppointment: false,
@@ -263,17 +265,22 @@ Page({
const status = Number(appointment.status)
const showPendingActions = status === STATUS_PENDING_SERVICE
const showRestoreAction = status === STATUS_COMPLETED || status === STATUS_CANCELLED
const canEditAppointment = Boolean(appointment.canEdit)
const canTransfer = canTransferAppointment() && canEditAppointment
this.setData({
appointment,
avatarText: String(appointment.customerName || '客').slice(0, 1),
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
priceText: formatAppointmentPrice(appointment.amount),
detailTags: buildDetailTags(appointment),
artistChangeRequests: Array.isArray(appointment.artistChangeRequests)
? appointment.artistChangeRequests
: [],
productImageUrls: imageUrls,
productImageFileIds: resolveProductImageFileIds(appointment).join(','),
canEditAppointment: Boolean(appointment.canEdit),
canTransferAppointment: canTransferAppointment(),
showActionRow: showPendingActions || showRestoreAction,
canEditAppointment,
canTransferAppointment: canTransfer,
showActionRow: showPendingActions || showRestoreAction || canTransfer,
showPendingActions,
showRestoreAction,
loadError: ''
@@ -328,7 +335,7 @@ Page({
},
goTransfer() {
if (!this.data.canTransferAppointment) {
if (!this.data.canTransferAppointment || !this.data.canEditAppointment) {
wx.showToast({ title: '只有店长可以改派预约', icon: 'none' })
return
}
@@ -73,6 +73,23 @@
<view class="card note-card">{{appointment.remark || '暂无备注'}}</view>
</view>
<view wx:if="{{!loadError && artistChangeRequests.length}}" class="section">
<view class="section-title">改派历史</view>
<view class="card change-history-card">
<view wx:for="{{artistChangeRequests}}" wx:key="id" class="change-history-item">
<view class="change-history-path">
<text>{{item.fromArtistName || '未分配'}}</text>
<text class="change-history-arrow">→</text>
<text>{{item.toArtistName || '未分配'}}</text>
</view>
<view class="change-history-meta">
<text>操作人:{{item.requesterName || '系统'}}</text>
<text>{{item.approvedTime || item.createTime || ''}}</text>
</view>
</view>
</view>
</view>
<view wx:if="{{priceModalVisible}}" class="detail-modal-mask" catchtap="stopTap">
<view class="price-modal" catchtap="stopTap">
<view class="price-modal-head">
@@ -97,9 +114,10 @@
</view>
</view>
<view wx:if="{{!loadError && showActionRow}}" class="fixed-bottom action-row {{showRestoreAction ? 'single' : ''}}">
<view wx:if="{{!loadError && showActionRow}}" class="fixed-bottom action-row {{showRestoreAction ? 'single' : ''}} {{canTransferAppointment ? 'with-transfer' : ''}}">
<button wx:if="{{showPendingActions}}" class="primary-btn" bindtap="complete">完成</button>
<button wx:if="{{showPendingActions}}" class="danger-btn" bindtap="deleteAppointment">删除此订单</button>
<button wx:if="{{canTransferAppointment}}" class="secondary-btn transfer-btn" bindtap="goTransfer">改派</button>
<button wx:if="{{showRestoreAction}}" class="secondary-btn" bindtap="restorePending">修改状态</button>
</view>
</view>
@@ -165,6 +165,42 @@
line-height: 1.6;
}
.change-history-card {
padding: 0 24rpx;
}
.change-history-item {
padding: 22rpx 0;
border-bottom: 1rpx solid #eee5dc;
}
.change-history-item:last-child {
border-bottom: 0;
}
.change-history-path {
display: flex;
align-items: center;
gap: 12rpx;
color: #2d2924;
font-size: 26rpx;
font-weight: 800;
}
.change-history-arrow {
color: #7d9d90;
font-size: 28rpx;
}
.change-history-meta {
display: flex;
justify-content: space-between;
gap: 16rpx;
margin-top: 10rpx;
color: #9a9288;
font-size: 22rpx;
}
.section-head {
display: flex;
align-items: center;
@@ -392,6 +428,10 @@
grid-template-columns: 1fr;
}
.action-row.with-transfer {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.action-row .primary-btn,
.action-row .secondary-btn,
.action-row .danger-btn {
@@ -1016,7 +1016,7 @@
.manual-field-row {
display: grid;
grid-template-columns: minmax(0, 1fr) 248rpx;
grid-template-columns: minmax(0, 1fr);
gap: 14rpx;
}
@@ -1176,13 +1176,15 @@
.manual-tag-input-row {
box-sizing: border-box;
display: grid;
grid-template-columns: minmax(0, 1fr) 140rpx;
display: flex;
align-items: center;
min-width: 0;
gap: 12rpx;
margin-top: 12rpx;
}
.manual-tag-input {
flex: 1;
min-width: 0;
height: 70rpx;
padding: 0 18rpx;
@@ -1195,9 +1197,10 @@
.manual-tag-add {
box-sizing: border-box;
width: 100%;
min-width: 0;
max-width: none;
flex: 0 0 140rpx;
width: 140rpx;
min-width: 140rpx;
max-width: 140rpx;
}
.manual-image-row {
@@ -1315,20 +1318,25 @@
}
.manual-action-row {
position: sticky;
bottom: 0;
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
box-sizing: border-box;
min-width: 0;
gap: 14rpx;
margin-top: 18rpx;
padding-top: 18rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 4rpx);
background: linear-gradient(180deg, rgba(247, 239, 231, 0), #f7efe7 26rpx);
}
.manual-action-row .secondary-btn,
.manual-action-row .primary-btn {
flex: none;
width: auto;
width: 100%;
min-width: 0;
max-width: none;
max-width: 100%;
}
.action-row {
@@ -43,6 +43,9 @@ Page({
const name = data.nickname || data.name || data.artistName || '美甲师'
const monthOrders = data.monthOrders || data.orderCount || 0
const monthAmount = data.monthAmount || data.turnover || 0
const avgAmount = data.avgAmount === undefined || data.avgAmount === null
? (monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0)
: data.avgAmount
this.setData({
loadError: '',
employee: {
@@ -58,7 +61,8 @@ Page({
identityText: displayText(data.identity),
monthOrders,
monthAmount,
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0
avgAmount,
currentStatusText: displayText(data.currentStatusText)
}
})
} catch (error) {
@@ -64,6 +64,10 @@
<text class="info-label">身份</text>
<text class="info-value">{{employee.identityText}}</text>
</view>
<view class="info-row">
<text class="info-label">当前状态</text>
<text class="info-value">{{employee.currentStatusText}}</text>
</view>
</view>
</view>