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 fba66b42c2 - Show all commits

View File

@@ -50,11 +50,21 @@ const isFav = computed(() => recipesStore.isFavorite(props.recipe))
const volumeLabel = computed(() => {
const ings = props.recipe.ingredients || []
const coco = ings.find(i => i.oil === '椰子油')
if (!coco || !coco.drops) return ''
const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0)
const ml = totalDrops / 18.6
if (ml <= 2) return '单次'
return `${Math.round(ml)}ml`
if (coco && coco.drops) {
const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0)
const ml = totalDrops / 18.6
if (ml <= 2) return '单次'
return `${Math.round(ml)}ml`
}
// Non-coconut: check if has portion product, extract volume from note
const hasPortion = ings.some(i => oilsStore.isPortionUnit(i.oil))
if (hasPortion) {
const note = props.recipe.note || ''
const m = note.match(/(\d+)\s*(ml|毫升|克|g)/i)
if (m) return `${m[1]}${m[2].toLowerCase()}`
return '调配'
}
return ''
})
</script>