feat: 非精油产品显示份、新增护肤品价目 #30
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user