功能:增加店长员工审核与登录提醒
This commit is contained in:
+8
-2
@@ -2,8 +2,9 @@ package com.xiaowang.jacyucloudsalon.core.modules.registration.controller;
|
||||
|
||||
import com.xiaowang.jacyucloudsalon.core.common.Result;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.dto.WorkbenchRegistrationRejectDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRegistrationApplicationDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.service.WorkbenchRegistrationService;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationReviewSummaryVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationReviewVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.mapper.UserMapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -28,12 +29,17 @@ public class AdminWorkbenchRegistrationController {
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result<List<WorkbenchRegistrationApplicationDO>> list(HttpServletRequest request) {
|
||||
public Result<List<WorkbenchRegistrationReviewVO>> list(HttpServletRequest request) {
|
||||
Long userId = requireUserId(request);
|
||||
UserDO user = userMapper.selectById(userId);
|
||||
return Result.success(registrationService.listForReviewer(userId, isPlatformAdmin(user)));
|
||||
}
|
||||
|
||||
@GetMapping("/summary")
|
||||
public Result<WorkbenchRegistrationReviewSummaryVO> summary(HttpServletRequest request) {
|
||||
return Result.success(registrationService.getReviewSummary(requireUserId(request)));
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/approve")
|
||||
public Result<Boolean> approve(HttpServletRequest request, @PathVariable Long id) {
|
||||
Long userId = requireUserId(request);
|
||||
|
||||
+5
@@ -2,6 +2,11 @@ package com.xiaowang.jacyucloudsalon.core.modules.registration.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRegistrationApplicationDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface WorkbenchRegistrationApplicationMapper extends BaseMapper<WorkbenchRegistrationApplicationDO> {
|
||||
|
||||
@Select("SELECT * FROM t_workbench_registration_application WHERE id = #{id} AND is_delete = 0 FOR UPDATE")
|
||||
WorkbenchRegistrationApplicationDO selectByIdForUpdate(@Param("id") Long id);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,7 +1,8 @@
|
||||
package com.xiaowang.jacyucloudsalon.core.modules.registration.service;
|
||||
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.dto.WorkbenchRegistrationRequestDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRegistrationApplicationDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationReviewSummaryVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationReviewVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationStatusVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -10,7 +11,8 @@ public interface WorkbenchRegistrationService {
|
||||
WorkbenchRegistrationStatusVO register(WorkbenchRegistrationRequestDTO request);
|
||||
WorkbenchRegistrationStatusVO getStatus(Long userId);
|
||||
WorkbenchRegistrationStatusVO resubmit(WorkbenchRegistrationRequestDTO request);
|
||||
List<WorkbenchRegistrationApplicationDO> listForReviewer(Long reviewerId, boolean platformAdmin);
|
||||
List<WorkbenchRegistrationReviewVO> listForReviewer(Long reviewerId, boolean platformAdmin);
|
||||
WorkbenchRegistrationReviewSummaryVO getReviewSummary(Long reviewerId);
|
||||
boolean approve(Long reviewerId, boolean platformAdmin, Long applicationId);
|
||||
boolean reject(Long reviewerId, boolean platformAdmin, Long applicationId, String reason);
|
||||
}
|
||||
|
||||
+73
-10
@@ -7,6 +7,8 @@ import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRe
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRegistrationStatus;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.mapper.WorkbenchRegistrationApplicationMapper;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.service.WorkbenchRegistrationService;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationReviewSummaryVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationReviewVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationStatusVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.integration.service.WechatMiniAuthService;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.integration.dto.WechatMiniRegistrationTicket;
|
||||
@@ -18,13 +20,19 @@ import com.xiaowang.jacyucloudsalon.core.modules.shop.mapper.UserShopBindingMapp
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.mapper.UserMapper;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.service.UserService;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.system.service.SystemParameterConfigService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationService {
|
||||
@@ -35,6 +43,7 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
private final UserShopBindingSupport userShopBindingSupport;
|
||||
private final UserShopBindingMapper userShopBindingMapper;
|
||||
private final WechatMiniAuthService wechatMiniAuthService;
|
||||
private final SystemParameterConfigService systemParameterConfigService;
|
||||
|
||||
public WorkbenchRegistrationServiceImpl(
|
||||
WorkbenchRegistrationApplicationMapper applicationMapper,
|
||||
@@ -43,7 +52,8 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
UserService userService,
|
||||
UserShopBindingSupport userShopBindingSupport,
|
||||
UserShopBindingMapper userShopBindingMapper,
|
||||
WechatMiniAuthService wechatMiniAuthService
|
||||
WechatMiniAuthService wechatMiniAuthService,
|
||||
SystemParameterConfigService systemParameterConfigService
|
||||
) {
|
||||
this.applicationMapper = applicationMapper;
|
||||
this.userMapper = userMapper;
|
||||
@@ -52,6 +62,7 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
this.userShopBindingSupport = userShopBindingSupport;
|
||||
this.userShopBindingMapper = userShopBindingMapper;
|
||||
this.wechatMiniAuthService = wechatMiniAuthService;
|
||||
this.systemParameterConfigService = systemParameterConfigService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,13 +169,38 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkbenchRegistrationApplicationDO> listForReviewer(Long reviewerId, boolean platformAdmin) {
|
||||
public List<WorkbenchRegistrationReviewVO> listForReviewer(Long reviewerId, boolean platformAdmin) {
|
||||
List<WorkbenchRegistrationApplicationDO> applications;
|
||||
if (platformAdmin) {
|
||||
return applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_ADMIN).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
|
||||
applications = applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_ADMIN).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
|
||||
} else {
|
||||
UserDO reviewer = requireManager(reviewerId);
|
||||
applications = applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_MANAGER).eq(WorkbenchRegistrationApplicationDO::getShopId, reviewer.getShopId()).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
|
||||
}
|
||||
UserDO reviewer = userMapper.selectById(reviewerId);
|
||||
require(reviewer != null && Integer.valueOf(2).equals(reviewer.getType()), "仅店长可以审核店员申请");
|
||||
return applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_MANAGER).eq(WorkbenchRegistrationApplicationDO::getShopId, reviewer.getShopId()).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
|
||||
List<Long> applicantIds = applications.stream()
|
||||
.map(WorkbenchRegistrationApplicationDO::getUserId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, UserDO> applicants = applicantIds.isEmpty()
|
||||
? Map.of()
|
||||
: userMapper.selectBatchIds(applicantIds).stream()
|
||||
.collect(Collectors.toMap(UserDO::getId, Function.identity()));
|
||||
return applications.stream()
|
||||
.map(application -> toReviewVO(application, applicants.get(application.getUserId())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkbenchRegistrationReviewSummaryVO getReviewSummary(Long reviewerId) {
|
||||
UserDO reviewer = requireManager(reviewerId);
|
||||
Long pendingCount = applicationMapper.selectCount(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class)
|
||||
.eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_MANAGER)
|
||||
.eq(WorkbenchRegistrationApplicationDO::getShopId, reviewer.getShopId())
|
||||
.eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0));
|
||||
boolean noticeEnabled = "true".equalsIgnoreCase(systemParameterConfigService.getEnabledValue(
|
||||
"WORKBENCH", "MANAGER_REGISTRATION_REVIEW_NOTICE"));
|
||||
return new WorkbenchRegistrationReviewSummaryVO(pendingCount == null ? 0L : pendingCount, noticeEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,14 +240,16 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
}
|
||||
|
||||
private WorkbenchRegistrationApplicationDO loadReviewable(Long reviewerId, boolean platformAdmin, Long applicationId) {
|
||||
WorkbenchRegistrationApplicationDO application = applicationMapper.selectById(applicationId);
|
||||
require(application != null && WorkbenchRegistrationStatus.REJECTED.equals(application.getStatus()) == false, "审核申请不存在或已处理");
|
||||
WorkbenchRegistrationApplicationDO application = applicationMapper.selectByIdForUpdate(applicationId);
|
||||
require(application != null, "审核申请不存在或已处理");
|
||||
if (platformAdmin) {
|
||||
require(WorkbenchRegistrationStatus.PENDING_ADMIN.equals(application.getStatus()), "管理员只能审核店长申请");
|
||||
require(WorkbenchRegistrationRole.MANAGER.equals(application.getRoleType()), "管理员只能审核店长申请");
|
||||
} else {
|
||||
UserDO reviewer = userMapper.selectById(reviewerId);
|
||||
require(reviewer != null && Integer.valueOf(2).equals(reviewer.getType()) && reviewer.getShopId().equals(application.getShopId()), "无权审核该店铺申请");
|
||||
UserDO reviewer = requireManager(reviewerId);
|
||||
require(Objects.equals(reviewer.getShopId(), application.getShopId()), "无权审核该店铺申请");
|
||||
require(WorkbenchRegistrationStatus.PENDING_MANAGER.equals(application.getStatus()), "店长只能审核店员申请");
|
||||
require(WorkbenchRegistrationRole.STAFF.equals(application.getRoleType()), "店长只能审核店员申请");
|
||||
}
|
||||
return application;
|
||||
}
|
||||
@@ -224,6 +262,31 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
return new WorkbenchRegistrationStatusVO(application.getId(), application.getApplicationNo(), application.getRoleType(), application.getStatus(), application.getRejectReason(), application.getShopId(), application.getShopName());
|
||||
}
|
||||
|
||||
private WorkbenchRegistrationReviewVO toReviewVO(WorkbenchRegistrationApplicationDO application, UserDO applicant) {
|
||||
WorkbenchRegistrationReviewVO review = new WorkbenchRegistrationReviewVO();
|
||||
BeanUtils.copyProperties(application, review);
|
||||
if (applicant != null) {
|
||||
review.setApplicantNickname(applicant.getNickname());
|
||||
review.setApplicantAvatar(applicant.getAvatar());
|
||||
review.setApplicantMaskedPhone(maskPhone(applicant.getPhone()));
|
||||
}
|
||||
return review;
|
||||
}
|
||||
|
||||
private UserDO requireManager(Long reviewerId) {
|
||||
UserDO reviewer = userMapper.selectById(reviewerId);
|
||||
require(reviewer != null && Integer.valueOf(2).equals(reviewer.getType()) && reviewer.getShopId() != null,
|
||||
"仅店长可以审核店员申请");
|
||||
return reviewer;
|
||||
}
|
||||
|
||||
private String maskPhone(String phone) {
|
||||
if (!StringUtils.hasText(phone) || phone.length() < 7) {
|
||||
return "";
|
||||
}
|
||||
return phone.substring(0, 3) + "****" + phone.substring(phone.length() - 4);
|
||||
}
|
||||
|
||||
private String requireText(String value, String message) {
|
||||
require(StringUtils.hasText(value), message);
|
||||
return value.trim();
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.xiaowang.jacyucloudsalon.core.modules.registration.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class WorkbenchRegistrationReviewSummaryVO {
|
||||
private final long pendingCount;
|
||||
private final boolean noticeEnabled;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.xiaowang.jacyucloudsalon.core.modules.registration.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class WorkbenchRegistrationReviewVO {
|
||||
private Long id;
|
||||
private String applicationNo;
|
||||
private Long userId;
|
||||
private String roleType;
|
||||
private Long shopId;
|
||||
private String shopName;
|
||||
private String shopAddress;
|
||||
private String status;
|
||||
private Long reviewerId;
|
||||
private LocalDateTime reviewedAt;
|
||||
private String rejectReason;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
private String applicantNickname;
|
||||
private String applicantAvatar;
|
||||
private String applicantMaskedPhone;
|
||||
}
|
||||
+5
@@ -27,5 +27,10 @@ class WorkbenchRegistrationControllerMappingTest {
|
||||
GetMapping listMapping = listMethod.getAnnotation(GetMapping.class);
|
||||
assertNotNull(listMapping);
|
||||
assertEquals("/list", Arrays.stream(listMapping.value()).findFirst().orElse(""));
|
||||
|
||||
Method summaryMethod = AdminWorkbenchRegistrationController.class.getMethod("summary", javax.servlet.http.HttpServletRequest.class);
|
||||
GetMapping summaryMapping = summaryMethod.getAnnotation(GetMapping.class);
|
||||
assertNotNull(summaryMapping);
|
||||
assertEquals("/summary", Arrays.stream(summaryMapping.value()).findFirst().orElse(""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1983,6 +1983,10 @@ export interface WorkbenchRegistrationApplication {
|
||||
status: 'PENDING_ADMIN' | 'PENDING_MANAGER' | 'APPROVED' | 'REJECTED'
|
||||
rejectReason?: string
|
||||
createTime?: string
|
||||
updateTime?: string
|
||||
applicantNickname?: string
|
||||
applicantAvatar?: string
|
||||
applicantMaskedPhone?: string
|
||||
}
|
||||
|
||||
export const adminWorkbenchRegistrationApi = {
|
||||
|
||||
@@ -27,6 +27,20 @@
|
||||
<a-button type="primary" :loading="saving" @click="save">保存默认密码</a-button>
|
||||
</a-form>
|
||||
</a-card>
|
||||
<a-card title="店长员工审核提醒" :loading="loading">
|
||||
<a-alert
|
||||
message="控制店长登录小程序后的待审核弹窗"
|
||||
description="关闭后只是不再主动弹窗,员工页面中的审核入口和待审核数量仍然保留。"
|
||||
show-icon
|
||||
type="info"
|
||||
/>
|
||||
<a-form class="settings-form" layout="vertical">
|
||||
<a-form-item label="登录提醒">
|
||||
<a-switch v-model:checked="reviewNoticeEnabled" checked-children="显示" un-checked-children="隐藏" />
|
||||
</a-form-item>
|
||||
<a-button type="primary" :loading="savingReviewNotice" @click="saveReviewNotice">保存审核提醒设置</a-button>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -38,7 +52,9 @@ import { adminSystemParameterConfigApi, type SystemParameterConfigVO } from '@/a
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const savingSmsProvider = ref(false)
|
||||
const savingReviewNotice = ref(false)
|
||||
const enabled = ref(true)
|
||||
const reviewNoticeEnabled = ref(true)
|
||||
const form = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'USER',
|
||||
configKey: 'DEFAULT_PASSWORD',
|
||||
@@ -55,13 +71,22 @@ const smsProviderForm = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'SMS', configKey: 'SMS_PROVIDER', configName: '短信供应商', configValue: 'SPUG', enabled: 1,
|
||||
remark: '全局切换短信供应商时同步验证码模板和 MessageHub 通道'
|
||||
})
|
||||
const reviewNoticeForm = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'WORKBENCH',
|
||||
configKey: 'MANAGER_REGISTRATION_REVIEW_NOTICE',
|
||||
configName: '店长员工审核提醒',
|
||||
configValue: 'true',
|
||||
enabled: 1,
|
||||
remark: '控制店长登录小程序后是否显式提示当前门店的待审核员工申请'
|
||||
})
|
||||
|
||||
const load = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const [configs, smsConfigs] = await Promise.all([
|
||||
const [configs, smsConfigs, workbenchConfigs] = await Promise.all([
|
||||
adminSystemParameterConfigApi.listConfigs('USER'),
|
||||
adminSystemParameterConfigApi.listConfigs('SMS')
|
||||
adminSystemParameterConfigApi.listConfigs('SMS'),
|
||||
adminSystemParameterConfigApi.listConfigs('WORKBENCH')
|
||||
])
|
||||
const config = configs.find(item => item.configKey === 'DEFAULT_PASSWORD')
|
||||
if (config) {
|
||||
@@ -70,6 +95,11 @@ const load = async () => {
|
||||
}
|
||||
const smsProvider = smsConfigs.find(item => item.configKey === 'SMS_PROVIDER')
|
||||
if (smsProvider) Object.assign(smsProviderForm, smsProvider)
|
||||
const reviewNotice = workbenchConfigs.find(item => item.configKey === 'MANAGER_REGISTRATION_REVIEW_NOTICE')
|
||||
if (reviewNotice) {
|
||||
Object.assign(reviewNoticeForm, reviewNotice)
|
||||
reviewNoticeEnabled.value = reviewNotice.enabled === 1 && String(reviewNotice.configValue).toLowerCase() === 'true'
|
||||
}
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '默认密码加载失败')
|
||||
} finally {
|
||||
@@ -113,6 +143,23 @@ const save = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const saveReviewNotice = async () => {
|
||||
savingReviewNotice.value = true
|
||||
try {
|
||||
await adminSystemParameterConfigApi.saveConfig({
|
||||
...reviewNoticeForm,
|
||||
configValue: 'true',
|
||||
enabled: reviewNoticeEnabled.value ? 1 : 0
|
||||
})
|
||||
message.success(reviewNoticeEnabled.value ? '店长员工审核提醒已开启' : '店长员工审核提醒已关闭')
|
||||
await load()
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '审核提醒设置保存失败')
|
||||
} finally {
|
||||
savingReviewNotice.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
})
|
||||
|
||||
@@ -66,5 +66,32 @@ module.exports = {
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
reviewSummary() {
|
||||
return request({
|
||||
url: '/user/workbench/registration/summary'
|
||||
})
|
||||
},
|
||||
|
||||
reviewApplications() {
|
||||
return request({
|
||||
url: '/user/workbench/registration/list'
|
||||
})
|
||||
},
|
||||
|
||||
approveApplication(id) {
|
||||
return request({
|
||||
url: `/user/workbench/registration/${id}/approve`,
|
||||
method: 'POST'
|
||||
})
|
||||
},
|
||||
|
||||
rejectApplication(id, reason) {
|
||||
return request({
|
||||
url: `/user/workbench/registration/${id}/reject`,
|
||||
method: 'POST',
|
||||
data: { reason }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ function reset(preference) {
|
||||
navigations.length = 0
|
||||
appDefinition.globalData.userInfo = null
|
||||
appDefinition.globalData.wechatLoginState = null
|
||||
appDefinition.globalData.reviewNoticeShown = true
|
||||
appDefinition.globalData.openEmployeeReview = true
|
||||
codeSequence = 0
|
||||
}
|
||||
|
||||
@@ -40,6 +42,8 @@ async function run() {
|
||||
assert.strictEqual(appDefinition.globalData.userInfo.id, 1)
|
||||
assert.strictEqual(statusCalled, false)
|
||||
assert.strictEqual(codeSequence, 1)
|
||||
assert.strictEqual(appDefinition.globalData.reviewNoticeShown, false)
|
||||
assert.strictEqual(appDefinition.globalData.openEmployeeReview, false)
|
||||
|
||||
reset({ rememberMe: false })
|
||||
let quickLoginCalled = false
|
||||
@@ -66,6 +70,7 @@ async function run() {
|
||||
appDefinition.logoutDevice()
|
||||
assert.strictEqual(storage[LOGIN_PREFERENCE_KEY], undefined)
|
||||
assert.strictEqual(appDefinition.globalData.userInfo, null)
|
||||
assert.strictEqual(appDefinition.globalData.reviewNoticeShown, false)
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
|
||||
+13
-3
@@ -9,7 +9,9 @@ App({
|
||||
shopName: BRAND_CONFIG.defaultShopName,
|
||||
userInfo: null,
|
||||
planningNeedRefresh: false,
|
||||
wechatLoginState: null
|
||||
wechatLoginState: null,
|
||||
reviewNoticeShown: false,
|
||||
openEmployeeReview: false
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
@@ -55,7 +57,7 @@ App({
|
||||
})
|
||||
this.publishWechatLoginState(result)
|
||||
if (result.status === 'SUCCESS' && result.accessToken) {
|
||||
this.setSession(result)
|
||||
this.setSession(result, true)
|
||||
wx.reLaunch({ url: '/pages/planning/index' })
|
||||
return
|
||||
}
|
||||
@@ -96,7 +98,11 @@ App({
|
||||
}
|
||||
},
|
||||
|
||||
setSession(session) {
|
||||
setSession(session, newLoginSession = false) {
|
||||
if (newLoginSession) {
|
||||
this.globalData.reviewNoticeShown = false
|
||||
this.globalData.openEmployeeReview = false
|
||||
}
|
||||
auth.setSession(session)
|
||||
this.bootstrapSession()
|
||||
},
|
||||
@@ -105,6 +111,8 @@ App({
|
||||
auth.clearSession()
|
||||
profileCache.invalidate()
|
||||
this.globalData.userInfo = null
|
||||
this.globalData.reviewNoticeShown = false
|
||||
this.globalData.openEmployeeReview = false
|
||||
},
|
||||
|
||||
logoutDevice() {
|
||||
@@ -112,5 +120,7 @@ App({
|
||||
profileCache.invalidate()
|
||||
this.globalData.userInfo = null
|
||||
this.globalData.wechatLoginState = null
|
||||
this.globalData.reviewNoticeShown = false
|
||||
this.globalData.openEmployeeReview = false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
const assert = require('assert')
|
||||
|
||||
const requests = []
|
||||
const storage = {}
|
||||
global.wx = {
|
||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||
getStorageSync: key => storage[key] || '',
|
||||
setStorageSync: (key, value) => { storage[key] = value },
|
||||
removeStorageSync: key => { delete storage[key] },
|
||||
request: options => {
|
||||
requests.push(options)
|
||||
options.success({ statusCode: 200, data: { code: 200, data: {} } })
|
||||
}
|
||||
}
|
||||
global.getApp = () => ({ clearSession: () => {}, goLogin: () => {} })
|
||||
|
||||
const employeesApi = require('./api/employees')
|
||||
|
||||
async function run() {
|
||||
await employeesApi.reviewSummary()
|
||||
await employeesApi.reviewApplications()
|
||||
await employeesApi.approveApplication(12)
|
||||
await employeesApi.rejectApplication(12, '资料不完整')
|
||||
|
||||
assert.deepStrictEqual(requests.map(item => [item.method || 'GET', item.url, item.data]), [
|
||||
['GET', 'http://127.0.0.1:80/api/admin/user/workbench/registration/summary', undefined],
|
||||
['GET', 'http://127.0.0.1:80/api/admin/user/workbench/registration/list', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/admin/user/workbench/registration/12/approve', undefined],
|
||||
['POST', 'http://127.0.0.1:80/api/admin/user/workbench/registration/12/reject', { reason: '资料不完整' }]
|
||||
])
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
console.error(error)
|
||||
process.exitCode = 1
|
||||
})
|
||||
@@ -12,10 +12,28 @@ function buildScheduleSummary(item) {
|
||||
return time ? `${mode} ${time}` : mode
|
||||
}
|
||||
|
||||
function formatApplicationTime(value) {
|
||||
if (!value) return ''
|
||||
return String(value).replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
function confirmModal(options) {
|
||||
return new Promise(resolve => {
|
||||
wx.showModal({ ...options, success: resolve, fail: () => resolve({ confirm: false }) })
|
||||
})
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
employees: [],
|
||||
loadError: '',
|
||||
isManager: false,
|
||||
reviewExpanded: false,
|
||||
reviewApplications: [],
|
||||
reviewPendingCount: 0,
|
||||
reviewLoading: false,
|
||||
reviewError: '',
|
||||
reviewingId: '',
|
||||
createModalVisible: false,
|
||||
creating: false,
|
||||
createForm: {
|
||||
@@ -31,7 +49,96 @@ Page({
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
const userInfo = getApp().globalData.userInfo || {}
|
||||
this.setData({ isManager: Number(userInfo.type) === 2 })
|
||||
this.loadEmployees()
|
||||
if (Number(userInfo.type) === 2) this.loadReviewSummary()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
const app = getApp()
|
||||
if (!this.data.isManager || !app.globalData.openEmployeeReview) return
|
||||
app.globalData.openEmployeeReview = false
|
||||
this.setData({ reviewExpanded: true })
|
||||
return this.loadReviewApplications()
|
||||
},
|
||||
|
||||
async loadReviewSummary() {
|
||||
if (!this.data.isManager) return
|
||||
try {
|
||||
const summary = await employeesApi.reviewSummary()
|
||||
this.setData({ reviewPendingCount: Number(summary.pendingCount || 0) })
|
||||
} catch (error) {
|
||||
// 审核摘要失败不影响员工列表。
|
||||
}
|
||||
},
|
||||
|
||||
toggleReview() {
|
||||
if (!this.data.isManager) return
|
||||
const reviewExpanded = !this.data.reviewExpanded
|
||||
this.setData({ reviewExpanded })
|
||||
if (reviewExpanded) this.loadReviewApplications()
|
||||
},
|
||||
|
||||
async loadReviewApplications() {
|
||||
if (!this.data.isManager || this.data.reviewLoading) return
|
||||
this.setData({ reviewLoading: true, reviewError: '' })
|
||||
try {
|
||||
const data = await employeesApi.reviewApplications()
|
||||
const applications = (Array.isArray(data) ? data : []).map(item => ({
|
||||
...item,
|
||||
applicantNickname: item.applicantNickname || '待审核员工',
|
||||
applicantAvatar: item.applicantAvatar || '',
|
||||
applicantMaskedPhone: item.applicantMaskedPhone || '',
|
||||
applicationTimeText: formatApplicationTime(item.createTime)
|
||||
}))
|
||||
this.setData({ reviewApplications: applications, reviewPendingCount: applications.length })
|
||||
} catch (error) {
|
||||
this.setData({ reviewError: error.message || '审核申请加载失败' })
|
||||
} finally {
|
||||
this.setData({ reviewLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
async approveApplication(event) {
|
||||
const id = event.currentTarget.dataset.id
|
||||
if (!id || this.data.reviewingId) return
|
||||
const result = await confirmModal({ title: '通过员工申请', content: '确认允许该员工加入当前门店吗?' })
|
||||
if (!result.confirm) return
|
||||
await this.submitReview(id, () => employeesApi.approveApplication(id), '申请已通过')
|
||||
},
|
||||
|
||||
async rejectApplication(event) {
|
||||
const id = event.currentTarget.dataset.id
|
||||
if (!id || this.data.reviewingId) return
|
||||
const result = await confirmModal({
|
||||
title: '驳回员工申请',
|
||||
content: '',
|
||||
editable: true,
|
||||
placeholderText: '请输入驳回原因',
|
||||
confirmText: '确认驳回'
|
||||
})
|
||||
if (!result.confirm) return
|
||||
const reason = String(result.content || '').trim()
|
||||
if (!reason) {
|
||||
wx.showToast({ title: '请输入驳回原因', icon: 'none' })
|
||||
return
|
||||
}
|
||||
await this.submitReview(id, () => employeesApi.rejectApplication(id, reason), '申请已驳回')
|
||||
},
|
||||
|
||||
async submitReview(id, action, successMessage) {
|
||||
this.setData({ reviewingId: String(id) })
|
||||
try {
|
||||
await action()
|
||||
wx.showToast({ title: successMessage, icon: 'success' })
|
||||
await Promise.all([this.loadReviewApplications(), this.loadEmployees()])
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '申请状态已变化,请刷新重试', icon: 'none' })
|
||||
await this.loadReviewApplications()
|
||||
} finally {
|
||||
this.setData({ reviewingId: '' })
|
||||
}
|
||||
},
|
||||
|
||||
async loadEmployees() {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
const assert = require('assert')
|
||||
|
||||
global.wx = {
|
||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||
getStorageSync: () => '',
|
||||
setStorageSync: () => {},
|
||||
removeStorageSync: () => {}
|
||||
}
|
||||
|
||||
const appMock = {
|
||||
globalData: {
|
||||
userInfo: { type: 2 },
|
||||
openEmployeeReview: true
|
||||
}
|
||||
}
|
||||
global.getApp = () => appMock
|
||||
|
||||
let definition
|
||||
global.Page = value => { definition = value }
|
||||
require('./index')
|
||||
|
||||
function createPage() {
|
||||
return {
|
||||
...definition,
|
||||
data: { ...definition.data, isManager: true },
|
||||
setData(values) { Object.assign(this.data, values) }
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const employeesApi = require('../../api/employees')
|
||||
employeesApi.reviewApplications = async () => [{
|
||||
id: 12,
|
||||
applicationNo: 'SALON-001',
|
||||
applicantNickname: '小周',
|
||||
createTime: '2026-10-12T10:30:00'
|
||||
}]
|
||||
|
||||
const page = createPage()
|
||||
await page.onShow()
|
||||
|
||||
assert.strictEqual(appMock.globalData.openEmployeeReview, false)
|
||||
assert.strictEqual(page.data.reviewExpanded, true)
|
||||
assert.strictEqual(page.data.reviewPendingCount, 1)
|
||||
assert.strictEqual(page.data.reviewApplications[0].applicationTimeText, '2026-10-12 10:30')
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
console.error(error)
|
||||
process.exitCode = 1
|
||||
})
|
||||
@@ -1,9 +1,40 @@
|
||||
<view class="page">
|
||||
<view class="list-heading">
|
||||
<text>美甲师</text>
|
||||
<button wx:if="{{isManager}}" class="compact-btn review-toggle {{reviewExpanded ? 'is-open' : ''}}" bindtap="toggleReview">
|
||||
审核<text wx:if="{{reviewPendingCount > 0}}" class="review-badge">{{reviewPendingCount}}</text>
|
||||
</button>
|
||||
<button class="compact-btn" bindtap="addEmployee">新增</button>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{isManager && reviewExpanded}}" class="review-panel card">
|
||||
<view class="review-panel-head">
|
||||
<view><text class="review-title">员工申请审核</text><text class="review-subtitle">仅显示当前门店待处理申请</text></view>
|
||||
<text class="review-count">{{reviewPendingCount}} 项</text>
|
||||
</view>
|
||||
<view wx:if="{{reviewLoading}}" class="review-state">正在加载申请…</view>
|
||||
<view wx:elif="{{reviewError}}" class="review-state review-error">
|
||||
<text>{{reviewError}}</text>
|
||||
<button class="secondary-btn review-retry" bindtap="loadReviewApplications">重试</button>
|
||||
</view>
|
||||
<view wx:elif="{{reviewApplications.length === 0}}" class="review-state">暂无待审核员工申请</view>
|
||||
<view wx:else class="review-list">
|
||||
<view wx:for="{{reviewApplications}}" wx:key="id" class="review-item">
|
||||
<image class="review-avatar" src="{{item.applicantAvatar || '/assets/images/default-user-avatar.png'}}" mode="aspectFill"></image>
|
||||
<view class="review-info">
|
||||
<text class="review-name">{{item.applicantNickname}}</text>
|
||||
<text wx:if="{{item.applicantMaskedPhone}}" class="review-meta">{{item.applicantMaskedPhone}}</text>
|
||||
<text class="review-meta">{{item.shopName || '当前门店'}} · {{item.applicationTimeText}}</text>
|
||||
<text class="review-number">申请编号 {{item.applicationNo}}</text>
|
||||
</view>
|
||||
<view class="review-actions">
|
||||
<button class="review-action reject" data-id="{{item.id}}" disabled="{{reviewingId}}" bindtap="rejectApplication">驳回</button>
|
||||
<button class="review-action approve" data-id="{{item.id}}" loading="{{reviewingId == item.id}}" disabled="{{reviewingId}}" bindtap="approveApplication">通过</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view wx:if="{{loadError}}" class="empty card">
|
||||
<text>{{loadError}}</text>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.list-heading text {
|
||||
.list-heading > text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,173 @@
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.list-heading .review-toggle {
|
||||
position: relative;
|
||||
margin-right: 12rpx;
|
||||
margin-left: 0;
|
||||
border-color: #c9d8d2;
|
||||
background: #eef5f2;
|
||||
color: #2f6f62;
|
||||
}
|
||||
|
||||
.list-heading .review-toggle.is-open {
|
||||
background: #2f6f62;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.review-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 30rpx;
|
||||
height: 30rpx;
|
||||
margin-left: 8rpx;
|
||||
padding: 0 7rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #d9685f;
|
||||
color: #fff;
|
||||
font-size: 19rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.review-panel {
|
||||
margin-bottom: 22rpx;
|
||||
padding: 22rpx;
|
||||
border: 1rpx solid #dce8e3;
|
||||
background: #f8fcfa;
|
||||
}
|
||||
|
||||
.review-panel-head,
|
||||
.review-item,
|
||||
.review-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.review-panel-head {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.review-title,
|
||||
.review-subtitle,
|
||||
.review-name,
|
||||
.review-meta,
|
||||
.review-number {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.review-title {
|
||||
color: #25211d;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.review-subtitle {
|
||||
margin-top: 4rpx;
|
||||
color: #8b847c;
|
||||
font-size: 21rpx;
|
||||
}
|
||||
|
||||
.review-count {
|
||||
color: #2f6f62;
|
||||
font-size: 23rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.review-list {
|
||||
display: grid;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.review-item {
|
||||
gap: 14rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 5rpx 18rpx rgba(47, 111, 98, 0.07);
|
||||
}
|
||||
|
||||
.review-avatar {
|
||||
flex: 0 0 auto;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 50%;
|
||||
background: #eee9e1;
|
||||
}
|
||||
|
||||
.review-info {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.review-name {
|
||||
color: #28231f;
|
||||
font-size: 27rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.review-meta,
|
||||
.review-number {
|
||||
margin-top: 4rpx;
|
||||
overflow: hidden;
|
||||
color: #817a72;
|
||||
font-size: 20rpx;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.review-number {
|
||||
color: #aaa198;
|
||||
font-size: 18rpx;
|
||||
}
|
||||
|
||||
.review-actions {
|
||||
flex: 0 0 auto;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.review-action {
|
||||
width: auto;
|
||||
min-width: 82rpx;
|
||||
height: 54rpx;
|
||||
margin: 0;
|
||||
padding: 0 15rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 21rpx;
|
||||
font-weight: 800;
|
||||
line-height: 54rpx;
|
||||
}
|
||||
|
||||
.review-action.reject {
|
||||
border: 1rpx solid #e7c7c2;
|
||||
background: #fff5f3;
|
||||
color: #a8554e;
|
||||
}
|
||||
|
||||
.review-action.approve {
|
||||
border: 1rpx solid #2f6f62;
|
||||
background: #2f6f62;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.review-state {
|
||||
padding: 34rpx 12rpx;
|
||||
color: #8c857d;
|
||||
font-size: 23rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.review-state.review-error {
|
||||
color: #a8554e;
|
||||
}
|
||||
|
||||
.review-retry {
|
||||
width: 150rpx;
|
||||
min-width: 150rpx;
|
||||
margin: 16rpx auto 0;
|
||||
}
|
||||
|
||||
.employee-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -183,7 +183,7 @@ Page({
|
||||
},
|
||||
|
||||
finishLogin(result) {
|
||||
getApp().setSession(result)
|
||||
getApp().setSession(result, true)
|
||||
auth.setLoginPreference(this.data.rememberMe ? {
|
||||
rememberMe: true,
|
||||
preferredShopId: result.userInfo && result.userInfo.shopId,
|
||||
|
||||
@@ -5,6 +5,7 @@ const auth = require('../../utils/auth')
|
||||
const { uploadProfileImage } = require('../../utils/upload')
|
||||
const { normalizeAvatar } = require('../../utils/profile-card')
|
||||
const profileCache = require('../../utils/profile-cache')
|
||||
const employeesApi = require('../../api/employees')
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
@@ -110,6 +111,7 @@ Page({
|
||||
},
|
||||
|
||||
async refreshAccountPrompts() {
|
||||
let shouldShowProfilePrompt = false
|
||||
try {
|
||||
const profile = await profileCache.getProfile()
|
||||
const session = auth.getSession()
|
||||
@@ -119,14 +121,47 @@ Page({
|
||||
const missingNickname = !String(profile.nickname || '').trim() || String(profile.nickname).startsWith('微信用户')
|
||||
const avatar = normalizeAvatar(profile.avatar)
|
||||
const skipped = wx.getStorageSync(auth.PROFILE_PROMPT_SKIPPED_KEY) === '1'
|
||||
shouldShowProfilePrompt = !skipped && (missingNickname || !avatar)
|
||||
this.setData({
|
||||
phoneBannerVisible: Number(profile.phoneVerified) !== 1 && dismissed !== today,
|
||||
profilePromptVisible: !skipped && (missingNickname || !avatar),
|
||||
profilePromptVisible: false,
|
||||
profileForm: { nickname: missingNickname ? '' : profile.nickname, avatar }
|
||||
})
|
||||
} catch (error) {
|
||||
// 资料提醒失败不影响规划数据。
|
||||
}
|
||||
const navigatedToReview = await this.showEmployeeReviewNotice()
|
||||
if (!navigatedToReview) {
|
||||
this.setData({ profilePromptVisible: shouldShowProfilePrompt })
|
||||
}
|
||||
},
|
||||
|
||||
async showEmployeeReviewNotice() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
if (Number(userInfo.type) !== 2 || app.globalData.reviewNoticeShown) return false
|
||||
let summary
|
||||
try {
|
||||
summary = await employeesApi.reviewSummary()
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
if (!summary.noticeEnabled || Number(summary.pendingCount || 0) <= 0) return false
|
||||
app.globalData.reviewNoticeShown = true
|
||||
const result = await new Promise(resolve => {
|
||||
wx.showModal({
|
||||
title: '有员工申请待审核',
|
||||
content: `当前有 ${summary.pendingCount} 条员工加入申请,是否立即处理?`,
|
||||
cancelText: '稍后处理',
|
||||
confirmText: '立即审核',
|
||||
success: resolve,
|
||||
fail: () => resolve({ confirm: false })
|
||||
})
|
||||
})
|
||||
if (!result.confirm) return false
|
||||
app.globalData.openEmployeeReview = true
|
||||
wx.switchTab({ url: '/pages/employees/index' })
|
||||
return true
|
||||
},
|
||||
|
||||
openAccountSettings() { wx.navigateTo({ url: '/pages/account-settings/index' }) },
|
||||
|
||||
@@ -7,9 +7,12 @@ global.wx = {
|
||||
getStorageSync: () => '',
|
||||
setStorageSync: () => {},
|
||||
removeStorageSync: () => {},
|
||||
showToast: () => {}
|
||||
showToast: () => {},
|
||||
showModal: ({ success }) => success({ confirm: false }),
|
||||
switchTab: () => {}
|
||||
}
|
||||
global.getApp = () => ({ globalData: { userInfo: {} } })
|
||||
const appMock = { globalData: { userInfo: {} } }
|
||||
global.getApp = () => appMock
|
||||
|
||||
let definition
|
||||
global.Page = value => { definition = value }
|
||||
@@ -69,6 +72,19 @@ async function run() {
|
||||
assert.strictEqual(calendarRequests, 1)
|
||||
resolveCalendar({ artists: [], appointments: [], daySummaries: [] })
|
||||
await Promise.all([requestOne, requestTwo])
|
||||
|
||||
const employeesApi = require('../../api/employees')
|
||||
const noticePage = createPage()
|
||||
appMock.globalData.userInfo = { type: 2 }
|
||||
appMock.globalData.reviewNoticeShown = false
|
||||
employeesApi.reviewSummary = async () => ({ pendingCount: 2, noticeEnabled: true })
|
||||
let switched = false
|
||||
global.wx.showModal = ({ success }) => success({ confirm: true })
|
||||
global.wx.switchTab = ({ url }) => { switched = url === '/pages/employees/index' }
|
||||
assert.strictEqual(await noticePage.showEmployeeReviewNotice(), true)
|
||||
assert.strictEqual(switched, true)
|
||||
assert.strictEqual(appMock.globalData.reviewNoticeShown, true)
|
||||
assert.strictEqual(appMock.globalData.openEmployeeReview, true)
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
USE jayucloud_salon;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
INSERT INTO t_system_parameter_config (
|
||||
id,
|
||||
config_group,
|
||||
config_key,
|
||||
config_name,
|
||||
config_value,
|
||||
enabled,
|
||||
remark,
|
||||
create_time,
|
||||
update_time,
|
||||
is_delete
|
||||
)
|
||||
VALUES (
|
||||
313931273555139020,
|
||||
'WORKBENCH',
|
||||
'MANAGER_REGISTRATION_REVIEW_NOTICE',
|
||||
'店长员工审核提醒',
|
||||
'true',
|
||||
1,
|
||||
'控制店长登录小程序后是否显式提示当前门店的待审核员工申请',
|
||||
NOW(),
|
||||
NOW(),
|
||||
0
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
config_name = VALUES(config_name),
|
||||
remark = VALUES(remark),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,35 @@
|
||||
# 店长员工审核与登录提醒设计
|
||||
|
||||
## 目标
|
||||
|
||||
店长可在小程序员工页直接处理当前门店的员工注册申请。存在待审核申请时,系统根据后台动态参数,在每次成功登录会话中最多提醒一次,并提供直达审核区域的入口。
|
||||
|
||||
## 交互与数据流
|
||||
|
||||
1. 店长进入员工页时获取待审核摘要,并在“审核”按钮显示数量角标。
|
||||
2. 点击“审核”后在当前页面展开申请列表;通过操作需要确认,驳回操作必须填写原因。
|
||||
3. 登录进入规划页后获取审核摘要。开关开启且数量大于零时优先显示审核提醒。
|
||||
4. 点击“立即审核”切换到员工 Tab 并自动展开申请列表;点击“稍后处理”后本会话不再提醒,再继续处理资料完善弹窗。
|
||||
5. 摘要、列表或提醒请求失败不阻断员工列表、登录及规划页数据。
|
||||
|
||||
## 权限与一致性
|
||||
|
||||
- 只有 `type=2` 的店长可以读取本门店 `PENDING_MANAGER` 申请和执行审核。
|
||||
- 平台管理员继续通过原后台入口处理 `PENDING_ADMIN` 店长申请。
|
||||
- 审核事务使用数据库行锁串行处理同一申请,避免重复通过、驳回或权限同步。
|
||||
- 列表接口返回展示 VO,补充申请人的昵称、头像和脱敏手机号,不暴露 OpenID。
|
||||
|
||||
## 动态参数
|
||||
|
||||
参数 `WORKBENCH / MANAGER_REGISTRATION_REVIEW_NOTICE` 存储于 `t_system_parameter_config`。`config_value=true` 且 `enabled=1` 时显示登录提醒;停用只隐藏提醒,不关闭审核功能。
|
||||
|
||||
## 验收重点
|
||||
|
||||
- 店长仅能查看和审核本门店员工申请。
|
||||
- 通过后员工账号及门店关系启用,列表和角标同步减少;驳回原因不能为空。
|
||||
- 自动登录、手动登录和多门店确认登录均建立新的提醒会话。
|
||||
- 审核提醒与资料完善弹窗不重叠,审核提醒优先。
|
||||
|
||||
## 实施验证记录
|
||||
|
||||
当前 Codex 会话未提供 GitNexus `impact` 与 `detect_changes` 工具,因此无法执行图谱级影响分析和提交前变更检测。实施中改用静态调用链检索、Git 差异范围检查、Core 编译与单元测试、小程序测试、后台单元测试与生产构建进行替代验证。
|
||||
@@ -0,0 +1,18 @@
|
||||
# 店长员工审核提醒参数说明
|
||||
|
||||
## 参数
|
||||
|
||||
- 分组:`WORKBENCH`
|
||||
- 键:`MANAGER_REGISTRATION_REVIEW_NOTICE`
|
||||
- 值:`true`
|
||||
- 启用状态:`enabled=1` 时显示登录提醒,`enabled=0` 时隐藏登录提醒。
|
||||
|
||||
该参数存储在 `t_system_parameter_config`,由后台“系统设置”页面动态管理。它只控制店长成功登录小程序后的待审核弹窗,不影响员工页面的审核入口、待审核数量及审核能力。
|
||||
|
||||
## 发布步骤
|
||||
|
||||
1. 发布后端、后台和小程序代码。
|
||||
2. 在目标 Salon 数据库执行 `docs/scripts/sql/versions/店长员工审核提醒参数_20261012.sql`。
|
||||
3. 使用平台管理员进入后台“系统设置”,确认“店长员工审核提醒”状态。
|
||||
|
||||
脚本可重复执行,重复执行不会覆盖管理员已经选择的启用或停用状态。本次仓库变更不会连接或修改任何实际数据库及 Nacos 环境。
|
||||
Reference in New Issue
Block a user