feat(浏览器扩展): 优化推广费同步浮窗

This commit is contained in:
2026-08-27 14:24:43 +08:00
parent b3c77c08b1
commit 19bc987f36
5 changed files with 114 additions and 40 deletions
@@ -111,16 +111,23 @@ const autoDaySpanLabel = computed(() => {
}
});
const shopStatusLabel = computed(() => {
const shopTagLabel = computed(() => {
if (shopMatching.value) return '匹配中';
if (shopMatched.value && channelShopId.value != null) return '已授权';
if (pageMallName.value.trim()) return '未授权,请到 BI 系统授权同名店铺';
return '未识别店铺';
if (pageMallName.value.trim()) return '未授权';
return '未识别';
});
const headerShopLine = computed(() => {
const shopTagClass = computed(() => {
if (shopMatching.value) return 'ecbi-shop-tag--loading';
if (shopMatched.value && channelShopId.value != null) return 'ecbi-shop-tag--ok';
if (pageMallName.value.trim()) return 'ecbi-shop-tag--warn';
return 'ecbi-shop-tag--muted';
});
const headerShopTitle = computed(() => {
const name = pageMallName.value.trim() || '未识别店铺';
return `${name} · ${shopStatusLabel.value}`;
return `${name} · ${shopTagLabel.value}`;
});
function onHeatSelect(date: string | undefined) {
@@ -489,15 +496,10 @@ onUnmounted(() => {
>
<div class="ecbi-header-main">
<h1>{{ EXTENSION_NAME }}</h1>
<p
class="ecbi-header-sub"
:class="{
'ecbi-header-sub-warn': !shopMatched && Boolean(pageMallName.trim()) && !shopMatching,
}"
:title="headerShopLine"
>
{{ headerShopLine }}
</p>
<div class="ecbi-header-shop" :title="headerShopTitle">
<span class="ecbi-header-shop-name">{{ pageMallName.trim() || '未识别店铺' }}</span>
<span class="ecbi-shop-tag" :class="shopTagClass">{{ shopTagLabel }}</span>
</div>
<p class="ecbi-header-stats">{{ accumulatedLabel }}</p>
</div>
<div class="ecbi-header-actions">
@@ -521,6 +523,14 @@ onUnmounted(() => {
</header>
<div class="ecbi-body">
<div class="ecbi-status-bar">
<p class="ecbi-status" :class="{ 'ecbi-status-busy': busy || autoRunning }">
{{ statusText }}
</p>
<p v-if="syncResultText" class="ecbi-ok">{{ syncResultText }}</p>
<p v-if="errorText" class="ecbi-error">{{ errorText }}</p>
</div>
<div class="ecbi-meta">
<span>{{ dateModeLabel }}</span>
<span class="ecbi-meta-sep">·</span>
@@ -550,13 +560,21 @@ onUnmounted(() => {
>
读当日
</button>
<button
class="ecbi-btn ecbi-btn-ghost"
type="button"
:disabled="busy || autoRunning || !batch?.items?.length"
@click="clearAccumulated"
>
清空累计
</button>
<button
class="ecbi-btn ecbi-btn-primary"
type="button"
:disabled="busy || autoRunning || !batch?.items?.length"
@click="handleSync"
>
传入系统
同步到系统
</button>
</div>
@@ -602,14 +620,6 @@ onUnmounted(() => {
<button v-else class="ecbi-btn ecbi-btn-ghost" type="button" @click="stopAutoCollect">
停止
</button>
<button
class="ecbi-btn ecbi-btn-ghost"
type="button"
:disabled="busy || autoRunning || !batch?.items?.length"
@click="clearAccumulated"
>
清空累计
</button>
</div>
</div>
</details>
@@ -626,12 +636,6 @@ onUnmounted(() => {
<p v-else class="ecbi-muted" style="margin: 0">暂无数据</p>
</div>
</details>
<p class="ecbi-status" :class="{ 'ecbi-status-busy': busy || autoRunning }">
{{ statusText }}
</p>
<p v-if="syncResultText" class="ecbi-ok">{{ syncResultText }}</p>
<p v-if="errorText" class="ecbi-error">{{ errorText }}</p>
</div>
</div>
</template>
@@ -130,6 +130,76 @@
opacity: 1;
}
.ecbi-header-shop {
display: flex;
align-items: center;
gap: 6px;
margin-top: 2px;
min-width: 0;
}
.ecbi-header-shop-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
opacity: 0.92;
}
.ecbi-shop-tag {
flex-shrink: 0;
display: inline-flex;
align-items: center;
height: 20px;
padding: 0 8px;
border-radius: 4px;
font-size: 11px;
font-weight: 600;
line-height: 1;
}
.ecbi-shop-tag--ok {
background: #f6ffed;
color: #389e0d;
border: 1px solid #b7eb8f;
box-shadow: 0 0 0 1px rgb(255 255 255 / 0.35);
}
.ecbi-shop-tag--warn {
background: #fffbe6;
color: #ad6800;
border: 1px solid #ffe58f;
}
.ecbi-shop-tag--loading {
background: rgb(255 255 255 / 0.22);
color: #fff;
border: 1px solid rgb(255 255 255 / 0.4);
}
.ecbi-shop-tag--muted {
background: rgb(255 255 255 / 0.16);
color: rgb(255 255 255 / 0.9);
border: 1px solid rgb(255 255 255 / 0.28);
}
.ecbi-status-bar {
display: flex;
flex-direction: column;
gap: 4px;
padding: 8px 10px;
border-radius: var(--ecbi-radius);
background: var(--ecbi-fill);
border: 1px solid var(--ecbi-border-secondary);
}
.ecbi-status-bar .ecbi-status,
.ecbi-status-bar .ecbi-ok,
.ecbi-status-bar .ecbi-error {
margin: 0;
}
.ecbi-header-link {
border: 0;
background: rgb(255 255 255 / 0.16);
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"updatedAt": "2026-08-27T06:07:51.848Z",
"updatedAt": "2026-08-27T06:21:25.418Z",
"features": [
{
"id": "pdd-ad-fee",
@@ -12,7 +12,7 @@
"https://yingxiao.pinduoduo.com/"
],
"entry": "pdd-ad-fee.js",
"sha256": "8a3d135c052c69daaf4eeb61e25e6e124f7cfe82d4b05ebaae372312aa70dcf8",
"sha256": "35930f61306f190e88d70c12729c12650a7db1215ecb7220032dbedf036df737",
"executionWorld": "main"
}
]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long