diff --git a/JY-Salon-WeChat/pages/employees/index.js b/JY-Salon-WeChat/pages/employees/index.js index 652f998f..33ceb355 100644 --- a/JY-Salon-WeChat/pages/employees/index.js +++ b/JY-Salon-WeChat/pages/employees/index.js @@ -12,11 +12,23 @@ function buildScheduleSummary(item) { } function buildRoleText(item) { - return Number(item.type) === 2 ? '店长' : '店员' + if (Number(item.type) === 2 || item.identity === '店长') { + return '店长' + } + return item.identity || item.roleName || '美甲师' +} + +function buildStatusCode(item) { + return item.currentStatusCode || (Number(item.status) === 0 ? 'DISABLED' : 'NORMAL') +} + +function buildStatusText(item, statusCode) { + return item.currentStatusText || (statusCode === 'DISABLED' ? '停用' : statusCode === 'REST' ? '休假' : '正常') } function toEmployeeRow(item, index) { const name = item.nickname || item.name || item.artistName || `美甲师${index + 1}` + const statusCode = buildStatusCode(item) return { id: item.userId || item.id, name, @@ -25,16 +37,48 @@ function toEmployeeRow(item, index) { color: item.color || EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length], monthOrders: item.monthOrders || item.orderCount || 0, monthAmount: item.monthAmount || item.turnover || 0, + todayOrders: item.todayOrders || item.todayAppointments || item.todayAppointmentCount || 0, + avgAmount: item.avgAmount || 0, scheduleSummary: buildScheduleSummary(item), roleText: buildRoleText(item), + statusCode, + statusText: buildStatusText(item, statusCode), + statusClass: statusCode === 'DISABLED' ? 'disabled' : statusCode === 'REST' ? 'rest' : 'normal', isManager: Number(item.type) === 2 } } +function buildStatusFilters(rows) { + const countByStatus = rows.reduce((map, item) => { + map[item.statusCode] = (map[item.statusCode] || 0) + 1 + return map + }, {}) + return [ + { value: 'ALL', label: '全部', count: rows.length }, + { value: 'NORMAL', label: '正常', count: countByStatus.NORMAL || 0 }, + { value: 'REST', label: '休假', count: countByStatus.REST || 0 }, + { value: 'DISABLED', label: '停用', count: countByStatus.DISABLED || 0 } + ] +} + +function filterEmployees(rows, status) { + if (status === 'ALL') { + return rows + } + return rows.filter(item => item.statusCode === status) +} + Page({ data: { - managers: [], + allEmployees: [], employees: [], + statusFilters: [ + { value: 'ALL', label: '全部', count: 0 }, + { value: 'NORMAL', label: '正常', count: 0 }, + { value: 'REST', label: '休假', count: 0 }, + { value: 'DISABLED', label: '停用', count: 0 } + ], + activeStatus: 'ALL', loadError: '', createModalVisible: false, creating: false, @@ -61,18 +105,28 @@ Page({ const rows = list.map(toEmployeeRow) this.setData({ loadError: '', - managers: rows.filter(item => item.isManager), - employees: rows.filter(item => !item.isManager) + allEmployees: rows, + statusFilters: buildStatusFilters(rows), + employees: filterEmployees(rows, this.data.activeStatus) }) } catch (error) { this.setData({ - managers: [], + allEmployees: [], employees: [], - loadError: error.message || '美甲师列表加载失败' + statusFilters: buildStatusFilters([]), + loadError: error.message || '员工列表加载失败' }) } }, + switchStatus(event) { + const status = event.currentTarget.dataset.status + this.setData({ + activeStatus: status, + employees: filterEmployees(this.data.allEmployees, status) + }) + }, + openDetail(event) { wx.navigateTo({ url: `/pages/employee-detail/index?id=${event.currentTarget.dataset.id}` }) }, diff --git a/JY-Salon-WeChat/pages/employees/index.wxml b/JY-Salon-WeChat/pages/employees/index.wxml index 0da78da0..d7c0f73b 100644 --- a/JY-Salon-WeChat/pages/employees/index.wxml +++ b/JY-Salon-WeChat/pages/employees/index.wxml @@ -1,66 +1,68 @@ - - - 美甲师 - + + + 员工 - + + + + {{item.label}}({{item.count}}) + + + + + {{loadError}} - 暂无美甲师 + 暂无员工 - - 店长 - - - - + + + + + + {{item.shortName}} + + + + + {{item.name}} + {{item.roleText}} + + + {{item.statusText}} + {{item.scheduleSummary}} + + + + 今日预约 + {{item.todayOrders}} - {{item.shortName}} - - - {{item.name}} - {{item.roleText}} - - {{item.scheduleSummary}} - 本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}} + + 本月订单 + {{item.monthOrders}} + + + 本月收入 + ¥{{item.monthAmount}} - {{item.scheduleSummary === '未设置' ? '待排班' : '正常'}} - - - - - 店员 - - - - - - {{item.shortName}} - - - {{item.name}} - {{item.roleText}} - - {{item.scheduleSummary}} - 本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}} - - - {{item.scheduleSummary === '未设置' ? '待排班' : '正常'}} + › + + 新增美甲师 - × + diff --git a/JY-Salon-WeChat/pages/employees/index.wxss b/JY-Salon-WeChat/pages/employees/index.wxss index f2566d9d..2ba1948d 100644 --- a/JY-Salon-WeChat/pages/employees/index.wxss +++ b/JY-Salon-WeChat/pages/employees/index.wxss @@ -1,100 +1,98 @@ -.list-heading { +.employee-page { + padding-top: 30rpx; +} + +.employee-header { display: flex; align-items: center; - justify-content: flex-start; + justify-content: space-between; + margin: 0 4rpx 22rpx; +} + +.employee-page-title { + color: #302a25; + font-size: 38rpx; + font-weight: 900; +} + +.employee-filter-scroll { width: 100%; - margin-bottom: 16rpx; - color: #4c4740; - font-size: 28rpx; + margin-bottom: 22rpx; + white-space: nowrap; +} + +.employee-filters { + display: flex; + gap: 18rpx; + width: max-content; + min-width: 100%; +} + +.employee-filter { + display: flex; + align-items: center; + justify-content: center; + min-width: 104rpx; + height: 54rpx; + padding: 0 18rpx; + border-radius: 999rpx; + background: rgba(255, 255, 255, 0.72); + color: #8f877d; + font-size: 22rpx; font-weight: 800; } -.list-heading text { - flex: 1; +.employee-filter.active { + background: #eef7f0; + color: #55786d; + box-shadow: inset 0 0 0 1rpx rgba(111, 143, 131, 0.16); } -.list-heading .compact-btn { - margin-left: auto; -} - -.add-employee-btn { - width: 84rpx; - min-width: 84rpx; - max-width: 84rpx; - height: 84rpx; - min-height: 84rpx; - padding: 0; - border-radius: 50%; - background: #6f8f83; - color: #fffdf8; - font-size: 42rpx; - font-weight: 400; - line-height: 84rpx; - box-shadow: 0 10rpx 22rpx rgba(111, 143, 131, 0.2); +.employee-list { + display: flex; + flex-direction: column; + gap: 18rpx; } .employee-card { display: flex; align-items: center; - justify-content: space-between; - padding: 22rpx; - border-color: rgba(111, 143, 131, 0.1); + gap: 18rpx; + min-height: 156rpx; + padding: 22rpx 18rpx; + border-color: rgba(111, 143, 131, 0.08); background: rgba(255, 255, 255, 0.86); box-shadow: 0 8rpx 20rpx rgba(78, 96, 78, 0.045); animation: cardIn 180ms ease both; - transition: transform 160ms ease, box-shadow 160ms ease; +} + +.employee-card.manager { + background: rgba(255, 255, 255, 0.92); } .employee-card:active { transform: scale(0.99); - box-shadow: 0 6rpx 18rpx rgba(58, 48, 34, 0.08); } -.employee-section { - display: flex; - flex-direction: column; - gap: 14rpx; +.employee-avatar-wrap { + position: relative; + flex: 0 0 auto; + width: 92rpx; + height: 92rpx; } -.employee-section + .employee-section { - margin-top: 24rpx; -} - -.section-subtitle { - color: #6d665f; - font-size: 24rpx; - font-weight: 900; -} - -.manager-card { - border-color: rgba(111, 143, 131, 0.26); - background: #f4faf2; -} - -.employee-left { - display: flex; - align-items: center; - gap: 18rpx; -} - -.employee-title-row { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 10rpx; -} - -.avatar { +.employee-avatar { display: flex; align-items: center; justify-content: center; - width: 78rpx; - height: 78rpx; + width: 92rpx; + height: 92rpx; + overflow: hidden; + border: 4rpx solid #f5faf3; border-radius: 50%; color: #fff; - font-size: 28rpx; + font-size: 30rpx; font-weight: 900; - overflow: hidden; } .image-avatar image { @@ -102,27 +100,68 @@ height: 100%; } -.employee-name, -.employee-schedule, -.employee-meta { - display: block; +.employee-dot { + position: absolute; + right: 2rpx; + bottom: 4rpx; + width: 18rpx; + height: 18rpx; + border: 3rpx solid #fffdf8; + border-radius: 50%; +} + +.employee-dot.normal { + background: #85b58a; +} + +.employee-dot.rest { + background: #d7b17d; +} + +.employee-dot.disabled { + background: #b8afa6; +} + +.employee-card-body { + flex: 1; + min-width: 0; +} + +.employee-title-row, +.employee-status-row { + display: flex; + align-items: center; + min-width: 0; +} + +.employee-title-row { + gap: 10rpx; +} + +.employee-status-row { + gap: 12rpx; + margin-top: 8rpx; } .employee-name { + overflow: hidden; color: #25211d; - font-size: 28rpx; - font-weight: 800; + font-size: 29rpx; + font-weight: 900; + text-overflow: ellipsis; + white-space: nowrap; } .role-tag { display: inline-flex; align-items: center; - min-height: 34rpx; - padding: 0 12rpx; + flex: 0 0 auto; + min-height: 32rpx; + padding: 0 10rpx; border-radius: 999rpx; - background: #f2ede7; - color: #7b7168; - font-size: 20rpx; + background: #fff0df; + color: #bd7a4d; + font-size: 18rpx; font-weight: 900; } @@ -131,33 +170,80 @@ color: #55786d; } -.employee-meta { - margin-top: 8rpx; - color: #91897f; - font-size: 24rpx; +.employee-state { + flex: 0 0 auto; + min-height: 32rpx; + padding: 0 12rpx; + border-radius: 999rpx; + font-size: 19rpx; + font-weight: 900; + line-height: 32rpx; +} + +.employee-state.normal { + background: #eff7ef; + color: #5f9070; +} + +.employee-state.rest { + background: #fff4df; + color: #b57935; +} + +.employee-state.disabled { + background: #f0ece5; + color: #8d8379; } .employee-schedule { - margin-top: 6rpx; - color: #55786d; + overflow: hidden; + color: #9b938a; + font-size: 21rpx; + text-overflow: ellipsis; + white-space: nowrap; +} + +.employee-metrics { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 8rpx; + margin-top: 12rpx; +} + +.employee-metric { + min-width: 0; +} + +.metric-label, +.metric-value { + display: block; +} + +.metric-label { + color: #a39a90; + font-size: 18rpx; +} + +.metric-value { + margin-top: 4rpx; + color: #4c4740; font-size: 23rpx; - font-weight: 800; + font-weight: 900; } -.color-pill { - display: none; +.employee-metric.strong .metric-value { + color: #2f4d3d; } -.employee-state { +.arrow { flex: 0 0 auto; - min-height: 34rpx; - padding: 0 12rpx; - border-radius: 999rpx; - background: #eff7ef; - color: #5f9070; - font-size: 19rpx; - font-weight: 800; - line-height: 34rpx; + color: #b0a79e; + font-size: 46rpx; + line-height: 1; +} + +.employee-fab { + bottom: calc(112rpx + env(safe-area-inset-bottom)); } .retry-btn { @@ -197,9 +283,6 @@ .modal-title { display: block; -} - -.modal-title { color: #27211d; font-size: 34rpx; font-weight: 900; @@ -213,22 +296,19 @@ width: 48rpx; min-width: 48rpx; height: 48rpx; - border-radius: 50%; border: 1rpx solid #e4d8ca; + border-radius: 50%; background: #fffaf4; - color: transparent; - font-size: 0; - line-height: 0; } .modal-close::before, .modal-close::after { - content: ""; position: absolute; width: 22rpx; height: 3rpx; border-radius: 999rpx; background: #61554c; + content: ""; } .modal-close::before { diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index 182846ed..3a1bb4d8 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -643,3 +643,10 @@ - 处理方式:客户新增弹层增加 200 字以内多行备注输入框;小程序提交 `remark`;后端创建 DTO 校验并写入现有用户 `signature` 字段,详情页可继续复用原备注展示。 - 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。 - 验证结果:`AdminManagerControllerTest` 定向测试通过;小程序 JS、WXML、WXSS 和后端 Java 文件静态检查、BOM 检查、`git diff --check` 通过。 + +## 2026-07-25 员工页列表 UI 与状态筛选改造 + +- 变更原因:用户反馈员工页顶部角色分组块不需要,新增入口应与预约/客户页一致放到右下角,并希望列表视觉贴近参考图。 +- 处理方式:员工页移除顶部“美甲师/店员”分组块,新增右下角悬浮加号;列表改为头像、姓名、角色、当前状态、排班摘要、今日预约、本月订单和本月收入的卡片;顶部筛选改为按当前状态筛选全部/正常/休假/停用。 +- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。 +- 验证结果:员工页 JS、WXML、WXSS 静态检查与 BOM 检查通过,`git diff --check` 和 GitNexus staged 变更检测通过,风险 LOW 且 0 个受影响流程。