修复Salon注册预约客户流程

This commit is contained in:
2026-10-30 15:13:38 +08:00
parent 53b6fcaa11
commit 7b9a5e4d1c
20 changed files with 748 additions and 67 deletions
+31 -3
View File
@@ -109,6 +109,24 @@ async function run() {
const shortAppointmentLane = shortAppointmentState.dayLanes.find(lane => lane.artistId === 1)
assert.strictEqual(shortAppointmentLane.blocks[0].height, 60)
assert.strictEqual(shortAppointmentLane.blocks[0].compact, true)
const missingHoursPage = createPage({ viewMode: 'day', currentDateText: '2026-10-12' })
const missingHoursEmptyState = missingHoursPage.buildDayView({
artists: [{ id: 1, name: '美甲师', color: '#000' }],
appointments: []
})
assert.strictEqual(missingHoursEmptyState.hours.length, 0)
assert.strictEqual(missingHoursEmptyState.dayLanes.length, 0)
assert.strictEqual(missingHoursEmptyState.hasTimedAppointments, false)
missingHoursPage.clearCalendarView()
assert.strictEqual(missingHoursPage.data.businessHoursText, '营业时间暂不可用')
const missingHoursWithBookingState = missingHoursPage.buildDayView({
artists: [{ id: 1, name: '美甲师', color: '#000' }],
appointments: [{ orderItemId: 10, date: '2026-10-12', startTime: '2026-10-12 15:30:00', durationMinutes: 60, artistId: 1 }]
})
assert.strictEqual(missingHoursWithBookingState.hasTimedAppointments, true)
assert.strictEqual(missingHoursWithBookingState.hours[0].label, '15:00')
assert.strictEqual(missingHoursWithBookingState.hours[1].label, '16:00')
assert.strictEqual(missingHoursWithBookingState.dayLanes.find(lane => lane.artistId === 1).blocks.length, 1)
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%\);/)
@@ -136,6 +154,8 @@ async function run() {
})
})
assert.match(planningWxml, /class="lane-unassigned-tag">不占档期/)
assert.match(planningWxml, /门店营业时间未设置/)
assert.match(planningWxml, /bindtap="openShopSettings"/)
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/)
@@ -172,7 +192,7 @@ async function run() {
global.wx.navigateTo = options => navigations.push(options.url)
global.wx.showToast = options => toasts.push(options.title)
const quickCreatePage = createPage({ canCreateAppointment: true, selectedArtistId: '88' })
const quickCreatePage = createPage({ canCreateAppointment: true, businessHoursConfigured: true, selectedArtistId: '88' })
const today = dateUtil.formatDate(new Date())
quickCreatePage.quickCreateAppointment({ currentTarget: { dataset: { date: today } } })
assert.strictEqual(navigations.pop(), `/pages/appointment-form/index?date=${today}&artistId=88`)
@@ -190,14 +210,22 @@ async function run() {
quickCreatePage.quickCreateAppointment({ currentTarget: { dataset: { date: '2000-01-01' } } })
assert.strictEqual(navigations.pop(), '/pages/backfill-order/index?serviceDate=2000-01-01')
const readonlyPage = createPage({ canCreateAppointment: false, selectedArtistId: '88' })
const readonlyPage = createPage({ canCreateAppointment: false, businessHoursConfigured: true, selectedArtistId: '88' })
readonlyPage.quickCreateAppointment({ currentTarget: { dataset: { date: '2099-12-31' } } })
assert.strictEqual(navigations.length, 0)
assert.strictEqual(toasts.pop(), '当前账号仅支持查看预约')
const fabPage = createPage({ canCreateAppointment: true, currentDateText: '2026-10-12', selectedArtistId: '99' })
const fabPage = createPage({ canCreateAppointment: true, businessHoursConfigured: true, currentDateText: '2026-10-12', selectedArtistId: '99' })
fabPage.createAppointment()
assert.strictEqual(navigations.pop(), '/pages/appointment-form/index?date=2026-10-12&artistId=99')
const unconfiguredPage = createPage({ canCreateAppointment: true, businessHoursConfigured: false })
unconfiguredPage.quickCreateAppointment({ currentTarget: { dataset: { date: '2099-12-31' } } })
assert.strictEqual(navigations.length, 0)
assert.strictEqual(toasts.pop(), '请先在店铺设置中配置营业时间')
unconfiguredPage.openShopSettings()
assert.strictEqual(navigations.pop(), '/pages/shop-settings/index')
assert.strictEqual(unconfiguredPage._refreshCalendarOnShow, true)
}
run().catch(error => {