mock-car-model-api.js
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* 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
}