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

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
+12 -10
View File
@@ -1,16 +1,19 @@
const employeesApi = require('../../api/employees')
const mock = require('../../utils/mock')
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
const DEFAULT_EMPLOYEE_PASSWORD = 'Fingertip@123'
Page({
data: {
employees: [],
loadError: '',
createModalVisible: false,
creating: false,
createForm: {
nickname: '',
phone: '',
account: '',
password: '888888',
password: DEFAULT_EMPLOYEE_PASSWORD,
wechatId: ''
}
},
@@ -20,26 +23,25 @@ Page({
},
async loadEmployees() {
const fallback = mock.artists.map((item, index) => ({
...item,
monthOrders: 32 - index * 5,
monthAmount: 5800 - index * 760
}))
try {
const data = await employeesApi.list({ page: 1, size: 50 })
const list = data.list || data || []
this.setData({
loadError: '',
employees: list.map((item, index) => ({
id: item.userId || item.id,
name: item.nickname || item.name || item.artistName || `美甲师${index + 1}`,
shortName: (item.nickname || item.name || '师').slice(-1),
color: mock.artists[index % mock.artists.length].color,
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
monthOrders: item.monthOrders || item.orderCount || 0,
monthAmount: item.monthAmount || item.turnover || 0
}))
})
} catch (error) {
this.setData({ employees: fallback })
this.setData({
employees: [],
loadError: error.message || '美甲师列表加载失败'
})
}
},
@@ -79,7 +81,7 @@ Page({
nickname: '',
phone: '',
account: '',
password: '888888',
password: DEFAULT_EMPLOYEE_PASSWORD,
wechatId: ''
}
})