Dev #49

Merged
xiaowang merged 10 commits from dev into sit 2026-09-07 20:29:17 +08:00
39 changed files with 1066 additions and 150 deletions
@@ -45,6 +45,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
"/user/send-verification-code",
"/user/phone-login",
"/user/wechat-mini/**",
"/user/workbench/register/**",
"/user/workbench/shops/available",
"/user/reset-password-by-phone",
"/legal-agreement/current",
"/legal-agreement/current/**",
@@ -0,0 +1,84 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xiaowang.jacyucloudsalon.core.common.Result;
import com.xiaowang.jacyucloudsalon.core.modules.registration.dto.WorkbenchRegistrationRejectDTO;
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.service.WorkbenchRegistrationService;
import com.xiaowang.jacyucloudsalon.core.modules.registration.vo.WorkbenchRegistrationStatusVO;
import com.xiaowang.jacyucloudsalon.core.modules.shop.entity.ShopDO;
import com.xiaowang.jacyucloudsalon.core.modules.shop.mapper.ShopMapper;
import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO;
import com.xiaowang.jacyucloudsalon.core.modules.user.mapper.UserMapper;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@RequestMapping("/user/workbench")
public class WorkbenchRegistrationController {
private final WorkbenchRegistrationService registrationService;
private final UserMapper userMapper;
private final ShopMapper shopMapper;
public WorkbenchRegistrationController(WorkbenchRegistrationService registrationService, UserMapper userMapper, ShopMapper shopMapper) {
this.registrationService = registrationService;
this.userMapper = userMapper;
this.shopMapper = shopMapper;
}
@PostMapping("/register/phone")
public Result<WorkbenchRegistrationStatusVO> registerByPhone(@RequestBody WorkbenchRegistrationRequestDTO request) {
return Result.success(registrationService.register(request));
}
@PostMapping("/register/resubmit")
public Result<WorkbenchRegistrationStatusVO> resubmit(@RequestBody WorkbenchRegistrationRequestDTO request) {
return Result.success(registrationService.resubmit(request));
}
@GetMapping("/register/status")
public Result<WorkbenchRegistrationStatusVO> status(@RequestParam String phone) {
UserDO user = userMapper.selectOne(Wrappers.lambdaQuery(UserDO.class).eq(UserDO::getPhone, phone).eq(UserDO::getIsDelete, 0).last("limit 1"));
if (user == null) {
throw new IllegalArgumentException("未找到注册申请");
}
return Result.success(registrationService.getStatus(user.getId()));
}
@GetMapping("/shops/available")
public Result<List<ShopDO>> availableShops() {
return Result.success(shopMapper.selectList(Wrappers.lambdaQuery(ShopDO.class).eq(ShopDO::getStatus, 1).eq(ShopDO::getIsDelete, 0).select(ShopDO::getId, ShopDO::getShopName, ShopDO::getAddress).orderByAsc(ShopDO::getShopName)));
}
@GetMapping("/registration/list")
public Result<List<WorkbenchRegistrationApplicationDO>> list(HttpServletRequest request) {
Long userId = requireUserId(request);
UserDO user = userMapper.selectById(userId);
return Result.success(registrationService.listForReviewer(userId, user != null && Integer.valueOf(4).equals(user.getType())));
}
@PostMapping("/registration/{id}/approve")
public Result<Boolean> approve(HttpServletRequest request, @PathVariable Long id) {
Long userId = requireUserId(request);
UserDO user = userMapper.selectById(userId);
return Result.success(registrationService.approve(userId, user != null && Integer.valueOf(4).equals(user.getType()), id));
}
@PostMapping("/registration/{id}/reject")
public Result<Boolean> reject(HttpServletRequest request, @PathVariable Long id, @RequestBody WorkbenchRegistrationRejectDTO requestDTO) {
Long userId = requireUserId(request);
UserDO user = userMapper.selectById(userId);
return Result.success(registrationService.reject(userId, user != null && Integer.valueOf(4).equals(user.getType()), id, requestDTO == null ? null : requestDTO.getReason()));
}
private Long requireUserId(HttpServletRequest request) {
Object userId = request.getAttribute("userId");
if (!(userId instanceof Long)) {
throw new IllegalArgumentException("登录状态已失效");
}
return (Long) userId;
}
}
@@ -0,0 +1,10 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class WorkbenchRegistrationRejectDTO {
private String reason;
}
@@ -0,0 +1,20 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class WorkbenchRegistrationRequestDTO {
private Long applicationId;
private String wxCode;
private String phone;
private String verificationCode;
private String password;
private String confirmPassword;
private String roleType;
private Long shopId;
private String shopName;
private String shopAddress;
private Boolean agreementAccepted;
}
@@ -0,0 +1,48 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xiaowang.jacyucloudsalon.core.common.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("t_workbench_registration_application")
public class WorkbenchRegistrationApplicationDO extends BaseEntity {
@TableField("application_no")
private String applicationNo;
@TableField("user_id")
private Long userId;
@TableField("role_type")
private String roleType;
@TableField("shop_id")
private Long shopId;
@TableField("shop_name")
private String shopName;
@TableField("shop_address")
private String shopAddress;
@TableField("status")
private String status;
@TableField("reviewer_id")
private Long reviewerId;
@TableField("reviewed_at")
private LocalDateTime reviewedAt;
@TableField("reject_reason")
private String rejectReason;
@TableField("is_delete")
private Integer isDelete;
}
@@ -0,0 +1,9 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.entity;
public final class WorkbenchRegistrationRole {
public static final String MANAGER = "MANAGER";
public static final String STAFF = "STAFF";
private WorkbenchRegistrationRole() {
}
}
@@ -0,0 +1,11 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.entity;
public final class WorkbenchRegistrationStatus {
public static final String PENDING_ADMIN = "PENDING_ADMIN";
public static final String PENDING_MANAGER = "PENDING_MANAGER";
public static final String APPROVED = "APPROVED";
public static final String REJECTED = "REJECTED";
private WorkbenchRegistrationStatus() {
}
}
@@ -0,0 +1,7 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRegistrationApplicationDO;
public interface WorkbenchRegistrationApplicationMapper extends BaseMapper<WorkbenchRegistrationApplicationDO> {
}
@@ -0,0 +1,16 @@
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.WorkbenchRegistrationStatusVO;
import java.util.List;
public interface WorkbenchRegistrationService {
WorkbenchRegistrationStatusVO register(WorkbenchRegistrationRequestDTO request);
WorkbenchRegistrationStatusVO getStatus(Long userId);
WorkbenchRegistrationStatusVO resubmit(WorkbenchRegistrationRequestDTO request);
List<WorkbenchRegistrationApplicationDO> listForReviewer(Long reviewerId, boolean platformAdmin);
boolean approve(Long reviewerId, boolean platformAdmin, Long applicationId);
boolean reject(Long reviewerId, boolean platformAdmin, Long applicationId, String reason);
}
@@ -0,0 +1,244 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xiaowang.jacyucloudsalon.core.modules.auth.service.VerificationCodeService;
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.entity.WorkbenchRegistrationRole;
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.WorkbenchRegistrationStatusVO;
import com.xiaowang.jacyucloudsalon.core.modules.integration.entity.WechatMiniBindingDO;
import com.xiaowang.jacyucloudsalon.core.modules.integration.mapper.WechatMiniBindingMapper;
import com.xiaowang.jacyucloudsalon.core.modules.integration.service.WechatMiniClientService;
import com.xiaowang.jacyucloudsalon.core.modules.shop.entity.ShopDO;
import com.xiaowang.jacyucloudsalon.core.modules.shop.mapper.ShopMapper;
import com.xiaowang.jacyucloudsalon.core.modules.shop.support.UserShopBindingSupport;
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 org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
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.UUID;
@Service
public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationService {
private static final String REGISTER_SCENE = "PLANNING_MANAGER_REGISTER";
private final WorkbenchRegistrationApplicationMapper applicationMapper;
private final UserMapper userMapper;
private final ShopMapper shopMapper;
private final UserService userService;
private final VerificationCodeService verificationCodeService;
private final UserShopBindingSupport userShopBindingSupport;
private final WechatMiniBindingMapper wechatMiniBindingMapper;
private final WechatMiniClientService wechatMiniClientService;
private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
public WorkbenchRegistrationServiceImpl(
WorkbenchRegistrationApplicationMapper applicationMapper,
UserMapper userMapper,
ShopMapper shopMapper,
UserService userService,
VerificationCodeService verificationCodeService,
UserShopBindingSupport userShopBindingSupport,
WechatMiniBindingMapper wechatMiniBindingMapper,
WechatMiniClientService wechatMiniClientService
) {
this.applicationMapper = applicationMapper;
this.userMapper = userMapper;
this.shopMapper = shopMapper;
this.userService = userService;
this.verificationCodeService = verificationCodeService;
this.userShopBindingSupport = userShopBindingSupport;
this.wechatMiniBindingMapper = wechatMiniBindingMapper;
this.wechatMiniClientService = wechatMiniClientService;
}
@Override
@Transactional(rollbackFor = Exception.class)
public WorkbenchRegistrationStatusVO register(WorkbenchRegistrationRequestDTO request) {
require(request != null, "注册信息不能为空");
String phone = requireText(request.getPhone(), "手机号不能为空");
String roleType = requireText(request.getRoleType(), "请选择注册身份").toUpperCase();
require(WorkbenchRegistrationRole.MANAGER.equals(roleType) || WorkbenchRegistrationRole.STAFF.equals(roleType), "注册身份不合法");
require(verificationCodeService.verifyCode(phone, request.getVerificationCode()), "验证码错误或已过期");
require(request.getAgreementAccepted() == null || request.getAgreementAccepted(), "请先同意用户协议和隐私政策");
UserDO existing = userMapper.selectOne(Wrappers.lambdaQuery(UserDO.class).eq(UserDO::getPhone, phone).eq(UserDO::getIsDelete, 0).last("limit 1"));
require(existing == null, "该手机号已注册,请直接登录或查看审核状态");
require(StringUtils.hasText(request.getPassword()), "密码不能为空");
require(request.getPassword().equals(request.getConfirmPassword()), "两次密码不一致");
ShopDO shop = null;
if (WorkbenchRegistrationRole.MANAGER.equals(roleType)) {
String shopName = requireText(request.getShopName(), "店铺名称不能为空");
shop = new ShopDO();
shop.setShopName(shopName);
shop.setAddress(request.getShopAddress());
shop.setDescription("Salon店务工作台注册申请");
shop.setBusinessHours("10:00-22:00");
shop.setStatus(0);
shop.setIsDelete(0);
shopMapper.insert(shop);
} else {
require(request.getShopId() != null, "请选择要加入的店铺");
shop = shopMapper.selectOne(Wrappers.lambdaQuery(ShopDO.class).eq(ShopDO::getId, request.getShopId()).eq(ShopDO::getStatus, 1).eq(ShopDO::getIsDelete, 0));
require(shop != null, "店铺不存在或暂未营业");
}
UserDO user = new UserDO();
user.setShopId(shop.getId());
user.setNickname((WorkbenchRegistrationRole.MANAGER.equals(roleType) ? shop.getShopName() + "店长" : "Salon店员"));
user.setAccount(phone);
user.setPassword(passwordEncoder.encode(request.getPassword()));
user.setPhone(phone);
user.setContactPhone(phone);
user.setPhoneVerified(1);
user.setType(WorkbenchRegistrationRole.MANAGER.equals(roleType) ? 2 : 3);
user.setStatus(0);
user.setIsDelete(0);
userMapper.insert(user);
bindWechatUser(request.getWxCode(), user.getId());
userShopBindingSupport.syncUserShopBindings(user.getId(), List.of(shop.getId()));
userShopBindingSupport.updateBindingStatus(user.getId(), shop.getId(), 0);
WorkbenchRegistrationApplicationDO application = new WorkbenchRegistrationApplicationDO();
application.setApplicationNo("SALON-" + UUID.randomUUID().toString().replace("-", "").substring(0, 20).toUpperCase());
application.setUserId(user.getId());
application.setRoleType(roleType);
application.setShopId(shop.getId());
application.setShopName(shop.getShopName());
application.setShopAddress(shop.getAddress());
application.setStatus(WorkbenchRegistrationRole.MANAGER.equals(roleType) ? WorkbenchRegistrationStatus.PENDING_ADMIN : WorkbenchRegistrationStatus.PENDING_MANAGER);
application.setIsDelete(0);
applicationMapper.insert(application);
return toStatus(application);
}
@Override
public WorkbenchRegistrationStatusVO getStatus(Long userId) {
WorkbenchRegistrationApplicationDO application = findLatest(userId);
require(application != null, "未找到注册申请");
return toStatus(application);
}
@Override
@Transactional(rollbackFor = Exception.class)
public WorkbenchRegistrationStatusVO resubmit(WorkbenchRegistrationRequestDTO request) {
require(request != null && request.getApplicationId() != null, "申请信息不能为空");
WorkbenchRegistrationApplicationDO application = applicationMapper.selectById(request.getApplicationId());
require(application != null && WorkbenchRegistrationStatus.REJECTED.equals(application.getStatus()), "该申请当前不可重新提交");
require(verificationCodeService.verifyCode(requireText(request.getPhone(), "手机号不能为空"), request.getVerificationCode()), "验证码错误或已过期");
application.setStatus(WorkbenchRegistrationRole.MANAGER.equals(application.getRoleType()) ? WorkbenchRegistrationStatus.PENDING_ADMIN : WorkbenchRegistrationStatus.PENDING_MANAGER);
application.setRejectReason(null);
application.setReviewerId(null);
application.setReviewedAt(null);
applicationMapper.updateById(application);
return toStatus(application);
}
@Override
public List<WorkbenchRegistrationApplicationDO> listForReviewer(Long reviewerId, boolean platformAdmin) {
if (platformAdmin) {
return applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_ADMIN).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));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean approve(Long reviewerId, boolean platformAdmin, Long applicationId) {
WorkbenchRegistrationApplicationDO application = loadReviewable(reviewerId, platformAdmin, applicationId);
UserDO user = userMapper.selectById(application.getUserId());
require(user != null, "申请用户不存在");
if (WorkbenchRegistrationRole.MANAGER.equals(application.getRoleType())) {
require(platformAdmin && WorkbenchRegistrationStatus.PENDING_ADMIN.equals(application.getStatus()), "无权审核该申请");
ShopDO shop = shopMapper.selectById(application.getShopId());
require(shop != null, "申请店铺不存在");
shop.setStatus(1);
shopMapper.updateById(shop);
}
user.setStatus(1);
userMapper.updateById(user);
userShopBindingSupport.updateBindingStatus(user.getId(), application.getShopId(), 1);
userService.syncManagedPermissions(user.getId());
application.setStatus(WorkbenchRegistrationStatus.APPROVED);
application.setReviewerId(reviewerId);
application.setReviewedAt(LocalDateTime.now());
applicationMapper.updateById(application);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean reject(Long reviewerId, boolean platformAdmin, Long applicationId, String reason) {
WorkbenchRegistrationApplicationDO application = loadReviewable(reviewerId, platformAdmin, applicationId);
application.setStatus(WorkbenchRegistrationStatus.REJECTED);
application.setReviewerId(reviewerId);
application.setReviewedAt(LocalDateTime.now());
application.setRejectReason(requireText(reason, "驳回原因不能为空"));
applicationMapper.updateById(application);
return true;
}
private WorkbenchRegistrationApplicationDO loadReviewable(Long reviewerId, boolean platformAdmin, Long applicationId) {
WorkbenchRegistrationApplicationDO application = applicationMapper.selectById(applicationId);
require(application != null && WorkbenchRegistrationStatus.REJECTED.equals(application.getStatus()) == false, "审核申请不存在或已处理");
if (platformAdmin) {
require(WorkbenchRegistrationStatus.PENDING_ADMIN.equals(application.getStatus()), "管理员只能审核店长申请");
} else {
UserDO reviewer = userMapper.selectById(reviewerId);
require(reviewer != null && Integer.valueOf(2).equals(reviewer.getType()) && reviewer.getShopId().equals(application.getShopId()), "无权审核该店铺申请");
require(WorkbenchRegistrationStatus.PENDING_MANAGER.equals(application.getStatus()), "店长只能审核店员申请");
}
return application;
}
private WorkbenchRegistrationApplicationDO findLatest(Long userId) {
return applicationMapper.selectOne(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getUserId, userId).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByDesc(WorkbenchRegistrationApplicationDO::getCreateTime).last("limit 1"));
}
private WorkbenchRegistrationStatusVO toStatus(WorkbenchRegistrationApplicationDO application) {
return new WorkbenchRegistrationStatusVO(application.getId(), application.getApplicationNo(), application.getRoleType(), application.getStatus(), application.getRejectReason(), application.getShopId(), application.getShopName());
}
private String requireText(String value, String message) {
require(StringUtils.hasText(value), message);
return value.trim();
}
private void bindWechatUser(String wxCode, Long userId) {
if (!StringUtils.hasText(wxCode)) {
return;
}
WechatMiniClientService.SessionInfo sessionInfo = wechatMiniClientService.code2Session(wxCode);
String appId = wechatMiniClientService.getConfiguredAppId();
WechatMiniBindingDO binding = wechatMiniBindingMapper.selectOne(Wrappers.lambdaQuery(WechatMiniBindingDO.class).eq(WechatMiniBindingDO::getAppId, appId).eq(WechatMiniBindingDO::getOpenId, sessionInfo.openId()).last("limit 1"));
if (binding == null) {
binding = new WechatMiniBindingDO();
binding.setAppId(appId);
binding.setOpenId(sessionInfo.openId());
}
binding.setUserId(userId);
binding.setUnionId(sessionInfo.unionId());
binding.setStatus(1);
if (binding.getId() == null) {
wechatMiniBindingMapper.insert(binding);
} else {
wechatMiniBindingMapper.updateById(binding);
}
}
private void require(boolean condition, String message) {
if (!condition) {
throw new IllegalArgumentException(message);
}
}
}
@@ -0,0 +1,16 @@
package com.xiaowang.jacyucloudsalon.core.modules.registration.vo;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class WorkbenchRegistrationStatusVO {
private Long applicationId;
private String applicationNo;
private String roleType;
private String status;
private String rejectReason;
private Long shopId;
private String shopName;
}
+25
View File
@@ -1972,5 +1972,30 @@ export const adminSystemParameterConfigApi = {
}
}
export interface WorkbenchRegistrationApplication {
id: IdType
applicationNo: string
userId: IdType
roleType: 'MANAGER' | 'STAFF'
shopId?: IdType
shopName?: string
shopAddress?: string
status: 'PENDING_ADMIN' | 'PENDING_MANAGER' | 'APPROVED' | 'REJECTED'
rejectReason?: string
createTime?: string
}
export const adminWorkbenchRegistrationApi = {
list() {
return adminApi.get<WorkbenchRegistrationApplication[]>('/user/workbench/registration/list') as unknown as Promise<WorkbenchRegistrationApplication[]>
},
approve(id: IdType) {
return adminApi.post<boolean>(`/user/workbench/registration/${id}/approve`)
},
reject(id: IdType, reason: string) {
return adminApi.post<boolean>(`/user/workbench/registration/${id}/reject`, { reason })
}
}
export { adminApi }
export default adminApi
@@ -25,6 +25,7 @@ export const ADMIN_DASHBOARD_PATH = '/admin/dashboard'
export const adminNavigationItems: AdminNavigationItem[] = [
{ path: ADMIN_HOME_PATH, iconKey: 'home', label: '首页', permissionCode: '' },
{ path: '/admin/users', iconKey: 'user', label: '店长账号', permissionCode: 'user:view' },
{ path: '/admin/registrations', iconKey: 'team', label: '注册审核', permissionCode: 'user:view' },
{ path: '/admin/shops', iconKey: 'home', label: '店铺管理', permissionCode: 'shop:view' },
{ path: '/admin/settings', iconKey: 'tool', label: '系统设置', permissionCode: 'messagehub:config:manage' },
{ path: '/admin/profile', iconKey: 'user', label: '个人设置', permissionCode: '' }
+1 -1
View File
@@ -9,7 +9,7 @@ import {
const pageNames = [
['', 'HomeView', 'admin', undefined],
['users', 'UsersView', 'admin-users', 'user:view'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'],
['users', 'UsersView', 'admin-users', 'user:view'], ['registrations', 'WorkbenchRegistrationView', 'admin-registrations', 'user:view'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'],
['profile', 'ProfileView', 'admin-profile', undefined], ['settings', 'SystemSettingsView', 'admin-settings', 'messagehub:config:manage']
] as const
@@ -108,7 +108,7 @@ const visibleModules = computed(() => {
{
key: 'products',
title: '作品管理',
description: '维护作品、标签、可预约美甲师和优惠券。',
description: '维护作品、标签、可预约员工和优惠券。',
path: '/admin/products',
icon: ShopOutlined,
permissionCode: 'product:view',
@@ -134,8 +134,8 @@ const visibleModules = computed(() => {
},
{
key: 'artists',
title: '美甲师',
description: '查看状态、技能与作品挂载关系。',
title: '员工',
description: '查看员工状态、技能与排班关系。',
path: '/admin/nail-artists',
icon: TeamOutlined,
permissionCode: 'nail_artist:view',
@@ -548,7 +548,7 @@ const getUserTypeText = (type: number) => {
const map: Record<number, string> = {
0: '用户',
2: '店长',
3: '美甲师',
3: '店员',
4: '管理员'
}
return map[type] || '未知'
@@ -565,12 +565,12 @@ const filteredUserList = computed(() => {
return userList.value.filter(user => user.type !== 0 && !sameId(user.id, currentUserId))
}
// 店长只能看到美甲师(除了自己)
// 店长只能看到店员(除了自己)
if (currentLoginUser.value.type === 2) {
return userList.value.filter(user => user.type === 3 && !sameId(user.id, currentUserId))
}
// 其他用户类型(如美甲师)不能管理权限
// 其他用户类型(如店员)不能管理权限
return []
})
@@ -0,0 +1,57 @@
<template>
<div class="registration-page">
<a-page-header title="工作台注册审核" sub-title="审核店长注册申请" />
<a-card :bordered="false">
<a-table :columns="columns" :data-source="applications" :loading="loading" row-key="id">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'roleType'">{{ record.roleType === 'MANAGER' ? '店长' : '店员' }}</template>
<template v-else-if="column.key === 'status'">{{ statusLabel(record.status) }}</template>
<template v-else-if="column.key === 'action'">
<a-space v-if="record.status === 'PENDING_ADMIN'">
<a-button type="link" size="small" @click="approve(record.id)">通过</a-button>
<a-button type="link" danger size="small" @click="reject(record.id)">驳回</a-button>
</a-space>
</template>
</template>
</a-table>
</a-card>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { message } from 'ant-design-vue'
import { adminWorkbenchRegistrationApi, type WorkbenchRegistrationApplication } from '@/api/admin'
const loading = ref(false)
const applications = ref<WorkbenchRegistrationApplication[]>([])
const columns = [
{ title: '申请编号', dataIndex: 'applicationNo', key: 'applicationNo' },
{ title: '身份', key: 'roleType' },
{ title: '店铺', dataIndex: 'shopName', key: 'shopName' },
{ title: '地址', dataIndex: 'shopAddress', key: 'shopAddress' },
{ title: '状态', key: 'status' },
{ title: '操作', key: 'action', width: 150 }
]
const statusLabel = (status: string) => ({ PENDING_ADMIN: '待管理员审核', PENDING_MANAGER: '待店长审核', APPROVED: '已通过', REJECTED: '已驳回' }[status] || status)
const load = async () => {
loading.value = true
try { applications.value = await adminWorkbenchRegistrationApi.list() } catch (error) { message.error(error instanceof Error ? error.message : '获取注册申请失败') } finally { loading.value = false }
}
const approve = async (id: string | number) => {
await adminWorkbenchRegistrationApi.approve(id)
message.success('申请已通过')
await load()
}
const reject = (id: string | number) => {
const reason = window.prompt('请输入驳回原因') || ''
if (!reason.trim()) return
adminWorkbenchRegistrationApi.reject(id, reason).then(async () => { message.success('申请已驳回'); await load() }).catch(error => message.error(error instanceof Error ? error.message : '驳回失败'))
}
onMounted(load)
</script>
@@ -18,7 +18,7 @@ export const getAdminRoleLabel = (type?: number) => {
case 2:
return '店长'
case 3:
return '美甲师'
return '店员'
default:
return '后台账号'
}
@@ -95,6 +95,8 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
"/api/user/send-verification-code",
"/api/user/phone-login",
"/api/user/wechat-mini/**",
"/api/user/workbench/register/**",
"/api/user/workbench/shops/available",
"/api/user/reset-password-by-phone",
"/api/legal-agreement/current",
"/api/legal-agreement/current/**",
@@ -137,6 +137,8 @@ fingertip-designer:
- /api/user/send-verification-code
- /api/user/phone-login
- /api/user/wechat-mini/**
- /api/user/workbench/register/**
- /api/user/workbench/shops/available
- /api/user/reset-password-by-phone
- /api/nail-artist/profile/**
- /api/nail-artist/*/availability
+36 -1
View File
@@ -19,8 +19,34 @@ module.exports = {
register(data) {
return request({
url: '/auth/register',
url: '/user/workbench/register/phone',
method: 'POST',
params: { __baseUrl: API_DOMAIN },
data
})
},
getAvailableRegistrationShops() {
return request({
url: '/user/workbench/shops/available',
method: 'GET',
params: { __baseUrl: API_DOMAIN }
})
},
getRegistrationStatus(phone) {
return request({
url: `/user/workbench/register/status?phone=${encodeURIComponent(phone)}`,
method: 'GET',
params: { __baseUrl: API_DOMAIN }
})
},
resubmitRegistration(data) {
return request({
url: '/user/workbench/register/resubmit',
method: 'POST',
params: { __baseUrl: API_DOMAIN },
data
})
},
@@ -64,6 +90,15 @@ module.exports = {
})
},
wechatAutoLogin(wxCode) {
return request({
url: '/user/wechat-mini/auto-login',
method: 'POST',
params: { __baseUrl: API_DOMAIN },
data: { wxCode }
})
},
getPhoneLoginShops(phone) {
return request({
url: `/user/check/login-shops/phone/${encodeURIComponent(phone)}`,
-1
View File
@@ -13,7 +13,6 @@
"pages/schedule-setting/index",
"pages/leave-management/index",
"pages/color-setting/index",
"pages/employee-orders/index",
"pages/profile/index",
"pages/shop-settings/index",
"pages/export/index",
@@ -294,7 +294,7 @@ Page({
draftSavedAtText: draftForm ? '已恢复本机草稿' : ''
})
if (!creatable) {
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
this.loadOptions()
@@ -683,7 +683,7 @@ Page({
async submit() {
if (!this.data.canCreateAppointment) {
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
const form = this.data.form
@@ -68,7 +68,7 @@ Page({
createAppointment() {
if (!this.data.canCreateAppointment) {
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
const customer = this.data.customer || {}
@@ -32,7 +32,6 @@
<view class="card menu-card" data-url="/pages/schedule-setting/index" bindtap="go">排班设置</view>
<view class="card menu-card" data-url="/pages/leave-management/index" bindtap="go">请假管理</view>
<view class="card menu-card" data-url="/pages/color-setting/index" bindtap="go">颜色设置</view>
<view class="card menu-card" data-url="/pages/employee-orders/index" bindtap="go">订单记录</view>
</view>
</view>
</view>
+50 -5
View File
@@ -108,7 +108,8 @@ Page({
const preference = getLoginPreference()
if (preference.rememberMe) {
this.setData({
loginMode: preference.loginMode === 'password' ? 'password' : 'phone',
// 记住账号不代表默认使用密码登录,工作台优先引导手机号验证码登录。
loginMode: 'phone',
rememberMe: true,
'form.account': preference.account || '',
'form.phone': preference.phone || ''
@@ -440,6 +441,10 @@ Page({
this.saveLoginPreference()
wx.reLaunch({ url: '/pages/planning/index' })
} catch (error) {
if (String(error.message || '').indexOf('禁用') !== -1) {
await this.showRegistrationStatus()
return
}
if (isShopSelectionRequiredError(error)) {
try {
if (!this.data.shopSelectVisible) {
@@ -456,11 +461,51 @@ Page({
}
},
goRegister() {
wx.navigateTo({ url: '/pages/register/index' })
async showRegistrationStatus() {
try {
const phone = this.data.loginMode === 'phone' ? this.data.form.phone : this.data.form.account
const status = await authApi.getRegistrationStatus(String(phone || '').trim())
const statusText = {
PENDING_ADMIN: '管理员审核中',
PENDING_MANAGER: '店长审核中',
REJECTED: `申请已驳回:${status.rejectReason || '请修改资料后重新提交'}`,
APPROVED: '账号已审核,请稍后重试登录'
}[status.status] || '账号暂不可用'
wx.showToast({ title: statusText, icon: 'none', duration: 3000 })
} catch (statusError) {
wx.showToast({ title: statusError.message || '账号已被禁用', icon: 'none' })
}
},
wechatLogin() {
wx.showToast({ title: '请先使用账号登录', icon: 'none' })
async getWechatCode() {
const result = await new Promise((resolve, reject) => wx.login({ success: resolve, fail: reject }))
return result.code
},
goRegister(wxCode) {
const query = wxCode ? `?wxCode=${encodeURIComponent(wxCode)}` : ''
wx.navigateTo({ url: `/pages/register/index${query}` })
},
async wechatLogin() {
try {
const loginResult = await new Promise((resolve, reject) => {
wx.login({ success: resolve, fail: reject })
})
const result = await authApi.wechatAutoLogin(loginResult.code)
if (result.status === 'NEED_MANUAL_LOGIN') {
wx.showToast({ title: '新账号请先完成手机号注册和身份审核', icon: 'none', duration: 2500 })
const wxCode = await this.getWechatCode()
setTimeout(() => this.goRegister(wxCode), 900)
return
}
if (result.status !== 'SUCCESS' || !result.accessToken) {
throw new Error(result.message || '微信登录暂不可用')
}
getApp().setSession(result)
wx.reLaunch({ url: '/pages/planning/index' })
} catch (error) {
wx.showToast({ title: error.message || '微信快捷登录失败', icon: 'none' })
}
}
})
+4 -2
View File
@@ -2,13 +2,15 @@
<view class="brand">
<image class="logo" src="/assets/images/app-icon.png" mode="aspectFill"></image>
<text class="brand-name">{{appName}}</text>
<text class="brand-sub">美甲店预约排班管理</text>
<text class="brand-sub">门店工作台 · 让每一次服务都有清晰安排</text>
</view>
<view class="card auth-card">
<view class="welcome-copy">欢迎回来</view>
<view class="welcome-hint">登录后继续管理门店与今日排班</view>
<view class="mode-tabs">
<view class="mode-tab {{loginMode === 'password' ? 'active' : ''}}" data-mode="password" bindtap="switchLoginMode">密码登录</view>
<view class="mode-tab {{loginMode === 'phone' ? 'active' : ''}}" data-mode="phone" bindtap="switchLoginMode">验证码登录</view>
<view class="mode-tab {{loginMode === 'password' ? 'active' : ''}}" data-mode="password" bindtap="switchLoginMode">密码登录</view>
</view>
<view wx:if="{{loginMode === 'password'}}" class="field">
+57 -13
View File
@@ -2,7 +2,8 @@
display: flex;
flex-direction: column;
justify-content: flex-start;
padding-top: 12rpx;
padding: 34rpx 28rpx 48rpx;
background: #f4f8f5;
}
.brand {
@@ -22,21 +23,28 @@
.brand-name {
margin-top: 24rpx;
color: #24211d;
color: #2e4a3d;
font-size: 42rpx;
font-weight: 800;
}
.brand-sub {
margin-top: 8rpx;
color: #938c83;
font-size: 24rpx;
color: #7b8f82;
font-size: 23rpx;
}
.auth-card {
padding: 12rpx 24rpx 26rpx;
padding: 30rpx 24rpx 26rpx;
border: 1rpx solid #e1ebe3;
border-radius: 24rpx;
background: #fbfdfb;
box-shadow: 0 18rpx 46rpx rgba(55, 94, 72, .08);
}
.welcome-copy { color: #2e4a3d; font-size: 34rpx; font-weight: 800; }
.welcome-hint { margin-top: 8rpx; color: #87978c; font-size: 23rpx; }
.mode-tabs {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -44,7 +52,7 @@
margin: 12rpx 0 10rpx;
padding: 8rpx;
border-radius: 12px;
background: #f3eee7;
background: #edf5ef;
}
.mode-tab {
@@ -59,31 +67,64 @@
}
.mode-tab.active {
background: #fffdf8;
color: #55786d;
background: #ffffff;
color: #3d6652;
box-shadow: 0 8rpx 18rpx rgba(58, 48, 34, 0.08);
}
.code-row {
display: flex;
align-items: center;
flex: 1;
width: 100%;
min-width: 0;
gap: 14rpx;
}
.auth-card .field {
display: block;
min-height: 0;
padding: 0;
border: 0;
}
.auth-card .field-label {
display: block;
width: auto;
margin-bottom: 12rpx;
}
.auth-card .field input {
display: block;
box-sizing: border-box;
width: 100%;
height: 84rpx;
flex: none;
padding: 0 24rpx;
border: 1rpx solid #dfe9e1;
border-radius: 14rpx;
background: #f7faf7;
}
.code-input {
width: auto !important;
min-width: 0;
flex: 1 !important;
}
.code-btn {
width: 160rpx;
min-width: 160rpx;
max-width: 160rpx;
height: 56rpx;
width: 176rpx;
min-width: 176rpx;
max-width: 176rpx;
height: 68rpx;
flex: none;
padding: 0;
border: 1rpx solid #b9d0c0;
border-radius: 12rpx;
background: #edf5ef;
color: #6f8f83;
font-size: 24rpx;
font-weight: 700;
line-height: 68rpx;
text-align: center;
white-space: nowrap;
}
@@ -159,6 +200,9 @@
.wechat-btn {
margin-top: 34rpx;
border: 1rpx solid #c9dbce;
background: #edf5ef;
color: #3d6652;
}
.shop-select-mask {
+1 -1
View File
@@ -406,7 +406,7 @@ Page({
createAppointment() {
if (!this.data.canCreateAppointment) {
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
return
}
wx.navigateTo({
+59 -69
View File
@@ -1,95 +1,85 @@
const authApi = require('../../api/auth')
const { BRAND_CONFIG } = require('../../utils/config')
const PHONE_REGEX = /^1[3-9]\d{9}$/
Page({
data: {
form: {
phone: '',
code: '',
password: '',
confirmPassword: '',
shopName: ''
},
registerShopPlaceholder: BRAND_CONFIG.registerShopPlaceholder,
step: 1,
role: 'manager',
passwordMode: false,
form: { phone: '', code: '', password: '', confirmPassword: '', shopName: '', shopAddress: '', shopId: '' },
wxCode: '',
shopOptions: [],
shopIndex: 0,
selectedShopName: '',
loading: false,
codeLoading: false,
countdown: 0,
countdownTimer: null
},
onInput(event) {
this.setData({
[`form.${event.currentTarget.dataset.field}`]: event.detail.value
})
async onLoad(options) {
this.setData({ wxCode: options && options.wxCode ? options.wxCode : '' })
try {
const shopOptions = await authApi.getAvailableRegistrationShops()
this.setData({ shopOptions: Array.isArray(shopOptions) ? shopOptions : [] })
} catch (error) {
this.setData({ shopOptions: [] })
}
},
back() {
wx.navigateBack()
},
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
togglePasswordMode() { this.setData({ passwordMode: !this.data.passwordMode }) },
async sendCode() {
const phone = this.data.form.phone
if (!phone) {
wx.showToast({ title: '请输入手机号', icon: 'none' })
return
}
if (this.data.codeLoading || this.data.countdown > 0) {
return
}
const phone = String(this.data.form.phone || '').trim()
if (!PHONE_REGEX.test(phone)) { wx.showToast({ title: '请输入正确手机号', icon: 'none' }); return }
if (this.data.codeLoading || this.data.countdown > 0) return
this.setData({ codeLoading: true })
try {
await authApi.sendCode(phone)
wx.showToast({ title: '验证码已发送' })
this.startCountdown()
} catch (error) {
wx.showToast({ title: error.message || '发送失败', icon: 'none' })
} finally {
this.setData({ codeLoading: false })
}
try { await authApi.sendCode(phone); wx.showToast({ title: '验证码已发送' }); this.startCountdown() } catch (error) { wx.showToast({ title: error.message || '发送失败', icon: 'none' }) } finally { this.setData({ codeLoading: false }) }
},
startCountdown() {
if (this.data.countdownTimer) {
clearInterval(this.data.countdownTimer)
}
this.setData({ countdown: 60 })
const timer = setInterval(() => {
const next = this.data.countdown - 1
if (next <= 0) {
clearInterval(timer)
this.setData({ countdown: 0, countdownTimer: null })
return
}
this.setData({ countdown: next })
}, 1000)
this.setData({ countdownTimer: timer })
continueFromPhone() {
const form = this.data.form
if (!PHONE_REGEX.test(String(form.phone || '').trim()) || !/^\d{6}$/.test(String(form.code || '').trim())) { wx.showToast({ title: '请输入正确手机号和6位验证码', icon: 'none' }); return }
if (this.data.passwordMode && (!form.password || form.password !== form.confirmPassword)) { wx.showToast({ title: '请确认两次密码一致', icon: 'none' }); return }
this.setData({ step: 2 })
},
onUnload() {
if (this.data.countdownTimer) {
clearInterval(this.data.countdownTimer)
}
selectRole(event) { this.setData({ role: event.currentTarget.dataset.role }) },
continueFromRole() { this.setData({ step: 3 }) },
selectShop(event) {
const index = Number(event.detail.value)
const shop = this.data.shopOptions[index]
if (!shop) return
this.setData({ shopIndex: index, selectedShopName: shop.name, 'form.shopId': shop.id })
},
goBackStep() { this.setData({ step: Math.max(1, this.data.step - 1) }) },
async submit() {
const form = this.data.form
if (!form.phone || !form.code || !form.password || !form.shopName) {
wx.showToast({ title: '请补全注册信息', icon: 'none' })
return
}
if (form.password !== form.confirmPassword) {
wx.showToast({ title: '两次密码不一致', icon: 'none' })
return
}
if (this.data.role === 'manager' && !String(form.shopName || '').trim()) { wx.showToast({ title: '请输入店铺名称', icon: 'none' }); return }
if (this.data.role === 'staff' && !form.shopId) { wx.showToast({ title: '请选择要加入的店铺', icon: 'none' }); return }
if (this.data.role === 'staff') { wx.showToast({ title: '店员申请功能即将开放', icon: 'none' }); return }
this.setData({ loading: true })
try {
await authApi.register(form)
wx.showToast({ title: '注册成功' })
setTimeout(() => wx.navigateBack(), 500)
} catch (error) {
wx.showToast({ title: error.message || '注册失败', icon: 'none' })
} finally {
this.setData({ loading: false })
}
}
await authApi.register({ phone: form.phone, verificationCode: form.code, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, shopId: form.shopId, roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF', agreementAccepted: true, wxCode: this.data.wxCode })
this.setData({ step: 4 })
} catch (error) { wx.showToast({ title: error.message || '提交失败', icon: 'none' }) } finally { this.setData({ loading: false }) }
},
startCountdown() {
if (this.data.countdownTimer) clearInterval(this.data.countdownTimer)
this.setData({ countdown: 60 })
const timer = setInterval(() => { const next = this.data.countdown - 1; if (next <= 0) { clearInterval(timer); this.setData({ countdown: 0, countdownTimer: null }); return } this.setData({ countdown: next }) }, 1000)
this.setData({ countdownTimer: timer })
},
onUnload() { if (this.data.countdownTimer) clearInterval(this.data.countdownTimer) },
back() { wx.navigateBack() }
})
+14 -30
View File
@@ -1,32 +1,16 @@
<view class="page no-tab">
<view class="card form-card">
<view class="field">
<text class="field-label">手机号</text>
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" placeholder="请输入手机号" />
</view>
<view class="field">
<text class="field-label">验证码</text>
<input value="{{form.code}}" data-field="code" bindinput="onInput" placeholder="请输入验证码" />
<button class="code-btn {{countdown > 0 ? 'counting' : ''}}" loading="{{codeLoading}}" disabled="{{codeLoading || countdown > 0}}" bindtap="sendCode">
<text wx:if="{{countdown > 0}}">重新获取 {{countdown}}s</text>
<text wx:else>获取验证码</text>
</button>
</view>
<view class="field">
<text class="field-label">密码</text>
<input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="设置登录密码" />
</view>
<view class="field">
<text class="field-label">确认密码</text>
<input value="{{form.confirmPassword}}" data-field="confirmPassword" bindinput="onInput" password placeholder="再次输入密码" />
</view>
<view class="field">
<text class="field-label">店铺名称</text>
<input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="{{registerShopPlaceholder}}" />
</view>
</view>
<view class="fixed-bottom">
<button class="primary-btn" loading="{{loading}}" bindtap="submit">注册</button>
<view class="page no-tab auth-page">
<view class="auth-header"><image class="logo" src="/assets/images/app-icon.png" mode="aspectFill"></image><view class="header-copy"><text class="brand-name">Salon</text><text class="brand-sub">门店工作台 · 创建你的工作身份</text></view></view>
<view class="progress-row"><view class="progress-step {{step >= 1 ? 'active' : ''}}"><text>1</text><label>验证手机</label></view><view class="progress-line {{step >= 2 ? 'active' : ''}}"></view><view class="progress-step {{step >= 2 ? 'active' : ''}}"><text>2</text><label>选择身份</label></view><view class="progress-line {{step >= 3 ? 'active' : ''}}"></view><view class="progress-step {{step >= 3 ? 'active' : ''}}"><text>3</text><label>提交审核</label></view></view>
<view wx:if="{{step === 1}}" class="card form-card">
<view class="section-title">验证手机号</view><view class="section-desc">手机号将作为你的工作台登录账号</view>
<view class="field"><text class="field-label">手机号</text><input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="number" placeholder="请输入手机号" /></view>
<view class="field"><text class="field-label">验证码</text><view class="code-row"><input class="code-input" value="{{form.code}}" data-field="code" bindinput="onInput" type="number" placeholder="请输入6位验证码" /><button class="code-btn {{countdown > 0 ? 'counting' : ''}}" loading="{{codeLoading}}" disabled="{{codeLoading || countdown > 0}}" bindtap="sendCode"><text wx:if="{{countdown > 0}}">{{countdown}}s 后重发</text><text wx:else>获取验证码</text></button></view></view>
<view class="secondary-entry" bindtap="togglePasswordMode">使用密码注册 <text>›</text></view>
<view wx:if="{{passwordMode}}" class="password-panel"><view class="field"><text class="field-label">设置密码</text><input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="至少8位密码" /></view><view class="field"><text class="field-label">确认密码</text><input value="{{form.confirmPassword}}" data-field="confirmPassword" bindinput="onInput" password placeholder="再次输入密码" /></view></view>
<button class="primary-btn" loading="{{loading}}" bindtap="continueFromPhone">继续</button>
</view>
<view wx:if="{{step === 2}}" class="card form-card"><view class="section-title">你要加入哪种工作身份?</view><view class="section-desc">不同身份需要由不同的负责人审核</view><view class="role-list"><view class="role-option {{role === 'manager' ? 'selected' : ''}}" data-role="manager" bindtap="selectRole"><view class="role-icon">店</view><view class="role-copy"><text class="role-title">店长</text><text class="role-desc">创建并负责一家 Salon 门店</text></view><text class="role-mark">{{role === 'manager' ? '✓' : '○'}}</text></view><view class="role-option {{role === 'staff' ? 'selected' : ''}}" data-role="staff" bindtap="selectRole"><view class="role-icon">员</view><view class="role-copy"><text class="role-title">店员</text><text class="role-desc">加入已有门店协同工作</text></view><text class="role-mark">{{role === 'staff' ? '✓' : '○'}}</text></view></view><button class="primary-btn" bindtap="continueFromRole">继续</button><view class="back-entry" bindtap="goBackStep">返回上一步</view></view>
<view wx:if="{{step === 3}}" class="card form-card"><view class="section-title">{{role === 'manager' ? '完善店铺资料' : '选择要加入的店铺'}}</view><view class="section-desc">{{role === 'manager' ? '提交后由管理员审核,审核通过后即可登录' : '提交后由对应店长审核,审核通过后即可登录'}}</view><view wx:if="{{role === 'manager'}}" class="field"><text class="field-label">店铺名称</text><input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="请输入店铺名称" /></view><view wx:if="{{role === 'manager'}}" class="field"><text class="field-label">店铺地址</text><input value="{{form.shopAddress}}" data-field="shopAddress" bindinput="onInput" placeholder="请输入门店所在地址" /></view><view wx:if="{{role === 'staff'}}" class="field"><text class="field-label">选择店铺</text><picker range="{{shopOptions}}" range-key="name" value="{{shopIndex}}" bindchange="selectShop"><view class="picker-value {{selectedShopName ? 'filled' : ''}}">{{selectedShopName || '请选择要加入的店铺'}}</view></picker></view><view wx:if="{{role === 'staff'}}" class="notice">店员申请会发送给所选店铺的店长审核</view><button class="primary-btn" loading="{{loading}}" bindtap="submit">提交审核</button><view class="back-entry" bindtap="goBackStep">返回上一步</view></view>
<view wx:if="{{step === 4}}" class="card result-card"><view class="result-icon">✓</view><view class="section-title">申请已提交</view><view class="section-desc">{{role === 'manager' ? '管理员审核通过后,你就可以登录 Salon 工作台。' : '店长审核通过后,你就可以登录 Salon 工作台。'}}</view><view class="result-status">当前状态:<text>等待审核</text></view><button class="primary-btn" bindtap="back">返回登录</button></view>
<view class="safe-note">注册并不代表立即获得工作台权限,审核通过后才可登录。</view>
</view>
+244 -10
View File
@@ -1,17 +1,251 @@
.code-btn {
width: 180rpx;
min-width: 180rpx;
max-width: 180rpx;
height: 56rpx;
padding: 0;
color: #6f8f83;
font-size: 24rpx;
.auth-page {
padding: 36rpx 28rpx 48rpx;
background: #f4f8f5;
}
.auth-header {
display: flex;
align-items: center;
margin-bottom: 34rpx;
}
.logo {
width: 88rpx;
height: 88rpx;
border-radius: 26rpx;
background: #dce9df;
box-shadow: 0 12rpx 28rpx rgba(55, 94, 72, .14);
}
.header-copy {
display: flex;
flex-direction: column;
margin-left: 20rpx;
}
.brand-name { color: #2e4a3d; font-size: 42rpx; font-weight: 800; }
.brand-sub { margin-top: 8rpx; color: #7b8f82; font-size: 23rpx; }
.progress-row {
display: flex;
align-items: center;
margin-bottom: 26rpx;
}
.progress-step {
display: flex;
flex-direction: column;
align-items: center;
color: #a3b0a7;
font-size: 20rpx;
white-space: nowrap;
}
.progress-step text {
display: flex;
align-items: center;
justify-content: center;
width: 42rpx;
height: 42rpx;
border-radius: 50%;
background: #e0e9e2;
color: #8da095;
font-size: 22rpx;
font-weight: 700;
text-align: center;
}
.progress-step label { margin-top: 8rpx; }
.progress-step.active { color: #3d6652; }
.progress-step.active text { background: #3d6652; color: #fff; }
.progress-line {
height: 2rpx;
flex: 1;
margin: 0 12rpx 30rpx;
background: #dce6de;
}
.progress-line.active { background: #7ca48a; }
.form-card,
.result-card {
padding: 34rpx 28rpx;
border: 1rpx solid #e1ebe3;
border-radius: 24rpx;
background: #fbfdfb;
box-shadow: 0 18rpx 46rpx rgba(55, 94, 72, .08);
}
.section-title { color: #2e4a3d; font-size: 34rpx; font-weight: 800; }
.section-desc { margin-top: 10rpx; color: #87978c; font-size: 23rpx; line-height: 1.55; }
.auth-page .form-card .field {
display: block;
min-height: 0;
margin-top: 26rpx;
padding: 0;
border: 0;
}
.auth-page .form-card .field-label {
display: block;
width: auto;
margin: 0 0 12rpx;
color: #577061;
font-size: 23rpx;
font-weight: 700;
}
.auth-page .form-card .field input,
.picker-value {
box-sizing: border-box;
display: block;
width: 100%;
height: 84rpx;
flex: none;
padding: 0 24rpx;
border: 1rpx solid #dfe9e1;
border-radius: 14rpx;
background: #f7faf7;
color: #2e4a3d;
font-size: 27rpx;
}
.picker-value {
display: flex;
align-items: center;
color: #a0ada4;
}
.picker-value.filled { color: #2e4a3d; }
.code-row {
display: flex;
align-items: center;
width: 100%;
gap: 14rpx;
}
.auth-page .form-card .code-row .code-input {
width: auto;
min-width: 0;
flex: 1;
}
.code-btn {
width: 176rpx;
min-width: 176rpx;
height: 68rpx;
flex: none;
padding: 0;
border: 1rpx solid #b9d0c0;
border-radius: 12rpx;
background: #edf5ef;
color: #3d6652;
font-size: 23rpx;
font-weight: 700;
line-height: 68rpx;
white-space: nowrap;
}
.code-btn.counting {
color: #aaa39a;
border-color: #e0e8e2;
background: #f4f7f4;
color: #9ca9a0;
font-weight: 500;
}
.secondary-entry,
.back-entry {
margin-top: 24rpx;
color: #5b806b;
font-size: 24rpx;
text-align: center;
}
.secondary-entry text { margin-left: 8rpx; font-size: 30rpx; }
.password-panel { padding-bottom: 4rpx; }
.primary-btn {
height: 84rpx;
margin-top: 30rpx;
border-radius: 14rpx;
background: #3d6652;
color: #fff;
font-size: 28rpx;
font-weight: 700;
line-height: 84rpx;
}
.role-list { margin-top: 28rpx; }
.role-option {
display: flex;
align-items: center;
min-height: 112rpx;
margin-top: 16rpx;
padding: 0 20rpx;
border: 1rpx solid #e1ebe3;
border-radius: 16rpx;
background: #f8fbf8;
}
.role-option.selected {
border-color: #78a288;
background: #edf6ef;
box-shadow: 0 10rpx 22rpx rgba(61, 102, 82, .08);
}
.role-icon {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
border-radius: 18rpx;
background: #dce9df;
color: #3d6652;
font-size: 25rpx;
font-weight: 800;
}
.role-copy { display: flex; flex: 1; flex-direction: column; margin-left: 18rpx; }
.role-title { color: #2e4a3d; font-size: 28rpx; font-weight: 700; }
.role-desc { margin-top: 8rpx; color: #8b9b90; font-size: 22rpx; }
.role-mark { color: #6f9780; font-size: 34rpx; }
.notice {
margin-top: 18rpx;
padding: 18rpx;
border-radius: 12rpx;
background: #f1f6f2;
color: #718579;
font-size: 22rpx;
line-height: 1.5;
}
.result-card {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 64rpx;
text-align: center;
}
.result-icon {
display: flex;
align-items: center;
justify-content: center;
width: 92rpx;
height: 92rpx;
border-radius: 50%;
background: #dcece0;
color: #3d6652;
font-size: 48rpx;
font-weight: 800;
}
.result-card .section-title { margin-top: 24rpx; }
.result-status { margin-top: 28rpx; padding: 18rpx 28rpx; border-radius: 12rpx; background: #f1f6f2; color: #75887b; font-size: 24rpx; }
.result-status text { color: #c28b47; font-weight: 700; }
.safe-note { margin-top: 28rpx; color: #9aa9a0; font-size: 21rpx; line-height: 1.5; text-align: center; }
+3 -3
View File
@@ -140,9 +140,9 @@ const BASE_DOMAIN = resolveDomain(DOMAIN_MAP, ENV_VERSION, DEVELOP_TARGET)
const brandOverride = localOverride.brand || {}
const BRAND_CONFIG = {
appName: String(brandOverride.appName || '甲屿店务'),
productName: String(brandOverride.productName || '甲屿设计师'),
defaultShopName: String(brandOverride.defaultShopName || '甲屿设计师'),
registerShopPlaceholder: String(brandOverride.registerShopPlaceholder || '例如:甲屿设计师')
productName: String(brandOverride.productName || 'Salon'),
defaultShopName: String(brandOverride.defaultShopName || 'Salon'),
registerShopPlaceholder: String(brandOverride.registerShopPlaceholder || '例如:Salon中心店')
}
module.exports = {
@@ -4,9 +4,9 @@ module.exports = {
enableRequestSigning: true,
brand: {
appName: '甲屿店务',
productName: '甲屿设计师',
defaultShopName: '甲屿设计师',
registerShopPlaceholder: '例如:甲屿设计师'
productName: 'Salon',
defaultShopName: 'Salon',
registerShopPlaceholder: '例如:Salon中心店'
},
domains: {
local: 'http://127.0.0.1:80',
+3
View File
@@ -112,8 +112,11 @@ function isAuthFreePath(url) {
return [
'/auth/login',
'/auth/register',
'/user/workbench/register/',
'/user/workbench/shops/available',
'/user/send-verification-code',
'/user/phone-login',
'/user/wechat-mini/',
'/user/check/login-shops/',
'/legal-agreement/current'
].some(path => String(url || '').includes(path))
@@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS `t_workbench_registration_application` (
`id` bigint NOT NULL COMMENT '申请ID',
`application_no` varchar(40) NOT NULL COMMENT '申请编号',
`user_id` bigint NOT NULL COMMENT '申请用户ID',
`role_type` varchar(20) NOT NULL COMMENT '申请身份:MANAGER/STAFF',
`shop_id` bigint DEFAULT NULL COMMENT '目标店铺ID',
`shop_name` varchar(120) DEFAULT NULL COMMENT '店铺名称快照',
`shop_address` varchar(255) DEFAULT NULL COMMENT '店铺地址快照',
`status` varchar(30) NOT NULL COMMENT '状态:PENDING_ADMIN/PENDING_MANAGER/APPROVED/REJECTED',
`reviewer_id` bigint DEFAULT NULL COMMENT '审核人ID',
`reviewed_at` datetime DEFAULT NULL COMMENT '审核时间',
`reject_reason` varchar(500) DEFAULT NULL COMMENT '驳回原因',
`is_delete` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '逻辑删除:0-未删,1-已删',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_workbench_registration_application_no` (`application_no`),
KEY `idx_workbench_registration_user` (`user_id`),
KEY `idx_workbench_registration_shop_status` (`shop_id`, `status`),
KEY `idx_workbench_registration_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Salon店务工作台注册审核申请';
@@ -140,6 +140,8 @@ fingertip-designer:
- /api/user/send-verification-code
- /api/user/phone-login
- /api/user/wechat-mini/**
- /api/user/workbench/register/**
- /api/user/workbench/shops/available
- /api/user/reset-password-by-phone
- /api/nail-artist/profile/**
- /api/nail-artist/*/availability
@@ -137,6 +137,8 @@ fingertip-designer:
- /api/user/send-verification-code
- /api/user/phone-login
- /api/user/wechat-mini/**
- /api/user/workbench/register/**
- /api/user/workbench/shops/available
- /api/user/reset-password-by-phone
- /api/nail-artist/profile/**
- /api/nail-artist/*/availability
@@ -137,6 +137,8 @@ fingertip-designer:
- /api/user/send-verification-code
- /api/user/phone-login
- /api/user/wechat-mini/**
- /api/user/workbench/register/**
- /api/user/workbench/shops/available
- /api/user/reset-password-by-phone
- /api/nail-artist/profile/**
- /api/nail-artist/*/availability