完善店务员工工时与订单记录
This commit is contained in:
+1
-1
@@ -221,7 +221,7 @@ public class AdminManagerController {
|
||||
return Result.success(nailArtistInfoService.getAllNailArtists());
|
||||
}
|
||||
Long shopId = adminScopeHelper.resolveShopScope(currentUser, null);
|
||||
return Result.success(nailArtistInfoService.getByShopId(shopId));
|
||||
return Result.success(nailArtistInfoService.getManageableByShopId(shopId, currentUser.getId()));
|
||||
}
|
||||
|
||||
@GetMapping("/employees/{userId}")
|
||||
|
||||
+4
-2
@@ -539,18 +539,20 @@ class AdminManagerControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void employeesShouldReturnScopedArtistsForNonPlatformUser() {
|
||||
void employeesShouldReturnManageableArtistsForNonPlatformUser() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
manager.setId(5L);
|
||||
List<NailArtistInfoDTO> artists = List.of(new NailArtistInfoDTO());
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.isPlatformAdmin(manager)).thenReturn(false);
|
||||
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
|
||||
when(nailArtistInfoService.getByShopId(8L)).thenReturn(artists);
|
||||
when(nailArtistInfoService.getManageableByShopId(8L, 5L)).thenReturn(artists);
|
||||
|
||||
Result<List<NailArtistInfoDTO>> result = controller.employees(request);
|
||||
|
||||
assertThat(result.getData()).isSameAs(artists);
|
||||
verify(nailArtistInfoService).getManageableByShopId(8L, 5L);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
const EMPTY_FIELD_TEXT = '未填写'
|
||||
|
||||
function displayText(value) {
|
||||
const text = String(value || '').trim()
|
||||
return text || EMPTY_FIELD_TEXT
|
||||
}
|
||||
|
||||
function buildRoleText(data) {
|
||||
return Number(data.type) === 2 ? '店长' : '店员'
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -34,6 +44,12 @@ Page({
|
||||
name,
|
||||
shortName: name.slice(-1),
|
||||
color: data.color || EMPLOYEE_COLORS[0],
|
||||
roleText: buildRoleText(data),
|
||||
accountText: displayText(data.account),
|
||||
phoneText: displayText(data.phone),
|
||||
contactPhoneText: displayText(data.contactPhone),
|
||||
wechatIdText: displayText(data.wechatId),
|
||||
identityText: displayText(data.identity),
|
||||
monthOrders,
|
||||
monthAmount,
|
||||
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
<view wx:else class="avatar" style="background: {{employee.color}};">{{employee.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{employee.name}}</text>
|
||||
<text class="tag" style="background: {{employee.color}}; color: #fff;">员工色</text>
|
||||
<view class="head-tag-row">
|
||||
<text class="tag" style="background: {{employee.color}}; color: #fff;">{{employee.roleText}}</text>
|
||||
<text class="tag ghost">员工色</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -30,10 +33,44 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="section-title">基础信息</view>
|
||||
<view class="card info-card">
|
||||
<view class="info-row">
|
||||
<text class="info-label">姓名</text>
|
||||
<text class="info-value">{{employee.name}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">角色</text>
|
||||
<text class="info-value">{{employee.roleText}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">登录账号</text>
|
||||
<text class="info-value">{{employee.accountText}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">手机号</text>
|
||||
<text class="info-value">{{employee.phoneText}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">联系电话</text>
|
||||
<text class="info-value">{{employee.contactPhoneText}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">微信号</text>
|
||||
<text class="info-value">{{employee.wechatIdText}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">身份</text>
|
||||
<text class="info-value">{{employee.identityText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="menu-grid">
|
||||
<view class="card menu-card" data-url="/pages/schedule-setting/index" bindtap="go">排班设置</view>
|
||||
<view class="card menu-card" data-url="/pages/leave-management/index" bindtap="go">请假管理</view>
|
||||
<view class="card menu-card" data-url="/pages/leave-management/index" bindtap="go">工时管理</view>
|
||||
<view class="card menu-card" data-url="/pages/color-setting/index" bindtap="go">颜色设置</view>
|
||||
<view class="card menu-card" data-url="/pages/employee-orders/index" bindtap="go">订单记录</view>
|
||||
</view>
|
||||
|
||||
@@ -41,6 +41,18 @@
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.head-tag-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.tag.ghost {
|
||||
background: #f2ede7;
|
||||
color: #7b7168;
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
@@ -68,6 +80,45 @@
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
padding: 8rpx 24rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
padding: 22rpx 0;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
}
|
||||
|
||||
.info-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.info-label,
|
||||
.info-value {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
flex: 0 0 auto;
|
||||
color: #91897f;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #302c27;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.menu-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
|
||||
@@ -23,6 +23,7 @@ function orderAmount(item) {
|
||||
function toOrderRow(item, index) {
|
||||
return {
|
||||
id: item.orderItemId || index,
|
||||
detailId: item.orderItemId || item.id || '',
|
||||
date: item.date || shortDate(item.startTime),
|
||||
project: item.productTitle || '预约作品',
|
||||
customer: item.customerName || '到店客户',
|
||||
@@ -80,5 +81,14 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
openOrder(event) {
|
||||
const id = event.currentTarget.dataset.id
|
||||
if (!id) {
|
||||
wx.showToast({ title: '订单项ID不能为空', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.navigateTo({ url: `/pages/appointment-detail/index?id=${id}` })
|
||||
},
|
||||
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<view wx:elif="{{loadError}}" class="empty card error">{{loadError}}</view>
|
||||
<view wx:elif="{{orders.length === 0}}" class="empty card">当前日期范围内没有订单</view>
|
||||
<view wx:else class="list">
|
||||
<view wx:for="{{orders}}" wx:key="id" class="card list-card order-row">
|
||||
<view wx:for="{{orders}}" wx:key="id" class="card list-card order-row" data-id="{{item.detailId}}" bindtap="openOrder">
|
||||
<view>
|
||||
<text class="order-title">{{item.project}}</text>
|
||||
<text class="muted">{{item.date}} · {{item.customer}}</text>
|
||||
|
||||
@@ -11,8 +11,29 @@ function buildScheduleSummary(item) {
|
||||
return time ? `${mode} ${time}` : mode
|
||||
}
|
||||
|
||||
function buildRoleText(item) {
|
||||
return Number(item.type) === 2 ? '店长' : '店员'
|
||||
}
|
||||
|
||||
function toEmployeeRow(item, index) {
|
||||
const name = item.nickname || item.name || item.artistName || `美甲师${index + 1}`
|
||||
return {
|
||||
id: item.userId || item.id,
|
||||
name,
|
||||
shortName: name.slice(-1),
|
||||
avatar: item.avatar || item.avatarUrl || '',
|
||||
color: item.color || EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0,
|
||||
scheduleSummary: buildScheduleSummary(item),
|
||||
roleText: buildRoleText(item),
|
||||
isManager: Number(item.type) === 2
|
||||
}
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
managers: [],
|
||||
employees: [],
|
||||
loadError: '',
|
||||
createModalVisible: false,
|
||||
@@ -37,21 +58,15 @@ Page({
|
||||
try {
|
||||
const data = await employeesApi.list({ page: 1, size: 50 })
|
||||
const list = data.list || data || []
|
||||
const rows = list.map(toEmployeeRow)
|
||||
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),
|
||||
avatar: item.avatar || item.avatarUrl || '',
|
||||
color: item.color || EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0,
|
||||
scheduleSummary: buildScheduleSummary(item)
|
||||
}))
|
||||
managers: rows.filter(item => item.isManager),
|
||||
employees: rows.filter(item => !item.isManager)
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
managers: [],
|
||||
employees: [],
|
||||
loadError: error.message || '美甲师列表加载失败'
|
||||
})
|
||||
|
||||
@@ -9,20 +9,48 @@
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadEmployees">重试</button>
|
||||
</view>
|
||||
<view wx:elif="{{employees.length === 0}}" class="empty card">暂无美甲师</view>
|
||||
<view wx:for="{{employees}}" wx:key="id" class="card employee-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view class="employee-left">
|
||||
<view wx:if="{{item.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{item.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{item.name}}</text>
|
||||
<text class="employee-schedule">{{item.scheduleSummary}}</text>
|
||||
<text class="employee-meta">本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}</text>
|
||||
<view wx:elif="{{managers.length === 0 && employees.length === 0}}" class="empty card">暂无美甲师</view>
|
||||
|
||||
<view wx:if="{{managers.length}}" class="employee-section">
|
||||
<view class="section-subtitle">店长</view>
|
||||
<view wx:for="{{managers}}" wx:key="id" class="card employee-card manager-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view class="employee-left">
|
||||
<view wx:if="{{item.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{item.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
<view class="employee-title-row">
|
||||
<text class="employee-name">{{item.name}}</text>
|
||||
<text class="role-tag manager">{{item.roleText}}</text>
|
||||
</view>
|
||||
<text class="employee-schedule">{{item.scheduleSummary}}</text>
|
||||
<text class="employee-meta">本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-pill" style="background: {{item.color}};"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{employees.length}}" class="employee-section">
|
||||
<view class="section-subtitle">店员</view>
|
||||
<view wx:for="{{employees}}" wx:key="id" class="card employee-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view class="employee-left">
|
||||
<view wx:if="{{item.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{item.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
<view class="employee-title-row">
|
||||
<text class="employee-name">{{item.name}}</text>
|
||||
<text class="role-tag">{{item.roleText}}</text>
|
||||
</view>
|
||||
<text class="employee-schedule">{{item.scheduleSummary}}</text>
|
||||
<text class="employee-meta">本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-pill" style="background: {{item.color}};"></view>
|
||||
</view>
|
||||
<view class="color-pill" style="background: {{item.color}};"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -31,12 +31,39 @@
|
||||
box-shadow: 0 6rpx 18rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.employee-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.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.22);
|
||||
}
|
||||
|
||||
.employee-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.employee-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -67,6 +94,23 @@
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.role-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 34rpx;
|
||||
padding: 0 12rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f2ede7;
|
||||
color: #7b7168;
|
||||
font-size: 20rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.role-tag.manager {
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
}
|
||||
|
||||
.employee-meta {
|
||||
margin-top: 8rpx;
|
||||
color: #91897f;
|
||||
|
||||
@@ -1,11 +1,99 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
function formatExceptionSummary(item) {
|
||||
const date = String(item.workDate || '').slice(0, 10)
|
||||
const remark = String(item.remark || '').trim()
|
||||
return {
|
||||
id: item.id || `${date}-${remark || 'leave'}`,
|
||||
date,
|
||||
text: remark || '全天请假'
|
||||
}
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
days: Array.from({ length: 31 }).map((_, index) => ({ day: index + 1, rest: [12, 25].includes(index + 1) })),
|
||||
records: [
|
||||
{ date: '2026-06-12', text: '全天请假' },
|
||||
{ date: '2026-06-25', text: '下午请假' }
|
||||
]
|
||||
artistId: '',
|
||||
records: [],
|
||||
leaveForm: {
|
||||
workDate: dateUtil.formatDate(new Date()),
|
||||
remark: ''
|
||||
},
|
||||
loading: false,
|
||||
saving: false,
|
||||
loadError: ''
|
||||
},
|
||||
add() { wx.showToast({ title: '请选择日期后保存', icon: 'none' }) },
|
||||
back() { wx.navigateBack() }
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ artistId: options.id || '' })
|
||||
this.loadRecords()
|
||||
},
|
||||
|
||||
async loadRecords() {
|
||||
if (!this.data.artistId) {
|
||||
this.setData({ records: [], loadError: '员工ID不能为空' })
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true, loadError: '' })
|
||||
try {
|
||||
const setting = await employeesApi.scheduleRule({ artistId: this.data.artistId })
|
||||
const exceptions = Array.isArray(setting.exceptions) ? setting.exceptions : []
|
||||
this.setData({
|
||||
records: exceptions
|
||||
.filter(item => item.exceptionType === 'REST')
|
||||
.map(formatExceptionSummary)
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
records: [],
|
||||
loadError: error.message || '工时记录加载失败'
|
||||
})
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
onLeaveDateChange(event) {
|
||||
this.setData({ 'leaveForm.workDate': event.detail.value })
|
||||
},
|
||||
|
||||
onLeaveRemarkInput(event) {
|
||||
this.setData({ 'leaveForm.remark': event.detail.value })
|
||||
},
|
||||
|
||||
async add() {
|
||||
const form = this.data.leaveForm
|
||||
if (!this.data.artistId) {
|
||||
wx.showToast({ title: '员工ID不能为空', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.workDate) {
|
||||
wx.showToast({ title: '请选择请假日期', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await employeesApi.saveScheduleException({
|
||||
artistId: this.data.artistId,
|
||||
workDate: form.workDate,
|
||||
exceptionType: 'REST',
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '请假已新增', icon: 'success' })
|
||||
this.setData({ 'leaveForm.remark': '' })
|
||||
await this.loadRecords()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '新增请假失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "请假管理"
|
||||
"navigationBarTitleText": "工时管理"
|
||||
}
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card mini-calendar">
|
||||
<view wx:for="{{days}}" wx:key="date" class="mini-day {{item.rest ? 'rest' : ''}}">{{item.day}}</view>
|
||||
</view>
|
||||
<view class="section">
|
||||
<view class="section-title">请假记录</view>
|
||||
<view class="list">
|
||||
<view wx:for="{{records}}" wx:key="date" class="card list-card">{{item.date}} {{item.text}}</view>
|
||||
<view class="card leave-form">
|
||||
<view class="field">
|
||||
<text class="field-label">请假日期</text>
|
||||
<picker mode="date" value="{{leaveForm.workDate}}" bindchange="onLeaveDateChange">
|
||||
<view class="field-value">{{leaveForm.workDate}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">备注</text>
|
||||
<input value="{{leaveForm.remark}}" bindinput="onLeaveRemarkInput" placeholder="可选,例如全天请假" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="add">新增请假</button></view>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">工时记录</view>
|
||||
<view class="list">
|
||||
<view wx:if="{{loading}}" class="empty card">工时记录加载中...</view>
|
||||
<view wx:elif="{{loadError}}" class="empty card error">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadRecords">重试</button>
|
||||
</view>
|
||||
<view wx:elif="{{records.length === 0}}" class="empty card">暂无请假记录</view>
|
||||
<view wx:for="{{records}}" wx:key="id" class="card list-card leave-record">
|
||||
<text class="leave-date">{{item.date}}</text>
|
||||
<text class="leave-text">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" loading="{{saving}}" bindtap="add">新增请假</button></view>
|
||||
</view>
|
||||
|
||||
@@ -1,22 +1,49 @@
|
||||
.mini-calendar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 10rpx;
|
||||
padding: 18rpx;
|
||||
.leave-form {
|
||||
padding: 8rpx 24rpx;
|
||||
}
|
||||
|
||||
.mini-day {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 64rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #f2ede7;
|
||||
color: #5d564e;
|
||||
.field input,
|
||||
.field-value {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
min-height: 58rpx;
|
||||
padding: 14rpx 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f4f0ea;
|
||||
color: #4d473f;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mini-day.rest {
|
||||
background: #e7f0f6;
|
||||
color: #6e9fbd;
|
||||
.leave-record {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.leave-date,
|
||||
.leave-text {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.leave-date {
|
||||
color: #302c27;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.leave-text {
|
||||
color: #7b7168;
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
const PRESETS = [
|
||||
@@ -20,12 +19,6 @@ const WEEKDAYS = [
|
||||
{ value: 7, label: '周日' }
|
||||
]
|
||||
|
||||
const EXCEPTION_TYPES = [
|
||||
{ value: 'REST', label: '休假' },
|
||||
{ value: 'EXTRA_WORK', label: '临时上班' },
|
||||
{ value: 'CHANGE_SHIFT', label: '临时改班' }
|
||||
]
|
||||
|
||||
function copyWorkDays(days) {
|
||||
return (days || []).map(day => Number(day)).filter(day => day >= 1 && day <= 7)
|
||||
}
|
||||
@@ -49,22 +42,6 @@ function buildWeekdayOptions(workDays) {
|
||||
}))
|
||||
}
|
||||
|
||||
function buildExceptionTypeLabel(exceptionType) {
|
||||
const option = EXCEPTION_TYPES.find(item => item.value === exceptionType) || EXCEPTION_TYPES[0]
|
||||
return option.label
|
||||
}
|
||||
|
||||
function buildExceptionSummary(item) {
|
||||
const type = EXCEPTION_TYPES.find(option => option.value === item.exceptionType)
|
||||
if (!item) {
|
||||
return ''
|
||||
}
|
||||
if (item.exceptionType === 'REST') {
|
||||
return `${item.workDate} ${type ? type.label : '休假'}`
|
||||
}
|
||||
return `${item.workDate} ${type ? type.label : '例外'} ${String(item.startTime || '').slice(0, 5)}-${String(item.endTime || '').slice(0, 5)}`
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
artistId: '',
|
||||
@@ -72,10 +49,6 @@ Page({
|
||||
presetOptions: buildPresetOptions('DOUBLE_REST'),
|
||||
weekdays: WEEKDAYS,
|
||||
weekdayOptions: buildWeekdayOptions([1, 2, 3, 4, 5]),
|
||||
exceptionTypes: EXCEPTION_TYPES,
|
||||
exceptionTypeIndex: 0,
|
||||
exceptionTypeLabel: '休假',
|
||||
exceptions: [],
|
||||
loading: false,
|
||||
saving: false,
|
||||
form: {
|
||||
@@ -84,13 +57,6 @@ Page({
|
||||
startTime: '09:00',
|
||||
endTime: '17:00',
|
||||
remark: ''
|
||||
},
|
||||
exceptionForm: {
|
||||
workDate: dateUtil.formatDate(new Date()),
|
||||
exceptionType: 'REST',
|
||||
startTime: '10:00',
|
||||
endTime: '18:00',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
|
||||
@@ -119,13 +85,7 @@ Page({
|
||||
this.setData({
|
||||
form,
|
||||
presetOptions: buildPresetOptions(form.presetType),
|
||||
weekdayOptions: buildWeekdayOptions(form.workDays),
|
||||
exceptions: (setting.exceptions || []).map(item => ({
|
||||
...item,
|
||||
startTime: item.startTime ? String(item.startTime).slice(0, 5) : '',
|
||||
endTime: item.endTime ? String(item.endTime).slice(0, 5) : '',
|
||||
summary: buildExceptionSummary(item)
|
||||
}))
|
||||
weekdayOptions: buildWeekdayOptions(form.workDays)
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '排班规则加载失败', icon: 'none' })
|
||||
@@ -184,33 +144,6 @@ Page({
|
||||
this.setData({ [`form.${field}`]: event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({ [`exceptionForm.${field}`]: event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionDateChange(event) {
|
||||
this.setData({ 'exceptionForm.workDate': event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionStartChange(event) {
|
||||
this.setData({ 'exceptionForm.startTime': event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionEndChange(event) {
|
||||
this.setData({ 'exceptionForm.endTime': event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionTypeChange(event) {
|
||||
const index = Number(event.detail.value)
|
||||
const option = this.data.exceptionTypes[index] || this.data.exceptionTypes[0]
|
||||
this.setData({
|
||||
exceptionTypeIndex: index,
|
||||
exceptionTypeLabel: buildExceptionTypeLabel(option.value),
|
||||
'exceptionForm.exceptionType': option.value
|
||||
})
|
||||
},
|
||||
|
||||
async save() {
|
||||
const form = this.data.form
|
||||
const workDays = copyWorkDays(form.workDays)
|
||||
@@ -243,36 +176,6 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
async saveException() {
|
||||
const form = this.data.exceptionForm
|
||||
if (!form.workDate || !form.exceptionType) {
|
||||
wx.showToast({ title: '请补全例外日期', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (form.exceptionType !== 'REST' && (!form.startTime || !form.endTime || form.startTime >= form.endTime)) {
|
||||
wx.showToast({ title: '请填写正确的例外时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await employeesApi.saveScheduleException({
|
||||
artistId: this.data.artistId,
|
||||
workDate: form.workDate,
|
||||
exceptionType: form.exceptionType,
|
||||
startTime: form.exceptionType === 'REST' ? null : form.startTime,
|
||||
endTime: form.exceptionType === 'REST' ? null : form.endTime,
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '例外已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '例外保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
||||
@@ -28,40 +28,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">特殊日期</view>
|
||||
<view class="card rule-card">
|
||||
<view class="field">
|
||||
<text class="field-label">日期</text>
|
||||
<picker mode="date" value="{{exceptionForm.workDate}}" bindchange="onExceptionDateChange"><view class="field-value">{{exceptionForm.workDate}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">类型</text>
|
||||
<picker range="{{exceptionTypes}}" range-key="label" value="{{exceptionTypeIndex}}" bindchange="onExceptionTypeChange"><view class="field-value">{{exceptionTypeLabel}}</view></picker>
|
||||
</view>
|
||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
|
||||
<text class="field-label">开始时间</text>
|
||||
<picker mode="time" value="{{exceptionForm.startTime}}" bindchange="onExceptionStartChange"><view class="field-value">{{exceptionForm.startTime}}</view></picker>
|
||||
</view>
|
||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
|
||||
<text class="field-label">结束时间</text>
|
||||
<picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="field-value">{{exceptionForm.endTime}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">备注</text>
|
||||
<input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" />
|
||||
</view>
|
||||
<button class="secondary-btn exception-btn" loading="{{saving}}" bindtap="saveException">保存特殊日期</button>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{exceptions.length}}" class="exception-list">
|
||||
<view wx:for="{{exceptions}}" wx:key="id" class="card exception-card">
|
||||
<text>{{item.summary}}</text>
|
||||
<text wx:if="{{item.remark}}" class="exception-remark">{{item.remark}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<button class="primary-btn" loading="{{saving}}" bindtap="save">保存排班规则</button>
|
||||
</view>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.rule-card {
|
||||
.rule-card {
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
|
||||
@@ -60,35 +60,3 @@
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.exception-btn {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.exception-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.exception-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
color: #4c4740;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: transform 180ms ease, box-shadow 180ms ease;
|
||||
}
|
||||
|
||||
.exception-card:active {
|
||||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
.exception-remark {
|
||||
color: #8d857b;
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# 店务员工工时与订单记录设计
|
||||
|
||||
## 范围
|
||||
|
||||
- 店务小程序员工页展示店长,并将店长置顶为单独区域。
|
||||
- 店长可以从员工页进入店长自己的员工详情页,查看个人基础信息。
|
||||
- 员工排班设置页移除特殊日期模块,常规排班保存保持不变。
|
||||
- 员工详情入口从“请假管理”改为“工时管理”,工时管理内支持新增请假。
|
||||
- 员工订单记录点击具体订单跳转到现有预约详情页。
|
||||
|
||||
## 方案
|
||||
|
||||
- 后端 `GET /admin/manager/employees` 对非平台管理员改用可管理人员列表,复用已有店长兜底资料能力,不影响用户端可预约人员接口。
|
||||
- 小程序员工列表把 `type=2` 的店长归入置顶区域,其余人员显示在员工列表;两类卡片沿用当前员工卡片样式,只增加角色标签。
|
||||
- 员工详情复用现有员工详情接口,展示姓名、角色、手机号、联系电话、微信号、账号等基础信息;没有返回值时显示“未填写”。
|
||||
- 排班设置页只保留常规排班规则。已有员工排班例外接口保留,由工时管理页用于新增 REST 请假。
|
||||
- 工时管理页从员工排班规则设置返回的 `exceptions` 渲染请假记录,新增请假保存 `exceptionType=REST`,并标记规划页刷新。
|
||||
- 员工订单记录使用订单项 ID 打开 `/pages/appointment-detail/index`。
|
||||
|
||||
## 验证
|
||||
|
||||
- 后端定向测试覆盖店长员工列表使用可管理列表。
|
||||
- 店务小程序做 JS 语法检查和静态路由/文案检查。
|
||||
- 提交前运行 `git diff --check` 与 GitNexus `detect_changes`。
|
||||
@@ -451,3 +451,11 @@
|
||||
- 安全措施:修改前已在生产 Nginx 节点创建带时间戳的配置备份;未修改 MinIO、软路由、Nacos、数据库或应用代码。
|
||||
- 验证结果:`nginx -t` 通过并 reload;当前 DNS `wcy111.top -> 14.107.44.229`;三台 Core 访问 `https://minio.yunail.art/minio/health/live` 均返回 `200`;Nginx 本机 HTTP/HTTPS 虚拟主机均返回 `200`。
|
||||
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
|
||||
|
||||
## 2026-07-24 店务小程序员工工时与订单记录调整
|
||||
|
||||
- 变更原因:店务端需要在员工页展示店长,允许查看店长基础信息;排班设置不再直接维护特殊日期;请假入口改为工时管理;员工订单记录需要可进入订单详情。
|
||||
- 处理方式:`/admin/manager/employees` 非平台管理员改用 `getManageableByShopId`,复用已有店长兜底资料;店务小程序员工列表按店长/店员分区展示,员工详情新增基础信息卡片并把请假管理入口改为工时管理;排班设置页移除特殊日期 UI;工时管理页读取员工排班例外中的 `REST` 记录并支持新增请假;订单记录行点击跳转预约详情页。
|
||||
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
|
||||
- 影响范围:影响 `JY-Core` 管理端员工列表接口和 `JY-Salon-WeChat` 员工、排班、工时、订单记录页面;不改用户端可预约人员接口,不删除后端排班例外能力,不改变预约容量校验链路。
|
||||
- 验证方式:执行店务小程序相关 JS 语法检查、后端 `AdminManagerControllerTest` 定向测试、关键旧文案检索、`git diff --check` 和 GitNexus 变更检测。
|
||||
|
||||
@@ -111,3 +111,12 @@
|
||||
- 已完成:创建生产 Nginx 配置备份,`nginx -t` 通过并 reload。
|
||||
- 已验证:三台 Core 访问 `https://minio.yunail.art/minio/health/live` 均返回 200;Nginx 本机 HTTP/HTTPS 虚拟主机均返回 200。
|
||||
- 当前阻塞:暂无;七牛副本区域错误仍是独立问题,尚未修改。
|
||||
|
||||
## 2026-07-24 店务小程序员工工时与订单记录
|
||||
|
||||
- 已完成:用户确认店长置顶单独区,视觉保持当前小程序卡片风格。
|
||||
- 已完成:后端员工列表非平台管理员改用可管理列表,以便店长出现在员工页。
|
||||
- 已完成:店务小程序员工页分区展示店长/店员,员工详情展示基础信息,入口改为工时管理。
|
||||
- 已完成:排班设置移除特殊日期 UI,工时管理页读取请假记录并支持新增 REST 请假,订单记录行跳转预约详情。
|
||||
- 下一步:运行最终检查、GitNexus 变更检测并提交本次相关文件。
|
||||
- 当前阻塞:暂无。
|
||||
|
||||
Reference in New Issue
Block a user