feat(performance): 카페24 마켓 연동 주문을 해당 쇼핑몰 열로 집계
- 카페24 마켓 통합관리가 가져온 주문(market_id ≠ self)을 MARKET_MAP 으로 네이버·쿠팡·11번가 등 열에 (SaleEvent.marketplace_code). 연결표에 없는 마켓은 카페24 열 — 전체 합계는 카페24 일별 매출내역과 같음 - 환불도 원 주문의 마켓으로 같은 열에 - 카페24 사건 ID 에 c24: 접두어, 기간 교체는 카페24 열 + 다른 열의 c24: 행만 — 직접 연동분은 보존 - 매출 대조 마켓별 표에 "반영 열", 설정 화면에 "카페24 경유" 표시 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -482,6 +482,8 @@
|
||||
const r = await api("GET", "/performance/api/marketplaces/cafe24/reconcile?date=" + encodeURIComponent(day));
|
||||
if (!r.ok) { out.innerHTML = '<p class="perf-notice is-warn">' + esc((r.label ? r.label + " — " : "") + r.message) + "</p>"; return; }
|
||||
const s = r.orders.self, m = r.orders.market, rs = r.refunds.self, rm = r.refunds.market;
|
||||
const MARKET_NAMES = {};
|
||||
root.querySelectorAll("tr[data-code]").forEach(function (tr) { MARKET_NAMES[tr.dataset.code] = tr.dataset.name; });
|
||||
const disc = ["membership_discount_amount", "set_product_discount_amount", "app_discount_amount",
|
||||
"market_other_discount_amount", "shipping_fee_discount_amount"];
|
||||
const coup = ["coupon_discount_price", "coupon_shipping_fee_amount"];
|
||||
@@ -510,7 +512,7 @@
|
||||
["순매출(결제합계 − 환불합계)", s.total - rs.actual_refund_amount, m.total - rm.actual_refund_amount, "key"],
|
||||
]);
|
||||
out.innerHTML = '<table class="perf-table" style="margin-top:8px"><thead><tr><th class="perf-th-label">' + esc(r.date) +
|
||||
"</th><th>자체몰(실적 반영)</th><th>다른 마켓 연동(제외)</th></tr></thead><tbody>" +
|
||||
"</th><th>자체몰(카페24 열)</th><th>다른 마켓 연동(해당 쇼핑몰 열)</th></tr></thead><tbody>" +
|
||||
rows.map(function (x) {
|
||||
const cls = x[3] === "key" ? ' class="perf-row-week"' : "";
|
||||
const f = function (v) { return x[3] === "cnt" ? fmt(v) : won(v); };
|
||||
@@ -520,9 +522,11 @@
|
||||
((r.by_market || []).length
|
||||
? '<h4 class="perf-h" style="margin:14px 0 6px">다른 마켓 연동 주문 — 마켓별</h4>' +
|
||||
'<table class="perf-table"><thead><tr><th class="perf-th-label">market_id</th><th class="perf-th-label">주문경로</th>' +
|
||||
"<th>주문수</th><th>결제합계</th><th>환불</th><th>순매출</th></tr></thead><tbody>" +
|
||||
'<th class="perf-th-label">반영 열</th><th>주문수</th><th>결제합계</th><th>환불</th><th>순매출</th></tr></thead><tbody>' +
|
||||
r.by_market.map(function (b) {
|
||||
const col = MARKET_NAMES[b.target] || b.target;
|
||||
return '<tr><td class="perf-td-label">' + esc(b.market_id) + "</td><td>" + esc((b.names || []).join(", ")) +
|
||||
"</td><td>" + esc(col) + (b.target === "cafe24" ? ' <span class="perf-muted">(연결표 없음)</span>' : "") +
|
||||
'</td><td class="perf-num">' + fmt(b.orders) + '</td><td class="perf-num">' + won(b.total) +
|
||||
'</td><td class="perf-num">' + won(-b.refund_amount) + '</td><td class="perf-num">' + won(b.total - b.refund_amount) + "</td></tr>";
|
||||
}).join("") + "</tbody></table>"
|
||||
|
||||
Reference in New Issue
Block a user