支持管理账号手机号选填

This commit is contained in:
2026-07-21 07:42:32 +08:00
parent 8aa77ab44c
commit 0d947e4784
18 changed files with 192 additions and 68 deletions
+1 -1
View File
@@ -198,7 +198,7 @@ export interface CustomerCreateRequest {
export interface EmployeeCreateRequest {
nickname: string
phone: string
phone?: string
account: string
password?: string
contactPhone?: string
@@ -82,9 +82,9 @@
</div>
<div class="field"><label class="required">昵称</label><input v-model.trim="editForm.nickname" placeholder="请输入昵称" /></div>
<div class="field"><label class="required">登录手机号</label><input v-model.trim="editForm.phone" inputmode="tel" placeholder="请输入登录手机号" /></div>
<div class="field"><label>登录手机号</label><input v-model.trim="editForm.phone" inputmode="tel" placeholder="选填,填写后用于手机号登录" /></div>
<div class="field"><label>联系电话</label><input v-model.trim="editForm.contactPhone" inputmode="tel" placeholder="请输入联系电话" /></div>
<div class="field"><label class="required">微信号</label><input v-model.trim="editForm.wechatId" placeholder="请输入微信号" /></div>
<div class="field"><label>微信号</label><input v-model.trim="editForm.wechatId" placeholder="请输入微信号" /></div>
<div class="field"><label>身份/级别</label><input v-model.trim="editForm.identity" placeholder="例如:高级美甲师" /></div>
<div class="field">
<label>状态</label>
@@ -361,14 +361,11 @@ const validateEditForm = (): boolean => {
toast.error('请输入员工昵称')
return false
}
if (!phonePattern.test(editForm.phone.trim())) {
const phone = editForm.phone.trim()
if (phone && !phonePattern.test(phone)) {
toast.error('请输入正确的登录手机号')
return false
}
if (!editForm.wechatId.trim()) {
toast.error('请输入微信号')
return false
}
return true
}
+11 -6
View File
@@ -29,7 +29,7 @@
>
<div class="modal-form">
<div class="field"><label class="required">姓名</label><input v-model.trim="createForm.nickname" placeholder="请输入姓名" /></div>
<div class="field"><label class="required">手机号</label><input v-model.trim="createForm.phone" inputmode="numeric" placeholder="请输入手机号" /></div>
<div class="field"><label>手机号</label><input v-model.trim="createForm.phone" inputmode="numeric" placeholder="选填,填写后用于手机号登录" /></div>
<div class="field"><label class="required">登录账号</label><input v-model.trim="createForm.account" placeholder="请输入登录账号" /></div>
<div class="field"><label>初始密码</label><input v-model="createForm.password" type="password" placeholder="不填则使用默认密码" /></div>
<div class="field"><label>微信号</label><input v-model.trim="createForm.wechatId" placeholder="请输入微信号" /></div>
@@ -79,6 +79,7 @@ const createModalVisible = ref(false)
const creating = ref(false)
const defaultPasswordNoticeVisible = ref(false)
const defaultPasswordNoticePassword = ref('')
const phonePattern = /^1[3-9]\d{9}$/
const buildEmptyCreateForm = (): CreateEmployeeForm => ({
nickname: '',
phone: '',
@@ -177,19 +178,23 @@ const createEmployee = async (): Promise<void> => {
const phone = createForm.phone.trim()
const account = createForm.account.trim()
const password = createForm.password.trim()
const wechatId = createForm.wechatId.trim() || phone
if (!nickname || !phone || !account) {
const wechatId = createForm.wechatId.trim()
if (!nickname || !account) {
toast.error('请补全美甲师信息')
return
}
if (phone && !phonePattern.test(phone)) {
toast.error('请输入正确的手机号')
return
}
creating.value = true
try {
const requestData: EmployeeCreateRequest = {
nickname,
phone,
phone: phone || undefined,
account,
contactPhone: phone,
wechatId
contactPhone: phone || undefined,
wechatId: wechatId || undefined
}
if (password) {
requestData.password = password