保存客户与员工排班改造阶段成果
This commit is contained in:
+12
-5
@@ -370,10 +370,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createUser(UserDTO userDTO) {
|
||||
return createUserInternal(userDTO, false);
|
||||
return createUserInternal(userDTO);
|
||||
}
|
||||
|
||||
private Long createUserInternal(UserDTO userDTO, boolean allowMissingCustomerPhone) {
|
||||
private Long createUserInternal(UserDTO userDTO) {
|
||||
String validatedAccount = AccountValidationUtils.requireValidAccount(userDTO.getAccount());
|
||||
// 检查账号是否已存在
|
||||
UserDO existingUser = findUserByAccount(validatedAccount);
|
||||
@@ -390,7 +390,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
Long validatedShopId = pickPrimaryShopId(validatedShopIds);
|
||||
Integer userType = userDTO.getType();
|
||||
String validatedPhone = Integer.valueOf(0).equals(userType)
|
||||
? validateCustomerPhone(userDTO.getPhone(), !(allowMissingCustomerPhone && Integer.valueOf(0).equals(userType)))
|
||||
? validateCustomerPhone(userDTO.getPhone(), false)
|
||||
: validateUserPhone(userDTO.getPhone(), null, true);
|
||||
String validatedWechatId = UserProfileFieldSupport.normalizeOptionalText(userDTO.getWechatId());
|
||||
if (Integer.valueOf(0).equals(userType)) {
|
||||
@@ -532,7 +532,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
customer.setShopIds(List.of(shopId));
|
||||
customer.setLevel(VIP_LEVEL_NORMAL);
|
||||
customer.setVipId(0L);
|
||||
return createUserInternal(customer, true);
|
||||
return createUserInternal(customer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -665,7 +665,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
userDO.setPassword(passwordEncoder.encode(userDTO.getPassword()));
|
||||
}
|
||||
if (userDTO.getPhone() != null) {
|
||||
userDO.setPhone(validateUserPhone(userDTO.getPhone(), id, true));
|
||||
userDO.setPhone(Integer.valueOf(0).equals(userDO.getType())
|
||||
? validateCustomerPhone(userDTO.getPhone(), false)
|
||||
: validateUserPhone(userDTO.getPhone(), id, true));
|
||||
}
|
||||
if (userDTO.getContactPhone() != null) {
|
||||
userDO.setContactPhone(UserProfileFieldSupport.normalizeOptionalText(userDTO.getContactPhone()));
|
||||
@@ -733,6 +735,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
userDO.setCustomerIdentityHash(customerIdentityHash(userDO.getNickname(), userDO.getWechatId(), customerPhone));
|
||||
} else {
|
||||
userDO.setCustomerIdentityHash(null);
|
||||
if (StringUtils.hasText(userDO.getPhone()) && !isDeletedPlaceholderPhone(userDO.getPhone())) {
|
||||
ensurePhoneNotUsed(userDO.getPhone(), id);
|
||||
}
|
||||
}
|
||||
List<Long> validatedShopIds = null;
|
||||
boolean shopBindingChanged = userDTO.getShopIds() != null || userDTO.getShopId() != null;
|
||||
@@ -3234,6 +3239,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
private void ensurePhoneNotUsed(String phone, Long currentUserId) {
|
||||
LambdaQueryWrapper<UserDO> wrapper = Wrappers.lambdaQuery(UserDO.class)
|
||||
.eq(UserDO::getPhoneHash, phoneCrypto.index(phone))
|
||||
.ne(UserDO::getType, 0)
|
||||
.eq(UserDO::getIsDelete, 0);
|
||||
if (currentUserId != null) {
|
||||
wrapper.ne(UserDO::getId, currentUserId);
|
||||
@@ -3347,6 +3353,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
String normalized = phone.trim();
|
||||
UserDO user = userMapper.selectOne(Wrappers.lambdaQuery(UserDO.class)
|
||||
.eq(UserDO::getPhoneHash, phoneCrypto.index(normalized))
|
||||
.ne(UserDO::getType, 0)
|
||||
.eq(UserDO::getIsDelete, 0)
|
||||
.last("limit 1"));
|
||||
if (user == null) {
|
||||
|
||||
@@ -93,6 +93,10 @@ CALL salon_v8_add_column_if_missing(
|
||||
't_user', 'active_customer_identity_hash',
|
||||
'char(64) GENERATED ALWAYS AS (CASE WHEN type = 0 AND COALESCE(is_delete, 0) = 0 THEN customer_identity_hash ELSE NULL END) STORED COMMENT ''有效客户组合身份索引'''
|
||||
);
|
||||
CALL salon_v8_add_column_if_missing(
|
||||
't_user', 'active_service_phone_hash',
|
||||
'char(64) GENERATED ALWAYS AS (CASE WHEN type <> 0 AND COALESCE(is_delete, 0) = 0 THEN phone_hash ELSE NULL END) STORED COMMENT ''有效員工和管理員手机号唯一索引'''
|
||||
);
|
||||
CALL salon_v8_add_column_if_missing(
|
||||
't_nail_artist_info', 'color',
|
||||
'varchar(7) NULL COMMENT ''美甲师规划专属颜色'''
|
||||
@@ -103,6 +107,9 @@ CALL salon_v8_add_index_if_missing('t_user', 'idx_user_phone_hash', '(`phone_has
|
||||
CALL salon_v8_add_unique_index_if_missing(
|
||||
't_user', 'uk_user_active_customer_identity_hash', '(`active_customer_identity_hash`)'
|
||||
);
|
||||
CALL salon_v8_add_unique_index_if_missing(
|
||||
't_user', 'uk_user_active_service_phone_hash', '(`active_service_phone_hash`)'
|
||||
);
|
||||
|
||||
DROP PROCEDURE IF EXISTS salon_v8_add_column_if_missing;
|
||||
DROP PROCEDURE IF EXISTS salon_v8_add_index_if_missing;
|
||||
|
||||
@@ -147,7 +147,7 @@ Page({
|
||||
status: 1,
|
||||
remark: '新建美甲师默认全天可预约,可在排班设置中调整'
|
||||
}).then(() => {
|
||||
this.finishCreated(!this.data.pickerMode, false)
|
||||
this.finishCreated(!this.data.pickerMode, true)
|
||||
}).catch(error => {
|
||||
wx.showModal({
|
||||
title: '默认排班设置失败',
|
||||
|
||||
@@ -53,8 +53,9 @@
|
||||
<view class="onboarding-icon">✓</view>
|
||||
<text class="onboarding-title">美甲师已创建</text>
|
||||
<text class="onboarding-desc">{{pickerMode ? '设置常规排班后,可继续把当前预约分配给该美甲师。' : '为新美甲师设置首个常规排班,之后即可正常承接预约。'}}</text>
|
||||
<text class="onboarding-default-note">不立即设置时,将默认全年无休、全天可预约(00:00-23:59),之后可在排班设置中调整。</text>
|
||||
<button class="primary-btn onboarding-primary" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="setupFirstSchedule">{{pickerMode ? '设置排班并分配' : '立即设置排班'}}</button>
|
||||
<button class="onboarding-skip" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="skipFirstSchedule">{{pickerMode ? '暂不设置' : '稍后设置(默认全天可约)'}}</button>
|
||||
<button class="onboarding-skip" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="skipFirstSchedule">{{pickerMode ? '暂不设置(默认全天可约)' : '不设置,使用默认全天排班'}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -136,5 +136,6 @@
|
||||
|
||||
.onboarding-title { margin-top: 22rpx; color: #17211f; font-size: 32rpx; font-weight: 900; }
|
||||
.onboarding-desc { margin-top: 12rpx; color: #837b72; font-size: 23rpx; line-height: 1.7; text-align: center; }
|
||||
.onboarding-default-note { margin-top: 14rpx; padding: 14rpx 16rpx; border-radius: 12rpx; background: #eff7f2; color: #39705d; font-size: 21rpx; line-height: 1.55; text-align: left; }
|
||||
.onboarding-primary { width: 100%; margin-top: 30rpx; }
|
||||
.onboarding-skip { margin-top: 12rpx; background: transparent; color: #7e776f; font-size: 23rpx; }
|
||||
|
||||
@@ -493,7 +493,7 @@ Page({
|
||||
return {
|
||||
...item,
|
||||
top: Math.max(0, itemStart - startMinute) * minuteScale + laneHeaderHeight,
|
||||
height: Math.max(100, (item.durationMinutes || 60) * minuteScale),
|
||||
height: Math.max(60, (item.durationMinutes || 60) * minuteScale),
|
||||
compact: Number(item.durationMinutes || 60) <= 15,
|
||||
timeText: resolveAppointmentTimeText(item)
|
||||
}
|
||||
@@ -508,7 +508,7 @@ Page({
|
||||
return {
|
||||
...item,
|
||||
top: Math.max(0, itemStart - startMinute) * minuteScale + laneHeaderHeight,
|
||||
height: Math.max(100, (item.durationMinutes || 60) * minuteScale),
|
||||
height: Math.max(60, (item.durationMinutes || 60) * minuteScale),
|
||||
compact: Number(item.durationMinutes || 60) <= 15,
|
||||
timeText: resolveAppointmentTimeText(item)
|
||||
}
|
||||
|
||||
@@ -98,12 +98,16 @@
|
||||
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{block.status === 0 ? 'pending' : ''}} {{block.compact ? 'compact' : ''}}" 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-meta">{{block.timeText}} · {{block.productTitle}}</text>
|
||||
<text class="block-status">{{block.statusText}}</text>
|
||||
<view class="block-actions" catchtap="stopTap">
|
||||
<text wx:if="{{!block.historicalBackfill && block.status === 0 && block.assignmentStatus !== 'UNASSIGNED'}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
|
||||
<text wx:if="{{!block.historicalBackfill}}" data-id="{{block.orderItemId}}" catchtap="quickTransfer">{{block.assignmentStatus === 'UNASSIGNED' ? '分配' : '改派'}}</text>
|
||||
<text wx:if="{{!block.historicalBackfill || block.status === 4}}" data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
|
||||
<text wx:if="{{block.historicalBackfill && block.status === 4}}" data-id="{{block.orderItemId}}" data-status="2" catchtap="quickUpdateStatus">完成</text>
|
||||
<view class="block-footer">
|
||||
<view class="block-footer">
|
||||
<text class="block-status">{{block.statusText}}</text>
|
||||
<view class="block-actions" catchtap="stopTap">
|
||||
<text wx:if="{{!block.historicalBackfill && block.status === 0 && block.assignmentStatus !== 'UNASSIGNED'}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
|
||||
<text wx:if="{{!block.historicalBackfill}}" data-id="{{block.orderItemId}}" catchtap="quickTransfer">{{block.assignmentStatus === 'UNASSIGNED' ? '分配' : '改派'}}</text>
|
||||
<text wx:if="{{!block.historicalBackfill || block.status === 4}}" data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
|
||||
<text wx:if="{{block.historicalBackfill && block.status === 4}}" data-id="{{block.orderItemId}}" data-status="2" catchtap="quickUpdateStatus">完成</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">{{item.emptyText || '全天可约'}}</view>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
.control-card {
|
||||
padding: 12rpx 16rpx;
|
||||
padding: 8rpx 14rpx;
|
||||
}
|
||||
|
||||
.calendar-error-card {
|
||||
@@ -145,12 +145,12 @@
|
||||
}
|
||||
|
||||
.icon-btn.small {
|
||||
width: 52rpx;
|
||||
min-width: 52rpx;
|
||||
max-width: 52rpx;
|
||||
height: 52rpx;
|
||||
min-height: 52rpx;
|
||||
font-size: 34rpx;
|
||||
width: 44rpx;
|
||||
min-width: 44rpx;
|
||||
max-width: 44rpx;
|
||||
height: 44rpx;
|
||||
min-height: 44rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.date-center {
|
||||
@@ -162,21 +162,21 @@
|
||||
|
||||
.date-main {
|
||||
color: #17211f;
|
||||
font-size: 32rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.date-sub {
|
||||
color: #71807a;
|
||||
font-size: 22rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.segmented {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8rpx;
|
||||
margin-top: 10rpx;
|
||||
padding: 6rpx;
|
||||
margin-top: 6rpx;
|
||||
padding: 4rpx;
|
||||
border-radius: 12px;
|
||||
background: #f1ece4;
|
||||
}
|
||||
@@ -185,7 +185,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 46rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 10px;
|
||||
color: #7d756c;
|
||||
font-size: 24rpx;
|
||||
@@ -203,14 +203,15 @@
|
||||
.artist-filter {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin-top: 10rpx;
|
||||
height: 44rpx;
|
||||
margin-top: 6rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.artist-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 52rpx;
|
||||
height: 44rpx;
|
||||
margin-right: 10rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 999rpx;
|
||||
@@ -242,8 +243,8 @@
|
||||
.unassigned-notice {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 14rpx;
|
||||
padding: 14rpx 16rpx;
|
||||
margin-top: 8rpx;
|
||||
padding: 10rpx 12rpx;
|
||||
border-radius: 12rpx;
|
||||
background: #fff4e5;
|
||||
color: #8b5e24;
|
||||
@@ -344,6 +345,7 @@
|
||||
flex-shrink: 0;
|
||||
border-right: 1rpx solid #e7ece9;
|
||||
background-image: linear-gradient(to bottom, rgba(203, 220, 213, 0.45) 1rpx, transparent 1rpx);
|
||||
background-position: 0 54rpx;
|
||||
background-size: 100% 240rpx;
|
||||
}
|
||||
|
||||
@@ -367,6 +369,7 @@
|
||||
left: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
gap: 2rpx;
|
||||
overflow: hidden;
|
||||
padding: 6rpx 10rpx;
|
||||
@@ -400,10 +403,17 @@
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.block-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 18rpx;
|
||||
}
|
||||
|
||||
.block-actions {
|
||||
display: flex;
|
||||
gap: 10rpx;
|
||||
margin-top: 2rpx;
|
||||
margin-top: 0;
|
||||
color: #247b63;
|
||||
font-size: 18rpx;
|
||||
font-weight: 800;
|
||||
@@ -433,6 +443,10 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.appointment-block.compact .block-footer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.lane-empty {
|
||||
position: absolute;
|
||||
top: 76rpx;
|
||||
|
||||
Reference in New Issue
Block a user