fix: 原价成本→单买成本,导出简版加可做次数和单买成本列
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Failing after 7m5s

页面: 原价成本改为单买成本
导出简版: 配方名+可做次数+套装成本+单买成本+售价+利润率
导出完整版: 增加可做次数列,原价成本→单买成本

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 10:55:59 +00:00
parent f03bf699e5
commit 9206272a68

View File

@@ -41,7 +41,7 @@
<th class="th-name">配方名</th>
<th class="th-times">可做次数</th>
<th class="th-cost">套装成本</th>
<th class="th-cost">原价成本</th>
<th class="th-cost">单买成本</th>
<th class="th-price">售价</th>
<th class="th-profit">利润率</th>
</tr>
@@ -238,15 +238,15 @@ async function exportExcel(mode) {
const ws = wb.addWorksheet(ka.name)
// Kit info header
ws.mergeCells('A1:F1')
ws.mergeCells(mode === 'full' ? 'A1:H1' : 'A1:F1')
const titleCell = ws.getCell('A1')
titleCell.value = `${ka.name} — ¥${ka.price}${ka.oils.length}种精油 — 可做${ka.recipeCount}个配方`
titleCell.font = { bold: true, size: 13 }
titleCell.alignment = { horizontal: 'center' }
if (mode === 'full') {
// Full version: recipe name, tags, ingredients detail, kit cost, original cost, selling price, margin
const headers = ['配方名', '标签', '精油成分', '套装成本', '原价成本', '售价', '利润率']
// Full version: recipe name, tags, ingredients, times, kit cost, original cost, selling price, margin
const headers = ['配方名', '标签', '精油成分', '可做次数', '套装成本', '单买成本', '售价', '利润率']
const headerRow = ws.addRow(headers)
applyHeaderStyle(headerRow)
@@ -261,6 +261,7 @@ async function exportExcel(mode) {
r.name,
(r.tags || []).join('/'),
ingredientStr,
calcMaxTimes(r),
Number(r.kitCost.toFixed(2)),
Number(r.originalCost.toFixed(2)),
price || '',
@@ -268,8 +269,8 @@ async function exportExcel(mode) {
])
}
} else {
// Simple version: recipe name, kit cost, selling price, margin
const headers = ['配方名', '套装成本', '售价', '利润率']
// Simple version: recipe name, times, kit cost, original cost, selling price, margin
const headers = ['配方名', '可做次数', '套装成本', '单买成本', '售价', '利润率']
const headerRow = ws.addRow(headers)
applyHeaderStyle(headerRow)
@@ -278,7 +279,9 @@ async function exportExcel(mode) {
const margin = calcMargin(r.kitCost, price)
ws.addRow([
r.name,
calcMaxTimes(r),
Number(r.kitCost.toFixed(2)),
Number(r.originalCost.toFixed(2)),
price || '',
price ? `${margin.toFixed(1)}%` : '',
])