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

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
@@ -1,23 +1,43 @@
const mock = require('../../utils/mock')
const employeesApi = require('../../api/employees')
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
Page({
data: {
id: '',
employee: {}
employee: {},
loadError: ''
},
onLoad(options) {
const id = options.id || mock.artists[0].id
const artist = mock.artists.find(item => String(item.id) === String(id)) || mock.artists[0]
this.setData({
id,
employee: {
...artist,
monthOrders: 32,
monthAmount: 5800,
avgAmount: 181
}
})
this.setData({ id: options.id || '' })
this.loadDetail()
},
async loadDetail() {
try {
const data = await employeesApi.detail(this.data.id)
const name = data.nickname || data.name || data.artistName || '美甲师'
const monthOrders = data.monthOrders || data.orderCount || 0
const monthAmount = data.monthAmount || data.turnover || 0
this.setData({
loadError: '',
employee: {
...data,
name,
shortName: name.slice(-1),
color: data.color || EMPLOYEE_COLORS[0],
monthOrders,
monthAmount,
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0
}
})
} catch (error) {
this.setData({
employee: {},
loadError: error.message || '美甲师详情加载失败'
})
}
},
go(event) {