fix: 产品管理表格增加默认规格、成本价和售价列

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
taiyi 2026-06-04 19:37:59 +08:00
parent 238f7cfcf9
commit 2fff1b2c43
2 changed files with 11 additions and 2 deletions

View File

@ -730,6 +730,7 @@ export async function fetchProductList(filters = {}) {
unit: spec.unit || "-",
costPrice: Number(spec.cost_price || 0).toFixed(2),
salePrice: Number(spec.sale_price || 0).toFixed(2),
isDefault: Boolean(spec.is_default),
status: Number(spec.status || 1) === 1 ? "启用" : "停用",
remark: spec.remark || "-",
})),

View File

@ -535,7 +535,11 @@
<tr>
<th><input type="checkbox" :checked="selectedProductIds.length === productRows.length && productRows.length > 0" @change="toggleAllProducts($event)" /></th>
<th>产品名称</th>
<th>规格数量</th>
<th>默认规格</th>
<th>单位</th>
<th>规格数</th>
<th>成本价</th>
<th>售价</th>
<th>分类</th>
<th>状态</th>
<th>操作</th>
@ -545,7 +549,11 @@
<tr v-for="row in productRows" :key="row.productName">
<td><input type="checkbox" :value="row.productId" v-model="selectedProductIds" /></td>
<td>{{ row.productName }}</td>
<td>{{ row.specifications.find(s => s.isDefault)?.specification || row.specifications[0]?.specification || '-' }}</td>
<td>{{ row.specifications.find(s => s.isDefault)?.unit || row.specifications[0]?.unit || '-' }}</td>
<td>{{ row.specifications.length }}</td>
<td>¥{{ row.specifications.find(s => s.isDefault)?.costPrice || row.specifications[0]?.costPrice || '0.00' }}</td>
<td>¥{{ row.specifications.find(s => s.isDefault)?.salePrice || row.specifications[0]?.salePrice || '0.00' }}</td>
<td>{{ row.categoryName }}</td>
<td>{{ row.status }}</td>
<td>
@ -1992,7 +2000,7 @@ textarea,
.loading { margin: 0; color: #6b7280; }
.empty-state { padding: 24px; border: 1px dashed #cbd5e1; border-radius: 16px; color: #64748b; text-align: center; background: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
th { color: #334155; font-size: 13px; background: #f8fafc; }
.status { display: inline-flex; padding: 4px 10px; border-radius: 999px; }