fix: 商品卡片移除规格展示数量限制,全部规格均可展示

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
小蟑螂
2026-05-08 11:20:19 +08:00
co-authored by Claude Opus 4.7
parent 7761667904
commit f17e6df65b
@@ -79,9 +79,6 @@ const goToDetails = (product: ProductVO.Info) => {
router.push(`/ecom/product/overview/${product.id}`); router.push(`/ecom/product/overview/${product.id}`);
}; };
const MAX_VISIBLE_SPECS = 4;
const visibleSpecs = computed(() => (props.product.specs || []).slice(0, MAX_VISIBLE_SPECS));
/** id 仅来自后端的已有规格;新增行不传 id,用 _clientKey 做列表 key */ /** id 仅来自后端的已有规格;新增行不传 id,用 _clientKey 做列表 key */
type EditableSpec = { type EditableSpec = {
id?: number; id?: number;
@@ -241,7 +238,7 @@ const displaySpecs = computed(() => {
if (isEditing.value) { if (isEditing.value) {
return draft.value.specs; return draft.value.specs;
} }
return visibleSpecs.value; return props.product.specs || [];
}); });
const formatCost = (val?: number) => `¥${(val ?? 0).toFixed(2)}`; const formatCost = (val?: number) => `¥${(val ?? 0).toFixed(2)}`;
@@ -593,12 +590,6 @@ const saveEdit = async () => {
</Tooltip> </Tooltip>
</span> </span>
</div> </div>
<div
v-if="!isEditing && (product.specs?.length || 0) > visibleSpecs.length"
class="more-tip"
>
仅展示前 {{ visibleSpecs.length }} 条规格,点击「经营统计」查看全部
</div>
</div> </div>
<div v-else-if="!isEditing" class="empty-text">暂无规格数据</div> <div v-else-if="!isEditing" class="empty-text">暂无规格数据</div>
</div> </div>
@@ -1275,14 +1266,6 @@ const saveEdit = async () => {
font-size: 0.875rem; font-size: 0.875rem;
} }
.more-tip {
padding: 10px 16px;
font-size: 11px;
color: #8c8c8c;
border-top: 1px dashed #f0f0f0;
background: #fafafa;
}
.empty-text { .empty-text {
font-size: 13px; font-size: 13px;
color: #8c8c8c; color: #8c8c8c;
@@ -1449,7 +1432,6 @@ html.dark {
.field-label, .field-label,
.label, .label,
.more-tip,
.empty-text, .empty-text,
.no-image, .no-image,
.cost-prefix { .cost-prefix {
@@ -1590,11 +1572,6 @@ html.dark {
border: 1px solid hsl(var(--primary) / 26%); border: 1px solid hsl(var(--primary) / 26%);
} }
.more-tip {
background: $accent-light-bg;
border-top: 1px dashed $border-base;
}
.meta-box, .meta-box,
.table-container, .table-container,
.spec-row, .spec-row,