You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
2.3 KiB
32 lines
2.3 KiB
import type { Product, ConstitutionType } from '../types'
|
|
|
|
// 模拟产品数据
|
|
export const mockProducts: Product[] = [
|
|
{ id: 1, name: '黄芪精口服液', category: '补气类', description: '补气固表', efficacy: '补气固表,增强免疫力', suitable: '气虚质', price: 68, imageUrl: '', mallUrl: 'https://mall.example.com/product/1' },
|
|
{ id: 2, name: '人参蜂王浆', category: '补气类', description: '补气养血', efficacy: '补气养血,改善疲劳', suitable: '气虚质', price: 128, imageUrl: '', mallUrl: 'https://mall.example.com/product/2' },
|
|
{ id: 3, name: '鹿茸参精胶囊', category: '温阳类', description: '温肾壮阳', efficacy: '温肾壮阳,补气养血', suitable: '阳虚质', price: 268, imageUrl: '', mallUrl: 'https://mall.example.com/product/3' },
|
|
{ id: 4, name: '枸杞原浆', category: '滋阴类', description: '滋补肝肾', efficacy: '滋补肝肾,明目润肺', suitable: '阴虚质', price: 158, imageUrl: '', mallUrl: 'https://mall.example.com/product/4' },
|
|
{ id: 5, name: '红豆薏米粉', category: '祛湿类', description: '健脾祛湿', efficacy: '健脾祛湿,消肿利水', suitable: '痰湿质', price: 39, imageUrl: '', mallUrl: 'https://mall.example.com/product/5' },
|
|
{ id: 6, name: '三七粉', category: '活血类', description: '活血化瘀', efficacy: '活血化瘀,消肿止痛', suitable: '血瘀质', price: 128, imageUrl: '', mallUrl: 'https://mall.example.com/product/6' },
|
|
{ id: 7, name: '玫瑰花茶', category: '理气类', description: '疏肝理气', efficacy: '疏肝理气,美容养颜', suitable: '气郁质', price: 38, imageUrl: '', mallUrl: 'https://mall.example.com/product/7' },
|
|
{ id: 8, name: '益生菌粉', category: '抗敏类', description: '调节肠道', efficacy: '调节肠道,增强免疫', suitable: '特禀质', price: 98, imageUrl: '', mallUrl: 'https://mall.example.com/product/8' }
|
|
]
|
|
|
|
// 体质-产品关联
|
|
const constitutionProductMap: Record<ConstitutionType, number[]> = {
|
|
pinghe: [1, 2],
|
|
qixu: [1, 2],
|
|
yangxu: [3],
|
|
yinxu: [4],
|
|
tanshi: [5],
|
|
shire: [5],
|
|
xueyu: [6],
|
|
qiyu: [7],
|
|
tebing: [8]
|
|
}
|
|
|
|
// 根据体质获取推荐产品
|
|
export function getProductsByConstitution(type: ConstitutionType): Product[] {
|
|
const productIds = constitutionProductMap[type] || []
|
|
return mockProducts.filter(p => productIds.includes(p.id))
|
|
}
|
|
|