feat: 套装成本扣除配件价值后再分摊
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Has been cancelled
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Has been cancelled
芳香调理-香薰机¥375,家庭医生-香薰机+木盒¥475,全精油-香薰机+竹木架¥575 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,9 +37,9 @@ export function useKitCost() {
|
|||||||
}
|
}
|
||||||
if (totalBottlePrice === 0) return {}
|
if (totalBottlePrice === 0) return {}
|
||||||
|
|
||||||
// Proportional allocation — kit accessories treated as freebies,
|
// Proportional allocation — subtract accessory value, then cap at bottle price sum
|
||||||
// so oil cost = min(kit price, sum of bottle prices)
|
const oilBudget = kit.price - (kit.accessoryValue || 0)
|
||||||
const effectivePrice = Math.min(kit.price, totalBottlePrice)
|
const effectivePrice = Math.min(oilBudget, totalBottlePrice)
|
||||||
const perDrop = {}
|
const perDrop = {}
|
||||||
for (const name of resolved) {
|
for (const name of resolved) {
|
||||||
const meta = oils.oilsMeta[name]
|
const meta = oils.oilsMeta[name]
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
// doTERRA 套装配置
|
// doTERRA 套装配置
|
||||||
// 价格和内容更新频率低,手动维护即可
|
// 价格和内容更新频率低,手动维护即可
|
||||||
// bottleCount: 某种油在套装中的瓶数(用于成本分摊和可做次数计算,默认1)
|
// bottleCount: 某种油在套装中的瓶数(用于成本分摊和可做次数计算,默认1)
|
||||||
|
// accessoryValue: 配件价值(香薰机、木盒等),从套装价中扣除后再分摊到精油
|
||||||
export const KITS = [
|
export const KITS = [
|
||||||
{
|
{
|
||||||
id: 'aroma',
|
id: 'aroma',
|
||||||
name: '芳香调理套装',
|
name: '芳香调理套装',
|
||||||
price: 2950,
|
price: 2950,
|
||||||
|
accessoryValue: 375, // 香薰机
|
||||||
oils: [
|
oils: [
|
||||||
'茶树', '野橘', '椒样薄荷', '薰衣草',
|
'茶树', '野橘', '椒样薄荷', '薰衣草',
|
||||||
'芳香调理', '安定情绪', '保卫', '舒缓',
|
'芳香调理', '安定情绪', '保卫', '舒缓',
|
||||||
@@ -16,6 +18,7 @@ export const KITS = [
|
|||||||
id: 'family',
|
id: 'family',
|
||||||
name: '家庭医生套装',
|
name: '家庭医生套装',
|
||||||
price: 2250,
|
price: 2250,
|
||||||
|
accessoryValue: 475, // 香薰机375 + 木盒100
|
||||||
oils: [
|
oils: [
|
||||||
'乳香', '茶树', '薰衣草', '柠檬', '椒样薄荷', '西班牙牛至',
|
'乳香', '茶树', '薰衣草', '柠檬', '椒样薄荷', '西班牙牛至',
|
||||||
'乐活', '舒缓', '保卫', '顺畅呼吸',
|
'乐活', '舒缓', '保卫', '顺畅呼吸',
|
||||||
@@ -53,6 +56,7 @@ export const KITS = [
|
|||||||
'柑橘清新', '顺畅呼吸', '净化清新', '赋活呼吸', '天然防护',
|
'柑橘清新', '顺畅呼吸', '净化清新', '赋活呼吸', '天然防护',
|
||||||
'椰子油',
|
'椰子油',
|
||||||
],
|
],
|
||||||
|
accessoryValue: 575, // 香薰机375 + 竹木架200
|
||||||
// 115mL×1 + 30mL×6 = 295mL, 标准瓶115mL, 约2.57瓶
|
// 115mL×1 + 30mL×6 = 295mL, 标准瓶115mL, 约2.57瓶
|
||||||
bottleCount: { '椰子油': 2.57 },
|
bottleCount: { '椰子油': 2.57 },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user