优化员工排班与规划月视图体验

This commit is contained in:
2026-06-27 00:08:18 +08:00
parent 5fc0e35759
commit 13916e61b7
21 changed files with 413 additions and 73 deletions
@@ -13,7 +13,5 @@ public class ArtistScheduleExceptionDTO {
private String exceptionType;
private LocalTime startTime;
private LocalTime endTime;
private Integer slotMinutes;
private Integer capacity;
private String remark;
}
@@ -13,8 +13,6 @@ public class ArtistScheduleRuleDTO {
private List<Integer> workDays;
private LocalTime startTime;
private LocalTime endTime;
private Integer slotMinutes;
private Integer capacity;
private Integer status;
private String remark;
}
@@ -99,4 +99,19 @@ public class NailArtistInfoDTO {
* 用户签名
*/
private String signature;
/**
* 头像访问地址
*/
private String avatar;
/**
* 排班模式摘要
*/
private String scheduleModeSummary;
/**
* 排班时间摘要
*/
private String scheduleTimeSummary;
}
@@ -168,8 +168,8 @@ public class ArtistScheduleServiceImpl implements ArtistScheduleService {
rule.setWorkDays(encodeWorkDays(resolveWorkDays(dto.getWorkDays(), presetType)));
rule.setStartTime(startTime);
rule.setEndTime(endTime);
rule.setSlotMinutes(normalizeSlotMinutes(dto.getSlotMinutes()));
rule.setCapacity(normalizeCapacity(dto.getCapacity()));
rule.setSlotMinutes(DEFAULT_SLOT_MINUTES);
rule.setCapacity(DEFAULT_CAPACITY);
rule.setStatus(dto.getStatus() == null ? 1 : dto.getStatus());
rule.setRemark(trimText(dto.getRemark()));
rule.setIsDelete(0);
@@ -196,8 +196,8 @@ public class ArtistScheduleServiceImpl implements ArtistScheduleService {
exception.setExceptionType(exceptionType);
exception.setStartTime(startTime);
exception.setEndTime(endTime);
exception.setSlotMinutes(normalizeSlotMinutes(dto.getSlotMinutes()));
exception.setCapacity(normalizeCapacity(dto.getCapacity()));
exception.setSlotMinutes(DEFAULT_SLOT_MINUTES);
exception.setCapacity(DEFAULT_CAPACITY);
exception.setRemark(trimText(dto.getRemark()));
exception.setIsDelete(0);
return exception;
@@ -406,14 +406,6 @@ public class ArtistScheduleServiceImpl implements ArtistScheduleService {
}
}
private Integer normalizeSlotMinutes(Integer slotMinutes) {
return slotMinutes == null || slotMinutes < 15 ? DEFAULT_SLOT_MINUTES : slotMinutes;
}
private Integer normalizeCapacity(Integer capacity) {
return capacity == null || capacity < 1 ? DEFAULT_CAPACITY : capacity;
}
private String trimText(String value) {
return value == null ? null : value.trim();
}
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaowang.fingertipdesigner.core.modules.artist.dto.NailArtistInfoDTO;
import com.xiaowang.fingertipdesigner.core.modules.artist.entity.ArtistScheduleDO;
import com.xiaowang.fingertipdesigner.core.modules.artist.entity.ArtistScheduleRuleDO;
import com.xiaowang.fingertipdesigner.core.modules.artist.entity.NailArtistInfoDO;
import com.xiaowang.fingertipdesigner.core.modules.order.entity.OrderArtistReviewDO;
import com.xiaowang.fingertipdesigner.core.modules.order.entity.OrderDO;
@@ -14,6 +15,7 @@ import com.xiaowang.fingertipdesigner.core.modules.user.entity.UserDO;
import com.xiaowang.fingertipdesigner.core.modules.artist.mapper.NailArtistInfoMapper;
import com.xiaowang.fingertipdesigner.core.modules.planning.mapper.AppointmentReservationMapper;
import com.xiaowang.fingertipdesigner.core.modules.artist.mapper.ArtistScheduleMapper;
import com.xiaowang.fingertipdesigner.core.modules.artist.mapper.ArtistScheduleRuleMapper;
import com.xiaowang.fingertipdesigner.core.modules.order.mapper.OrderArtistReviewMapper;
import com.xiaowang.fingertipdesigner.core.modules.order.mapper.OrderItemMapper;
import com.xiaowang.fingertipdesigner.core.modules.order.mapper.OrderMapper;
@@ -66,6 +68,8 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
private static final int MAX_AVAILABILITY_SLOTS = 16;
private static final DateTimeFormatter DATE_TEXT_FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE;
private static final DateTimeFormatter TIME_TEXT_FORMATTER = DateTimeFormatter.ofPattern("HH:mm");
private static final String PRESET_DOUBLE_REST = "DOUBLE_REST";
private static final String PRESET_SINGLE_REST = "SINGLE_REST";
@Autowired
/**
@@ -109,6 +113,9 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
@Autowired(required = false)
private ArtistScheduleMapper artistScheduleMapper;
@Autowired(required = false)
private ArtistScheduleRuleMapper artistScheduleRuleMapper;
@Autowired(required = false)
private AppointmentReservationMapper appointmentReservationMapper;
@@ -143,6 +150,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
result.add(dto);
}
}
enrichScheduleSummaries(result, null);
return result;
}
@@ -177,6 +185,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
dto.setShopName(shop == null ? null : shop.getShopName());
result.add(dto);
}
enrichScheduleSummaries(result, shopId);
return result;
}
@@ -405,6 +414,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
if (user != null) {
dto.setNickname(user.getNickname());
dto.setSignature(user.getSignature());
dto.setAvatar(resolveAccessibleAvatar(user.getAvatar()));
dto.setUserType(user.getType());
dto.setUserTypeName(resolveUserTypeName(user.getType()));
if (dto.getParticipateProduction() == null) {
@@ -432,6 +442,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
dto.setUserId(user.getId());
dto.setNickname(user.getNickname());
dto.setSignature(user.getSignature());
dto.setAvatar(resolveAccessibleAvatar(user.getAvatar()));
dto.setUserType(user.getType());
dto.setUserTypeName(resolveUserTypeName(user.getType()));
dto.setIdentity("美甲师");
@@ -453,6 +464,66 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
return dto;
}
private void enrichScheduleSummaries(List<NailArtistInfoDTO> artists, Long shopId) {
if (artistScheduleRuleMapper == null || artists == null || artists.isEmpty()) {
return;
}
Set<Long> artistIds = artists.stream()
.map(NailArtistInfoDTO::getUserId)
.filter(userId -> userId != null && userId > 0)
.collect(Collectors.toCollection(LinkedHashSet::new));
if (artistIds.isEmpty()) {
return;
}
LambdaQueryWrapper<ArtistScheduleRuleDO> wrapper = new LambdaQueryWrapper<ArtistScheduleRuleDO>()
.in(ArtistScheduleRuleDO::getArtistId, artistIds)
.eq(ArtistScheduleRuleDO::getIsDelete, 0);
if (shopId != null && shopId > 0) {
wrapper.eq(ArtistScheduleRuleDO::getShopId, shopId);
}
Map<Long, ArtistScheduleRuleDO> ruleByArtistId = artistScheduleRuleMapper.selectList(wrapper).stream()
.collect(Collectors.toMap(ArtistScheduleRuleDO::getArtistId, rule -> rule, (left, right) -> left));
artists.forEach(artist -> applyScheduleSummary(artist, ruleByArtistId.get(artist.getUserId())));
}
private void applyScheduleSummary(NailArtistInfoDTO artist, ArtistScheduleRuleDO rule) {
if (artist == null) {
return;
}
if (rule == null || !Integer.valueOf(1).equals(rule.getStatus())) {
artist.setScheduleModeSummary("未设置");
artist.setScheduleTimeSummary("");
return;
}
artist.setScheduleModeSummary(resolveScheduleModeSummary(rule.getPresetType()));
artist.setScheduleTimeSummary(formatScheduleTimeSummary(rule.getStartTime(), rule.getEndTime()));
}
private String resolveScheduleModeSummary(String presetType) {
if (PRESET_DOUBLE_REST.equals(presetType)) {
return "双休";
}
if (PRESET_SINGLE_REST.equals(presetType)) {
return "单休";
}
return "自定义";
}
private String formatScheduleTimeSummary(LocalTime startTime, LocalTime endTime) {
if (startTime == null || endTime == null) {
return "";
}
return TIME_TEXT_FORMATTER.format(startTime) + "-" + TIME_TEXT_FORMATTER.format(endTime);
}
private String resolveAccessibleAvatar(String avatar) {
if (!StringUtils.hasText(avatar)) {
return null;
}
String accessibleUrl = objectStorageUrlSupport.toAccessibleUrl(avatar);
return StringUtils.hasText(accessibleUrl) ? accessibleUrl : avatar;
}
/**
* Run business method `isVisibleServiceUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
@@ -15,8 +15,6 @@ public class ArtistScheduleExceptionVO {
private String exceptionType;
private LocalTime startTime;
private LocalTime endTime;
private Integer slotMinutes;
private Integer capacity;
private String remark;
private LocalDateTime createTime;
}
@@ -15,8 +15,6 @@ public class ArtistScheduleRuleVO {
private List<Integer> workDays;
private LocalTime startTime;
private LocalTime endTime;
private Integer slotMinutes;
private Integer capacity;
private Integer status;
private String remark;
private LocalDateTime createTime;
@@ -63,6 +63,7 @@ public class PlanningServiceImpl implements PlanningService {
private static final int DEFAULT_SLOT_MINUTES = 30;
private static final int DEFAULT_DURATION_MINUTES = 60;
private static final int MONTH_AVAILABLE_MINUTES = 90;
private static final String RESERVATION_PENDING_QUOTE = "PENDING_QUOTE";
private static final String RESERVATION_CONFIRMED = "CONFIRMED";
private static final String PRODUCT_SOURCE_TYPE_MANAGER_APPOINTMENT = "MANAGER_APPOINTMENT";
@@ -525,15 +526,18 @@ public class PlanningServiceImpl implements PlanningService {
List<PlanningArtistCountVO> artistCounts = new ArrayList<>();
int workingArtistCount = 0;
int busyWorkingArtistCount = 0;
int fullWorkingArtistCount = 0;
for (PlanningArtistVO artist : artists) {
int count = countByArtist.getOrDefault(artist.getId(), 0L).intValue();
ArtistScheduleDO schedule = scheduleByArtist.get(artist.getId());
String artistStatus = resolveArtistDayStatus(artist, schedule, count);
List<PlanningAppointmentVO> artistAppointments = dayAppointments.stream()
.filter(appointment -> Objects.equals(appointment.getArtistId(), artist.getId()))
.toList();
String artistStatus = resolveArtistDayStatus(artist, schedule, artistAppointments);
if (!"rest".equals(artistStatus)) {
workingArtistCount++;
if (count > 0) {
busyWorkingArtistCount++;
if ("full".equals(artistStatus)) {
fullWorkingArtistCount++;
}
}
PlanningArtistCountVO countVO = new PlanningArtistCountVO();
@@ -547,33 +551,71 @@ public class PlanningServiceImpl implements PlanningService {
}
int total = dayAppointments.size();
boolean hasWorkingSchedule = workingArtistCount > 0;
boolean allBusy = workingArtistCount > 0 && busyWorkingArtistCount == workingArtistCount;
boolean allFull = workingArtistCount > 0 && fullWorkingArtistCount == workingArtistCount;
PlanningDaySummaryVO summary = new PlanningDaySummaryVO();
summary.setDate(date);
summary.setTotalCount(total);
summary.setArtistCounts(artistCounts);
summary.setDayStatus(PlanningCalendarSupport.resolveDayStatus(total, hasWorkingSchedule, allBusy));
summary.setDayStatus(PlanningCalendarSupport.resolveDayStatus(total, hasWorkingSchedule, allFull));
summaries.add(summary);
cursor = cursor.plusDays(1);
}
return summaries;
}
private String resolveArtistDayStatus(PlanningArtistVO artist, ArtistScheduleDO schedule, int count) {
private String resolveArtistDayStatus(PlanningArtistVO artist, ArtistScheduleDO schedule, List<PlanningAppointmentVO> appointments) {
if (schedule != null && !Integer.valueOf(1).equals(schedule.getStatus())) {
return "rest";
}
if (schedule == null && Integer.valueOf(0).equals(artist.getStatus())) {
if (schedule == null || Integer.valueOf(0).equals(artist.getStatus())) {
return "rest";
}
if (count <= 0) {
return "free";
if (hasContinuousFreeWindow(schedule, appointments, MONTH_AVAILABLE_MINUTES)) {
return appointments.isEmpty() ? "free" : "working";
}
if (schedule != null && schedule.getCapacity() != null && schedule.getCapacity() > 0 && count >= schedule.getCapacity() * 4) {
return "full";
return "full";
}
private boolean hasContinuousFreeWindow(ArtistScheduleDO schedule, List<PlanningAppointmentVO> appointments, int requiredMinutes) {
if (schedule == null || schedule.getStartTime() == null || schedule.getEndTime() == null || requiredMinutes <= 0) {
return false;
}
return "working";
int startMinute = schedule.getStartTime().toSecondOfDay() / 60;
int endMinute = schedule.getEndTime().toSecondOfDay() / 60;
if (endMinute - startMinute < requiredMinutes) {
return false;
}
int cursor = startMinute;
List<TimeRange> ranges = appointments.stream()
.map(this::toTimeRange)
.filter(Objects::nonNull)
.filter(range -> range.endMinute() > startMinute && range.startMinute() < endMinute)
.map(range -> new TimeRange(Math.max(range.startMinute(), startMinute), Math.min(range.endMinute(), endMinute)))
.sorted(Comparator.comparing(TimeRange::startMinute).thenComparing(TimeRange::endMinute))
.toList();
for (TimeRange range : ranges) {
if (range.startMinute() - cursor >= requiredMinutes) {
return true;
}
cursor = Math.max(cursor, range.endMinute());
}
return endMinute - cursor >= requiredMinutes;
}
private TimeRange toTimeRange(PlanningAppointmentVO appointment) {
if (appointment == null) {
return null;
}
Integer startMinute = appointment.getStartMinute();
Integer durationMinutes = appointment.getDurationMinutes();
if (startMinute == null || durationMinutes == null || durationMinutes <= 0) {
return null;
}
return new TimeRange(startMinute, startMinute + durationMinutes);
}
private record TimeRange(int startMinute, int endMinute) {
}
private ProductDO requireActiveProduct(Long productId, Long shopId) {
@@ -69,12 +69,12 @@ public final class PlanningCalendarSupport {
if (!hasWorkingSchedule) {
return "rest";
}
if (totalCount <= 0) {
return "free";
}
if (allWorkingArtistsBusy) {
return "full";
}
if (totalCount <= 0) {
return "free";
}
return "working";
}
@@ -107,7 +107,18 @@ class ArtistScheduleServiceImplTest {
service.saveException(extraWorkException(sunday));
verify(scheduleMapper).updateGeneratedSchedule(any(), eq(LocalTime.of(10, 0)), eq(LocalTime.of(18, 0)), eq(30), eq(2), eq(1), any());
verify(scheduleMapper).updateGeneratedSchedule(any(), eq(LocalTime.of(10, 0)), eq(LocalTime.of(18, 0)), eq(60), eq(1), eq(1), any());
}
@Test
void saveRuleUsesInternalCapacityAndSlotDefaults() {
service.saveRule(rule("DOUBLE_REST", List.of(1, 2, 3, 4, 5), LocalTime.of(9, 0), LocalTime.of(17, 0)));
ArgumentCaptor<Integer> slotCaptor = ArgumentCaptor.forClass(Integer.class);
ArgumentCaptor<Integer> capacityCaptor = ArgumentCaptor.forClass(Integer.class);
verify(scheduleMapper, org.mockito.Mockito.atLeastOnce()).updateGeneratedSchedule(any(), any(), any(), slotCaptor.capture(), capacityCaptor.capture(), any(), any());
assertThat(slotCaptor.getAllValues()).allMatch(value -> value == 60);
assertThat(capacityCaptor.getAllValues()).allMatch(value -> value == 1);
}
@Test
@@ -138,8 +149,6 @@ class ArtistScheduleServiceImplTest {
dto.setWorkDays(workDays);
dto.setStartTime(startTime);
dto.setEndTime(endTime);
dto.setSlotMinutes(60);
dto.setCapacity(1);
return dto;
}
@@ -160,8 +169,6 @@ class ArtistScheduleServiceImplTest {
dto.setExceptionType("EXTRA_WORK");
dto.setStartTime(LocalTime.of(10, 0));
dto.setEndTime(LocalTime.of(18, 0));
dto.setSlotMinutes(30);
dto.setCapacity(2);
return dto;
}
@@ -2,6 +2,7 @@ package com.xiaowang.fingertipdesigner.core.modules.planning.service.impl;
import com.xiaowang.fingertipdesigner.core.modules.artist.mapper.ArtistScheduleMapper;
import com.xiaowang.fingertipdesigner.core.modules.artist.mapper.NailArtistInfoMapper;
import com.xiaowang.fingertipdesigner.core.modules.artist.entity.ArtistScheduleDO;
import com.xiaowang.fingertipdesigner.core.modules.order.entity.OrderDO;
import com.xiaowang.fingertipdesigner.core.modules.order.entity.OrderItemDO;
import com.xiaowang.fingertipdesigner.core.modules.order.mapper.OrderItemMapper;
@@ -27,7 +28,9 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -184,6 +187,49 @@ class PlanningServiceImplTest {
assertThat(product.getImageFileIds()).isNull();
}
@Test
void calendarMarksMonthAvailabilityByContinuousNinetyMinuteWindow() {
UserDO manager = user(2, 8L);
UserDO freeArtist = user(3, 8L);
freeArtist.setId(20L);
freeArtist.setNickname("小王");
UserDO shortShiftArtist = user(3, 8L);
shortShiftArtist.setId(21L);
shortShiftArtist.setNickname("小李");
LocalDate date = LocalDate.of(2026, 6, 26);
ShopDO shop = new ShopDO();
shop.setBusinessHours("09:00-18:00");
ArtistScheduleDO freeSchedule = schedule(20L, date, LocalTime.of(9, 0), LocalTime.of(12, 0));
ArtistScheduleDO shortSchedule = schedule(21L, date, LocalTime.of(9, 0), LocalTime.of(10, 0));
AppointmentReservationDO reservation = reservation(20L, 200L, 300L, date.atTime(10, 30), date.atTime(12, 0));
OrderDO order = order(200L, 8L, 30L);
OrderItemDO item = orderItem(300L, 200L, 100L, 20L, date.atTime(10, 30));
ProductDO product = product(100L, 8L, "90分钟");
UserDO customer = user(0, 8L);
customer.setId(30L);
customer.setNickname("测试客户");
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
when(shopMapper.selectById(8L)).thenReturn(shop);
when(userMapper.selectList(any())).thenReturn(List.of(freeArtist, shortShiftArtist));
when(nailArtistInfoMapper.selectList(any())).thenReturn(List.of());
when(artistScheduleMapper.selectList(any())).thenReturn(List.of(freeSchedule, shortSchedule));
when(appointmentReservationMapper.selectList(any())).thenReturn(List.of(reservation));
when(orderItemMapper.selectList(any())).thenReturn(List.of());
when(orderItemMapper.selectBatchIds(any())).thenReturn(List.of(item));
when(orderMapper.selectBatchIds(any())).thenReturn(List.of(order));
when(productMapper.selectBatchIds(any())).thenReturn(List.of(product));
when(userMapper.selectBatchIds(any())).thenReturn(List.of(customer));
var calendar = planningService.getCalendar(manager, date, date, null);
var summary = calendar.getDaySummaries().get(0);
assertThat(summary.getDayStatus()).isEqualTo("working");
assertThat(summary.getArtistCounts())
.extracting(count -> count.getArtistId() + ":" + count.getStatus())
.contains("20:working", "21:full");
}
private UserDO user(Integer type, Long shopId) {
UserDO user = new UserDO();
user.setId(10L + type);
@@ -194,4 +240,66 @@ class PlanningServiceImplTest {
user.setPhone("13800138000");
return user;
}
private ArtistScheduleDO schedule(Long artistId, LocalDate date, LocalTime startTime, LocalTime endTime) {
ArtistScheduleDO schedule = new ArtistScheduleDO();
schedule.setId(1000L + artistId);
schedule.setShopId(8L);
schedule.setArtistId(artistId);
schedule.setWorkDate(date);
schedule.setStartTime(startTime);
schedule.setEndTime(endTime);
schedule.setCapacity(1);
schedule.setSlotMinutes(90);
schedule.setStatus(1);
schedule.setIsDelete(0);
return schedule;
}
private AppointmentReservationDO reservation(Long artistId, Long orderId, Long orderItemId,
LocalDateTime startTime, LocalDateTime endTime) {
AppointmentReservationDO reservation = new AppointmentReservationDO();
reservation.setOrderId(orderId);
reservation.setOrderItemId(orderItemId);
reservation.setShopId(8L);
reservation.setArtistId(artistId);
reservation.setProductTitle("测试预约");
reservation.setAppointmentStartTime(startTime);
reservation.setAppointmentEndTime(endTime);
reservation.setStatus("CONFIRMED");
reservation.setIsDelete(0);
return reservation;
}
private OrderDO order(Long orderId, Long shopId, Long customerId) {
OrderDO order = new OrderDO();
order.setId(orderId);
order.setShopId(shopId);
order.setUserId(customerId);
order.setStatus(1);
order.setIsDelete(0);
return order;
}
private OrderItemDO orderItem(Long orderItemId, Long orderId, Long productId, Long artistId, LocalDateTime appointmentTime) {
OrderItemDO item = new OrderItemDO();
item.setId(orderItemId);
item.setOrderId(orderId);
item.setProductId(productId);
item.setArtistId(artistId);
item.setQuantity(1);
item.setAppointmentTime(appointmentTime);
item.setIsDelete(0);
return item;
}
private ProductDO product(Long productId, Long shopId, String durationText) {
ProductDO product = new ProductDO();
product.setId(productId);
product.setShopId(shopId);
product.setTitle("测试作品");
product.setApproximateDuration(durationText);
product.setIsDelete(0);
return product;
}
}
+2 -1
View File
@@ -5,7 +5,8 @@ App({
globalData: {
appName: BRAND_CONFIG.appName,
shopName: BRAND_CONFIG.defaultShopName,
userInfo: null
userInfo: null,
planningNeedRefresh: false
},
onLaunch() {
+9 -1
View File
@@ -3,6 +3,12 @@ const employeesApi = require('../../api/employees')
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
const DEFAULT_EMPLOYEE_PASSWORD = 'Fingertip@123'
function buildScheduleSummary(item) {
const mode = item.scheduleModeSummary || item.scheduleMode || '未设置'
const time = item.scheduleTimeSummary || item.ruleTimeSummary || ''
return time ? `${mode} ${time}` : mode
}
Page({
data: {
employees: [],
@@ -32,9 +38,11 @@ Page({
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: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
monthOrders: item.monthOrders || item.orderCount || 0,
monthAmount: item.monthAmount || item.turnover || 0
monthAmount: item.monthAmount || item.turnover || 0,
scheduleSummary: buildScheduleSummary(item)
}))
})
} catch (error) {
+5 -1
View File
@@ -12,9 +12,13 @@
<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 class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
<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>
</view>
@@ -22,6 +22,13 @@
align-items: center;
justify-content: space-between;
padding: 22rpx;
animation: cardIn 180ms ease both;
transition: transform 160ms ease, box-shadow 160ms ease;
}
.employee-card:active {
transform: scale(0.99);
box-shadow: 0 6rpx 18rpx rgba(58, 48, 34, 0.08);
}
.employee-left {
@@ -40,9 +47,20 @@
color: #fff;
font-size: 28rpx;
font-weight: 900;
overflow: hidden;
}
.image-avatar {
background: #f0ece5;
}
.image-avatar image {
width: 100%;
height: 100%;
}
.employee-name,
.employee-schedule,
.employee-meta {
display: block;
}
@@ -59,6 +77,13 @@
font-size: 24rpx;
}
.employee-schedule {
margin-top: 6rpx;
color: #55786d;
font-size: 23rpx;
font-weight: 800;
}
.color-pill {
width: 44rpx;
height: 18rpx;
@@ -80,6 +105,7 @@
align-items: flex-end;
justify-content: center;
background: rgba(18, 15, 12, 0.48);
animation: maskIn 180ms ease both;
}
.employee-modal {
@@ -88,6 +114,7 @@
border-radius: 28rpx 28rpx 0 0;
background: #fffaf4;
box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
animation: modalUp 220ms ease both;
}
.modal-head {
@@ -171,3 +198,32 @@
.modal-submit {
margin-top: 22rpx;
}
@keyframes cardIn {
from {
opacity: 0;
transform: translateY(8rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes maskIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes modalUp {
from {
transform: translateY(40rpx);
}
to {
transform: translateY(0);
}
}
+5 -1
View File
@@ -60,8 +60,12 @@ Page({
},
onShow() {
if (this._needRefresh) {
const app = getApp()
const storageRefresh = wx.getStorageSync('planningNeedRefresh') === '1'
if (this._needRefresh || app.globalData.planningNeedRefresh || storageRefresh) {
this._needRefresh = false
app.globalData.planningNeedRefresh = false
wx.removeStorageSync('planningNeedRefresh')
this.loadCalendar()
}
},
+33 -2
View File
@@ -22,6 +22,7 @@
.control-card {
padding: 18rpx;
animation: pageFadeIn 180ms ease both;
}
.calendar-error-card {
@@ -136,12 +137,14 @@
color: #7d756c;
font-size: 24rpx;
font-weight: 700;
transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.segment.active {
background: #fffdf8;
color: #2f2a25;
box-shadow: 0 6rpx 14rpx rgba(58, 48, 34, 0.07);
transform: translateY(-1rpx);
}
.artist-filter {
@@ -162,11 +165,13 @@
color: #625b52;
font-size: 24rpx;
font-weight: 700;
transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.artist-chip.active {
background: #e5eee9;
color: #4e7165;
transform: translateY(-1rpx);
}
.chip-dot {
@@ -284,6 +289,12 @@
border-radius: 10px;
background: #fff7ee;
box-shadow: 0 8rpx 16rpx rgba(58, 48, 34, 0.08);
transition: transform 160ms ease, box-shadow 160ms ease;
}
.appointment-block:active {
transform: scale(0.98);
box-shadow: 0 4rpx 10rpx rgba(58, 48, 34, 0.08);
}
.appointment-block.pending {
@@ -444,12 +455,14 @@
color: #766e65;
font-size: 22rpx;
font-weight: 800;
transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.month-mode.active {
background: #fffdf8;
color: #2f6f62;
box-shadow: 0 4rpx 12rpx rgba(58, 48, 34, 0.07);
transform: translateY(-1rpx);
}
.row-name-switch {
@@ -487,6 +500,7 @@
border-radius: 50%;
background: #fffdf8;
box-shadow: 0 2rpx 6rpx rgba(58, 48, 34, 0.16);
transition: transform 180ms ease;
}
.row-name-switch.active .switch-track {
@@ -520,6 +534,11 @@
border-right: 1rpx solid #eee8df;
border-bottom: 1rpx solid #eee8df;
background: #fffdf8;
transition: background-color 180ms ease, transform 160ms ease;
}
.month-cell:active {
transform: scale(0.985);
}
.month-cell:nth-child(7n) {
@@ -543,7 +562,7 @@
.month-day {
color: #2c2824;
font-size: 26rpx;
font-size: 22rpx;
font-weight: 800;
}
@@ -552,7 +571,7 @@
}
.day-mark {
font-size: 18rpx;
font-size: 17rpx;
font-weight: 800;
}
@@ -584,6 +603,7 @@
font-weight: 800;
line-height: 1;
white-space: nowrap;
transition: transform 160ms ease;
}
.month-blocks {
@@ -632,3 +652,14 @@
font-size: 20rpx;
text-align: center;
}
@keyframes pageFadeIn {
from {
opacity: 0;
transform: translateY(8rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@@ -82,8 +82,6 @@ Page({
workDays: [1, 2, 3, 4, 5],
startTime: '09:00',
endTime: '17:00',
slotMinutes: 60,
capacity: 1,
remark: ''
},
exceptionForm: {
@@ -91,8 +89,6 @@ Page({
exceptionType: 'REST',
startTime: '10:00',
endTime: '18:00',
slotMinutes: 60,
capacity: 1,
remark: ''
}
},
@@ -117,8 +113,6 @@ Page({
workDays: copyWorkDays(rule.workDays || preset.workDays),
startTime: String(rule.startTime || preset.startTime).slice(0, 5),
endTime: String(rule.endTime || preset.endTime).slice(0, 5),
slotMinutes: rule.slotMinutes || 60,
capacity: rule.capacity || 1,
remark: rule.remark || ''
}
this.setData({
@@ -235,11 +229,10 @@ Page({
workDays,
startTime: form.startTime,
endTime: form.endTime,
slotMinutes: Number(form.slotMinutes) || 60,
capacity: Number(form.capacity) || 1,
status: 1,
remark: String(form.remark || '').trim()
})
this.markPlanningRefresh()
wx.showToast({ title: '排班规则已保存', icon: 'success' })
await this.loadRule()
} catch (error) {
@@ -267,10 +260,9 @@ Page({
exceptionType: form.exceptionType,
startTime: form.exceptionType === 'REST' ? null : form.startTime,
endTime: form.exceptionType === 'REST' ? null : form.endTime,
slotMinutes: Number(form.slotMinutes) || 60,
capacity: Number(form.capacity) || 1,
remark: String(form.remark || '').trim()
})
this.markPlanningRefresh()
wx.showToast({ title: '例外已保存', icon: 'success' })
await this.loadRule()
} catch (error) {
@@ -282,5 +274,17 @@ Page({
back() {
wx.navigateBack()
},
markPlanningRefresh() {
const app = getApp()
app.globalData.planningNeedRefresh = true
wx.setStorageSync('planningNeedRefresh', '1')
const pages = getCurrentPages()
pages.forEach(page => {
if (page.route === 'pages/planning/index') {
page._needRefresh = true
}
})
}
})
@@ -21,14 +21,6 @@
<text class="field-label">结束时间</text>
<picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="field-value">{{form.endTime}}</view></picker>
</view>
<view class="field">
<text class="field-label">预约间隔</text>
<input type="number" value="{{form.slotMinutes}}" data-field="slotMinutes" bindinput="onInput" />
</view>
<view class="field">
<text class="field-label">容量</text>
<input type="number" value="{{form.capacity}}" data-field="capacity" bindinput="onInput" />
</view>
<view class="field">
<text class="field-label">备注</text>
<input value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="可选" />
@@ -55,14 +47,6 @@
<text class="field-label">结束时间</text>
<picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="field-value">{{exceptionForm.endTime}}</view></picker>
</view>
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
<text class="field-label">预约间隔</text>
<input type="number" value="{{exceptionForm.slotMinutes}}" data-field="slotMinutes" bindinput="onExceptionInput" />
</view>
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
<text class="field-label">容量</text>
<input type="number" value="{{exceptionForm.capacity}}" data-field="capacity" bindinput="onExceptionInput" />
</view>
<view class="field">
<text class="field-label">备注</text>
<input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" />
@@ -23,6 +23,7 @@
color: #5f5951;
font-size: 24rpx;
font-weight: 700;
transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.preset-chip.active,
@@ -30,6 +31,7 @@
border-color: #6f8f83;
background: #e5eee9;
color: #55786d;
transform: translateY(-2rpx);
}
.field-block {
@@ -49,6 +51,16 @@
text-align: right;
}
.field-value {
min-height: 58rpx;
padding: 14rpx 20rpx;
border-radius: 999rpx;
background: #f4f0ea;
color: #4d473f;
font-size: 26rpx;
font-weight: 700;
}
.exception-btn {
margin-top: 22rpx;
}
@@ -68,6 +80,11 @@
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 {
+4
View File
@@ -581,6 +581,8 @@ rtk node WeChatProgram/utils/theme.test.js
- GitNexus `query` 可能提示 FTS indexes missing,关键词检索会退化;如果需要更可靠的图谱搜索,可运行 `rtk npx gitnexus analyze --force` 重建索引。
- 当前工作区大范围未提交改动曾让 GitNexus `detect_changes` 判定为 `critical`。提交前必须重新检测,并确认影响面和本轮提交边界一致。
- GitNexus impact 可能无法解析当前未提交/新增符号,即使 `rtk gitnexus status` 显示索引 up-to-date;本轮 `OrderServiceImpl.requestArtistChange`、`OrderServiceImpl.createSystemBusinessMessage`、`useConfirmEnter`、`App` 都返回 target not found / risk UNKNOWN。遇到这种情况要记录结果,并用局部测试和人工影响面控制兜底。
- GitNexus MCP 可能在补充 impact 或 detect_changes 时返回 `Transport closed`;先保留已完成的类级/方法级 impact 结论,再用定向测试、非交互 diff 和提交边界复核兜底,不能跳过记录。
- GitNexus 索引 stale 且本地 LadybugDB WAL 待恢复时,CLI `detect-changes` 可能只输出 WAL 提示后退出 1;先尝试 `rtk node .gitnexus/run.cjs analyze` 修复索引,仍失败时把它作为验证缺口记录。
- 终端读取中文文档时如果出现乱码,可在 PowerShell 命令里设置 UTF-8 输出编码。
## SQL 与数据库坑
@@ -628,6 +630,7 @@ rtk node WeChatProgram/utils/theme.test.js
- 登录页和小屏页面必须使用可滚动容器,保证按钮在小屏可见。
- 小程序很多页面只做过 `node --check`,真机交互仍需微信开发者工具验证。
- 用户端文案必须中文,不要出现英文测试提示或英文占位验收数据。
- 小程序自动化的 `mp_evaluate` 在部分会话会对任意函数报 `(intermediate value) is not a function`;验证页面状态时改用 `page_setData`、`page_getData`、`page_snapshot` 等不依赖 evaluate 的工具。
## Web 体验坑
@@ -652,6 +655,7 @@ rtk node WeChatProgram/utils/theme.test.js
- 店铺位置展示给用户时只显示地点名称/地址,经纬度只做隐藏数据。
- 订单创建链路必须防重复与防并发:同店铺、同美甲师、预约时间、购物车 `FOR UPDATE`、用户锁/美甲师锁和锁续租都不能省。已创建订单后的刷新/跳转失败,不能再提示“创建订单失败”。
- 用户“停用/删除/解绑”语义不能混:停用是账号级 `t_user.status`,删除是系统管理员软删账号,解绑只处理当前店铺绑定。列表必须按有效绑定过滤,避免“删除成功但列表残留”。
- 排班规则里的“90 分钟”只用于规划月视图判断是否存在连续可约空档,不能写入 `t_artist_schedule.slot_minutes` 或客户端可约时段生成;具体排班仍保持内部默认时段步进,容量固定为内部默认值 1。
## 已知验证缺口