feat(admin): goods view family badges and sibling matching
This commit is contained in:
@@ -18,7 +18,7 @@ import { tagsApi } from '@/api/tags'
|
|||||||
import { tagGroupsApi } from '@/api/tag-groups'
|
import { tagGroupsApi } from '@/api/tag-groups'
|
||||||
import { originGoodsApi } from '@/api/origin-goods'
|
import { originGoodsApi } from '@/api/origin-goods'
|
||||||
import { syncApi } from '@/api/sync'
|
import { syncApi } from '@/api/sync'
|
||||||
import { sameOriginGroup } from '@/utils/origin-name'
|
import { sameFamily } from '@/utils/family-match'
|
||||||
|
|
||||||
const mode = ref<'category' | 'country' | 'global'>('category')
|
const mode = ref<'category' | 'country' | 'global'>('category')
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@@ -275,6 +275,9 @@ function buildRightTree(tree: OriginGoodsTreeResponse) {
|
|||||||
variantCount: og.variantCount ?? 0,
|
variantCount: og.variantCount ?? 0,
|
||||||
sizeRowCount: og.sizeRowCount ?? 0,
|
sizeRowCount: og.sizeRowCount ?? 0,
|
||||||
packageRowCount: og.packageRowCount ?? 0,
|
packageRowCount: og.packageRowCount ?? 0,
|
||||||
|
familyId: og.familyId ?? null,
|
||||||
|
familyCode: og.familyCode ?? null,
|
||||||
|
familyStale: og.familyStale ?? null,
|
||||||
}))
|
}))
|
||||||
return {
|
return {
|
||||||
id: 'rc-' + node.categoryId,
|
id: 'rc-' + node.categoryId,
|
||||||
@@ -408,7 +411,7 @@ function openConfigModal(og: any, dropTarget: any) {
|
|||||||
configSiblings.value = siblings
|
configSiblings.value = siblings
|
||||||
configPrimaryId.value = String(og.rawId)
|
configPrimaryId.value = String(og.rawId)
|
||||||
configChecked.value = siblings
|
configChecked.value = siblings
|
||||||
.filter((s) => sameOriginGroup(ogNode?.goodName ?? og.goodName, s.goodName))
|
.filter((s) => sameFamily(ogNode ?? { goodName: og.goodName }, s))
|
||||||
.map((s) => String(s.rawId))
|
.map((s) => String(s.rawId))
|
||||||
configForm.value = { countryId: '', cascaderCategory: [], categoryId: '', tagIds: [], positionId: '', goodImage: og.goodImage || '' }
|
configForm.value = { countryId: '', cascaderCategory: [], categoryId: '', tagIds: [], positionId: '', goodImage: og.goodImage || '' }
|
||||||
if (dropTarget) {
|
if (dropTarget) {
|
||||||
@@ -1688,6 +1691,18 @@ onMounted(() => loadAll())
|
|||||||
<el-image v-if="data.goodImage" :src="data.goodImage" fit="cover" class="og-thumb" />
|
<el-image v-if="data.goodImage" :src="data.goodImage" fit="cover" class="og-thumb" />
|
||||||
<div v-else class="og-thumb og-thumb-placeholder" />
|
<div v-else class="og-thumb og-thumb-placeholder" />
|
||||||
<span class="og-name">{{ data.label }}</span>
|
<span class="og-name">{{ data.label }}</span>
|
||||||
|
<el-tag
|
||||||
|
v-if="data.familyCode"
|
||||||
|
size="small"
|
||||||
|
type="info"
|
||||||
|
class="og-family-tag"
|
||||||
|
:title="data.familyStale ? '族待处理:上游已变化' : '所属产品族'"
|
||||||
|
>{{ data.familyCode }}</el-tag>
|
||||||
|
<span
|
||||||
|
v-if="data.familyStale"
|
||||||
|
class="og-badge og-badge--warn"
|
||||||
|
title="该链接所属族已锁定且上游数据变化,待人工处理"
|
||||||
|
>族待处理</span>
|
||||||
<span
|
<span
|
||||||
v-if="data.configuredCount > 0"
|
v-if="data.configuredCount > 0"
|
||||||
class="og-badge og-badge--ok"
|
class="og-badge og-badge--ok"
|
||||||
@@ -2376,6 +2391,7 @@ onMounted(() => loadAll())
|
|||||||
background: linear-gradient(135deg, #f5f7fa, #e9ecef);
|
background: linear-gradient(135deg, #f5f7fa, #e9ecef);
|
||||||
}
|
}
|
||||||
.og-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
|
.og-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
|
||||||
|
.og-family-tag { flex-shrink: 0; }
|
||||||
.og-price { color: #909399; font-size: 12px; flex-shrink: 0; }
|
.og-price { color: #909399; font-size: 12px; flex-shrink: 0; }
|
||||||
.og-badge {
|
.og-badge {
|
||||||
font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 8px;
|
font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 8px;
|
||||||
|
|||||||
Reference in New Issue
Block a user