mock-car-model-api.js 1.64 KB
/**
 * scrm getCarSeriesList / getCarTypeList mock
 * 与 car-brand-merchant-mock 子品牌 id 对齐,供四级车型 L3/L4 联调
 */

const DEFAULT_SERIES = [
	{ id: 'mock-series-1', name: 'Mock车系A' },
	{ id: 'mock-series-2', name: 'Mock车系B' }
]

const DEFAULT_TYPES = [
	{ id: 'mock-type-1', name: '2024款 标准版' },
	{ id: 'mock-type-2', name: '2024款 旗舰版' }
]

/** 按子品牌 id 返回 mock 车系列表 */
function getMockCarSeriesList({ brandId, childBrandId } = {}) {
	const key = childBrandId != null ? String(childBrandId) : String(brandId || '')
	const map = {
		'3454': [
			{ id: 'series-m7', name: '问界M7' },
			{ id: 'series-m9', name: '问界M9' }
		],
		'3503': [{ id: 'series-s9', name: '享界S9' }],
		'3502': [{ id: 'series-z1', name: '尊界M9' }],
		'3458': [{ id: 'series-r7', name: '智界R7' }],
		'3574': [{ id: 'series-sh1', name: '尚界H5' }],
		'3067': [
			{ id: 'series-free', name: 'FREE' },
			{ id: 'series-dream', name: '梦想家' }
		]
	}
	return map[key] || DEFAULT_SERIES
}

/** 按车系 id 返回 mock 款型列表 */
function getMockCarTypeList(carSeriesId) {
	const key = carSeriesId != null ? String(carSeriesId) : ''
	const map = {
		'series-m7': [
			{ id: 'type-m7-max', name: '2024款 Max' },
			{ id: 'type-m7-ultra', name: '2024款 Ultra' }
		],
		'series-m9': [{ id: 'type-m9-pro', name: '2024款 增程版' }],
		'series-free': [{ id: 'type-free-2024', name: '2024款 超长续航' }],
		'series-dream': [{ id: 'type-dream-2024', name: '2024款 尊享版' }]
	}
	return map[key] || DEFAULT_TYPES
}

module.exports = {
	getMockCarSeriesList,
	getMockCarTypeList,
	DEFAULT_SERIES,
	DEFAULT_TYPES
}