完善小程序排班与预约快捷操作

This commit is contained in:
2026-09-04 16:13:58 +08:00
parent 4209ee732c
commit 9ac56115d0
6 changed files with 88 additions and 6 deletions
+43
View File
@@ -418,5 +418,48 @@ Page({
wx.navigateTo({
url: `/pages/appointment-detail/index?id=${event.currentTarget.dataset.id}`
})
},
stopTap() {
},
async quickUpdateStatus(event) {
const appointment = this.data.appointments.find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id))
if (!appointment) return
try {
await planningApi.updateStatus(appointment.orderId, Number(event.currentTarget.dataset.status))
wx.showToast({ title: '预约已确认', icon: 'success' })
this.loadCalendar()
} catch (error) {
wx.showToast({ title: error.message || '预约状态更新失败', icon: 'none' })
}
},
quickTransfer(event) {
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${event.currentTarget.dataset.id}` })
},
quickCancel(event) {
const appointment = this.data.appointments.find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id))
if (!appointment) return
wx.showModal({
title: '取消预约',
content: '确定取消这条预约吗?',
success: result => {
if (result.confirm) {
this.updateAppointmentStatus(appointment.orderId, 3)
}
}
})
},
async updateAppointmentStatus(orderId, status) {
try {
await planningApi.updateStatus(orderId, status)
wx.showToast({ title: '预约已取消', icon: 'success' })
this.loadCalendar()
} catch (error) {
wx.showToast({ title: error.message || '预约取消失败', icon: 'none' })
}
}
})
@@ -67,6 +67,11 @@
<text class="block-title">{{block.customerName}}</text>
<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}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
<text data-id="{{block.orderItemId}}" catchtap="quickTransfer">改派</text>
<text data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
</view>
</view>
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
</view>
+13
View File
@@ -320,6 +320,19 @@
line-height: 1.25;
}
.block-actions {
display: flex;
gap: 10rpx;
margin-top: 6rpx;
color: #2f6f62;
font-size: 20rpx;
font-weight: 800;
}
.block-actions text {
padding: 2rpx 6rpx;
}
.lane-empty {
position: absolute;
top: 76rpx;