| | |
| | | const normalizedMerchantType = computed(() => String(form.merchantType || '').trim()) |
| | | const isFoodMerchant = computed(() => normalizedMerchantType.value === '餐饮服务') |
| | | const isServiceMerchant = computed(() => isFoodMerchant.value || normalizedMerchantType.value === '景区服务') |
| | | const requiresMerchantOperator = computed(() => !isEditMode.value && ( |
| | | normalizedMerchantType.value === '景区服务' |
| | | || (isFoodMerchant.value && Number(form.canLoginMerchantApp) === 1) |
| | | )) |
| | | |
| | | function queryString(key: string, fallback = '') { |
| | | const value = route.query[key] |
| | |
| | | } |
| | | |
| | | async function checkLoginAccountAvailable() { |
| | | if (isEditMode.value || !isFoodMerchant.value || Number(form.canLoginMerchantApp) !== 1) return true |
| | | if (!requiresMerchantOperator.value) return true |
| | | if (!/^[A-Za-z0-9]{1,32}$/.test(accountForm.loginAccount)) return false |
| | | accountChecking.value = true |
| | | try { |
| | |
| | | ElMessage.warning('请输入排序') |
| | | return |
| | | } |
| | | if (!isEditMode.value && isServiceMerchant.value && Number(form.canLoginMerchantApp) === 1) { |
| | | if (requiresMerchantOperator.value) { |
| | | if (!accountForm.loginAccount.trim()) { |
| | | ElMessage.warning('请输入登录账号') |
| | | return |
| | | } |
| | | if (!/^[A-Za-z0-9]{1,32}$/.test(accountForm.loginAccount)) { |
| | | ElMessage.warning('登录账号仅支持英文和数字,长度不超过32位') |
| | | return |
| | | } |
| | | if (!(await checkLoginAccountAvailable())) return |
| | | if (!accountForm.loginPassword) { |
| | | ElMessage.warning('请输入登录密码') |
| | | return |
| | | } |
| | | if (accountForm.loginPassword.length < 6 || accountForm.loginPassword.length > 64) { |
| | | ElMessage.warning('登录密码长度须为6至64位') |
| | | return |
| | | } |
| | | if (!accountForm.confirmPassword) { |
| | | ElMessage.warning('请输入确认密码') |
| | | return |
| | | } |
| | | } |
| | |
| | | businessStatus: form.businessStatus, |
| | | longitude: Number(form.longitude || 0) || undefined, |
| | | latitude: Number(form.latitude || 0) || undefined, |
| | | canLoginMerchantApp: Number(form.canLoginMerchantApp ?? 1), |
| | | canLoginMerchantApp: requiresMerchantOperator.value ? 1 : Number(form.canLoginMerchantApp ?? 1), |
| | | loginAccount: !isEditMode.value ? accountForm.loginAccount : undefined, |
| | | loginPassword: !isEditMode.value ? accountForm.loginPassword : undefined, |
| | | groupBuyingEnabled: form.groupBuyingEnabled, |