新增历史补单与服务中状态

This commit is contained in:
2026-10-13 12:36:01 +08:00
parent 3ab615ccd4
commit bd8d95fcd9
29 changed files with 294 additions and 29 deletions
@@ -35,7 +35,7 @@ Page({
appointment,
isUnassigned: appointment.assignmentStatus === 'UNASSIGNED' || !appointment.artistId,
avatarText: String(appointment.customerName || '客').slice(0, 1),
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
timeText: appointment.historicalBackfill && !appointment.startTime ? '时间未记录' : `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
loadError: ''
})
},
@@ -56,6 +56,7 @@ Page({
},
confirm() {
if (this.data.appointment.historicalBackfill) return
this.updateStatus(1)
},
@@ -68,6 +69,7 @@ Page({
},
goTransfer() {
if (this.data.appointment.historicalBackfill) return
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${this.data.id}` })
},
@@ -14,8 +14,9 @@
</view>
</view>
<view class="detail-actions">
<text class="tag">{{appointment.statusText}}</text>
<button class="small-action" bindtap="goTransfer">{{isUnassigned ? '分配员工' : '改派'}}</button>
<text wx:if="{{appointment.historicalBackfill}}" class="tag">历史补单 · {{appointment.statusText}}</text>
<text wx:else class="tag">{{appointment.statusText}}</text>
<button wx:if="{{!appointment.historicalBackfill}}" class="small-action" bindtap="goTransfer">{{isUnassigned ? '分配员工' : '改派'}}</button>
</view>
</view>
<view class="detail-grid">
@@ -44,8 +45,8 @@
</view>
<view wx:if="{{!loadError}}" class="fixed-bottom action-row">
<button class="secondary-btn" disabled="{{isUnassigned}}" bindtap="confirm">{{isUnassigned ? '待分配' : '确认'}}</button>
<button class="primary-btn" disabled="{{isUnassigned}}" bindtap="complete">完成</button>
<button wx:if="{{!appointment.historicalBackfill}}" class="secondary-btn" disabled="{{isUnassigned}}" bindtap="confirm">{{isUnassigned ? '待分配' : '确认'}}</button>
<button class="primary-btn" disabled="{{isUnassigned}}" bindtap="complete">{{appointment.historicalBackfill ? '完成补单' : '完成'}}</button>
<button class="danger-btn" bindtap="cancel">取消</button>
</view>
</view>
+16 -3
View File
@@ -85,6 +85,7 @@ Page({
freeArtistCount: 0,
pendingCount: 0,
unassignedCount: 0,
historicalBackfillItems: [],
rangeUnassignedCount: 0,
nearestUnassignedDate: '',
canCreateAppointment: true,
@@ -481,9 +482,11 @@ Page({
? (calendar.artists || []).filter(item => String(item.id) === String(this.data.selectedArtistId))
: (calendar.artists || [])
const dayAppointments = (calendar.appointments || []).filter(item => resolveAppointmentDate(item) === this.data.currentDateText)
const historicalBackfillItems = dayAppointments.filter(item => item.historicalBackfill)
const employeeLanes = filteredArtists.map(artist => {
const blocks = dayAppointments
.filter(item => String(item.artistId) === String(artist.id))
.filter(item => item.startTime)
.map(item => {
const itemStart = resolveAppointmentStartMinute(item)
return {
@@ -497,6 +500,7 @@ Page({
})
const unassignedBlocks = dayAppointments
.filter(item => !item.artistId)
.filter(item => item.startTime)
.map(item => {
const itemStart = resolveAppointmentStartMinute(item)
return {
@@ -523,9 +527,10 @@ Page({
laneItemWidth: 248,
laneWidth: Math.max(720, lanes.length * 248),
dayTotal: dayAppointments.length,
freeArtistCount: employeeLanes.filter(item => item.blocks.length === 0).length,
freeArtistCount: employeeLanes.filter(item => item.blocks.every(block => block.historicalBackfill)).length,
pendingCount,
unassignedCount: unassignedBlocks.length
unassignedCount: unassignedBlocks.length,
historicalBackfillItems
}
},
@@ -625,6 +630,14 @@ Page({
this.openAppointmentForm(this.data.currentDateText)
},
openBackfillOrder() {
if (!this.data.canCreateAppointment) {
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
wx.navigateTo({ url: '/pages/backfill-order/index' })
},
openAppointmentForm(appointmentDate) {
const query = [`date=${encodeURIComponent(appointmentDate)}`]
if (this.data.selectedArtistId) {
@@ -647,7 +660,7 @@ Page({
if (!appointment) return
try {
await planningApi.updateStatus(appointment.orderId, Number(event.currentTarget.dataset.status))
wx.showToast({ title: '预约已确认', icon: 'success' })
wx.showToast({ title: Number(event.currentTarget.dataset.status) === 2 ? '补单已完成' : '预约已确认', icon: 'success' })
this.loadCalendar()
} catch (error) {
wx.showToast({ title: error.message || '预约状态更新失败', icon: 'none' })
+12 -3
View File
@@ -20,6 +20,7 @@
<view class="segmented">
<view wx:for="{{viewModes}}" wx:key="value" class="segment {{viewMode === item.value ? 'active' : ''}}" data-mode="{{item.value}}" bindtap="switchView">{{item.label}}</view>
</view>
<button wx:if="{{canCreateAppointment}}" class="backfill-entry" bindtap="openBackfillOrder">补录历史订单</button>
<scroll-view class="artist-filter" scroll-x enable-flex>
<view class="artist-chip {{!selectedArtistId ? 'active' : ''}}" data-id="" bindtap="selectArtist">全部员工</view>
<view wx:for="{{artists}}" wx:key="id" class="artist-chip {{selectedArtistId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectArtist">
@@ -57,6 +58,13 @@
<block wx:if="{{!calendarError}}">
<view wx:if="{{viewMode === 'day'}}" class="section">
<view wx:if="{{historicalBackfillItems.length}}" class="card historical-backfill-card">
<view class="section-title">历史补单</view>
<view wx:for="{{historicalBackfillItems}}" wx:key="orderItemId" class="historical-backfill-row" data-id="{{item.orderItemId}}" bindtap="openAppointment">
<view><text>{{item.customerName || '散客'}} · {{item.productTitle}}</text><text class="muted">{{item.artistName}} · {{item.startTime || '时间未记录'}}</text></view>
<text>{{item.statusText}} · ¥{{item.amount}}</text>
</view>
</view>
<view class="day-summary">
<view class="summary-item card">
<text class="summary-value">{{dayTotal}}</text>
@@ -93,9 +101,10 @@
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
<text class="block-status">{{block.statusText}}</text>
<view class="block-actions" catchtap="stopTap">
<text wx:if="{{block.status === 0 && block.assignmentStatus !== 'UNASSIGNED'}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
<text data-id="{{block.orderItemId}}" catchtap="quickTransfer">{{block.assignmentStatus === 'UNASSIGNED' ? '分配' : '改派'}}</text>
<text data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
<text wx:if="{{!block.historicalBackfill && block.status === 0 && block.assignmentStatus !== 'UNASSIGNED'}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
<text wx:if="{{!block.historicalBackfill}}" data-id="{{block.orderItemId}}" catchtap="quickTransfer">{{block.assignmentStatus === 'UNASSIGNED' ? '分配' : '改派'}}</text>
<text wx:if="{{!block.historicalBackfill || block.status === 4}}" data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
<text wx:if="{{block.historicalBackfill && block.status === 4}}" data-id="{{block.orderItemId}}" data-status="2" catchtap="quickUpdateStatus">完成</text>
</view>
</view>
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">{{item.emptyText || '全天可约'}}</view>
@@ -769,3 +769,6 @@
transform: translateY(0);
}
}
.backfill-entry{margin:18rpx 0 0;background:#f1ebe4;color:#4f766d;border:1rpx solid #d9cfc3;font-size:25rpx;line-height:68rpx;height:68rpx;border-radius:12rpx}
.historical-backfill-card{margin:20rpx 0;padding:22rpx}.historical-backfill-row{display:flex;justify-content:space-between;align-items:center;padding:18rpx 0;border-top:1rpx solid #eee7df;font-size:26rpx}.historical-backfill-row .muted{display:block;color:#92887e;font-size:22rpx;margin-top:8rpx}