From a3d3e21085c46c41125260e3265eb1f15a36e85d Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Tue, 14 Apr 2026 00:06:59 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A5=97=E8=A3=85=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E6=89=A3=E9=99=A4=E9=85=8D=E4=BB=B6=E4=BB=B7=E5=80=BC=E5=90=8E?= =?UTF-8?q?=E5=86=8D=E5=88=86=E6=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 芳香调理-香薰机¥375,家庭医生-香薰机+木盒¥475,全精油-香薰机+竹木架¥575 Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/composables/useKitCost.js | 6 +++--- frontend/src/config/kits.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/composables/useKitCost.js b/frontend/src/composables/useKitCost.js index f3f46a2..c7b5af9 100644 --- a/frontend/src/composables/useKitCost.js +++ b/frontend/src/composables/useKitCost.js @@ -37,9 +37,9 @@ export function useKitCost() { } if (totalBottlePrice === 0) return {} - // Proportional allocation — kit accessories treated as freebies, - // so oil cost = min(kit price, sum of bottle prices) - const effectivePrice = Math.min(kit.price, totalBottlePrice) + // Proportional allocation — subtract accessory value, then cap at bottle price sum + const oilBudget = kit.price - (kit.accessoryValue || 0) + const effectivePrice = Math.min(oilBudget, totalBottlePrice) const perDrop = {} for (const name of resolved) { const meta = oils.oilsMeta[name] diff --git a/frontend/src/config/kits.js b/frontend/src/config/kits.js index 8b173d5..213f0b1 100644 --- a/frontend/src/config/kits.js +++ b/frontend/src/config/kits.js @@ -1,11 +1,13 @@ // doTERRA 套装配置 // 价格和内容更新频率低,手动维护即可 // bottleCount: 某种油在套装中的瓶数(用于成本分摊和可做次数计算,默认1) +// accessoryValue: 配件价值(香薰机、木盒等),从套装价中扣除后再分摊到精油 export const KITS = [ { id: 'aroma', name: '芳香调理套装', price: 2950, + accessoryValue: 375, // 香薰机 oils: [ '茶树', '野橘', '椒样薄荷', '薰衣草', '芳香调理', '安定情绪', '保卫', '舒缓', @@ -16,6 +18,7 @@ export const KITS = [ id: 'family', name: '家庭医生套装', price: 2250, + accessoryValue: 475, // 香薰机375 + 木盒100 oils: [ '乳香', '茶树', '薰衣草', '柠檬', '椒样薄荷', '西班牙牛至', '乐活', '舒缓', '保卫', '顺畅呼吸', @@ -53,6 +56,7 @@ export const KITS = [ '柑橘清新', '顺畅呼吸', '净化清新', '赋活呼吸', '天然防护', '椰子油', ], + accessoryValue: 575, // 香薰机375 + 竹木架200 // 115mL×1 + 30mL×6 = 295mL, 标准瓶115mL, 约2.57瓶 bottleCount: { '椰子油': 2.57 }, },