feat: 非精油产品显示份、新增护肤品价目 #30
@@ -56,15 +56,15 @@ const volumeLabel = computed(() => {
|
||||
if (ml <= 2) return '单次'
|
||||
return `${Math.round(ml)}ml`
|
||||
}
|
||||
// Non-coconut: sum portion products by unit
|
||||
const unitSums = {}
|
||||
// Non-coconut: sum all portion products as ml
|
||||
let totalMl = 0
|
||||
let hasProduct = false
|
||||
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)
|
||||
hasProduct = true
|
||||
totalMl += ing.drops || 0
|
||||
}
|
||||
const parts = Object.entries(unitSums).map(([u, v]) => `${Math.round(v)}${u}`)
|
||||
if (parts.length) return parts.join('+')
|
||||
if (hasProduct && totalMl > 0) return `${Math.round(totalMl)}ml`
|
||||
return ''
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1458,11 +1458,22 @@ function openRecipeDetail(recipe) {
|
||||
function getVolumeLabel(ingredients) {
|
||||
const ings = 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: sum portion products, mixed units all convert to ml
|
||||
let totalMl = 0
|
||||
let hasProduct = false
|
||||
for (const ing of ings) {
|
||||
if (!oils.isPortionUnit(ing.oil)) continue
|
||||
hasProduct = true
|
||||
totalMl += ing.drops || 0
|
||||
}
|
||||
if (hasProduct && totalMl > 0) return `${Math.round(totalMl)}ml`
|
||||
return ''
|
||||
}
|
||||
|
||||
function diaryMatchesPublic(d) {
|
||||
|
||||
Reference in New Issue
Block a user