规划页并排展示待分配预约

This commit is contained in:
2026-10-29 21:01:01 +08:00
parent 6697b7e193
commit eb1a41bfd1
5 changed files with 157 additions and 20 deletions
@@ -76,6 +76,14 @@ async function run() {
})
assert.strictEqual(monthDays.length, 42)
assert.strictEqual(monthDays.some(item => item.artistCounts.some(count => count.artistId === '__unassigned__' && count.count === 1)), true)
assert.strictEqual(monthDays.find(item => item.unassignedCount === 1).unassignedCount, 1)
const weekStart = dateUtil.formatDate(dateUtil.startOfWeek(page.data.currentDateText))
const weekDays = definition.buildWeekDays.call(page, {
artists: [{ id: 1, name: '美甲师', shortName: '员', color: '#000' }],
daySummaries: [{ date: weekStart, totalCount: 2, unassignedCount: 2, artistCounts: [] }]
})
assert.strictEqual(weekDays[0].unassignedCount, 2)
assert.strictEqual(weekDays[0].artistCounts[0].artistId, '__unassigned__')
const dayPage = createPage({ currentDateText: '2026-10-12', selectedArtistId: '' })
const dayState = dayPage.buildDayView({
@@ -104,6 +112,32 @@ async function run() {
assert.match(planningWxml, /class="hour-line" style="top: \{\{hour\.top\}\}rpx;"/)
assert.match(planningWxml, /class="time-label" style="top: \{\{item\.top\}\}rpx;"/)
assert.match(planningWxss, /\.hour-line\s*\{[^}]*transform:\s*translateY\(-50%\);/)
const overlappingState = dayPage.buildDayView({
businessStartTime: '10:00',
businessEndTime: '12:00',
artists: [{ id: 1, name: '美甲师', color: '#000' }],
appointments: [
{ orderItemId: 11, date: '2026-10-12', startTime: '2026-10-12 10:00:00', durationMinutes: 60, artistId: null },
{ orderItemId: 12, date: '2026-10-12', startTime: '2026-10-12 10:30:00', durationMinutes: 60, artistId: null },
{ orderItemId: 13, date: '2026-10-12', startTime: '2026-10-12 10:45:00', durationMinutes: 30, artistId: null },
{ orderItemId: 14, date: '2026-10-12', startTime: '2026-10-12 11:30:00', durationMinutes: 60, artistId: null }
]
})
assert.strictEqual(overlappingState.dayLanes[0].width, 744)
const overlappingBlocks = overlappingState.dayLanes[0].blocks
assert.deepStrictEqual(overlappingBlocks.map(block => block.left), [12, 260, 508, 12])
assert.deepStrictEqual(overlappingBlocks.map(block => block.width), [224, 224, 224, 720])
const overlaps = (left, right) => left.itemStart < right.itemEnd && right.itemStart < left.itemEnd
overlappingBlocks.slice(0, 3).forEach((left, index, blocks) => {
blocks.slice(index + 1).forEach(right => {
if (overlaps(left, right)) {
assert.ok(left.left + left.width <= right.left || right.left + right.width <= left.left)
}
})
})
assert.match(planningWxml, /class="lane-unassigned-tag">不占档期/)
assert.match(planningWxml, /class="week-unassigned-count">待分配 \{\{item\.unassignedCount\}\}/)
assert.match(planningWxml, /class="month-unassigned-count">待 \{\{item\.unassignedCount\}\}/)
assert.doesNotMatch(planningWxss, /background-size:\s*100% 240rpx/)
assert.match(planningWxss, /\.control-card\s*\{[^}]*padding:\s*8rpx 14rpx;/)