feat: 非精油产品显示份、新增护肤品价目 #30

Merged
hera merged 28 commits from fix/next-batch-4 into main 2026-04-13 19:26:58 +00:00
Showing only changes of commit 5f1ead03ab - Show all commits

View File

@@ -56,11 +56,15 @@ const volumeLabel = computed(() => {
if (ml <= 2) return '单次'
return `${Math.round(ml)}ml`
}
// Non-coconut: find portion product and show its amount + unit
const portionIng = ings.find(i => oilsStore.isPortionUnit(i.oil))
if (portionIng) {
return `${portionIng.drops}${oilsStore.unitLabel(portionIng.oil)}`
// Non-coconut: sum portion products by unit
const unitSums = {}
for (const ing of ings) {
if (!oilsStore.isPortionUnit(ing.oil)) continue
const u = oilsStore.unitLabel(ing.oil)
unitSums[u] = (unitSums[u] || 0) + (ing.drops || 0)
}
const parts = Object.entries(unitSums).map(([u, v]) => `${Math.round(v)}${u}`)
if (parts.length) return parts.join('+')
return ''
})
</script>