修复店务预约与小程序生产问题
This commit is contained in:
+3
@@ -34,6 +34,9 @@ public class OrderItemDO extends BaseEntity {
|
|||||||
private BigDecimal referencePrice;
|
private BigDecimal referencePrice;
|
||||||
private BigDecimal quotedPrice;
|
private BigDecimal quotedPrice;
|
||||||
private BigDecimal confirmedPrice;
|
private BigDecimal confirmedPrice;
|
||||||
|
private Boolean depositPaid;
|
||||||
|
private Boolean needRemoval;
|
||||||
|
private Boolean fromMeituan;
|
||||||
/**
|
/**
|
||||||
* Field `artistId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
* Field `artistId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+3
@@ -9,6 +9,9 @@ public class PlanningAppointmentCreateDTO {
|
|||||||
private Long customerUserId;
|
private Long customerUserId;
|
||||||
private String customerName;
|
private String customerName;
|
||||||
private String phone;
|
private String phone;
|
||||||
|
private Boolean depositPaid;
|
||||||
|
private Boolean needRemoval;
|
||||||
|
private Boolean fromMeituan;
|
||||||
private Long productId;
|
private Long productId;
|
||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
private Long artistId;
|
private Long artistId;
|
||||||
|
|||||||
+66
-20
@@ -117,8 +117,9 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
);
|
);
|
||||||
Map<LocalDate, ShopScheduleExceptionDO> shopExceptionByDate = listShopScheduleExceptions(shopId, start, end);
|
Map<LocalDate, ShopScheduleExceptionDO> shopExceptionByDate = listShopScheduleExceptions(shopId, start, end);
|
||||||
|
|
||||||
List<PlanningArtistVO> artists = listArtists(shopId, artistId);
|
List<PlanningArtistVO> artists = listArtists(shopId, null);
|
||||||
List<ArtistScheduleDO> schedules = listSchedules(shopId, start, end, artists, artistId);
|
List<PlanningArtistVO> selectedArtists = selectCalendarArtists(artists, artistId);
|
||||||
|
List<ArtistScheduleDO> schedules = listSchedules(shopId, start, end, selectedArtists, artistId);
|
||||||
List<PlanningScheduleVO> scheduleVos = schedules.stream()
|
List<PlanningScheduleVO> scheduleVos = schedules.stream()
|
||||||
.map(schedule -> toScheduleVO(schedule, artists))
|
.map(schedule -> toScheduleVO(schedule, artists))
|
||||||
.sorted(Comparator.comparing(PlanningScheduleVO::getDate)
|
.sorted(Comparator.comparing(PlanningScheduleVO::getDate)
|
||||||
@@ -141,7 +142,8 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
vo.setArtists(artists);
|
vo.setArtists(artists);
|
||||||
vo.setSchedules(scheduleVos);
|
vo.setSchedules(scheduleVos);
|
||||||
vo.setAppointments(appointments);
|
vo.setAppointments(appointments);
|
||||||
vo.setDaySummaries(buildDaySummaries(start, end, artists, schedules, appointments, shop, shopExceptionByDate));
|
vo.setDaySummaries(buildDaySummaries(start, end, selectedArtists, schedules, appointments, shop, shopExceptionByDate,
|
||||||
|
artistId != null && artistId > 0));
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,6 +197,9 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
item.setPrice(unitPrice);
|
item.setPrice(unitPrice);
|
||||||
item.setArtistId(artist.getId());
|
item.setArtistId(artist.getId());
|
||||||
item.setAppointmentTime(startTime);
|
item.setAppointmentTime(startTime);
|
||||||
|
item.setDepositPaid(Boolean.TRUE.equals(dto.getDepositPaid()));
|
||||||
|
item.setNeedRemoval(Boolean.TRUE.equals(dto.getNeedRemoval()));
|
||||||
|
item.setFromMeituan(Boolean.TRUE.equals(dto.getFromMeituan()));
|
||||||
item.setIsDelete(0);
|
item.setIsDelete(0);
|
||||||
orderItemMapper.insert(item);
|
orderItemMapper.insert(item);
|
||||||
|
|
||||||
@@ -282,6 +287,15 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
item.setPrice(unitPrice);
|
item.setPrice(unitPrice);
|
||||||
item.setArtistId(artist.getId());
|
item.setArtistId(artist.getId());
|
||||||
item.setAppointmentTime(startTime);
|
item.setAppointmentTime(startTime);
|
||||||
|
if (dto.getDepositPaid() != null) {
|
||||||
|
item.setDepositPaid(dto.getDepositPaid());
|
||||||
|
}
|
||||||
|
if (dto.getNeedRemoval() != null) {
|
||||||
|
item.setNeedRemoval(dto.getNeedRemoval());
|
||||||
|
}
|
||||||
|
if (dto.getFromMeituan() != null) {
|
||||||
|
item.setFromMeituan(dto.getFromMeituan());
|
||||||
|
}
|
||||||
orderItemMapper.updateById(item);
|
orderItemMapper.updateById(item);
|
||||||
return getAppointment(currentUser, item.getId());
|
return getAppointment(currentUser, item.getId());
|
||||||
}
|
}
|
||||||
@@ -662,6 +676,9 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
vo.setArtistId(artistId);
|
vo.setArtistId(artistId);
|
||||||
vo.setArtistName(artist == null ? "未分配" : artist.getName());
|
vo.setArtistName(artist == null ? "未分配" : artist.getName());
|
||||||
vo.setArtistColor(artist == null ? ARTIST_COLORS.get(0) : artist.getColor());
|
vo.setArtistColor(artist == null ? ARTIST_COLORS.get(0) : artist.getColor());
|
||||||
|
vo.setDepositPaid(item != null && Boolean.TRUE.equals(item.getDepositPaid()));
|
||||||
|
vo.setNeedRemoval(item != null && Boolean.TRUE.equals(item.getNeedRemoval()));
|
||||||
|
vo.setFromMeituan(item != null && Boolean.TRUE.equals(item.getFromMeituan()));
|
||||||
vo.setDate(start == null ? null : start.toLocalDate().toString());
|
vo.setDate(start == null ? null : start.toLocalDate().toString());
|
||||||
vo.setStartTime(start == null ? null : DATE_TIME_FORMATTER.format(start));
|
vo.setStartTime(start == null ? null : DATE_TIME_FORMATTER.format(start));
|
||||||
vo.setEndTime(end == null ? null : DATE_TIME_FORMATTER.format(end));
|
vo.setEndTime(end == null ? null : DATE_TIME_FORMATTER.format(end));
|
||||||
@@ -681,7 +698,8 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
|
|
||||||
private List<PlanningDaySummaryVO> buildDaySummaries(LocalDate start, LocalDate end, List<PlanningArtistVO> artists,
|
private List<PlanningDaySummaryVO> buildDaySummaries(LocalDate start, LocalDate end, List<PlanningArtistVO> artists,
|
||||||
List<ArtistScheduleDO> schedules, List<PlanningAppointmentVO> appointments,
|
List<ArtistScheduleDO> schedules, List<PlanningAppointmentVO> appointments,
|
||||||
ShopDO shop, Map<LocalDate, ShopScheduleExceptionDO> shopExceptionByDate) {
|
ShopDO shop, Map<LocalDate, ShopScheduleExceptionDO> shopExceptionByDate,
|
||||||
|
boolean artistScoped) {
|
||||||
Map<String, List<PlanningAppointmentVO>> appointmentsByDate = appointments.stream()
|
Map<String, List<PlanningAppointmentVO>> appointmentsByDate = appointments.stream()
|
||||||
.filter(appointment -> appointment.getDate() != null)
|
.filter(appointment -> appointment.getDate() != null)
|
||||||
.collect(Collectors.groupingBy(PlanningAppointmentVO::getDate));
|
.collect(Collectors.groupingBy(PlanningAppointmentVO::getDate));
|
||||||
@@ -737,15 +755,30 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
ShopScheduleSupport.LocalTimeRange openRange = ShopScheduleSupport.resolveOpenRange(shop, shopExceptionByDate.get(cursor), cursor);
|
ShopScheduleSupport.LocalTimeRange openRange = ShopScheduleSupport.resolveOpenRange(shop, shopExceptionByDate.get(cursor), cursor);
|
||||||
summary.setBusinessStartTime(openRange.startTime() == null ? null : openRange.startTime().toString());
|
summary.setBusinessStartTime(openRange.startTime() == null ? null : openRange.startTime().toString());
|
||||||
summary.setBusinessEndTime(openRange.endTime() == null ? null : openRange.endTime().toString());
|
summary.setBusinessEndTime(openRange.endTime() == null ? null : openRange.endTime().toString());
|
||||||
summary.setDayStatus(openRange.open()
|
summary.setDayStatus(resolveDaySummaryStatus(openRange, total, hasWorkingSchedule, allFull, artistScoped));
|
||||||
? PlanningCalendarSupport.resolveDayStatus(total, hasWorkingSchedule, allFull)
|
|
||||||
: "rest");
|
|
||||||
summaries.add(summary);
|
summaries.add(summary);
|
||||||
cursor = cursor.plusDays(1);
|
cursor = cursor.plusDays(1);
|
||||||
}
|
}
|
||||||
return summaries;
|
return summaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String resolveDaySummaryStatus(ShopScheduleSupport.LocalTimeRange openRange, int totalCount,
|
||||||
|
boolean hasWorkingSchedule, boolean allFull, boolean artistScoped) {
|
||||||
|
if (!openRange.open()) {
|
||||||
|
return "rest";
|
||||||
|
}
|
||||||
|
if (artistScoped) {
|
||||||
|
return PlanningCalendarSupport.resolveDayStatus(totalCount, hasWorkingSchedule, allFull);
|
||||||
|
}
|
||||||
|
if (hasWorkingSchedule && allFull) {
|
||||||
|
return "full";
|
||||||
|
}
|
||||||
|
if (totalCount <= 0) {
|
||||||
|
return "free";
|
||||||
|
}
|
||||||
|
return "working";
|
||||||
|
}
|
||||||
|
|
||||||
private Map<LocalDate, ShopScheduleExceptionDO> listShopScheduleExceptions(Long shopId, LocalDate start, LocalDate end) {
|
private Map<LocalDate, ShopScheduleExceptionDO> listShopScheduleExceptions(Long shopId, LocalDate start, LocalDate end) {
|
||||||
return shopScheduleExceptionMapper.selectList(new QueryWrapper<ShopScheduleExceptionDO>()
|
return shopScheduleExceptionMapper.selectList(new QueryWrapper<ShopScheduleExceptionDO>()
|
||||||
.eq("shop_id", shopId)
|
.eq("shop_id", shopId)
|
||||||
@@ -884,23 +917,27 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
}
|
}
|
||||||
return customer;
|
return customer;
|
||||||
}
|
}
|
||||||
if (!hasText(dto.getPhone())) {
|
String customerName = trimToNull(dto.getCustomerName());
|
||||||
throw new RuntimeException("客户手机号不能为空");
|
String phone = trimToNull(dto.getPhone());
|
||||||
|
if (hasText(phone)) {
|
||||||
|
QueryWrapper<UserDO> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("is_delete", 0)
|
||||||
|
.and(query -> query.eq("phone", phone).or().eq("contact_phone", phone))
|
||||||
|
.last("LIMIT 1");
|
||||||
|
UserDO existing = userMapper.selectOne(wrapper);
|
||||||
|
if (existing != null) {
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QueryWrapper<UserDO> wrapper = new QueryWrapper<>();
|
if (!hasText(customerName)) {
|
||||||
wrapper.eq("is_delete", 0)
|
throw new RuntimeException("客户姓名不能为空");
|
||||||
.and(query -> query.eq("phone", dto.getPhone()).or().eq("contact_phone", dto.getPhone()))
|
|
||||||
.last("LIMIT 1");
|
|
||||||
UserDO existing = userMapper.selectOne(wrapper);
|
|
||||||
if (existing != null) {
|
|
||||||
return existing;
|
|
||||||
}
|
}
|
||||||
UserDO customer = new UserDO();
|
UserDO customer = new UserDO();
|
||||||
customer.setShopId(shopId);
|
customer.setShopId(shopId);
|
||||||
customer.setNickname(firstNonBlank(dto.getCustomerName(), dto.getPhone()));
|
customer.setNickname(firstNonBlank(customerName, phone, "到店客户"));
|
||||||
customer.setPhone(dto.getPhone());
|
customer.setPhone(phone);
|
||||||
customer.setContactPhone(dto.getPhone());
|
customer.setContactPhone(phone);
|
||||||
customer.setAccount(dto.getPhone());
|
customer.setAccount("guest" + snowflakeIdGenerator.nextIdString());
|
||||||
customer.setPassword(ENCODED_UNSET_PASSWORD);
|
customer.setPassword(ENCODED_UNSET_PASSWORD);
|
||||||
customer.setType(0);
|
customer.setType(0);
|
||||||
customer.setStatus(1);
|
customer.setStatus(1);
|
||||||
@@ -909,6 +946,15 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
return customer;
|
return customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<PlanningArtistVO> selectCalendarArtists(List<PlanningArtistVO> artists, Long artistId) {
|
||||||
|
if (artistId == null || artistId <= 0) {
|
||||||
|
return artists;
|
||||||
|
}
|
||||||
|
return artists.stream()
|
||||||
|
.filter(artist -> Objects.equals(artist.getId(), artistId))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
private String buildOrderCustomerNameSnapshot(PlanningAppointmentCreateDTO dto, UserDO customer) {
|
private String buildOrderCustomerNameSnapshot(PlanningAppointmentCreateDTO dto, UserDO customer) {
|
||||||
return firstNonBlank(
|
return firstNonBlank(
|
||||||
dto.getCustomerName(),
|
dto.getCustomerName(),
|
||||||
|
|||||||
+3
@@ -25,6 +25,9 @@ public class PlanningAppointmentVO {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
private String statusText;
|
private String statusText;
|
||||||
private String occupancyStatus;
|
private String occupancyStatus;
|
||||||
|
private Boolean depositPaid;
|
||||||
|
private Boolean needRemoval;
|
||||||
|
private Boolean fromMeituan;
|
||||||
private Boolean canEdit;
|
private Boolean canEdit;
|
||||||
private Boolean canCancel;
|
private Boolean canCancel;
|
||||||
private String conflictReason;
|
private String conflictReason;
|
||||||
|
|||||||
+144
@@ -211,6 +211,83 @@ class PlanningServiceImplTest {
|
|||||||
assertThat(appointment.getCustomerName()).isEqualTo("王女士");
|
assertThat(appointment.getCustomerName()).isEqualTo("王女士");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createAppointmentShouldCreateWalkInCustomerWithoutPhoneAndStoreFlags() {
|
||||||
|
UserDO manager = user(2, 8L);
|
||||||
|
UserDO artist = user(3, 8L);
|
||||||
|
artist.setId(20L);
|
||||||
|
ShopDO shop = new ShopDO();
|
||||||
|
shop.setBusinessHours("10:00-22:00");
|
||||||
|
PlanningAppointmentCreateDTO dto = new PlanningAppointmentCreateDTO();
|
||||||
|
dto.setCustomerName(" 到店王女士 ");
|
||||||
|
dto.setArtistId(20L);
|
||||||
|
dto.setAppointmentDate("2026-07-20");
|
||||||
|
dto.setAppointmentTime("15:00");
|
||||||
|
dto.setDurationMinutes(60);
|
||||||
|
dto.setManualProductTitle("净色护理");
|
||||||
|
dto.setManualProductPrice(new BigDecimal("128.00"));
|
||||||
|
dto.setDepositPaid(true);
|
||||||
|
dto.setNeedRemoval(true);
|
||||||
|
dto.setFromMeituan(true);
|
||||||
|
|
||||||
|
ProductDO[] storedProduct = new ProductDO[1];
|
||||||
|
UserDO[] storedCustomer = new UserDO[1];
|
||||||
|
OrderDO[] storedOrder = new OrderDO[1];
|
||||||
|
OrderItemDO[] storedItem = new OrderItemDO[1];
|
||||||
|
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
|
||||||
|
when(productMapper.insert(any(ProductDO.class))).thenAnswer(invocation -> {
|
||||||
|
ProductDO product = invocation.getArgument(0);
|
||||||
|
product.setId(100L);
|
||||||
|
storedProduct[0] = product;
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
when(userMapper.selectById(20L)).thenReturn(artist);
|
||||||
|
when(shopMapper.selectById(8L)).thenReturn(shop);
|
||||||
|
when(snowflakeIdGenerator.nextIdString()).thenReturn("202607200001", "202607200002");
|
||||||
|
when(userMapper.insert(any(UserDO.class))).thenAnswer(invocation -> {
|
||||||
|
UserDO customer = invocation.getArgument(0);
|
||||||
|
customer.setId(30L);
|
||||||
|
storedCustomer[0] = customer;
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
when(orderMapper.insert(any(OrderDO.class))).thenAnswer(invocation -> {
|
||||||
|
OrderDO order = invocation.getArgument(0);
|
||||||
|
order.setId(200L);
|
||||||
|
storedOrder[0] = order;
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
when(orderItemMapper.insert(any(OrderItemDO.class))).thenAnswer(invocation -> {
|
||||||
|
OrderItemDO item = invocation.getArgument(0);
|
||||||
|
item.setId(300L);
|
||||||
|
storedItem[0] = item;
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
when(orderItemMapper.selectById(300L)).thenAnswer(invocation -> storedItem[0]);
|
||||||
|
when(orderMapper.selectById(200L)).thenAnswer(invocation -> storedOrder[0]);
|
||||||
|
when(productMapper.selectById(100L)).thenAnswer(invocation -> storedProduct[0]);
|
||||||
|
AppointmentReservationDO reservation = reservation(20L, 200L, 300L,
|
||||||
|
LocalDateTime.of(2026, 7, 20, 15, 0),
|
||||||
|
LocalDateTime.of(2026, 7, 20, 16, 0));
|
||||||
|
when(appointmentReservationMapper.selectOne(any())).thenReturn(reservation);
|
||||||
|
when(userMapper.selectBatchIds(any())).thenAnswer(invocation -> List.of(storedCustomer[0]));
|
||||||
|
|
||||||
|
var appointment = planningService.createAppointment(manager, dto);
|
||||||
|
|
||||||
|
ArgumentCaptor<UserDO> customerCaptor = ArgumentCaptor.forClass(UserDO.class);
|
||||||
|
org.mockito.Mockito.verify(userMapper).insert(customerCaptor.capture());
|
||||||
|
assertThat(customerCaptor.getValue().getNickname()).isEqualTo("到店王女士");
|
||||||
|
assertThat(customerCaptor.getValue().getPhone()).isNull();
|
||||||
|
assertThat(customerCaptor.getValue().getContactPhone()).isNull();
|
||||||
|
assertThat(customerCaptor.getValue().getAccount()).isEqualTo("guest202607200001");
|
||||||
|
assertThat(storedItem[0].getDepositPaid()).isTrue();
|
||||||
|
assertThat(storedItem[0].getNeedRemoval()).isTrue();
|
||||||
|
assertThat(storedItem[0].getFromMeituan()).isTrue();
|
||||||
|
assertThat(appointment.getCustomerName()).isEqualTo("到店王女士");
|
||||||
|
assertThat(appointment.getDepositPaid()).isTrue();
|
||||||
|
assertThat(appointment.getNeedRemoval()).isTrue();
|
||||||
|
assertThat(appointment.getFromMeituan()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createAppointmentRejectsStoreRestDay() {
|
void createAppointmentRejectsStoreRestDay() {
|
||||||
UserDO manager = user(2, 8L);
|
UserDO manager = user(2, 8L);
|
||||||
@@ -316,6 +393,73 @@ class PlanningServiceImplTest {
|
|||||||
assertThat(calendar.getAppointments().get(0).getCustomerName()).isEqualTo("预约王女士");
|
assertThat(calendar.getAppointments().get(0).getCustomerName()).isEqualTo("预约王女士");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void calendarUsesShopStatusWhenNoEmployeeScheduleInShopView() {
|
||||||
|
UserDO manager = user(2, 8L);
|
||||||
|
UserDO firstArtist = user(3, 8L);
|
||||||
|
firstArtist.setId(20L);
|
||||||
|
firstArtist.setNickname("小王");
|
||||||
|
UserDO secondArtist = user(3, 8L);
|
||||||
|
secondArtist.setId(21L);
|
||||||
|
secondArtist.setNickname("小李");
|
||||||
|
LocalDate date = LocalDate.of(2026, 7, 20);
|
||||||
|
ShopDO shop = new ShopDO();
|
||||||
|
shop.setBusinessHours("09:00-18:00");
|
||||||
|
shop.setSchedulePresetType("EVERYDAY");
|
||||||
|
|
||||||
|
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
|
||||||
|
when(shopMapper.selectById(8L)).thenReturn(shop);
|
||||||
|
when(shopScheduleExceptionMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(userMapper.selectList(any())).thenReturn(List.of(firstArtist, secondArtist));
|
||||||
|
when(nailArtistInfoMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(artistScheduleMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(artistScheduleRuleMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(appointmentReservationMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(orderItemMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
|
||||||
|
var calendar = planningService.getCalendar(manager, date, date, null);
|
||||||
|
|
||||||
|
var summary = calendar.getDaySummaries().get(0);
|
||||||
|
assertThat(summary.getDayStatus()).isEqualTo("free");
|
||||||
|
assertThat(summary.getArtistCounts())
|
||||||
|
.extracting(count -> count.getArtistId() + ":" + count.getStatus())
|
||||||
|
.containsExactly("20:rest", "21:rest");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void calendarUsesEmployeeStatusWhenSingleArtistHasNoSchedule() {
|
||||||
|
UserDO manager = user(2, 8L);
|
||||||
|
UserDO firstArtist = user(3, 8L);
|
||||||
|
firstArtist.setId(20L);
|
||||||
|
firstArtist.setNickname("小王");
|
||||||
|
UserDO secondArtist = user(3, 8L);
|
||||||
|
secondArtist.setId(21L);
|
||||||
|
secondArtist.setNickname("小李");
|
||||||
|
LocalDate date = LocalDate.of(2026, 7, 20);
|
||||||
|
ShopDO shop = new ShopDO();
|
||||||
|
shop.setBusinessHours("09:00-18:00");
|
||||||
|
shop.setSchedulePresetType("EVERYDAY");
|
||||||
|
|
||||||
|
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
|
||||||
|
when(shopMapper.selectById(8L)).thenReturn(shop);
|
||||||
|
when(shopScheduleExceptionMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(userMapper.selectList(any())).thenReturn(List.of(firstArtist, secondArtist));
|
||||||
|
when(nailArtistInfoMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(artistScheduleMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(artistScheduleRuleMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(appointmentReservationMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
when(orderItemMapper.selectList(any())).thenReturn(List.of());
|
||||||
|
|
||||||
|
var calendar = planningService.getCalendar(manager, date, date, 20L);
|
||||||
|
|
||||||
|
assertThat(calendar.getArtists()).hasSize(2);
|
||||||
|
var summary = calendar.getDaySummaries().get(0);
|
||||||
|
assertThat(summary.getDayStatus()).isEqualTo("rest");
|
||||||
|
assertThat(summary.getArtistCounts())
|
||||||
|
.extracting(count -> count.getArtistId() + ":" + count.getStatus())
|
||||||
|
.containsExactly("20:rest");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void calendarUsesRuleWhenDailyScheduleMissing() {
|
void calendarUsesRuleWhenDailyScheduleMissing() {
|
||||||
UserDO manager = user(2, 8L);
|
UserDO manager = user(2, 8L);
|
||||||
|
|||||||
@@ -269,6 +269,9 @@ Page({
|
|||||||
manualProductImageUrl: '',
|
manualProductImageUrl: '',
|
||||||
durationMinutes: '',
|
durationMinutes: '',
|
||||||
artistId: '',
|
artistId: '',
|
||||||
|
depositPaid: false,
|
||||||
|
needRemoval: false,
|
||||||
|
fromMeituan: false,
|
||||||
remark: ''
|
remark: ''
|
||||||
},
|
},
|
||||||
customerOptions: [],
|
customerOptions: [],
|
||||||
@@ -378,6 +381,13 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onToggleChange(event) {
|
||||||
|
const field = event.currentTarget.dataset.field
|
||||||
|
this.setData({
|
||||||
|
[`form.${field}`]: !!event.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
onCustomerFocus(event) {
|
onCustomerFocus(event) {
|
||||||
const field = event.currentTarget.dataset.field
|
const field = event.currentTarget.dataset.field
|
||||||
this.setData({ customerDropdownVisible: true })
|
this.setData({ customerDropdownVisible: true })
|
||||||
@@ -715,8 +725,10 @@ Page({
|
|||||||
}
|
}
|
||||||
const form = this.data.form
|
const form = this.data.form
|
||||||
const hasManualProduct = String(form.manualProductTitle || '').trim() && String(form.manualProductPrice || '').trim()
|
const hasManualProduct = String(form.manualProductTitle || '').trim() && String(form.manualProductPrice || '').trim()
|
||||||
|
const customerName = String(form.customerName || '').trim()
|
||||||
|
const phone = String(form.phone || '').trim()
|
||||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||||
if (!form.customerName || !form.phone || (!form.productId && !hasManualProduct) || !form.artistId) {
|
if (!customerName || (!form.productId && !hasManualProduct) || !form.artistId) {
|
||||||
wx.showToast({ title: '请补全预约信息', icon: 'none' })
|
wx.showToast({ title: '请补全预约信息', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -733,8 +745,13 @@ Page({
|
|||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
...form,
|
...form,
|
||||||
|
customerName,
|
||||||
|
phone: phone || undefined,
|
||||||
customerUserId: form.customerUserId ? String(form.customerUserId) : undefined,
|
customerUserId: form.customerUserId ? String(form.customerUserId) : undefined,
|
||||||
artistId: String(form.artistId),
|
artistId: String(form.artistId),
|
||||||
|
depositPaid: !!form.depositPaid,
|
||||||
|
needRemoval: !!form.needRemoval,
|
||||||
|
fromMeituan: !!form.fromMeituan,
|
||||||
durationMinutes,
|
durationMinutes,
|
||||||
clientRequestId: buildClientRequestId('manager-appointment')
|
clientRequestId: buildClientRequestId('manager-appointment')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" />
|
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" />
|
||||||
</view>
|
</view>
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label required">手机号</text>
|
<text class="field-label">手机号</text>
|
||||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入手机号" />
|
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="可选,填写后匹配客户" />
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{customerDropdownVisible}}" class="customer-dropdown">
|
<view wx:if="{{customerDropdownVisible}}" class="customer-dropdown">
|
||||||
<view wx:if="{{customerLoading}}" class="customer-option muted-option">正在搜索客户...</view>
|
<view wx:if="{{customerLoading}}" class="customer-option muted-option">正在搜索客户...</view>
|
||||||
@@ -58,6 +58,26 @@
|
|||||||
<text class="time-arrow">›</text>
|
<text class="time-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="appointment-flags">
|
||||||
|
<view class="field toggle-field">
|
||||||
|
<view class="toggle-copy">
|
||||||
|
<text class="field-label">是否交定金</text>
|
||||||
|
</view>
|
||||||
|
<switch checked="{{form.depositPaid}}" color="#6f8f83" data-field="depositPaid" bindchange="onToggleChange" />
|
||||||
|
</view>
|
||||||
|
<view class="field toggle-field">
|
||||||
|
<view class="toggle-copy">
|
||||||
|
<text class="field-label">是否需要卸甲</text>
|
||||||
|
</view>
|
||||||
|
<switch checked="{{form.needRemoval}}" color="#6f8f83" data-field="needRemoval" bindchange="onToggleChange" />
|
||||||
|
</view>
|
||||||
|
<view class="field toggle-field">
|
||||||
|
<view class="toggle-copy">
|
||||||
|
<text class="field-label">是否来自美团</text>
|
||||||
|
</view>
|
||||||
|
<switch checked="{{form.fromMeituan}}" color="#6f8f83" data-field="fromMeituan" bindchange="onToggleChange" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="field textarea-field">
|
<view class="field textarea-field">
|
||||||
<text class="field-label">备注</text>
|
<text class="field-label">备注</text>
|
||||||
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="客户偏好、款式说明" />
|
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="客户偏好、款式说明" />
|
||||||
|
|||||||
@@ -130,6 +130,25 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.appointment-flags {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14rpx;
|
||||||
|
margin-top: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-field {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-copy {
|
||||||
|
display: flex;
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.capacity-tip {
|
.capacity-tip {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1,7 +1,28 @@
|
|||||||
|
const employeesApi = require('../../api/employees')
|
||||||
|
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||||
|
|
||||||
|
function normalizeColor(value) {
|
||||||
|
let color = String(value || '').trim()
|
||||||
|
if (!color) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
if (color[0] !== '#') {
|
||||||
|
color = `#${color}`
|
||||||
|
}
|
||||||
|
if (!/^#[0-9a-fA-F]{6}$/.test(color)) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return color.toUpperCase()
|
||||||
|
}
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
|
id: '',
|
||||||
|
employee: {},
|
||||||
selected: '#7BA7C7',
|
selected: '#7BA7C7',
|
||||||
customColor: '#7BA7C7',
|
customColor: '#7BA7C7',
|
||||||
|
saving: false,
|
||||||
|
loadError: '',
|
||||||
wheelColors: [
|
wheelColors: [
|
||||||
'#E0627A', '#E7785B', '#E2A64B', '#D8C85C', '#9EBB63', '#63B77B',
|
'#E0627A', '#E7785B', '#E2A64B', '#D8C85C', '#9EBB63', '#63B77B',
|
||||||
'#4CB7A6', '#56A7D6', '#5F82D7', '#7C70D4', '#A66BC8', '#CF72A8'
|
'#4CB7A6', '#56A7D6', '#5F82D7', '#7C70D4', '#A66BC8', '#CF72A8'
|
||||||
@@ -15,26 +36,93 @@ Page({
|
|||||||
'#6D8491', '#829A9A', '#A9B3A2', '#C6B7D1', '#E0C2B6', '#F0D6A8'
|
'#6D8491', '#829A9A', '#A9B3A2', '#C6B7D1', '#E0C2B6', '#F0D6A8'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLoad(options) {
|
||||||
|
this.setData({ id: options.id || '' })
|
||||||
|
this.loadDetail()
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadDetail() {
|
||||||
|
const userId = this.data.id
|
||||||
|
if (!userId) {
|
||||||
|
this.setData({ loadError: '员工ID不能为空' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const data = await employeesApi.detail(userId)
|
||||||
|
const color = normalizeColor(data.color) || this.data.selected
|
||||||
|
this.setData({
|
||||||
|
loadError: '',
|
||||||
|
employee: data,
|
||||||
|
selected: color,
|
||||||
|
customColor: color
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
this.setData({
|
||||||
|
employee: {},
|
||||||
|
loadError: error.message || '美甲师详情加载失败'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
select(event) {
|
select(event) {
|
||||||
const color = event.currentTarget.dataset.color
|
const color = normalizeColor(event.currentTarget.dataset.color)
|
||||||
|
if (!color) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.setData({ selected: color, customColor: color })
|
this.setData({ selected: color, customColor: color })
|
||||||
},
|
},
|
||||||
|
|
||||||
selectWheelColor(event) {
|
selectWheelColor(event) {
|
||||||
const color = event.currentTarget.dataset.color
|
const color = normalizeColor(event.currentTarget.dataset.color)
|
||||||
|
if (!color) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.setData({ selected: color, customColor: color })
|
this.setData({ selected: color, customColor: color })
|
||||||
},
|
},
|
||||||
|
|
||||||
onCustomInput(event) {
|
onCustomInput(event) {
|
||||||
this.setData({ customColor: event.detail.value })
|
this.setData({ customColor: event.detail.value })
|
||||||
},
|
},
|
||||||
|
|
||||||
applyCustomColor() {
|
applyCustomColor() {
|
||||||
let color = (this.data.customColor || '').trim()
|
const color = normalizeColor(this.data.customColor)
|
||||||
if (color && color[0] !== '#') color = `#${color}`
|
if (!color) {
|
||||||
if (!/^#[0-9a-fA-F]{6}$/.test(color)) {
|
|
||||||
wx.showToast({ title: '请输入6位色值', icon: 'none' })
|
wx.showToast({ title: '请输入6位色值', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.setData({ selected: color.toUpperCase(), customColor: color.toUpperCase() })
|
this.setData({ selected: color, customColor: color })
|
||||||
},
|
},
|
||||||
save() { wx.showToast({ title: '已保存到本地' }) },
|
|
||||||
back() { wx.navigateBack() }
|
async save() {
|
||||||
|
if (!this.data.id) {
|
||||||
|
wx.showToast({ title: '员工ID不能为空', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const color = normalizeColor(this.data.selected)
|
||||||
|
if (!color) {
|
||||||
|
wx.showToast({ title: '请选择正确颜色', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ saving: true })
|
||||||
|
try {
|
||||||
|
await employeesApi.save({
|
||||||
|
userId: this.data.id,
|
||||||
|
color
|
||||||
|
})
|
||||||
|
markPlanningRefresh()
|
||||||
|
wx.showToast({ title: '已保存', icon: 'success' })
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.navigateBack()
|
||||||
|
}, 300)
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ saving: false })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
back() {
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,27 +1,37 @@
|
|||||||
<view class="page no-tab">
|
<view class="page no-tab">
|
||||||
<view class="card color-preview" style="background: {{selected}};">{{selected}}</view>
|
<view wx:if="{{loadError}}" class="empty card">
|
||||||
<view class="section-title">推荐色</view>
|
<text>{{loadError}}</text>
|
||||||
<view class="palette recommended-palette">
|
<button class="secondary-btn retry-btn" bindtap="loadDetail">重试</button>
|
||||||
<view wx:for="{{recommendedColors}}" wx:key="*this" class="color-swatch recommended {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="section-title">色盘选择</view>
|
|
||||||
<view class="card color-wheel-card">
|
<block wx:else>
|
||||||
<view class="color-wheel-wrap">
|
<view class="card color-preview" style="background: {{selected}};">
|
||||||
<view class="color-wheel">
|
<text class="color-preview-name">{{employee.nickname || employee.name || '员工颜色'}}</text>
|
||||||
<view wx:for="{{wheelColors}}" wx:key="*this" class="wheel-hit hit-{{index}}" data-color="{{item}}" bindtap="selectWheelColor"></view>
|
<text class="color-preview-value">{{selected}}</text>
|
||||||
<view class="wheel-center" style="background: {{selected}};">
|
</view>
|
||||||
<text>{{selected}}</text>
|
<view class="section-title">推荐色</view>
|
||||||
|
<view class="palette recommended-palette">
|
||||||
|
<view wx:for="{{recommendedColors}}" wx:key="*this" class="color-swatch recommended {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
||||||
|
</view>
|
||||||
|
<view class="section-title">色盘选择</view>
|
||||||
|
<view class="card color-wheel-card">
|
||||||
|
<view class="color-wheel-wrap">
|
||||||
|
<view class="color-wheel">
|
||||||
|
<view wx:for="{{wheelColors}}" wx:key="*this" class="wheel-hit hit-{{index}}" data-color="{{item}}" bindtap="selectWheelColor"></view>
|
||||||
|
<view class="wheel-center" style="background: {{selected}};">
|
||||||
|
<text>{{selected}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="palette-grid compact">
|
||||||
|
<view wx:for="{{paletteColors}}" wx:key="*this" class="palette-dot {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="palette-grid compact">
|
<view class="card custom-color-card">
|
||||||
<view wx:for="{{paletteColors}}" wx:key="*this" class="palette-dot {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
<view class="custom-color-preview" style="background: {{customColor}};"></view>
|
||||||
|
<input class="custom-color-input" value="{{customColor}}" maxlength="7" placeholder="#7BA7C7" bindinput="onCustomInput" />
|
||||||
|
<button class="small-action" bindtap="applyCustomColor">应用</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="fixed-bottom"><button class="primary-btn" loading="{{saving}}" bindtap="save">保存颜色</button></view>
|
||||||
<view class="card custom-color-card">
|
</block>
|
||||||
<view class="custom-color-preview" style="background: {{customColor}};"></view>
|
|
||||||
<input class="custom-color-input" value="{{customColor}}" maxlength="7" placeholder="#7BA7C7" bindinput="onCustomInput" />
|
|
||||||
<button class="small-action" bindtap="applyCustomColor">应用</button>
|
|
||||||
</view>
|
|
||||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="save">保存颜色</button></view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
.color-preview {
|
.color-preview {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
gap: 10rpx;
|
||||||
height: 168rpx;
|
height: 168rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 34rpx;
|
font-size: 34rpx;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.color-preview-name {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-preview-value {
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
.palette {
|
.palette {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
|||||||
@@ -12,7 +12,12 @@ Page({
|
|||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.setData({ id: options.id || '' })
|
this.setData({ id: options.id || '' })
|
||||||
this.loadDetail()
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
if (this.data.id) {
|
||||||
|
this.loadDetail()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadDetail() {
|
async loadDetail() {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Page({
|
|||||||
avatarUploading: false
|
avatarUploading: false
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onShow() {
|
||||||
this.loadEmployees()
|
this.loadEmployees()
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ Page({
|
|||||||
name: item.nickname || item.name || item.artistName || `美甲师${index + 1}`,
|
name: item.nickname || item.name || item.artistName || `美甲师${index + 1}`,
|
||||||
shortName: (item.nickname || item.name || '师').slice(-1),
|
shortName: (item.nickname || item.name || '师').slice(-1),
|
||||||
avatar: item.avatar || item.avatarUrl || '',
|
avatar: item.avatar || item.avatarUrl || '',
|
||||||
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
color: item.color || EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||||
monthAmount: item.monthAmount || item.turnover || 0,
|
monthAmount: item.monthAmount || item.turnover || 0,
|
||||||
scheduleSummary: buildScheduleSummary(item)
|
scheduleSummary: buildScheduleSummary(item)
|
||||||
|
|||||||
@@ -67,24 +67,31 @@
|
|||||||
.code-row {
|
.code-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-input {
|
.code-input {
|
||||||
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-btn {
|
.code-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
min-width: 160rpx;
|
min-width: 160rpx;
|
||||||
max-width: 160rpx;
|
max-width: 160rpx;
|
||||||
height: 56rpx;
|
height: 56rpx;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
color: #6f8f83;
|
color: #6f8f83;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-align: right;
|
line-height: 1;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.agreement-row,
|
.agreement-row,
|
||||||
|
|||||||
@@ -41,6 +41,17 @@ function resolveAppointmentTimeText(item) {
|
|||||||
return `${startText}-${endText}`
|
return `${startText}-${endText}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildAppointmentBadges(item) {
|
||||||
|
const badges = []
|
||||||
|
if (item.needRemoval) {
|
||||||
|
badges.push({ key: 'needRemoval', text: '需卸甲', type: 'removal' })
|
||||||
|
}
|
||||||
|
if (item.fromMeituan) {
|
||||||
|
badges.push({ key: 'fromMeituan', text: '美团', type: 'meituan' })
|
||||||
|
}
|
||||||
|
return badges
|
||||||
|
}
|
||||||
|
|
||||||
function isCompletedStatus(status) {
|
function isCompletedStatus(status) {
|
||||||
return Number(status) === 2
|
return Number(status) === 2
|
||||||
}
|
}
|
||||||
@@ -150,7 +161,7 @@ Page({
|
|||||||
selectedArtistId: id,
|
selectedArtistId: id,
|
||||||
selectedArtistName: artist ? artist.name : '全部员工'
|
selectedArtistName: artist ? artist.name : '全部员工'
|
||||||
})
|
})
|
||||||
this.prepareView()
|
this.loadCalendar()
|
||||||
},
|
},
|
||||||
|
|
||||||
selectDate(event) {
|
selectDate(event) {
|
||||||
@@ -366,8 +377,9 @@ Page({
|
|||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
top: Math.max(0, itemStart - startMinute) + laneHeaderHeight,
|
top: Math.max(0, itemStart - startMinute) + laneHeaderHeight,
|
||||||
height: Math.max(64, item.durationMinutes || 60),
|
height: Math.max(82, item.durationMinutes || 60),
|
||||||
timeText: resolveAppointmentTimeText(item),
|
timeText: resolveAppointmentTimeText(item),
|
||||||
|
badges: buildAppointmentBadges(item),
|
||||||
statusClass: appointmentStatusClass(item.status)
|
statusClass: appointmentStatusClass(item.status)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -66,6 +66,9 @@
|
|||||||
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{block.statusClass}}" style="top: {{block.top}}rpx; height: {{block.height}}rpx; border-left-color: {{item.color}};" data-id="{{block.orderItemId}}" bindtap="openAppointment">
|
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{block.statusClass}}" style="top: {{block.top}}rpx; height: {{block.height}}rpx; border-left-color: {{item.color}};" data-id="{{block.orderItemId}}" bindtap="openAppointment">
|
||||||
<text class="block-title">{{block.customerName}}</text>
|
<text class="block-title">{{block.customerName}}</text>
|
||||||
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
|
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
|
||||||
|
<view wx:if="{{block.badges.length}}" class="block-badges">
|
||||||
|
<text wx:for="{{block.badges}}" wx:for-item="badge" wx:key="key" class="block-badge {{badge.type}}">{{badge.text}}</text>
|
||||||
|
</view>
|
||||||
<text class="block-status">{{block.statusText}}</text>
|
<text class="block-status">{{block.statusText}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
|
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
|
||||||
|
|||||||
@@ -355,6 +355,35 @@
|
|||||||
line-height: 1.25;
|
line-height: 1.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.block-badges {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 24rpx;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
border-radius: 999rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.82);
|
||||||
|
color: #7b5b46;
|
||||||
|
font-size: 18rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-badge.removal {
|
||||||
|
background: #fff0dc;
|
||||||
|
color: #9a5f2d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-badge.meituan {
|
||||||
|
background: #eaf4ff;
|
||||||
|
color: #49729d;
|
||||||
|
}
|
||||||
|
|
||||||
.lane-empty {
|
.lane-empty {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 76rpx;
|
top: 76rpx;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const { BRAND_CONFIG } = require('../../utils/config')
|
|||||||
const userApi = require('../../api/user')
|
const userApi = require('../../api/user')
|
||||||
const authApi = require('../../api/auth')
|
const authApi = require('../../api/auth')
|
||||||
const auth = require('../../utils/auth')
|
const auth = require('../../utils/auth')
|
||||||
const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
|
const { chooseImageFilePath, uploadAvatar } = require('../../utils/upload')
|
||||||
|
|
||||||
function resolveRoleText(type) {
|
function resolveRoleText(type) {
|
||||||
const role = Number(type)
|
const role = Number(type)
|
||||||
@@ -184,8 +184,13 @@ Page({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.setData({ avatarUploading: true })
|
this.setData({ avatarUploading: true })
|
||||||
const avatar = await uploadProfileImage(filePath)
|
const avatar = await uploadAvatar(filePath)
|
||||||
this.setData({ 'profileForm.avatar': avatar })
|
const profile = await userApi.info()
|
||||||
|
this.syncProfileToSession({
|
||||||
|
...profile,
|
||||||
|
avatar: profile.avatar || avatar
|
||||||
|
})
|
||||||
|
this.setData({ 'profileForm.avatar': profile.avatar || avatar })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="card profile-card">
|
<view class="card profile-card">
|
||||||
<view class="profile-main">
|
<view class="profile-main">
|
||||||
<view class="shop-logo">指</view>
|
<view wx:if="{{userInfo.avatar}}" class="shop-logo image-avatar">
|
||||||
|
<image src="{{userInfo.avatar}}" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view wx:else class="shop-logo">指</view>
|
||||||
<view class="profile-copy">
|
<view class="profile-copy">
|
||||||
<text class="shop-name">{{shopName}}</text>
|
<text class="shop-name">{{shopName}}</text>
|
||||||
<text class="phone">{{phone}}</text>
|
<text class="phone">{{phone}}</text>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 96rpx;
|
width: 96rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
|
overflow: hidden;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
background: #6f8f83;
|
background: #6f8f83;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -31,6 +32,11 @@
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.shop-logo image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.shop-name,
|
.shop-name,
|
||||||
.phone {
|
.phone {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -109,8 +109,19 @@ function uploadProfileImage(filePath) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uploadAvatar(filePath) {
|
||||||
|
return uploadFile({
|
||||||
|
url: '/user/upload-avatar',
|
||||||
|
baseUrl: API_DOMAIN,
|
||||||
|
filePath,
|
||||||
|
name: 'file',
|
||||||
|
errorMessage: '头像上传失败'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
chooseImageFilePath,
|
chooseImageFilePath,
|
||||||
uploadObjectFile,
|
uploadObjectFile,
|
||||||
|
uploadAvatar,
|
||||||
uploadProfileImage
|
uploadProfileImage
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,3 +219,12 @@
|
|||||||
- 处理方式:将 `JY-Salon-WeChat/utils/config.js` 和 `JY-Salon-WeChat/utils/config.local.example.js` 中的 `tunnel`、`dev-remote` 统一改为 `https://yunail.art`,保留 `local` 为 `http://127.0.0.1:80`;删除本机残留的 `config.local.js` 覆盖,让代码默认分流生效;同步更新运维配置说明。
|
- 处理方式:将 `JY-Salon-WeChat/utils/config.js` 和 `JY-Salon-WeChat/utils/config.local.example.js` 中的 `tunnel`、`dev-remote` 统一改为 `https://yunail.art`,保留 `local` 为 `http://127.0.0.1:80`;删除本机残留的 `config.local.js` 覆盖,让代码默认分流生效;同步更新运维配置说明。
|
||||||
- 影响范围:店务小程序开发者工具、本地覆盖配置和店务小程序的非本地开发/体验/正式环境接口指向;设计师小程序沿用代码默认分流,不再依赖本机覆盖强制切换。
|
- 影响范围:店务小程序开发者工具、本地覆盖配置和店务小程序的非本地开发/体验/正式环境接口指向;设计师小程序沿用代码默认分流,不再依赖本机覆盖强制切换。
|
||||||
- 验证方式:开发者工具环境解析为 `http://127.0.0.1:80/api` 或 `http://127.0.0.1:80/admin/api`,非本地 `develop`、体验版和正式版解析为 `https://yunail.art` 对应接口;`git check-ignore -v` 仍能确认本地覆盖文件路径被忽略。
|
- 验证方式:开发者工具环境解析为 `http://127.0.0.1:80/api` 或 `http://127.0.0.1:80/admin/api`,非本地 `develop`、体验版和正式版解析为 `https://yunail.art` 对应接口;`git check-ignore -v` 仍能确认本地覆盖文件路径被忽略。
|
||||||
|
|
||||||
|
## 2026-07-20 店务小程序预约与生产问题修复
|
||||||
|
|
||||||
|
- 变更原因:生产反馈头像上传成功但页面不刷新、全周营业时店铺月视图仍按员工休息显示、新增预约手机号不应必填且需记录定金/卸甲/美团来源,后续补充员工颜色保存不生效和登录验证码倒计时偏移问题。
|
||||||
|
- 处理方式:店务小程序头像上传改走 `/user/upload-avatar` 并重新拉取用户信息刷新会话;预约表单手机号改为可选,新增“是否交定金、是否需要卸甲、是否来自美团”开关;日视图预约块展示卸甲和美团标记;员工颜色设置改为读取员工详情并保存到后端,返回员工列表和规划页后重新加载;登录验证码按钮改为固定尺寸居中布局。
|
||||||
|
- 后端处理:预约创建和更新保存 `depositPaid`、`needRemoval`、`fromMeituan`;预约客户不存在时自动新增客户,手机号为空时使用 `guest` 加雪花 ID 生成账号;日历汇总按视角计算营业状态,全部员工视角以店铺营业为主,单个员工视角以员工排班为主。
|
||||||
|
- 数据库变更:新增 `scripts/sql/migrations/预约附加参数/预约附加参数字段_20260720.sql`,为 `t_order_item` 增加 `deposit_paid`、`need_removal`、`from_meituan` 三个幂等列,不修改初始化 SQL。
|
||||||
|
- 影响范围:`JY-Core` 预约创建、预约更新、日历查询和预约返回对象;`JY-Salon-WeChat` 个人中心、预约表单、规划日视图、员工列表/详情/颜色设置和登录页样式。
|
||||||
|
- 验证方式:`mvn -f JY-Core/pom.xml -Dtest=PlanningServiceImplTest test` 通过 10 个用例;`mvn -f JY-Core/pom.xml -Dtest=JayuCloudSqlSchemaTest test` 通过 9 个用例;小程序变更 JS 执行 `node --check` 通过;微信开发者工具端口 `55089` 诊断为 IDE HTTP 服务端口而非自动化 WebSocket,页面自动化截图需在开启正确自动化端口后复验。
|
||||||
|
|||||||
@@ -80,3 +80,11 @@
|
|||||||
- 处理方式:这类校验改为在 `D:\codex\tmp` 创建临时 JS 脚本执行,执行完成后立即删除临时脚本。
|
- 处理方式:这类校验改为在 `D:\codex\tmp` 创建临时 JS 脚本执行,执行完成后立即删除临时脚本。
|
||||||
- 以后避免:凡是需要多条断言、对象字面量、路径字符串或嵌套引号的 Node 校验,不使用 `node -e`,直接用临时脚本。
|
- 以后避免:凡是需要多条断言、对象字面量、路径字符串或嵌套引号的 Node 校验,不使用 `node -e`,直接用临时脚本。
|
||||||
- 验证方式:临时脚本执行成功并输出预期断言结果,随后用 `Test-Path` 确认脚本已删除。
|
- 验证方式:临时脚本执行成功并输出预期断言结果,随后用 `Test-Path` 确认脚本已删除。
|
||||||
|
|
||||||
|
## 2026-07-20 微信开发者工具 IDE HTTP 端口不能当自动化端口
|
||||||
|
|
||||||
|
- 问题:把开发者工具服务端口 `55089` 当作小程序自动化 WebSocket 使用时,连接诊断显示端口可达但返回 HTTP 404,且 `looksLikeIdeHttp=true`、`looksLikeAutomatorWs=false`。
|
||||||
|
- 原因:微信开发者工具的 IDE HTTP 服务端口和 miniprogram-automator 自动化 WebSocket 端口不是同一个端口;MCP 自动化需要后者,默认常见为 `9420` 或 CLI `auto --auto-port` 指定的端口。
|
||||||
|
- 处理方式:遇到用户提供端口时,先用 `mp_diagnoseConnection` 诊断 `wsEndpoint`,如果命中 IDE HTTP 特征,不要继续把该端口传给自动化场景;需要用户开启自动化或提供真正的自动化 WebSocket 端口。
|
||||||
|
- 以后避免:页面自动化前区分“服务端口”和“自动化端口”,不要仅凭端口监听成功判断可自动化;`portListening=true` 但 `websocketReachable=false` 时应停止截图验证并记录缺口。
|
||||||
|
- 验证方式:正确自动化端口应同时满足 `websocketReachable=true` 和 `looksLikeAutomatorWs=true`,再运行 `mp_runScenario` 页面断言。
|
||||||
|
|||||||
+10
-9
@@ -2,24 +2,25 @@
|
|||||||
|
|
||||||
## 当前任务
|
## 当前任务
|
||||||
|
|
||||||
店务端小程序与网页端三项真实能力补齐:修改密码、导出 Excel、员工作品/订单。
|
店务小程序生产问题与预约优化:头像刷新、营业日状态、预约附加参数、客户自动新增、员工颜色保存、登录验证码按钮布局。
|
||||||
|
|
||||||
## 已完成
|
## 已完成
|
||||||
|
|
||||||
- 已完成后端 `/user/password` 原密码改密分支、`/admin/export` Excel 下载接口、`/admin/manager/employees/{userId}/orders` 员工订单接口。
|
- 已完成后端预约创建/更新保存 `depositPaid`、`needRemoval`、`fromMeituan`,手机号可空,客户不存在时自动新增;无手机号客户使用 `guest` 加雪花 ID 账号。
|
||||||
- 已完成 `JY-Salon-Front` 修改密码真实提交、导出 Blob 下载、员工订单真实列表。
|
- 已完成日历汇总按视角计算状态:全部员工视角按店铺营业状态,单个员工视角按员工排班状态。
|
||||||
- 已完成 `JY-Salon-WeChat` 修改密码真实提交并重新登录、导出下载打开 Excel、员工订单真实列表。
|
- 已新增 SQL `scripts/sql/migrations/预约附加参数/预约附加参数字段_20260720.sql`,为 `t_order_item` 增加三个预约附加参数列。
|
||||||
- 已更新 `docs/项目变更记录.md` 和 `docs/运维配置与集成说明.md`,记录 POI 依赖和接口行为。
|
- 已完成店务小程序头像上传刷新会话、预约表单开关、日视图标记、员工颜色后端保存并刷新、登录验证码按钮居中。
|
||||||
- 已通过 `JY-Core` 编译、`JY-Salon-Front` 构建、小程序变更 JS 语法检查、GitNexus `detect-changes`。
|
- 已更新 `docs/项目变更记录.md`,记录本轮功能、SQL、影响范围和验证结果。
|
||||||
|
- 已通过 `PlanningServiceImplTest`、`JayuCloudSqlSchemaTest` 和小程序变更 JS 语法检查。
|
||||||
|
|
||||||
## 下一步
|
## 下一步
|
||||||
|
|
||||||
- 暂存本次相关文件并创建中文 git 提交。
|
- 运行 GitNexus `detect_changes`,只暂存本次任务相关文件并创建中文 git 提交。
|
||||||
|
|
||||||
## 当前阻塞点
|
## 当前阻塞点
|
||||||
|
|
||||||
无。
|
- 微信开发者工具端口 `55089` 是 IDE HTTP 服务端口,不是自动化 WebSocket;页面自动化截图需在开启正确自动化端口后复验。
|
||||||
|
|
||||||
## 最近一次重要操作结果
|
## 最近一次重要操作结果
|
||||||
|
|
||||||
2026-07-16 本地验证通过;GitNexus `detect-changes` 显示 23 个文件、44 个符号、0 个流程、风险 LOW。
|
2026-07-20 本地后端定向测试与 SQL 结构测试均通过,小程序 JS 语法检查通过,DevTools 自动化连接未完成。
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS jayu_cloud DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
|
use jayu_cloud;
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS sp_jy_add_column_if_not_exists;
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE PROCEDURE sp_jy_add_column_if_not_exists(
|
||||||
|
IN p_table_name varchar(128),
|
||||||
|
IN p_column_name varchar(128),
|
||||||
|
IN p_column_sql varchar(1000)
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM information_schema.columns
|
||||||
|
WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = p_table_name
|
||||||
|
AND column_name = p_column_name
|
||||||
|
) THEN
|
||||||
|
SET @jy_sql = CONCAT('ALTER TABLE ', p_table_name, ' ADD COLUMN ', p_column_sql);
|
||||||
|
PREPARE jy_stmt FROM @jy_sql;
|
||||||
|
EXECUTE jy_stmt;
|
||||||
|
DEALLOCATE PREPARE jy_stmt;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
CALL sp_jy_add_column_if_not_exists('t_order_item', 'deposit_paid', '`deposit_paid` tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''是否交定金:0-否,1-是'' AFTER `appointment_time`');
|
||||||
|
CALL sp_jy_add_column_if_not_exists('t_order_item', 'need_removal', '`need_removal` tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''是否需要卸甲:0-否,1-是'' AFTER `deposit_paid`');
|
||||||
|
CALL sp_jy_add_column_if_not_exists('t_order_item', 'from_meituan', '`from_meituan` tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''是否来自美团:0-否,1-是'' AFTER `need_removal`');
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS sp_jy_add_column_if_not_exists;
|
||||||
Reference in New Issue
Block a user