feat(brandgating): 品牌Gating库并入店铺数据重复检查页

- 「店铺数据重复检查」新增「品牌Gating库」页签,承接原独立 Gating 网页后台的列表/筛选/统计、单条新增、批量导入、启停与删除。
- 复用既有 /api/admin/brand-gating 模块;接口权限键跟随宿主页 admin_shop_data_duplicate_check(V164 菜单已由 V166 删除)。
- 前端新增 brand-gating 模型/API 适配、BrandGatingPanel 与纯逻辑单测。
This commit is contained in:
2026-10-25 02:09:07 +08:00
parent 813bed66a3
commit 112c61afa8
7 changed files with 1169 additions and 21 deletions
@@ -13,8 +13,9 @@ import { aggregateDrawerRows, drawerSummaryOf, dupWithinGroup, indexShopGroups,
import type { DuplicateConsole, LedgerRow } from './duplicate-console-model.ts'
import { ASIN_COUNTRY_CODES, asinCountryLabel } from '../asin/asin-country.ts'
import { orderedPair } from '@/utils/datetime'
import BrandGatingPanel from './BrandGatingPanel.vue'
type Tab = 'dup' | 'ledger'
type Tab = 'dup' | 'ledger' | 'gating'
type Scope = 'global' | 'group'
const consoleData = ref<DuplicateConsole | null>(null)
@@ -431,18 +432,18 @@ onMounted(() => {
<div class="dup-head">
<div>
<h2>店铺数据撞款监控</h2>
<p>按 ASIN×店铺×站点分析同一 ASIN 在多家自营店铺/分组内的重复上架;分组归属来自店铺管理,只读展示。</p>
<p>按 ASIN×店铺×站点分析同一 ASIN 在多家自营店铺/分组内的重复上架;分组归属来自店铺管理,只读展示。品牌Gating库在同一页的第三个页签维护。</p>
</div>
</div>
<div v-if="loadError" class="load-banner">
<div v-if="loadError && activeTab !== 'gating'" class="load-banner">
<span>{{ loadError }}</span>
<button class="btn btn-ghost btn-sm" type="button" @click="loadConsole">重试</button>
<button class="btn btn-ghost btn-sm" type="button" @click="loadError = ''">知道了</button>
</div>
<!-- 筛选条件 -->
<section class="card filter">
<!-- 筛选条件(撞款/台账专用,Gating 页签隐藏) -->
<section v-if="activeTab !== 'gating'" class="card filter">
<div class="filter-title">筛选条件</div>
<div class="filter-row">
<div class="f-group">
@@ -492,10 +493,9 @@ onMounted(() => {
</div>
</section>
<div v-loading="loading" class="dup-body-wrap">
<template v-if="consoleData">
<div v-loading="loading && activeTab !== 'gating'" class="dup-body-wrap">
<!-- KPI 统计 -->
<section class="kpis">
<section v-if="consoleData && activeTab !== 'gating'" class="kpis">
<div v-for="kpi in kpis" :key="kpi.label" class="kpi" :class="kpi.tone">
<div class="k-label"><span class="k-dot"></span>{{ kpi.label }}</div>
<div class="k-value">{{ kpi.value }}</div>
@@ -504,7 +504,7 @@ onMounted(() => {
</section>
<!-- 店铺上架分布 -->
<section class="card store-strip">
<section v-if="consoleData && activeTab !== 'gating'" class="card store-strip">
<div class="strip-head">
<span class="strip-title">店铺上架分布</span>
<span class="strip-note">各店铺在本批站点中的上架记录量(含重复扫描)</span>
@@ -527,8 +527,9 @@ onMounted(() => {
<div class="tabs">
<button class="tab" :class="{ active: activeTab === 'dup' }" type="button" @click="switchTab('dup')">撞款监控 <span class="t-count">{{ totalDupCount }}</span></button>
<button class="tab" :class="{ active: activeTab === 'ledger' }" type="button" @click="switchTab('ledger')">全部ASIN台账 <span class="t-count">{{ ledgerTotal }}</span></button>
<button class="tab" :class="{ active: activeTab === 'gating' }" type="button" @click="switchTab('gating')">品牌Gating库</button>
</div>
<div class="actions">
<div v-if="activeTab !== 'gating'" class="actions">
<span v-if="overview" class="updated">数据更新时间 {{ overview.scannedAt || '—' }}</span>
<button v-if="isSuper" class="btn btn-ghost btn-sm" type="button" @click="groupInfoVisible = true">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" /><circle cx="9" cy="7" r="4" /><path d="M23 21v-2a4 4 0 0 0-3-3.87" /><path d="M16 3.13a4 4 0 0 1 0 7.75" /></svg>
@@ -545,8 +546,13 @@ onMounted(() => {
</div>
</div>
<!-- ============ 品牌Gating库(全平台共享数据) ============ -->
<template v-if="activeTab === 'gating'">
<BrandGatingPanel />
</template>
<!-- ============ 撞款监控 ============ -->
<template v-if="activeTab === 'dup'">
<template v-else-if="consoleData && activeTab === 'dup'">
<div v-if="isSuper" class="scope-bar">
<div class="seg">
<button class="seg-btn" :class="{ active: scope === 'global' }" type="button" @click="switchScope('global')">全店撞款</button>
@@ -626,7 +632,7 @@ onMounted(() => {
</template>
<!-- ============ 全部ASIN台账 ============ -->
<template v-else>
<template v-else-if="consoleData">
<div class="table-wrap" v-loading="ledgerLoading">
<table v-if="ledgerItems.length" class="ledger">
<thead>
@@ -661,9 +667,8 @@ onMounted(() => {
</div>
<OldPagination v-if="ledgerTotal" :total="ledgerTotal" :page="ledgerPage" :page-size="ledgerPageSize" @change="goPage" @size-change="changeLedgerSize" />
</template>
</template>
<div v-else-if="!loadError" class="card empty-state">
<div v-if="!consoleData && activeTab !== 'gating' && !loadError" class="card empty-state">
<div class="e-title">暂无扫描结果</div>
请点击右上角「重新分析」触发撞款扫描
</div>