新增历史补单与服务中状态
This commit is contained in:
@@ -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' })
|
||||
|
||||
Reference in New Issue
Block a user