实现Salon工作台注册审核闭环
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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' })
|
||||
},
|
||||
|
||||
@@ -406,7 +406,7 @@ Page({
|
||||
|
||||
createAppointment() {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.navigateTo({
|
||||
|
||||
@@ -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 }) }
|
||||
},
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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/',
|
||||
|
||||
Reference in New Issue
Block a user