From 72347493d741fb48ec266433a1b4bb48b63ec727 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Tue, 14 Apr 2026 12:55:01 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A5=97=E8=A3=85=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=8A=98=E6=89=A3=E7=8E=87=EF=BC=88=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BB=B7=E5=90=8E=E5=86=8DX=E6=8A=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/composables/useKitCost.js | 12 ++++++++++++ frontend/src/views/KitExport.vue | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/composables/useKitCost.js b/frontend/src/composables/useKitCost.js index 5134f32..efbdd12 100644 --- a/frontend/src/composables/useKitCost.js +++ b/frontend/src/composables/useKitCost.js @@ -86,11 +86,23 @@ export function useKitCost() { return KITS.map(kit => { const perDrop = calcKitPerDrop(kit) const recipes = getKitRecipes(kit) + // Calculate discount rate for display + const resolved = kit.oils.map(name => resolveOilName(name)) + const bc = kit.bottleCount || {} + let totalBP = 0 + for (const name of resolved) { + const meta = oils.oilsMeta[name] + totalBP += meta ? meta.bottlePrice * (bc[name] || 1) : 0 + } + const totalValue = totalBP + (kit.accessoryValue || 0) + const discountRate = totalValue > 0 ? Math.min(kit.price / totalValue, 1) : 1 + return { ...kit, perDrop, recipes, recipeCount: recipes.length, + discountRate, } }).sort((a, b) => a.recipeCount - b.recipeCount) }) diff --git a/frontend/src/views/KitExport.vue b/frontend/src/views/KitExport.vue index e8e4a41..d069c1b 100644 --- a/frontend/src/views/KitExport.vue +++ b/frontend/src/views/KitExport.vue @@ -22,6 +22,7 @@ >
{{ ka.name }}
¥{{ ka.price }}
+
会员价后再{{ (ka.discountRate * 10).toFixed(1) }}折
{{ ka.oils.length }} 种精油 可做 {{ ka.recipeCount }} 个配方 @@ -416,7 +417,8 @@ async function exportExcel(mode) { box-shadow: 0 2px 8px rgba(74, 157, 126, 0.15); } .kit-name { font-weight: 600; font-size: 14px; color: #3e3a44; margin-bottom: 4px; } -.kit-price { font-size: 18px; font-weight: 700; color: #4a9d7e; margin-bottom: 6px; } +.kit-price { font-size: 18px; font-weight: 700; color: #4a9d7e; margin-bottom: 2px; } +.kit-discount { font-size: 11px; color: #e65100; margin-bottom: 6px; } .kit-stats { font-size: 12px; color: #6b6375; display: flex; flex-direction: column; gap: 2px; } .kit-recipe-count { color: #4a9d7e; font-weight: 500; }