feat: 套装方案对比与导出功能 #32

Merged
hera merged 37 commits from feat/kit-comparison-export into main 2026-04-14 13:32:34 +00:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit 981765e4bb - Show all commits

View File

@@ -119,7 +119,13 @@ export function useKitCost() {
costs, // { aroma: 12.3, family: null, home3988: 10.8, full: 9.5 }
})
}
rows.sort((a, b) => a.name.localeCompare(b.name, 'zh'))
// Sort by number of kits that can make the recipe (fewest first), then by name
rows.sort((a, b) => {
const aCount = Object.values(a.costs).filter(v => v != null).length
const bCount = Object.values(b.costs).filter(v => v != null).length
if (aCount !== bCount) return aCount - bCount
return a.name.localeCompare(b.name, 'zh')
})
return rows
})

View File

@@ -39,7 +39,6 @@
<thead>
<tr>
<th class="th-name">配方名</th>
<th class="th-tags">标签</th>
<th class="th-cost">套装成本</th>
<th class="th-cost">原价成本</th>
<th class="th-price">售价</th>
@@ -49,7 +48,6 @@
<tbody>
<tr v-for="r in activeKitData.recipes" :key="r._id">
<td class="td-name">{{ r.name }}</td>
<td class="td-tags">{{ (r.tags || []).join('/') }}</td>
<td class="td-cost">{{ fmtPrice(r.kitCost) }}</td>
<td class="td-cost original">{{ fmtPrice(r.originalCost) }}</td>
<td class="td-price">