This commit is contained in:
@@ -938,9 +938,9 @@
|
||||
</div>
|
||||
<!-- 熱力圖圖例 -->
|
||||
<div class="px-3 pt-2 pb-1 d-flex gap-3 small text-muted ai-legend" style="font-size:0.73rem">
|
||||
<span><span style="display:inline-block;width:12px;height:12px;background:#fee2e2;border-radius:2px" class="me-1"></span>貴 >20%</span>
|
||||
<span><span style="display:inline-block;width:12px;height:12px;background:#fef9c3;border-radius:2px" class="me-1"></span>貴 10~20%</span>
|
||||
<span><span style="display:inline-block;width:12px;height:12px;background:#dcfce7;border-radius:2px" class="me-1"></span>我便宜</span>
|
||||
<span><span style="display:inline-block;width:12px;height:12px;background:#fee2e2;border-radius:2px" class="me-1"></span>PChome 貴 >20%</span>
|
||||
<span><span style="display:inline-block;width:12px;height:12px;background:#fef9c3;border-radius:2px" class="me-1"></span>PChome 貴 10~20%</span>
|
||||
<span><span style="display:inline-block;width:12px;height:12px;background:#dcfce7;border-radius:2px" class="me-1"></span>PChome 便宜</span>
|
||||
</div>
|
||||
<div class="card-body p-0 ai-table-scroll">
|
||||
<table class="table table-sm table-hover mb-0 align-middle" id="competitorTable">
|
||||
@@ -964,7 +964,7 @@
|
||||
</div>
|
||||
<div class="card-footer bg-white py-2 d-flex justify-content-between small text-muted">
|
||||
<span id="compCount">—</span>
|
||||
<span>僅顯示已確認同款的商品</span>
|
||||
<span id="compSourceSummary">僅顯示已確認同款的商品</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1046,6 +1046,7 @@ function renderKPIs(stats) {
|
||||
document.getElementById('kpiCompetitors').textContent = (stats.valid_competitor_prices || 0).toLocaleString();
|
||||
document.getElementById('kpiAiRecs').textContent = (stats.total_ai_recs || 0).toLocaleString();
|
||||
document.getElementById('kpiMatchRate').textContent = stats.match_rate ? `(${stats.match_rate}%)` : '';
|
||||
renderCompetitorSourceSummary(stats);
|
||||
|
||||
const hr = stats.high_risk_count || 0;
|
||||
document.getElementById('kpiHighRisk').textContent = hr;
|
||||
@@ -1117,6 +1118,20 @@ async function loadGrowthOps(forceRefresh = false) {
|
||||
}
|
||||
}
|
||||
|
||||
function renderCompetitorSourceSummary(stats) {
|
||||
const target = document.getElementById('compSourceSummary');
|
||||
if (!target) return;
|
||||
|
||||
const counts = stats.competitor_data_source_counts || {};
|
||||
const entries = Object.entries(counts)
|
||||
.filter(([, count]) => Number(count || 0) > 0)
|
||||
.map(([label, count]) => `${label} ${Number(count).toLocaleString()} 筆`);
|
||||
|
||||
target.textContent = entries.length
|
||||
? `資料來源:${entries.join('、')}`
|
||||
: '僅顯示已確認同款的商品';
|
||||
}
|
||||
|
||||
function renderGrowthActionHint(stats) {
|
||||
const hint = document.getElementById('growthActionHint');
|
||||
if (!hint) return;
|
||||
@@ -1358,6 +1373,8 @@ function renderCompetitorTable(rows) {
|
||||
'identity_v2': ['bg-success text-white', '同款確認'],
|
||||
'match_type_exact':['bg-success text-white', '同款確認'],
|
||||
'price_alert_exact':['bg-danger text-white', '價差告警'],
|
||||
'external_offers': ['bg-success text-white', '自動同步'],
|
||||
'legacy_competitor_cache':['bg-light text-dark','舊資料'],
|
||||
'evidence_brand': ['bg-light text-dark', '品牌一致'],
|
||||
'evidence_identity':['bg-light text-dark', '同款證據'],
|
||||
'match_shared_model_token':['bg-light text-dark','型號一致'],
|
||||
@@ -1374,7 +1391,7 @@ function renderCompetitorTable(rows) {
|
||||
: r.match_score >= 0.55 ? 'text-warning'
|
||||
: 'text-danger';
|
||||
|
||||
return `<tr data-risk="${r.risk}" data-name="${r.name.toLowerCase()}" style="${rowBg}">
|
||||
return `<tr data-risk="${r.risk}" data-source="${escapeHtml(r.data_source || '')}" data-name="${r.name.toLowerCase()}" style="${rowBg}">
|
||||
<td class="ps-3">
|
||||
<div style="font-size:0.82rem;font-weight:500" title="${r.name}">${r.name}</div>
|
||||
<small class="text-muted">${r.category} · ${r.sku}</small>
|
||||
@@ -1444,7 +1461,7 @@ function renderAiRecs(recs) {
|
||||
<span class="fw-bold text-truncate me-2" style="max-width:200px" title="${r.name}">${r.name}</span>
|
||||
<span class="badge ${sBg} flex-shrink-0">${sLabel}</span>
|
||||
</div>
|
||||
<div class="d-flex gap-3 mb-1 text-muted small">
|
||||
<div class="d-flex gap-3 mb-1 text-muted small">
|
||||
<span>MOMO <strong class="text-dark">$${r.momo_price.toLocaleString()}</strong></span>
|
||||
<span>PChome <strong class="text-secondary">$${r.pchome_price.toLocaleString()}</strong></span>
|
||||
<span class="${r.gap_pct > 10 ? 'text-danger fw-bold' : 'text-muted'}">${gapSign}${r.gap_pct}%</span>
|
||||
|
||||
Reference in New Issue
Block a user