串接商品看板比價覆核隊列
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s

This commit is contained in:
OoO
2026-05-20 01:14:12 +08:00
parent baf5eb2881
commit 2bf2245cea
6 changed files with 243 additions and 26 deletions

View File

@@ -39,9 +39,12 @@
</div>
</div>
<div class="dashboard-kpi">
<div class="dashboard-kpi-label momo-mono">待比對</div>
<div class="dashboard-kpi-value momo-mono is-warning">{{ overview.pending_match_count | default(0) | number_format }}</div>
<div class="dashboard-kpi-sub momo-mono">高價品項優先補抓</div>
<div class="dashboard-kpi-label momo-mono">比價覆核</div>
<div class="dashboard-kpi-value momo-mono is-warning">{{ overview.review_queue_count | default(0) | number_format }}</div>
<div class="dashboard-kpi-sub momo-mono">
<a class="dashboard-kpi-sub-link" href="{{ url_for('dashboard.index', filter='pchome_review', category=current_category, q=search_query, sort_by='pchome_review', order='desc') }}">需單位價覆核 {{ overview.unit_comparable_count | default(0) | number_format }}</a>
· 待補抓 {{ overview.pending_match_count | default(0) | number_format }}
</div>
</div>
<div class="dashboard-kpi">
<div class="dashboard-kpi-label momo-mono">資料新鮮度</div>
@@ -143,8 +146,42 @@
</div>
<div class="dashboard-focus-card">
<div class="dashboard-focus-label momo-mono">補資料優先</div>
{% if overview.pending_priority %}
<div class="dashboard-focus-label momo-mono">覆核與補資料</div>
{% if overview.review_queue %}
<div class="dashboard-focus-list">
{% for item in overview.review_queue %}
<div class="dashboard-focus-row">
<a class="dashboard-focus-row-title" href="{{ url_for('dashboard.index', filter='pchome_review', q=item.sku, sort_by='pchome_review', order='desc') }}">{{ item.name }}</a>
<div class="dashboard-focus-row-meta momo-mono">
<span class="dashboard-focus-chip is-review">{{ item.status_label }}</span>
<span>MOMO ${{ item.momo_price | int | number_format }}</span>
{% if item.candidate_pc_price %}
<span>候選 PChome ${{ item.candidate_pc_price | int | number_format }}</span>
{% endif %}
{% if item.best_match_score %}
<span>match {{ (item.best_match_score * 100) | round(0) | int }}%</span>
{% endif %}
</div>
<div class="dashboard-focus-sub">{{ item.action_label }}</div>
{% if item.unit_comparison and item.unit_comparison.summary %}
<div class="dashboard-review-note momo-mono">{{ item.unit_comparison.summary }}</div>
{% endif %}
<div class="dashboard-focus-row-links">
<a class="dashboard-platform-link is-momo momo-tracked-link" href="{{ build_momo_product_url(item.sku) if build_momo_product_url is defined else '#' }}" data-momo-original-url="{{ build_momo_product_url(item.sku) if build_momo_product_url is defined else '#' }}" target="_blank" rel="noopener noreferrer"
data-track-platform="momo"
data-track-source="dashboard-v2-overview-review-queue"
data-track-product-id="{{ item.sku }}"
data-track-icode="{{ item.sku }}"
data-track-product-name="{{ item.name|e }}">MOMO {{ item.sku }}</a>
{% if item.candidate_pc_id %}
<a class="dashboard-platform-link is-pchome" href="https://24h.pchome.com.tw/prod/{{ item.candidate_pc_id }}" target="_blank" rel="noopener noreferrer">PChome {{ item.candidate_pc_id }}</a>
{% endif %}
</div>
</div>
{% endfor %}
</div>
<a class="dashboard-focus-action" href="{{ url_for('dashboard.index', filter='pchome_review', category=current_category, q=search_query, sort_by='pchome_review', order='desc') }}">查看高優先覆核隊列</a>
{% elif overview.pending_priority %}
<div class="dashboard-focus-list">
{% for item in overview.pending_priority %}
<div class="dashboard-focus-row">
@@ -172,8 +209,8 @@
{% endfor %}
</div>
{% else %}
<div class="dashboard-focus-title">待比對清單已清空</div>
<div class="dashboard-focus-sub momo-mono">目前 ACTIVE 商品都有有效 PChome 配對或尚無最新 MOMO 價格</div>
<div class="dashboard-focus-title">覆核隊列已清空</div>
<div class="dashboard-focus-sub momo-mono">目前 ACTIVE 商品沒有高優先 PChome 覆核項目</div>
{% endif %}
</div>
</div>
@@ -203,6 +240,7 @@
<div class="dashboard-segmented">
<a class="{% if current_filter == 'all' %}is-active{% endif %}" href="{{ url_for('dashboard.index', filter='all', category=current_category, q=search_query, sort_by=current_sort, order=current_order) }}">全部</a>
<a class="{% if current_filter == 'ai_picks' %}is-active{% endif %}" href="{{ url_for('dashboard.index', filter='ai_picks', category=current_category, q=search_query, sort_by='timestamp', order='desc') }}">AI挑品</a>
<a class="{% if current_filter == 'pchome_review' %}is-active{% endif %}" href="{{ url_for('dashboard.index', filter='pchome_review', category=current_category, q=search_query, sort_by='pchome_review', order='desc') }}">比價覆核</a>
<a class="{% if current_filter == 'new' %}is-active{% endif %}" href="{{ url_for('dashboard.index', filter='new', category=current_category, q=search_query, sort_by=current_sort, order=current_order) }}">新上架</a>
<a class="{% if current_filter == 'increase' %}is-active{% endif %}" href="{{ url_for('dashboard.index', filter='increase', category=current_category, q=search_query, sort_by=current_sort, order=current_order) }}">漲價</a>
<a class="{% if current_filter == 'decrease' %}is-active{% endif %}" href="{{ url_for('dashboard.index', filter='decrease', category=current_category, q=search_query, sort_by=current_sort, order=current_order) }}">降價</a>
@@ -223,10 +261,12 @@
<div class="dashboard-table-card">
<div class="dashboard-table-head">
<span class="dashboard-section-index momo-mono">04</span>
<span class="dashboard-table-title">{{ 'AI 挑品清單' if current_filter == 'ai_picks' else '商品列表' }}</span>
<span class="dashboard-table-title">{{ 'AI 挑品清單' if current_filter == 'ai_picks' else ('比價覆核隊列' if current_filter == 'pchome_review' else '商品列表') }}</span>
<span class="dashboard-table-meta momo-mono">
{% if current_filter == 'ai_picks' %}
{{ total_items | number_format }} / {{ ai_pick_list_limit }} 品
{% elif current_filter == 'pchome_review' %}
{{ total_items | number_format }} / {{ overview.review_queue_count | default(0) | number_format }} 待處理
{% else %}
{{ total_items | number_format }} 筆
{% endif %}
@@ -293,7 +333,7 @@
{% endif %}
<div class="dashboard-table-wrap">
<table class="dashboard-table {% if current_filter == 'ai_picks' %}is-ai-picks{% endif %}">
<table class="dashboard-table {% if current_filter == 'ai_picks' %}is-ai-picks{% elif current_filter == 'pchome_review' %}is-review{% endif %}">
<thead>
<tr>
<th>分類</th>
@@ -305,6 +345,8 @@
<th>競價判讀</th>
{% if current_filter == 'ai_picks' %}
<th>AI 建議</th>
{% elif current_filter == 'pchome_review' %}
<th>覆核動作</th>
{% endif %}
<th class="text-end">
<a href="{{ url_for('dashboard.index', page=1, sort_by='yesterday_change', order='asc' if current_sort == 'yesterday_change' and current_order == 'desc' else 'desc', category=current_category, filter=current_filter, q=search_query) }}">昨日漲跌</a>
@@ -442,6 +484,35 @@
<span class="dashboard-muted">尚無建議理由</span>
{% endif %}
</td>
{% elif current_filter == 'pchome_review' %}
<td>
{% set review = item.pchome_review %}
<div class="dashboard-review-card">
<div class="dashboard-ai-pick-head">
<span class="dashboard-ai-pick-rank">{{ review.status_label if review else match_status.label }}</span>
{% if review and review.best_match_score %}
<span class="dashboard-ai-pick-confidence is-medium">match {{ (review.best_match_score * 100) | round(0) | int }}%</span>
{% endif %}
</div>
<div class="dashboard-ai-pick-reason">{{ review.action_label if review else decision.summary }}</div>
{% if review %}
<div class="dashboard-ai-evidence-line">
{% if review.candidate_count %}
<span>{{ review.candidate_count }} 筆候選</span>
{% endif %}
{% if review.candidate_pc_id %}
<span>PChome {{ review.candidate_pc_id }}</span>
{% endif %}
{% if review.attempted_at %}
<span>{{ review.attempted_at }}</span>
{% endif %}
</div>
{% if review.unit_comparison and review.unit_comparison.summary %}
<div class="dashboard-review-note momo-mono">{{ review.unit_comparison.summary }}</div>
{% endif %}
{% endif %}
</div>
</td>
{% endif %}
<td class="text-end momo-mono">
{% if item.yesterday_diff > 0 %}
@@ -471,7 +542,7 @@
</tr>
{% else %}
<tr>
<td colspan="{{ 10 if current_filter == 'ai_picks' else 9 }}">
<td colspan="{{ 10 if current_filter in ['ai_picks', 'pchome_review'] else 9 }}">
<div class="dashboard-empty">
{% if search_query %}
找不到與「{{ search_query }}」相關的商品