城市合伙人端开店城市屁默认郑州
This commit is contained in:
@@ -36,6 +36,20 @@ export function formatRegionLabel(region: ParsedChinaRegion): string {
|
||||
return `${region.province} / ${region.city} / ${region.district}`;
|
||||
}
|
||||
|
||||
/** 合伙人录店默认省市区 adcode:河南省 / 郑州市 / 金水区 */
|
||||
export const DEFAULT_REGION_CODES = ['41', '4101', '410105'] as const;
|
||||
|
||||
export function getDefaultPartnerRegionForm() {
|
||||
const regionCodes = [...DEFAULT_REGION_CODES];
|
||||
const parsed = parseRegionCodes(regionCodes);
|
||||
return {
|
||||
regionCodes,
|
||||
province: parsed?.province ?? '河南省',
|
||||
city: parsed?.city ?? '郑州市',
|
||||
district: parsed?.district ?? '金水区',
|
||||
};
|
||||
}
|
||||
|
||||
export function matchOpenCityId(cities: OpenCityRef[], districtCode: string): string | undefined {
|
||||
const cityCode = districtCodeToCityCode(districtCode);
|
||||
return (
|
||||
|
||||
@@ -27,12 +27,11 @@ export function storeDraftKey(accountId?: string): string {
|
||||
return accountId ? `${STORE_DRAFT_KEY}_${accountId}` : STORE_DRAFT_KEY;
|
||||
}
|
||||
|
||||
import { getDefaultPartnerRegionForm } from './china-region';
|
||||
|
||||
export const defaultStoreForm = (): StoreDraftForm => ({
|
||||
regionCodes: [],
|
||||
...getDefaultPartnerRegionForm(),
|
||||
cityId: '',
|
||||
province: '',
|
||||
city: '',
|
||||
district: '',
|
||||
name: '',
|
||||
phone: '',
|
||||
address: '',
|
||||
@@ -54,7 +53,7 @@ export function normalizeStringArray(raw: unknown, length: number): string[] {
|
||||
|
||||
function normalizeForm(raw: Record<string, unknown>): StoreDraftForm {
|
||||
const base = defaultStoreForm();
|
||||
const regionCodes = Array.isArray(raw.regionCodes)
|
||||
const regionCodes = Array.isArray(raw.regionCodes) && raw.regionCodes.length >= 3
|
||||
? raw.regionCodes.map((code) => String(code))
|
||||
: base.regionCodes;
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user