fix;提交代码子账号
This commit is contained in:
@@ -49,6 +49,8 @@ import {
|
||||
|
||||
validateStoreStep3,
|
||||
|
||||
patchEnvPhotoAt,
|
||||
|
||||
} from '../lib/storeDraft';
|
||||
|
||||
|
||||
@@ -73,6 +75,14 @@ function isPhoneConflictMessage(message: string) {
|
||||
|
||||
|
||||
|
||||
function isPhoneValidationMessage(message: string) {
|
||||
|
||||
return message.includes('联系电话') || message.includes('手机号');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default function StoreCreatePage() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
@@ -99,7 +109,6 @@ export default function StoreCreatePage() {
|
||||
|
||||
function reportFormError(message: string) {
|
||||
setSubmitError(message);
|
||||
toastError(message);
|
||||
}
|
||||
|
||||
const stepFromUrl = Number(params.get('step') || 0);
|
||||
@@ -201,7 +210,6 @@ export default function StoreCreatePage() {
|
||||
.catch((e) => {
|
||||
const msg = e instanceof Error ? e.message : '加载开城城市失败';
|
||||
setCitiesError(msg);
|
||||
toastError(msg);
|
||||
});
|
||||
|
||||
}, []);
|
||||
@@ -244,6 +252,22 @@ export default function StoreCreatePage() {
|
||||
|
||||
|
||||
|
||||
function patchEnvPhotoUrl(index: number, url: string) {
|
||||
|
||||
setForm((prev) => ({
|
||||
|
||||
...prev,
|
||||
|
||||
envPhotoUrls: patchEnvPhotoAt(prev.envPhotoUrls, index, url),
|
||||
|
||||
}));
|
||||
|
||||
setSubmitError('');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function bindRegionSelection(codes: string[]) {
|
||||
|
||||
const binding = resolveRegionBinding(codes, cities);
|
||||
@@ -308,11 +332,11 @@ export default function StoreCreatePage() {
|
||||
if (!phoneCheck.available) {
|
||||
const phoneMsg = phoneCheck.message ?? '该手机号已绑定门店,请更换';
|
||||
setFieldErrors({ phone: phoneMsg });
|
||||
toastError(phoneMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch {
|
||||
} catch (e) {
|
||||
reportFormError(e instanceof Error ? e.message : '手机号校验失败');
|
||||
return;
|
||||
|
||||
} finally {
|
||||
@@ -352,6 +376,10 @@ export default function StoreCreatePage() {
|
||||
const step1Msg = validateStoreStep1(form);
|
||||
|
||||
if (step1Msg) {
|
||||
if (isPhoneValidationMessage(step1Msg)) {
|
||||
setFieldErrors({ phone: step1Msg });
|
||||
return;
|
||||
}
|
||||
reportFormError(step1Msg);
|
||||
goStep(1);
|
||||
return;
|
||||
@@ -389,13 +417,16 @@ export default function StoreCreatePage() {
|
||||
|
||||
});
|
||||
|
||||
goStep(1);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
reportFormError(e instanceof Error ? e.message : '手机号校验失败');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const envPhotoUrls = form.envPhotoUrls.map((u) => u.trim()).filter(Boolean);
|
||||
|
||||
@@ -444,11 +475,10 @@ export default function StoreCreatePage() {
|
||||
const message = e instanceof Error ? e.message : '提交失败';
|
||||
if (isPhoneConflictMessage(message)) {
|
||||
setFieldErrors({ phone: message });
|
||||
toastError(message);
|
||||
goStep(1);
|
||||
return;
|
||||
}
|
||||
setSubmitError(message);
|
||||
toastError(message);
|
||||
} finally {
|
||||
|
||||
setSubmitting(false);
|
||||
@@ -725,15 +755,7 @@ export default function StoreCreatePage() {
|
||||
|
||||
onWechatReadyChange={setWechatReady}
|
||||
|
||||
onChange={(nextUrl) => {
|
||||
|
||||
const envPhotoUrls = [...form.envPhotoUrls];
|
||||
|
||||
envPhotoUrls[index] = nextUrl;
|
||||
|
||||
patchForm({ envPhotoUrls });
|
||||
|
||||
}}
|
||||
onChange={(nextUrl) => patchEnvPhotoUrl(index, nextUrl)}
|
||||
|
||||
/>
|
||||
|
||||
@@ -805,22 +827,44 @@ export default function StoreCreatePage() {
|
||||
|
||||
</div>
|
||||
|
||||
<section className="partner-form-card partner-store-phone-summary">
|
||||
<section className="partner-form-card">
|
||||
|
||||
<div className="partner-store-phone-summary-main">
|
||||
<div className="partner-field">
|
||||
|
||||
<span className="label-md text-muted">门店登录手机号</span>
|
||||
<label>门店登录手机号 <span className="text-primary">*</span></label>
|
||||
|
||||
<span className="body-md">{form.phone.trim() || '未填写'}</span>
|
||||
<div className="partner-field-input">
|
||||
|
||||
<span className="material-symbols-outlined">call</span>
|
||||
|
||||
<input
|
||||
|
||||
type="tel"
|
||||
|
||||
placeholder="请输入11位手机号"
|
||||
|
||||
value={form.phone}
|
||||
|
||||
onChange={(e) => patchForm({ phone: e.target.value })}
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
{fieldErrors.phone && (
|
||||
|
||||
<p className="partner-field-error" role="alert">{fieldErrors.phone}</p>
|
||||
|
||||
)}
|
||||
|
||||
<p className="label-md text-muted" style={{ marginTop: 8 }}>
|
||||
|
||||
该手机号将作为门店端登录账号,提交前会再次校验是否已被占用。
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" className="partner-weekly-link" onClick={() => goStep(1)}>
|
||||
|
||||
修改
|
||||
|
||||
</button>
|
||||
|
||||
</section>
|
||||
|
||||
<section className="partner-form-card">
|
||||
|
||||
Reference in New Issue
Block a user