fix: 精油价目恢复原始显示(每滴/每ml/每颗),ml产品用新显示
All checks were successful
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 12s
Test / e2e-test (push) Successful in 52s

精油: 总滴数 + 每滴价格 + 每ml价格(和之前一样)
植物空胶囊: /颗(和之前一样)
ml产品: 总容量Xml + 每ml价格(新)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 15:13:37 +00:00
parent 9beddc387a
commit 7abc219659

View File

@@ -146,9 +146,9 @@
<div v-if="getMeta(name)?.retailPrice" class="oil-retail-line">¥{{ getMeta(name).retailPrice }}/</div> <div v-if="getMeta(name)?.retailPrice" class="oil-retail-line">¥{{ getMeta(name).retailPrice }}/</div>
</template> </template>
<template v-else> <template v-else>
<div class="oil-price-line">¥{{ oils.pricePerDrop(name).toFixed(2) }}<span class="oil-price-unit">/{{ oils.unitLabel(name) }}</span></div> <div class="oil-price-line">¥{{ oils.pricePerDrop(name).toFixed(2) }}<span class="oil-price-unit">/{{ oilPriceUnit(name) }}</span></div>
<div v-if="getMeta(name)?.retailPrice && getMeta(name)?.dropCount" class="oil-retail-line"> <div v-if="getMeta(name)?.retailPrice && getMeta(name)?.dropCount" class="oil-retail-line">
¥{{ (getMeta(name).retailPrice / getMeta(name).dropCount).toFixed(2) }}/{{ oils.unitLabel(name) }} ¥{{ (getMeta(name).retailPrice / getMeta(name).dropCount).toFixed(2) }}/{{ oilPriceUnit(name) }}
</div> </div>
</template> </template>
</div> </div>
@@ -172,7 +172,7 @@
<div class="oil-card-price-info" v-if="getMeta(activeCardName)"> <div class="oil-card-price-info" v-if="getMeta(activeCardName)">
¥ {{ (getMeta(activeCardName).bottlePrice || 0).toFixed(2) }} ¥ {{ (getMeta(activeCardName).bottlePrice || 0).toFixed(2) }}
<span v-if="oils.pricePerDrop(activeCardName)"> <span v-if="oils.pricePerDrop(activeCardName)">
&middot; ¥ {{ oils.pricePerDrop(activeCardName).toFixed(4) }}/{{ oils.unitLabel(activeCardName) }} &middot; ¥ {{ oils.pricePerDrop(activeCardName).toFixed(4) }}/{{ oilPriceUnit(activeCardName) }}
</span> </span>
</div> </div>
</div> </div>
@@ -242,6 +242,10 @@
<span class="detail-label">零售价</span> <span class="detail-label">零售价</span>
<span class="detail-value">¥ {{ getMeta(selectedOilName).retailPrice.toFixed(2) }}</span> <span class="detail-value">¥ {{ getMeta(selectedOilName).retailPrice.toFixed(2) }}</span>
</div> </div>
<div v-if="!oils.isMlUnit(selectedOilName)" class="detail-row">
<span class="detail-label">每ml价格</span>
<span class="detail-value">{{ oils.pricePerDrop(selectedOilName) ? ('¥ ' + (oils.pricePerDrop(selectedOilName) * DROPS_PER_ML).toFixed(2)) : '--' }}</span>
</div>
<h4 style="margin:16px 0 8px">含此精油的配方</h4> <h4 style="margin:16px 0 8px">含此精油的配方</h4>
<div v-if="recipesWithOil.length" class="detail-recipes"> <div v-if="recipesWithOil.length" class="detail-recipes">
@@ -468,6 +472,12 @@ for (const [ml, drops] of Object.entries(VOLUME_OPTIONS)) {
DROPS_TO_VOLUME[drops] = ml + 'ml' DROPS_TO_VOLUME[drops] = ml + 'ml'
} }
function oilPriceUnit(name) {
if (oils.isMlUnit(name)) return 'ml'
if (name === '植物空胶囊') return '颗'
return '滴'
}
function volumeLabel(dropCount, name) { function volumeLabel(dropCount, name) {
if (dropCount === 160) return '160颗' if (dropCount === 160) return '160颗'
if (oils.isMlUnit(name)) return dropCount + 'ml' if (oils.isMlUnit(name)) return dropCount + 'ml'