// 分类页面mock数据模块 // 导出医药分类数据 export const medicineCategories = [ { id: 'cold', name: '感冒发烧', icon: '🤧', desc: '解热镇痛', color: '#2196F3' }, { id: 'stomach', name: '肠胃用药', icon: '🤢', desc: '消化系统', color: '#4CAF50' }, { id: 'pain', name: '止痛消炎', icon: '💊', desc: '镇痛消炎', color: '#F44336' }, { id: 'skin', name: '皮肤用药', icon: '🤕', desc: '皮肤护理', color: '#9C27B0' }, { id: 'vitamin', name: '维生素', icon: '🍊', desc: '营养补充', color: '#FF9800' }, { id: 'chronic', name: '慢性病', icon: '🫀', desc: '长期管理', color: '#795548' }, { id: 'child', name: '儿童用药', icon: '👶', desc: '儿童专用', color: '#00BCD4' }, { id: 'external', name: '外用药品', icon: '🧴', desc: '外用制剂', color: '#8BC34A' }, { id: 'device', name: '医疗器械', icon: '🩺', desc: '医疗设备', color: '#607D8B' }, { id: 'health', name: '健康食品', icon: '🥗', desc: '保健食品', color: '#FFC107' } ] // 导出mock商品数据 export const mockProducts = { cold: [ { id: 'cold1', name: '布洛芬缓释胶囊', specification: '0.3g*24粒', price: 18.5, originalPrice: 25.8, image: '/static/images/default-product.png', manufacturer: '修正药业', sales: 2560, badge: '热销' }, { id: 'cold2', name: '板蓝根颗粒', specification: '10g*20袋', price: 22.8, originalPrice: 29.9, image: '/static/images/default-product.png', manufacturer: '白云山', sales: 1890, badge: '推荐' }, { id: 'cold3', name: '连花清瘟胶囊', specification: '0.35g*36粒', price: 42.8, originalPrice: 48.0, image: '/static/images/default-product.png', manufacturer: '以岭药业', sales: 3200, badge: '爆款' }, { id: 'cold4', name: '对乙酰氨基酚片', specification: '0.5g*12片', price: 8.9, originalPrice: 12.0, image: '/static/images/default-product.png', manufacturer: '强生制药', sales: 1420, badge: '特价' }, { id: 'cold5', name: '感冒清热颗粒', specification: '3g*10袋', price: 16.5, originalPrice: 19.9, image: '/static/images/default-product.png', manufacturer: '同仁堂', sales: 980, badge: '新品' }, { id: 'cold6', name: '复方氨酚烷胺片', specification: '10片/盒', price: 12.8, originalPrice: 15.0, image: '/static/images/default-product.png', manufacturer: '三九医药', sales: 1650, badge: '家庭装' } ], stomach: [ { id: 'stomach1', name: '胃康灵胶囊', specification: '0.4g*24粒', price: 32.8, originalPrice: 38.5, image: '/static/images/default-product.png', manufacturer: '三九医药', sales: 890, badge: '热销' }, { id: 'stomach2', name: '奥美拉唑肠溶胶囊', specification: '20mg*14粒', price: 28.5, originalPrice: 35.0, image: '/static/images/default-product.png', manufacturer: '阿斯利康', sales: 1250, badge: '处方药' }, { id: 'stomach3', name: '健胃消食片', specification: '0.8g*32片', price: 15.9, originalPrice: 19.9, image: '/static/images/default-product.png', manufacturer: '江中制药', sales: 2100, badge: '推荐' }, { id: 'stomach4', name: '蒙脱石散', specification: '3g*10袋', price: 18.6, originalPrice: 22.0, image: '/static/images/default-product.png', manufacturer: '益普生', sales: 1780, badge: '止泻' }, { id: 'stomach5', name: '多潘立酮片', specification: '10mg*30片', price: 22.8, originalPrice: 26.5, image: '/static/images/default-product.png', manufacturer: '西安杨森', sales: 950, badge: '促消化' }, { id: 'stomach6', name: '铝碳酸镁咀嚼片', specification: '0.5g*20片', price: 25.9, originalPrice: 29.9, image: '/static/images/default-product.png', manufacturer: '拜耳', sales: 1320, badge: '护胃' } ], pain: [ { id: 'pain1', name: '阿莫西林胶囊', specification: '0.25g*24粒', price: 28.5, originalPrice: 35.0, image: '/static/images/default-product.png', manufacturer: '华北制药', sales: 1560, badge: '处方药' }, { id: 'pain2', name: '双氯芬酸钠缓释片', specification: '75mg*10片', price: 19.8, originalPrice: 24.0, image: '/static/images/default-product.png', manufacturer: '诺华制药', sales: 1280, badge: '止痛' }, { id: 'pain3', name: '云南白药胶囊', specification: '0.25g*32粒', price: 35.9, originalPrice: 42.0, image: '/static/images/default-product.png', manufacturer: '云南白药', sales: 2350, badge: '经典' }, { id: 'pain4', name: '塞来昔布胶囊', specification: '0.2g*10粒', price: 48.6, originalPrice: 55.0, image: '/static/images/default-product.png', manufacturer: '辉瑞', sales: 890, badge: '抗炎' }, { id: 'pain5', name: '布洛芬片', specification: '0.1g*24片', price: 12.5, originalPrice: 15.0, image: '/static/images/default-product.png', manufacturer: '中美史克', sales: 1680, badge: '经济装' }, { id: 'pain6', name: '头孢克肟胶囊', specification: '0.1g*6粒', price: 32.8, originalPrice: 38.0, image: '/static/images/default-product.png', manufacturer: '广州白云山', sales: 1120, badge: '抗生素' } ] } // 为其他分类生成默认商品数据 export const generateDefaultProducts = (categoryId: string) => { const baseProducts = [ { name: '通用药品1', price: 25.8, manufacturer: '知名药企', sales: 1200 }, { name: '通用药品2', price: 18.5, manufacturer: '知名药企', sales: 950 }, { name: '通用药品3', price: 32.0, manufacturer: '知名药企', sales: 1450 }, { name: '通用药品4', price: 22.8, manufacturer: '知名药企', sales: 880 }, { name: '通用药品5', price: 28.9, manufacturer: '知名药企', sales: 1100 }, { name: '通用药品6', price: 19.9, manufacturer: '知名药企', sales: 920 } ] return baseProducts.map((product, index) => ({ id: `${categoryId}${index + 1}`, ...product, specification: '规格待定', originalPrice: product.price * 1.2, image: '/static/images/default-product.png', badge: index === 0 ? '热销' : index === 1 ? '推荐' : '' })) } // 获取分类商品数据 export const getCategoryProducts = (categoryId: string) => { if (mockProducts[categoryId]) { return mockProducts[categoryId] } else { return generateDefaultProducts(categoryId) } } // 获取分类信息 export const getCategoryInfo = (categoryId: string) => { const category = medicineCategories.find(cat => cat.id === categoryId) if (category) { return { name: category.name, desc: category.desc } } else { // 返回默认分类信息 return { name: '感冒发烧', desc: '解热镇痛' } } }