From edc14b3d416bdf7ed6e1565040bf2a4813fbedc7 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 11:09:34 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E9=87=8D=E8=AE=BE=E8=AE=A1Salon=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B3=A8=E5=86=8C=E5=B7=A5=E4=BD=9C=E5=8F=B0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/login/index.wxml | 4 +- JC-Salon-WeChat/pages/login/index.wxss | 27 +++-- JC-Salon-WeChat/pages/register/index.js | 119 +++++++++------------- JC-Salon-WeChat/pages/register/index.wxml | 44 +++----- JC-Salon-WeChat/pages/register/index.wxss | 18 +--- 5 files changed, 86 insertions(+), 126 deletions(-) diff --git a/JC-Salon-WeChat/pages/login/index.wxml b/JC-Salon-WeChat/pages/login/index.wxml index 66c01dee..408addf2 100644 --- a/JC-Salon-WeChat/pages/login/index.wxml +++ b/JC-Salon-WeChat/pages/login/index.wxml @@ -2,10 +2,12 @@ {{appName}} - 美甲店预约排班管理 + 门店工作台 · 让每一次服务都有清晰安排 + 欢迎回来 + 登录后继续管理门店与今日排班 密码登录 验证码登录 diff --git a/JC-Salon-WeChat/pages/login/index.wxss b/JC-Salon-WeChat/pages/login/index.wxss index 579324fc..9a1dddd4 100644 --- a/JC-Salon-WeChat/pages/login/index.wxss +++ b/JC-Salon-WeChat/pages/login/index.wxss @@ -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,8 +67,8 @@ } .mode-tab.active { - background: #fffdf8; - color: #55786d; + background: #ffffff; + color: #3d6652; box-shadow: 0 8rpx 18rpx rgba(58, 48, 34, 0.08); } @@ -159,6 +167,9 @@ .wechat-btn { margin-top: 34rpx; + border: 1rpx solid #c9dbce; + background: #edf5ef; + color: #3d6652; } .shop-select-mask { diff --git a/JC-Salon-WeChat/pages/register/index.js b/JC-Salon-WeChat/pages/register/index.js index bd7d4e11..19729e37 100644 --- a/JC-Salon-WeChat/pages/register/index.js +++ b/JC-Salon-WeChat/pages/register/index.js @@ -1,95 +1,74 @@ 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: '' }, + shopOptions: [], + shopIndex: 0, + selectedShopName: '', loading: false, codeLoading: false, countdown: 0, countdownTimer: null }, - onInput(event) { - this.setData({ - [`form.${event.currentTarget.dataset.field}`]: event.detail.value - }) - }, + onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) }, - back() { - wx.navigateBack() - }, + 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, code: form.code, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, role: this.data.role }) + 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() } }) diff --git a/JC-Salon-WeChat/pages/register/index.wxml b/JC-Salon-WeChat/pages/register/index.wxml index 55657d83..827fe5b5 100644 --- a/JC-Salon-WeChat/pages/register/index.wxml +++ b/JC-Salon-WeChat/pages/register/index.wxml @@ -1,32 +1,16 @@ - - - - 手机号 - - - - 验证码 - - - - - 密码 - - - - 确认密码 - - - - 店铺名称 - - - - - - + + Salon门店工作台 · 创建你的工作身份 + 123 + + 先验证手机号手机号将作为你的工作台登录账号 + 手机号 + 验证码 + 使用密码注册 › + 设置密码确认密码 + + 你要加入哪种工作身份?不同身份需要由不同的负责人审核店店长创建并负责一家 Salon 门店{{role === 'manager' ? '✓' : '○'}}员店员加入已有门店协同工作{{role === 'staff' ? '✓' : '○'}}返回上一步 + {{role === 'manager' ? '完善店铺资料' : '选择要加入的店铺'}}{{role === 'manager' ? '提交后由管理员审核,审核通过后即可登录' : '提交后由对应店长审核,审核通过后即可登录'}}店铺名称店铺地址选择店铺{{selectedShopName || '请选择要加入的店铺'}}店员申请会发送给所选店铺的店长审核返回上一步 + ✓申请已提交{{role === 'manager' ? '管理员审核通过后,你就可以登录 Salon 工作台。' : '店长审核通过后,你就可以登录 Salon 工作台。'}}当前状态:等待审核 + 注册并不代表立即获得工作台权限,审核通过后才可登录。 diff --git a/JC-Salon-WeChat/pages/register/index.wxss b/JC-Salon-WeChat/pages/register/index.wxss index 4ae8187f..d7909c97 100644 --- a/JC-Salon-WeChat/pages/register/index.wxss +++ b/JC-Salon-WeChat/pages/register/index.wxss @@ -1,17 +1 @@ -.code-btn { - width: 180rpx; - min-width: 180rpx; - max-width: 180rpx; - height: 56rpx; - padding: 0; - color: #6f8f83; - font-size: 24rpx; - font-weight: 700; - text-align: center; - white-space: nowrap; -} - -.code-btn.counting { - color: #aaa39a; - font-weight: 500; -} +.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}.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}.field{margin-top:26rpx}.field-label{display:block;margin-bottom:12rpx;color:#577061;font-size:23rpx;font-weight:700}.field input,.picker-value{box-sizing:border-box;width:100%;height:84rpx;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;gap:14rpx}.code-input{min-width:0;flex:1}.code-btn{width:176rpx;min-width:176rpx;height:68rpx;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{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{margin-top:30rpx;height:84rpx;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} -- 2.54.0 From 29ad14b24a521c6559d1c5eb73de796d4900c6b0 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 11:15:51 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=BB=98=E8=AE=A4=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/login/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JC-Salon-WeChat/pages/login/index.js b/JC-Salon-WeChat/pages/login/index.js index 094aef20..192a29f3 100644 --- a/JC-Salon-WeChat/pages/login/index.js +++ b/JC-Salon-WeChat/pages/login/index.js @@ -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 || '' -- 2.54.0 From ddf7e4823b7bce9d277537021da1ec0b97e11a19 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 11:18:39 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=A0=87=E7=AD=BE=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/login/index.wxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JC-Salon-WeChat/pages/login/index.wxml b/JC-Salon-WeChat/pages/login/index.wxml index 408addf2..31fa87ab 100644 --- a/JC-Salon-WeChat/pages/login/index.wxml +++ b/JC-Salon-WeChat/pages/login/index.wxml @@ -9,8 +9,8 @@ 欢迎回来 登录后继续管理门店与今日排班 - 密码登录 验证码登录 + 密码登录 -- 2.54.0 From 6c8b3f8447cb8c8bf5a1e4a9edc3ed4cc69cb596 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 11:27:36 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=A0=87=E9=A2=98=E5=92=8C=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/register/index.wxml | 2 +- JC-Salon-WeChat/pages/register/index.wxss | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/JC-Salon-WeChat/pages/register/index.wxml b/JC-Salon-WeChat/pages/register/index.wxml index 827fe5b5..8a2aef23 100644 --- a/JC-Salon-WeChat/pages/register/index.wxml +++ b/JC-Salon-WeChat/pages/register/index.wxml @@ -2,7 +2,7 @@ Salon门店工作台 · 创建你的工作身份 123 - 先验证手机号手机号将作为你的工作台登录账号 + 验证手机号手机号将作为你的工作台登录账号 手机号 验证码 使用密码注册 › diff --git a/JC-Salon-WeChat/pages/register/index.wxss b/JC-Salon-WeChat/pages/register/index.wxss index d7909c97..e62fb2a5 100644 --- a/JC-Salon-WeChat/pages/register/index.wxss +++ b/JC-Salon-WeChat/pages/register/index.wxss @@ -1 +1,6 @@ -.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}.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}.field{margin-top:26rpx}.field-label{display:block;margin-bottom:12rpx;color:#577061;font-size:23rpx;font-weight:700}.field input,.picker-value{box-sizing:border-box;width:100%;height:84rpx;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;gap:14rpx}.code-input{min-width:0;flex:1}.code-btn{width:176rpx;min-width:176rpx;height:68rpx;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{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{margin-top:30rpx;height:84rpx;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} +.auth-page .form-card .field{display:block;min-height:0;padding:0;border:0} +.auth-page .form-card .field-label{width:auto;margin:0 0 12rpx} +.auth-page .form-card .field input{display:block;width:100%;flex:none} +.auth-page .form-card .code-row{display:flex;align-items:center;width:100%;gap:14rpx} +.auth-page .form-card .code-row .code-input{width:auto;flex:1;min-width:0} +.auth-page .form-card .code-row .code-btn{flex:none} -- 2.54.0 From 4f4d9856739b58afb4118ae0789085287dae2aa6 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 11:42:21 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=A1=B5=E6=A0=B7=E5=BC=8F=E8=A7=A3=E6=9E=90=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/register/index.wxss | 257 +++++++++++++++++++++- 1 file changed, 251 insertions(+), 6 deletions(-) diff --git a/JC-Salon-WeChat/pages/register/index.wxss b/JC-Salon-WeChat/pages/register/index.wxss index e62fb2a5..c9dba461 100644 --- a/JC-Salon-WeChat/pages/register/index.wxss +++ b/JC-Salon-WeChat/pages/register/index.wxss @@ -1,6 +1,251 @@ -.auth-page .form-card .field{display:block;min-height:0;padding:0;border:0} -.auth-page .form-card .field-label{width:auto;margin:0 0 12rpx} -.auth-page .form-card .field input{display:block;width:100%;flex:none} -.auth-page .form-card .code-row{display:flex;align-items:center;width:100%;gap:14rpx} -.auth-page .form-card .code-row .code-input{width:auto;flex:1;min-width:0} -.auth-page .form-card .code-row .code-btn{flex:none} +.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; +} + +.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 { + 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; } -- 2.54.0 From 28c2c2603ead407ede93b54aaf1be169f674a9ef Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 11:47:44 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E8=A1=A8=E5=8D=95=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/login/index.wxss | 43 +++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/JC-Salon-WeChat/pages/login/index.wxss b/JC-Salon-WeChat/pages/login/index.wxss index 9a1dddd4..294295b1 100644 --- a/JC-Salon-WeChat/pages/login/index.wxss +++ b/JC-Salon-WeChat/pages/login/index.wxss @@ -75,23 +75,56 @@ .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; } -- 2.54.0 From b4af2d6ab19b1929ca0d17b085d77c208cd74432 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 12:09:42 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=AE=9E=E7=8E=B0Salon=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8F=B0=E6=B3=A8=E5=86=8C=E5=AE=A1=E6=A0=B8=E9=97=AD=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/config/WebMvcConfig.java | 2 + .../WorkbenchRegistrationController.java | 79 +++++++ .../dto/WorkbenchRegistrationRejectDTO.java | 10 + .../dto/WorkbenchRegistrationRequestDTO.java | 18 ++ .../WorkbenchRegistrationApplicationDO.java | 48 +++++ .../entity/WorkbenchRegistrationRole.java | 9 + .../entity/WorkbenchRegistrationStatus.java | 11 + ...orkbenchRegistrationApplicationMapper.java | 7 + .../service/WorkbenchRegistrationService.java | 15 ++ .../WorkbenchRegistrationServiceImpl.java | 197 ++++++++++++++++++ .../vo/WorkbenchRegistrationStatusVO.java | 16 ++ JC-Salon-Frontend/src/api/admin.ts | 25 +++ .../src/config/admin-navigation.ts | 1 + JC-Salon-Frontend/src/router/index.ts | 2 +- .../src/views/admin/ManageView.vue | 6 +- .../src/views/admin/PermissionsView.vue | 6 +- .../views/admin/WorkbenchRegistrationView.vue | 57 +++++ .../src/views/admin/admin-helpers.ts | 2 +- JC-Salon-WeChat/api/auth.js | 19 +- JC-Salon-WeChat/app.json | 1 - .../pages/appointment-form/index.js | 4 +- .../pages/customer-detail/index.js | 2 +- .../pages/employee-detail/index.wxml | 1 - JC-Salon-WeChat/pages/login/index.js | 20 ++ JC-Salon-WeChat/pages/planning/index.js | 2 +- JC-Salon-WeChat/pages/register/index.js | 11 +- JC-Salon-WeChat/utils/config.js | 6 +- JC-Salon-WeChat/utils/config.local.example.js | 6 +- JC-Salon-WeChat/utils/request.js | 2 + .../工作台注册审核_20260907.sql | 21 ++ 30 files changed, 584 insertions(+), 22 deletions(-) create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRejectDTO.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationApplicationDO.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationRole.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationStatus.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/mapper/WorkbenchRegistrationApplicationMapper.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java create mode 100644 JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/vo/WorkbenchRegistrationStatusVO.java create mode 100644 JC-Salon-Frontend/src/views/admin/WorkbenchRegistrationView.vue create mode 100644 docs/scripts/sql/工作台注册审核_20260907/工作台注册审核_20260907.sql diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/WebMvcConfig.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/WebMvcConfig.java index 86988c63..c939b3df 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/WebMvcConfig.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/config/WebMvcConfig.java @@ -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/**", diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java new file mode 100644 index 00000000..75380872 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java @@ -0,0 +1,79 @@ +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 registerByPhone(@RequestBody WorkbenchRegistrationRequestDTO request) { + return Result.success(registrationService.register(request)); + } + + @GetMapping("/register/status") + public Result 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> 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(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 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 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; + } +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRejectDTO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRejectDTO.java new file mode 100644 index 00000000..8e7e1ee9 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRejectDTO.java @@ -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; +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java new file mode 100644 index 00000000..8de1a7e8 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java @@ -0,0 +1,18 @@ +package com.xiaowang.jacyucloudsalon.core.modules.registration.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class WorkbenchRegistrationRequestDTO { + 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; +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationApplicationDO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationApplicationDO.java new file mode 100644 index 00000000..385f5b42 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationApplicationDO.java @@ -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; +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationRole.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationRole.java new file mode 100644 index 00000000..c44891e9 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationRole.java @@ -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() { + } +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationStatus.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationStatus.java new file mode 100644 index 00000000..49fa508c --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/entity/WorkbenchRegistrationStatus.java @@ -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() { + } +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/mapper/WorkbenchRegistrationApplicationMapper.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/mapper/WorkbenchRegistrationApplicationMapper.java new file mode 100644 index 00000000..565ce2fe --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/mapper/WorkbenchRegistrationApplicationMapper.java @@ -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 { +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java new file mode 100644 index 00000000..f7abcd72 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java @@ -0,0 +1,15 @@ +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); + List listForReviewer(Long reviewerId, boolean platformAdmin); + boolean approve(Long reviewerId, boolean platformAdmin, Long applicationId); + boolean reject(Long reviewerId, boolean platformAdmin, Long applicationId, String reason); +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java new file mode 100644 index 00000000..f6f006b5 --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java @@ -0,0 +1,197 @@ +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.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 BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + + public WorkbenchRegistrationServiceImpl( + WorkbenchRegistrationApplicationMapper applicationMapper, + UserMapper userMapper, + ShopMapper shopMapper, + UserService userService, + VerificationCodeService verificationCodeService, + UserShopBindingSupport userShopBindingSupport + ) { + this.applicationMapper = applicationMapper; + this.userMapper = userMapper; + this.shopMapper = shopMapper; + this.userService = userService; + this.verificationCodeService = verificationCodeService; + this.userShopBindingSupport = userShopBindingSupport; + } + + @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); + 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 + public List 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 require(boolean condition, String message) { + if (!condition) { + throw new IllegalArgumentException(message); + } + } +} diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/vo/WorkbenchRegistrationStatusVO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/vo/WorkbenchRegistrationStatusVO.java new file mode 100644 index 00000000..15b7aa7b --- /dev/null +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/vo/WorkbenchRegistrationStatusVO.java @@ -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; +} diff --git a/JC-Salon-Frontend/src/api/admin.ts b/JC-Salon-Frontend/src/api/admin.ts index 700d9423..d4240b76 100644 --- a/JC-Salon-Frontend/src/api/admin.ts +++ b/JC-Salon-Frontend/src/api/admin.ts @@ -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('/user/workbench/registration/list') as unknown as Promise + }, + approve(id: IdType) { + return adminApi.post(`/user/workbench/registration/${id}/approve`) + }, + reject(id: IdType, reason: string) { + return adminApi.post(`/user/workbench/registration/${id}/reject`, { reason }) + } +} + export { adminApi } export default adminApi diff --git a/JC-Salon-Frontend/src/config/admin-navigation.ts b/JC-Salon-Frontend/src/config/admin-navigation.ts index 32f2b0a4..8fe6010e 100644 --- a/JC-Salon-Frontend/src/config/admin-navigation.ts +++ b/JC-Salon-Frontend/src/config/admin-navigation.ts @@ -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: '' } diff --git a/JC-Salon-Frontend/src/router/index.ts b/JC-Salon-Frontend/src/router/index.ts index 221dc1d0..f6d65d59 100644 --- a/JC-Salon-Frontend/src/router/index.ts +++ b/JC-Salon-Frontend/src/router/index.ts @@ -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 diff --git a/JC-Salon-Frontend/src/views/admin/ManageView.vue b/JC-Salon-Frontend/src/views/admin/ManageView.vue index f8f76ecf..c4012d4b 100644 --- a/JC-Salon-Frontend/src/views/admin/ManageView.vue +++ b/JC-Salon-Frontend/src/views/admin/ManageView.vue @@ -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', diff --git a/JC-Salon-Frontend/src/views/admin/PermissionsView.vue b/JC-Salon-Frontend/src/views/admin/PermissionsView.vue index fc632889..a3bcc66e 100644 --- a/JC-Salon-Frontend/src/views/admin/PermissionsView.vue +++ b/JC-Salon-Frontend/src/views/admin/PermissionsView.vue @@ -548,7 +548,7 @@ const getUserTypeText = (type: number) => { const map: Record = { 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 [] }) diff --git a/JC-Salon-Frontend/src/views/admin/WorkbenchRegistrationView.vue b/JC-Salon-Frontend/src/views/admin/WorkbenchRegistrationView.vue new file mode 100644 index 00000000..c0f886cc --- /dev/null +++ b/JC-Salon-Frontend/src/views/admin/WorkbenchRegistrationView.vue @@ -0,0 +1,57 @@ + + + diff --git a/JC-Salon-Frontend/src/views/admin/admin-helpers.ts b/JC-Salon-Frontend/src/views/admin/admin-helpers.ts index 2e5c2b57..7d1fa9c9 100644 --- a/JC-Salon-Frontend/src/views/admin/admin-helpers.ts +++ b/JC-Salon-Frontend/src/views/admin/admin-helpers.ts @@ -18,7 +18,7 @@ export const getAdminRoleLabel = (type?: number) => { case 2: return '店长' case 3: - return '美甲师' + return '店员' default: return '后台账号' } diff --git a/JC-Salon-WeChat/api/auth.js b/JC-Salon-WeChat/api/auth.js index 40ed96ba..99083d28 100644 --- a/JC-Salon-WeChat/api/auth.js +++ b/JC-Salon-WeChat/api/auth.js @@ -19,12 +19,29 @@ 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 } + }) + }, + sendCode(phone) { return request({ url: '/user/send-verification-code', diff --git a/JC-Salon-WeChat/app.json b/JC-Salon-WeChat/app.json index bd9553f0..93479560 100644 --- a/JC-Salon-WeChat/app.json +++ b/JC-Salon-WeChat/app.json @@ -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", diff --git a/JC-Salon-WeChat/pages/appointment-form/index.js b/JC-Salon-WeChat/pages/appointment-form/index.js index 532588c0..e414f937 100644 --- a/JC-Salon-WeChat/pages/appointment-form/index.js +++ b/JC-Salon-WeChat/pages/appointment-form/index.js @@ -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 diff --git a/JC-Salon-WeChat/pages/customer-detail/index.js b/JC-Salon-WeChat/pages/customer-detail/index.js index c41e227b..721f2dd8 100644 --- a/JC-Salon-WeChat/pages/customer-detail/index.js +++ b/JC-Salon-WeChat/pages/customer-detail/index.js @@ -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 || {} diff --git a/JC-Salon-WeChat/pages/employee-detail/index.wxml b/JC-Salon-WeChat/pages/employee-detail/index.wxml index 663ced2a..4a367743 100644 --- a/JC-Salon-WeChat/pages/employee-detail/index.wxml +++ b/JC-Salon-WeChat/pages/employee-detail/index.wxml @@ -32,7 +32,6 @@ 排班设置 请假管理 颜色设置 - 订单记录 diff --git a/JC-Salon-WeChat/pages/login/index.js b/JC-Salon-WeChat/pages/login/index.js index 192a29f3..3b3224ba 100644 --- a/JC-Salon-WeChat/pages/login/index.js +++ b/JC-Salon-WeChat/pages/login/index.js @@ -441,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) { @@ -457,6 +461,22 @@ Page({ } }, + 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' }) + } + }, + goRegister() { wx.navigateTo({ url: '/pages/register/index' }) }, diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js index 76bc069f..d9bc39ac 100644 --- a/JC-Salon-WeChat/pages/planning/index.js +++ b/JC-Salon-WeChat/pages/planning/index.js @@ -406,7 +406,7 @@ Page({ createAppointment() { if (!this.data.canCreateAppointment) { - wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' }) + wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' }) return } wx.navigateTo({ diff --git a/JC-Salon-WeChat/pages/register/index.js b/JC-Salon-WeChat/pages/register/index.js index 19729e37..dc08ba1d 100644 --- a/JC-Salon-WeChat/pages/register/index.js +++ b/JC-Salon-WeChat/pages/register/index.js @@ -17,6 +17,15 @@ Page({ countdownTimer: null }, + async onLoad() { + try { + const shopOptions = await authApi.getAvailableRegistrationShops() + this.setData({ shopOptions: Array.isArray(shopOptions) ? shopOptions : [] }) + } catch (error) { + this.setData({ shopOptions: [] }) + } + }, + onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) }, togglePasswordMode() { this.setData({ passwordMode: !this.data.passwordMode }) }, @@ -56,7 +65,7 @@ Page({ if (this.data.role === 'staff') { wx.showToast({ title: '店员申请功能即将开放', icon: 'none' }); return } this.setData({ loading: true }) try { - await authApi.register({ phone: form.phone, code: form.code, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, role: this.data.role }) + 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 }) this.setData({ step: 4 }) } catch (error) { wx.showToast({ title: error.message || '提交失败', icon: 'none' }) } finally { this.setData({ loading: false }) } }, diff --git a/JC-Salon-WeChat/utils/config.js b/JC-Salon-WeChat/utils/config.js index 91afbcdc..a8ca6b45 100644 --- a/JC-Salon-WeChat/utils/config.js +++ b/JC-Salon-WeChat/utils/config.js @@ -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 = { diff --git a/JC-Salon-WeChat/utils/config.local.example.js b/JC-Salon-WeChat/utils/config.local.example.js index 0f066672..cde2091c 100644 --- a/JC-Salon-WeChat/utils/config.local.example.js +++ b/JC-Salon-WeChat/utils/config.local.example.js @@ -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', diff --git a/JC-Salon-WeChat/utils/request.js b/JC-Salon-WeChat/utils/request.js index 611ade8d..b0cdaa32 100644 --- a/JC-Salon-WeChat/utils/request.js +++ b/JC-Salon-WeChat/utils/request.js @@ -112,6 +112,8 @@ function isAuthFreePath(url) { return [ '/auth/login', '/auth/register', + '/user/workbench/register/', + '/user/workbench/shops/available', '/user/send-verification-code', '/user/phone-login', '/user/check/login-shops/', diff --git a/docs/scripts/sql/工作台注册审核_20260907/工作台注册审核_20260907.sql b/docs/scripts/sql/工作台注册审核_20260907/工作台注册审核_20260907.sql new file mode 100644 index 00000000..c087dd68 --- /dev/null +++ b/docs/scripts/sql/工作台注册审核_20260907/工作台注册审核_20260907.sql @@ -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店务工作台注册审核申请'; -- 2.54.0 From a26252c020b7fde989604130a737267ebdb93f44 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 12:11:20 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=92=8C=E6=B3=A8=E5=86=8C=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E9=87=8D=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkbenchRegistrationController.java | 5 +++++ .../dto/WorkbenchRegistrationRequestDTO.java | 1 + .../service/WorkbenchRegistrationService.java | 1 + .../WorkbenchRegistrationServiceImpl.java | 15 +++++++++++++ JC-Salon-WeChat/api/auth.js | 18 ++++++++++++++++ JC-Salon-WeChat/pages/login/index.js | 21 +++++++++++++++++-- JC-Salon-WeChat/utils/request.js | 1 + 7 files changed, 60 insertions(+), 2 deletions(-) diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java index 75380872..a3a9e748 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/controller/WorkbenchRegistrationController.java @@ -34,6 +34,11 @@ public class WorkbenchRegistrationController { return Result.success(registrationService.register(request)); } + @PostMapping("/register/resubmit") + public Result resubmit(@RequestBody WorkbenchRegistrationRequestDTO request) { + return Result.success(registrationService.resubmit(request)); + } + @GetMapping("/register/status") public Result status(@RequestParam String phone) { UserDO user = userMapper.selectOne(Wrappers.lambdaQuery(UserDO.class).eq(UserDO::getPhone, phone).eq(UserDO::getIsDelete, 0).last("limit 1")); diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java index 8de1a7e8..55f03486 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java @@ -6,6 +6,7 @@ import lombok.Setter; @Getter @Setter public class WorkbenchRegistrationRequestDTO { + private Long applicationId; private String phone; private String verificationCode; private String password; diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java index f7abcd72..1779df78 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/WorkbenchRegistrationService.java @@ -9,6 +9,7 @@ import java.util.List; public interface WorkbenchRegistrationService { WorkbenchRegistrationStatusVO register(WorkbenchRegistrationRequestDTO request); WorkbenchRegistrationStatusVO getStatus(Long userId); + WorkbenchRegistrationStatusVO resubmit(WorkbenchRegistrationRequestDTO request); List listForReviewer(Long reviewerId, boolean platformAdmin); boolean approve(Long reviewerId, boolean platformAdmin, Long applicationId); boolean reject(Long reviewerId, boolean platformAdmin, Long applicationId, String reason); diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java index f6f006b5..e80fae5d 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java @@ -117,6 +117,21 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe 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 listForReviewer(Long reviewerId, boolean platformAdmin) { if (platformAdmin) { diff --git a/JC-Salon-WeChat/api/auth.js b/JC-Salon-WeChat/api/auth.js index 99083d28..cde9398a 100644 --- a/JC-Salon-WeChat/api/auth.js +++ b/JC-Salon-WeChat/api/auth.js @@ -42,6 +42,15 @@ module.exports = { }) }, + resubmitRegistration(data) { + return request({ + url: '/user/workbench/register/resubmit', + method: 'POST', + params: { __baseUrl: API_DOMAIN }, + data + }) + }, + sendCode(phone) { return request({ url: '/user/send-verification-code', @@ -81,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)}`, diff --git a/JC-Salon-WeChat/pages/login/index.js b/JC-Salon-WeChat/pages/login/index.js index 3b3224ba..cbc2bc86 100644 --- a/JC-Salon-WeChat/pages/login/index.js +++ b/JC-Salon-WeChat/pages/login/index.js @@ -481,7 +481,24 @@ Page({ wx.navigateTo({ url: '/pages/register/index' }) }, - wechatLogin() { - wx.showToast({ title: '请先使用账号登录', icon: 'none' }) + 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 }) + setTimeout(() => this.goRegister(), 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' }) + } } }) diff --git a/JC-Salon-WeChat/utils/request.js b/JC-Salon-WeChat/utils/request.js index b0cdaa32..2ddaee66 100644 --- a/JC-Salon-WeChat/utils/request.js +++ b/JC-Salon-WeChat/utils/request.js @@ -116,6 +116,7 @@ function isAuthFreePath(url) { '/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)) -- 2.54.0 From 63b226fe61f01d8a177dfcf328006ccbcd6b3f57 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 12:14:02 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E5=85=B3=E8=81=94=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=96=B0=E8=B4=A6=E5=8F=B7=E4=B8=8E=E6=B3=A8=E5=86=8C=E7=94=B3?= =?UTF-8?q?=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/WorkbenchRegistrationRequestDTO.java | 1 + .../WorkbenchRegistrationServiceImpl.java | 34 ++++++++++++++++++- JC-Salon-WeChat/pages/login/index.js | 13 +++++-- JC-Salon-WeChat/pages/register/index.js | 6 ++-- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java index 55f03486..13d6905c 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/dto/WorkbenchRegistrationRequestDTO.java @@ -7,6 +7,7 @@ import lombok.Setter; @Setter public class WorkbenchRegistrationRequestDTO { private Long applicationId; + private String wxCode; private String phone; private String verificationCode; private String password; diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java index e80fae5d..68b1e02d 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/registration/service/impl/WorkbenchRegistrationServiceImpl.java @@ -9,6 +9,9 @@ import com.xiaowang.jacyucloudsalon.core.modules.registration.entity.WorkbenchRe 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; @@ -33,6 +36,8 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe 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( @@ -41,7 +46,9 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe ShopMapper shopMapper, UserService userService, VerificationCodeService verificationCodeService, - UserShopBindingSupport userShopBindingSupport + UserShopBindingSupport userShopBindingSupport, + WechatMiniBindingMapper wechatMiniBindingMapper, + WechatMiniClientService wechatMiniClientService ) { this.applicationMapper = applicationMapper; this.userMapper = userMapper; @@ -49,6 +56,8 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe this.userService = userService; this.verificationCodeService = verificationCodeService; this.userShopBindingSupport = userShopBindingSupport; + this.wechatMiniBindingMapper = wechatMiniBindingMapper; + this.wechatMiniClientService = wechatMiniClientService; } @Override @@ -94,6 +103,7 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe 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); @@ -204,6 +214,28 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe 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); diff --git a/JC-Salon-WeChat/pages/login/index.js b/JC-Salon-WeChat/pages/login/index.js index cbc2bc86..1adfbda8 100644 --- a/JC-Salon-WeChat/pages/login/index.js +++ b/JC-Salon-WeChat/pages/login/index.js @@ -477,8 +477,14 @@ Page({ } }, - goRegister() { - wx.navigateTo({ url: '/pages/register/index' }) + 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() { @@ -489,7 +495,8 @@ Page({ const result = await authApi.wechatAutoLogin(loginResult.code) if (result.status === 'NEED_MANUAL_LOGIN') { wx.showToast({ title: '新账号请先完成手机号注册和身份审核', icon: 'none', duration: 2500 }) - setTimeout(() => this.goRegister(), 900) + const wxCode = await this.getWechatCode() + setTimeout(() => this.goRegister(wxCode), 900) return } if (result.status !== 'SUCCESS' || !result.accessToken) { diff --git a/JC-Salon-WeChat/pages/register/index.js b/JC-Salon-WeChat/pages/register/index.js index dc08ba1d..dfd2ac33 100644 --- a/JC-Salon-WeChat/pages/register/index.js +++ b/JC-Salon-WeChat/pages/register/index.js @@ -8,6 +8,7 @@ Page({ role: 'manager', passwordMode: false, form: { phone: '', code: '', password: '', confirmPassword: '', shopName: '', shopAddress: '', shopId: '' }, + wxCode: '', shopOptions: [], shopIndex: 0, selectedShopName: '', @@ -17,7 +18,8 @@ Page({ countdownTimer: null }, - async onLoad() { + async onLoad(options) { + this.setData({ wxCode: options && options.wxCode ? options.wxCode : '' }) try { const shopOptions = await authApi.getAvailableRegistrationShops() this.setData({ shopOptions: Array.isArray(shopOptions) ? shopOptions : [] }) @@ -65,7 +67,7 @@ Page({ if (this.data.role === 'staff') { wx.showToast({ title: '店员申请功能即将开放', icon: 'none' }); return } this.setData({ loading: true }) try { - 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 }) + 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 }) } }, -- 2.54.0 From f02601c25c3bccbe1b011842c516e869181432f8 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Mon, 7 Sep 2026 20:12:36 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BA=97=E5=8A=A1?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=8E=A5=E5=8F=A3=E7=BD=91=E5=85=B3=E9=89=B4?= =?UTF-8?q?=E6=9D=83=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jayucloudsalon/gateway/filter/AuthGlobalFilter.java | 2 ++ JC-Salon-Gateway/src/main/resources/application.yaml | 2 ++ nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml | 2 ++ .../namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml | 2 ++ nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml | 2 ++ 5 files changed, 10 insertions(+) diff --git a/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/filter/AuthGlobalFilter.java b/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/filter/AuthGlobalFilter.java index 280f6fe3..70630ad8 100644 --- a/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/filter/AuthGlobalFilter.java +++ b/JC-Salon-Gateway/src/main/java/com/xiaowang/jayucloudsalon/gateway/filter/AuthGlobalFilter.java @@ -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/**", diff --git a/JC-Salon-Gateway/src/main/resources/application.yaml b/JC-Salon-Gateway/src/main/resources/application.yaml index b2fab928..278b327a 100644 --- a/JC-Salon-Gateway/src/main/resources/application.yaml +++ b/JC-Salon-Gateway/src/main/resources/application.yaml @@ -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 diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index 3aee5aef..6705e43b 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -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 diff --git a/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index b2fab928..278b327a 100644 --- a/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -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 diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index b2fab928..278b327a 100644 --- a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -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 -- 2.54.0