保留预约暂不分配美甲师状态
This commit is contained in:
@@ -608,6 +608,9 @@ Page({
|
||||
},
|
||||
|
||||
async loadArtists(preferredArtistId, fallbackEmployee) {
|
||||
const unassignedSelection = preferredArtistId === undefined && this.data.selectedArtist.id === '__unassigned__'
|
||||
? this.data.selectedArtist
|
||||
: {}
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: this.data.form.appointmentDate,
|
||||
@@ -622,20 +625,22 @@ Page({
|
||||
avatar: fallbackEmployee.avatar || ''
|
||||
})
|
||||
}
|
||||
const selectedArtist = requestedId ? findArtist(artists, requestedId) : {}
|
||||
const selectedArtist = requestedId
|
||||
? findArtist(artists, requestedId)
|
||||
: unassignedSelection
|
||||
this.setData({
|
||||
artists,
|
||||
artistSelectorItems: this.filterArtistItems(artists, this.data.artistKeyword),
|
||||
selectedArtist,
|
||||
artistError: '',
|
||||
'form.artistId': selectedArtist.id || ''
|
||||
'form.artistId': selectedArtist.id === '__unassigned__' ? '' : selectedArtist.id || ''
|
||||
})
|
||||
this.refreshProductCards()
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
artists: [],
|
||||
artistSelectorItems: [],
|
||||
selectedArtist: {},
|
||||
artistSelectorItems: this.filterArtistItems([], this.data.artistKeyword),
|
||||
selectedArtist: unassignedSelection,
|
||||
'form.artistId': '',
|
||||
artistError: error.message || '美甲师列表加载失败',
|
||||
conflictTip: error.message || '美甲师列表加载失败',
|
||||
|
||||
@@ -39,8 +39,12 @@ function createPage() {
|
||||
|
||||
async function run() {
|
||||
const appointmentWxml = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8')
|
||||
const appointmentWxss = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8')
|
||||
assert.match(appointmentWxml, /已选择暂不分配美甲师/)
|
||||
assert.match(appointmentWxml, /selected-id="\{\{selectedArtist\.id\}\}"/)
|
||||
const imageGridStyle = appointmentWxss.match(/\.manual-style-image-grid\s*\{([^}]*)\}/)
|
||||
assert.ok(imageGridStyle)
|
||||
assert.match(imageGridStyle[1], /justify-content:\s*flex-start/)
|
||||
|
||||
const expiredPage = createPage()
|
||||
expiredPage.data.canCreateAppointment = true
|
||||
@@ -83,6 +87,24 @@ async function run() {
|
||||
assert.strictEqual(unassignedPage.data.form.appointmentTime, '14:00')
|
||||
assert.strictEqual(unassignedPage.data.artistSheetVisible, false)
|
||||
|
||||
planningApi.calendar = async () => ({ artists: [{ id: 2, name: '小李' }] })
|
||||
await unassignedPage.loadArtists()
|
||||
assert.strictEqual(unassignedPage.data.selectedArtist.id, '__unassigned__')
|
||||
assert.strictEqual(unassignedPage.data.form.artistId, '')
|
||||
assert.strictEqual(unassignedPage.data.artistSelectorItems[0].id, '__unassigned__')
|
||||
|
||||
const clearedPage = createPage()
|
||||
clearedPage.data.selectedArtist = { id: '__unassigned__', name: '暂不分配美甲师' }
|
||||
planningApi.calendar = async () => ({ artists: [{ id: 2, name: '小李' }] })
|
||||
await clearedPage.loadArtists('')
|
||||
assert.deepStrictEqual(clearedPage.data.selectedArtist, {})
|
||||
|
||||
planningApi.calendar = async () => { throw new Error('网络异常') }
|
||||
await unassignedPage.loadArtists()
|
||||
assert.strictEqual(unassignedPage.data.selectedArtist.id, '__unassigned__')
|
||||
assert.strictEqual(unassignedPage.data.form.artistId, '')
|
||||
assert.strictEqual(unassignedPage.data.artistSelectorItems[0].id, '__unassigned__')
|
||||
|
||||
let submittedPayload
|
||||
planningApi.createAppointment = async payload => {
|
||||
submittedPayload = payload
|
||||
|
||||
@@ -418,3 +418,4 @@
|
||||
- 恢复月历工具栏原布局:标题在左,显示模式与姓名开关作为一组靠右排列。
|
||||
- 预约款式图片横向滚动内容明确从左侧开始排列,保持图片和添加入口为正方形。
|
||||
- 美甲师选择器中的“暂不分配”可选中;选择后表单显示“已选择暂不分配美甲师”,但提交仍不携带美甲师 ID,并保留不校验排班占用的行为。
|
||||
- 日期切换重新加载美甲师列表或列表加载失败时,保留已选择的“暂不分配”展示状态;其业务 ID 仍为空。
|
||||
|
||||
Reference in New Issue
Block a user