|
| 1 | +const CATEGORIES = [ |
| 2 | + { id: 141, name: '黑咖/果咖' }, |
| 3 | + { id: 133, name: '奶咖' }, |
| 4 | + { id: 136, name: '蔬果汁' }, |
| 5 | + { id: 135, name: '水果茶' }, |
| 6 | + { id: 139, name: '奶茶/暖饮' } |
| 7 | +] |
| 8 | + |
| 9 | +const DRINKS = [ |
| 10 | + { id: 289, name: '美式', price: 15, categoryId: 141, categoryName: '黑咖/果咖', description: '', imageUrl: '' }, |
| 11 | + { id: 293, name: '白桃茶美式', price: 16, categoryId: 141, categoryName: '黑咖/果咖', description: '清爽茶香', imageUrl: '' }, |
| 12 | + { id: 295, name: '杨桃油柑美式', price: 18, categoryId: 141, categoryName: '黑咖/果咖', description: '鲜油柑+杨桃', imageUrl: '' }, |
| 13 | + { id: 353, name: '凤梨美式', price: 18, categoryId: 141, categoryName: '黑咖/果咖', description: '推荐', imageUrl: '' }, |
| 14 | + { id: 362, name: '葡萄美式', price: 18, categoryId: 141, categoryName: '黑咖/果咖', description: '', imageUrl: '' }, |
| 15 | + { id: 294, name: '爆柠美式', price: 18, categoryId: 141, categoryName: '黑咖/果咖', description: '', imageUrl: '' }, |
| 16 | + { id: 296, name: '鲜橙美式', price: 20, categoryId: 141, categoryName: '黑咖/果咖', description: '', imageUrl: '' }, |
| 17 | + |
| 18 | + { id: 393, name: '焦糖蜂窝拿铁', price: 20, categoryId: 133, categoryName: '奶咖', description: '', imageUrl: '' }, |
| 19 | + { id: 395, name: '小黄油拿铁', price: 20, categoryId: 133, categoryName: '奶咖', description: '', imageUrl: '' }, |
| 20 | + { id: 368, name: '黄油Dirty', price: 20, categoryId: 133, categoryName: '奶咖', description: '到店制作 大口喝', imageUrl: '' }, |
| 21 | + { id: 390, name: '轻芝士拿铁', price: 20, categoryId: 133, categoryName: '奶咖', description: '法国kiri芝士', imageUrl: '' }, |
| 22 | + { id: 195, name: '拿铁', price: 18, categoryId: 133, categoryName: '奶咖', description: '', imageUrl: '' }, |
| 23 | + { id: 384, name: 'SOE澳白', price: 18, categoryId: 133, categoryName: '奶咖', description: '小热杯 更"咖啡"!', imageUrl: '' }, |
| 24 | + { id: 383, name: '秋玫瑰拿铁', price: 20, categoryId: 133, categoryName: '奶咖', description: '玫瑰与奶咖的双向奔赴', imageUrl: '' }, |
| 25 | + { id: 299, name: '生椰拿铁', price: 20, categoryId: 133, categoryName: '奶咖', description: '', imageUrl: '' }, |
| 26 | + { id: 297, name: '橘皮拿铁', price: 20, categoryId: 133, categoryName: '奶咖', description: '', imageUrl: '' }, |
| 27 | + { id: 208, name: '燕麦拿铁', price: 22, categoryId: 133, categoryName: '奶咖', description: 'OATLY燕麦奶', imageUrl: '' }, |
| 28 | + |
| 29 | + { id: 394, name: '杨桃+油柑', price: 18, categoryId: 136, categoryName: '蔬果汁', description: '', imageUrl: '' }, |
| 30 | + { id: 389, name: '胡萝卜汁', price: 13, categoryId: 136, categoryName: '蔬果汁', description: '补充维生素A', imageUrl: '' }, |
| 31 | + { id: 386, name: '青瓜+西芹+苹果', price: 15, categoryId: 136, categoryName: '蔬果汁', description: '全能果蔬饮就它了', imageUrl: '' }, |
| 32 | + { id: 387, name: '青瓜+雪梨+柠檬', price: 15, categoryId: 136, categoryName: '蔬果汁', description: '一口喝出清润好气色', imageUrl: '' }, |
| 33 | + { id: 313, name: '苹果胡萝卜汁', price: 17, categoryId: 136, categoryName: '蔬果汁', description: '现榨无糖0负担', imageUrl: '' }, |
| 34 | + |
| 35 | + { id: 315, name: '蜂蜜柚子茶', price: 12, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 36 | + { id: 300, name: '海盐柠檬', price: 13, categoryId: 135, categoryName: '水果茶', description: '补充电解质', imageUrl: '' }, |
| 37 | + { id: 302, name: '鸭屎香柠檬茶', price: 13, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 38 | + { id: 301, name: '白桃乌龙柠檬茶', price: 13, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 39 | + { id: 305, name: '满杯百香果', price: 13, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 40 | + { id: 306, name: '百香益力多', price: 16, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 41 | + { id: 307, name: '柠檬益力多', price: 16, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 42 | + { id: 364, name: '黑加仑柠檬茶', price: 16, categoryId: 135, categoryName: '水果茶', description: '', imageUrl: '' }, |
| 43 | + { id: 303, name: '杨桃油柑柠檬茶', price: 16, categoryId: 135, categoryName: '水果茶', description: '鲜油柑榨+杨桃', imageUrl: '' }, |
| 44 | + |
| 45 | + { id: 371, name: '抹茶脑袋', price: 17, categoryId: 139, categoryName: '奶茶/暖饮', description: '冷热皆宜', imageUrl: '' }, |
| 46 | + { id: 372, name: '茶萃奶白', price: 16, categoryId: 139, categoryName: '奶茶/暖饮', description: '冷热皆宜', imageUrl: '' }, |
| 47 | + { id: 316, name: '黑糖姜母茶', price: 12, categoryId: 139, categoryName: '奶茶/暖饮', description: '热饮 红枣配枸杞', imageUrl: '' }, |
| 48 | + { id: 381, name: '红糖姜桃胶撞奶', price: 18, categoryId: 139, categoryName: '奶茶/暖饮', description: '热饮 姜跟牛奶很般配', imageUrl: '' } |
| 49 | +] |
| 50 | + |
| 51 | +function buildSkuSchema(categoryId) { |
| 52 | + const tempDim = { |
| 53 | + key: 'temperature', label: '温度', multiple: false, |
| 54 | + options: [ |
| 55 | + { value: 'ice', label: '冰' }, |
| 56 | + { value: 'hot', label: '热' } |
| 57 | + ] |
| 58 | + } |
| 59 | + const sugarDim = { |
| 60 | + key: 'sugar', label: '糖度', multiple: false, |
| 61 | + options: [ |
| 62 | + { value: 'none', label: '无糖' }, |
| 63 | + { value: 'less', label: '少糖' }, |
| 64 | + { value: 'normal', label: '标准' }, |
| 65 | + { value: 'more', label: '多糖' } |
| 66 | + ] |
| 67 | + } |
| 68 | + const cupDim = { |
| 69 | + key: 'cupSize', label: '杯型', multiple: false, |
| 70 | + options: [ |
| 71 | + { value: 'medium', label: '中杯', extraPrice: 0 }, |
| 72 | + { value: 'large', label: '大杯', extraPrice: 3 }, |
| 73 | + { value: 'xlarge', label: '超大杯', extraPrice: 6 } |
| 74 | + ] |
| 75 | + } |
| 76 | + const milkToppings = { |
| 77 | + key: 'toppings', label: '加料', multiple: true, |
| 78 | + options: [ |
| 79 | + { value: 'oatMilk', label: '燕麦奶', extraPrice: 3 }, |
| 80 | + { value: 'coconut', label: '椰浆', extraPrice: 3 }, |
| 81 | + { value: 'extraShot', label: '额外浓缩', extraPrice: 5 } |
| 82 | + ] |
| 83 | + } |
| 84 | + const teaToppings = { |
| 85 | + key: 'toppings', label: '加料', multiple: true, |
| 86 | + options: [ |
| 87 | + { value: 'pearl', label: '珍珠', extraPrice: 2 }, |
| 88 | + { value: 'jelly', label: '椰果', extraPrice: 2 } |
| 89 | + ] |
| 90 | + } |
| 91 | + const juiceCupDim = { |
| 92 | + key: 'cupSize', label: '杯型', multiple: false, |
| 93 | + options: [ |
| 94 | + { value: 'medium', label: '中杯', extraPrice: 0 }, |
| 95 | + { value: 'large', label: '大杯', extraPrice: 3 } |
| 96 | + ] |
| 97 | + } |
| 98 | + |
| 99 | + switch (categoryId) { |
| 100 | + case 141: return { dimensions: [tempDim, sugarDim] } |
| 101 | + case 133: return { dimensions: [tempDim, sugarDim, cupDim, milkToppings] } |
| 102 | + case 136: return { dimensions: [tempDim, juiceCupDim] } |
| 103 | + case 135: return { dimensions: [tempDim, sugarDim, cupDim] } |
| 104 | + case 139: return { dimensions: [tempDim, sugarDim, cupDim, teaToppings] } |
| 105 | + default: return { dimensions: [tempDim, sugarDim] } |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +function buildCatalog() { |
| 110 | + return DRINKS.map(d => ({ |
| 111 | + ...d, |
| 112 | + skuSchema: buildSkuSchema(d.categoryId) |
| 113 | + })) |
| 114 | +} |
| 115 | + |
| 116 | +module.exports = { CATEGORIES, DRINKS, buildCatalog, buildSkuSchema } |
0 commit comments