feat: 配方显示容量和可做次数;套装成本不超过单买价(配件视为赠品)
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Has been cancelled

- 每个配方名后显示容量(单次/5ml/10ml等)
- 新增可做次数列(按最先用完的精油计算)
- 套装成本分摊使用 min(套装价, 油瓶总价),避免含配件的套装算出比单买贵

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 23:55:50 +00:00
parent 7be167deeb
commit c090e5f3d6
2 changed files with 25 additions and 4 deletions

View File

@@ -35,12 +35,14 @@ export function useKitCost() {
}
if (totalBottlePrice === 0) return {}
// Proportional allocation
// Proportional allocation — kit accessories treated as freebies,
// so oil cost = min(kit price, sum of bottle prices)
const effectivePrice = Math.min(kit.price, totalBottlePrice)
const perDrop = {}
for (const name of resolved) {
const meta = oils.oilsMeta[name]
const bp = oilBottlePrices[name]
const kitCostForOil = (bp / totalBottlePrice) * kit.price
const kitCostForOil = (bp / totalBottlePrice) * effectivePrice
const drops = meta ? meta.dropCount : 1
perDrop[name] = drops > 0 ? kitCostForOil / drops : 0
}
@@ -124,6 +126,7 @@ export function useKitCost() {
id,
name: recipe.name,
tags: recipe.tags,
volume: recipe.volume,
ingredients: recipe.ingredients,
originalCost: recipe.originalCost,
costs,