修复管理师端预约与登录体验

This commit is contained in:
2026-06-26 11:07:54 +08:00
parent f1fdf6e5d3
commit 078a2b32cd
48 changed files with 1044 additions and 276 deletions
@@ -86,6 +86,7 @@ Page({
selectedArtist: {},
productModalVisible: false,
productKeyword: '',
productError: '',
conflictTip: '',
conflictLevel: 'free',
canCreateAppointment: true,
@@ -96,6 +97,8 @@ Page({
const creatable = canCreateAppointment()
this.setData({
canCreateAppointment: creatable,
'form.customerName': options.customerName ? decodeURIComponent(options.customerName) : '',
'form.phone': options.phone ? decodeURIComponent(options.phone) : '',
'form.appointmentDate': options.date || dateUtil.formatDate(new Date()),
'form.artistId': options.artistId || ''
})
@@ -107,17 +110,16 @@ Page({
},
async loadOptions() {
const fallbackProducts = [
{ id: 1, title: '纯色美甲', approximateDuration: '90分钟' },
{ id: 2, title: '猫眼延长', approximateDuration: '120分钟' },
{ id: 3, title: '手部护理', approximateDuration: '60分钟' }
]
try {
const productsData = await productsApi.list({ page: 1, size: 100 })
const products = productsData.list || productsData || fallbackProducts
this.setData({ products })
const products = productsData.list || productsData || []
this.setData({ products, productError: '' })
} catch (error) {
this.setData({ products: fallbackProducts })
this.setData({
products: [],
filteredProducts: [],
productError: error.message || '作品列表加载失败'
})
}
await this.loadArtists()
this.refreshProductCards()
@@ -125,14 +127,24 @@ Page({
},
async loadArtists() {
const calendar = await planningApi.calendar({
startDate: this.data.form.appointmentDate,
endDate: this.data.form.appointmentDate
})
const artists = getCalendarArtists(calendar)
const selectedArtist = this.data.form.artistId ? findArtist(artists, this.data.form.artistId) : {}
this.setData({ artists, selectedArtist })
this.refreshProductCards()
try {
const calendar = await planningApi.calendar({
startDate: this.data.form.appointmentDate,
endDate: this.data.form.appointmentDate
})
const artists = getCalendarArtists(calendar)
const selectedArtist = this.data.form.artistId ? findArtist(artists, this.data.form.artistId) : {}
this.setData({ artists, selectedArtist })
this.refreshProductCards()
} catch (error) {
this.setData({
artists: [],
selectedArtist: {},
'form.artistId': '',
conflictTip: error.message || '美甲师列表加载失败',
conflictLevel: 'danger'
})
}
},
onInput(event) {
@@ -198,7 +210,7 @@ Page({
const title = String(this.data.form.manualProductTitle || '').trim()
const price = Number(this.data.form.manualProductPrice)
if (!title || Number.isNaN(price) || price < 0) {
wx.showToast({ title: '请填写手动项目名称和价格', icon: 'none' })
wx.showToast({ title: '请填写手动预约作品名称和价格', icon: 'none' })
return
}
this.setData({
@@ -265,9 +277,9 @@ Page({
this.setData({ conflictTip: tip, conflictLevel: 'free' })
return { ok: true, tip }
} catch (error) {
const tip = '暂未获取到排班,请保存时以系统校验为准'
this.setData({ conflictTip: tip, conflictLevel: 'warn' })
return { ok: true, tip }
const tip = error.message || '排班校验失败,请稍后重试'
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
return { ok: false, tip }
}
},