feat(performance): 카페24 매출 대조 — 채널별 PC/모바일 주문 분리 + 결제수단별 표
- 주문 채널별 표에 PC 주문 / 모바일 주문(주문의 order_from_mobile 기준 — PC 채널이어도 휴대폰 주문은 모바일) 건수·결제합계, 카페24 열(자체몰) 합계 줄 - 결제수단별 표(카페24 열 주문의 payment_method_name 조합별 주문수·결제합계·비중) - 대조 카드를 설정 화면 가로 전체 폭으로(넓은 표가 잘리지 않게), 자체몰 채널 이름 정리(PC) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,7 @@ a.perf-seg.is-active, a.perf-seg.is-active:link, a.perf-seg.is-active:visited {
|
||||
.perf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
|
||||
.perf-h { margin: 0; font-size: 14px; font-weight: 600; }
|
||||
.perf-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
||||
.perf-grid2 > .perf-card-wide { grid-column: 1 / -1; } /* 표가 넓은 카드(매출 대조)는 한 줄 전체 */
|
||||
.perf-foot { margin: 8px 0 0; line-height: 1.5; }
|
||||
|
||||
/* 표 */
|
||||
|
||||
@@ -482,6 +482,7 @@
|
||||
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 dev = function (n, amt) { return n ? fmt(n) + '건 <span class="perf-muted">' + won(amt) + "</span>" : won(0); };
|
||||
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",
|
||||
@@ -522,7 +523,8 @@
|
||||
((r.by_channel || []).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 class="perf-th-label">구분</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 class="perf-th-label">반영 열</th><th>주문수</th><th>결제합계</th>' +
|
||||
"<th>PC 주문</th><th>모바일 주문</th><th>환불</th><th>순매출</th></tr></thead><tbody>" +
|
||||
r.by_channel.map(function (b) {
|
||||
const col = MARKET_NAMES[b.target] || b.target;
|
||||
const kind = b.kind === "self" ? "자체몰 채널" + (b.label ? "(" + b.label + ")" : "")
|
||||
@@ -530,8 +532,34 @@
|
||||
return '<tr><td class="perf-td-label">' + esc(b.market_id) + "</td><td>" + esc((b.names || []).join(", ")) +
|
||||
"</td><td>" + (b.kind === "unknown" ? kind : esc(kind)) + "</td><td>" + esc(col) +
|
||||
'</td><td class="perf-num">' + fmt(b.orders) + '</td><td class="perf-num">' + won(b.total) +
|
||||
'</td><td class="perf-num">' + dev(b.pc_orders, b.pc_total) + '</td><td class="perf-num">' + dev(b.mobile_orders, b.mobile_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>"
|
||||
}).join("") + "</tbody>" +
|
||||
// 카페24 열(자체몰) 기기 합계
|
||||
(function () {
|
||||
const own = r.by_channel.filter(function (b) { return b.target === "cafe24"; });
|
||||
const t = own.reduce(function (a, b) {
|
||||
a.o += b.orders; a.t += b.total; a.po += b.pc_orders; a.pt += b.pc_total; a.mo += b.mobile_orders; a.mt += b.mobile_total;
|
||||
a.ra += b.refund_amount; return a;
|
||||
}, { o: 0, t: 0, po: 0, pt: 0, mo: 0, mt: 0, ra: 0 });
|
||||
return '<tfoot><tr class="perf-row-week"><th class="perf-td-label" colspan="4">카페24 열(자체몰) 합계</th><td class="perf-num">' +
|
||||
fmt(t.o) + '</td><td class="perf-num">' + won(t.t) + '</td><td class="perf-num">' + dev(t.po, t.pt) +
|
||||
'</td><td class="perf-num">' + dev(t.mo, t.mt) + '</td><td class="perf-num">' + won(-t.ra) +
|
||||
'</td><td class="perf-num">' + won(t.t - t.ra) + "</td></tr></tfoot>";
|
||||
})() + "</table>" +
|
||||
'<p class="perf-foot perf-muted">PC/모바일은 주문의 모바일 주문 여부(order_from_mobile) 기준입니다 — 채널이 PC(self)여도 휴대폰에서 주문하면 모바일로 셉니다.</p>'
|
||||
: "") +
|
||||
((r.by_payment || []).length
|
||||
? '<h4 class="perf-h" style="margin:14px 0 6px">결제수단별 (카페24 열)</h4>' +
|
||||
'<table class="perf-table"><thead><tr><th class="perf-th-label">결제수단</th><th>주문수</th><th>결제합계</th><th>비중</th></tr></thead><tbody>' +
|
||||
(function () {
|
||||
const tot = r.by_payment.reduce(function (a, p) { return a + p.total; }, 0);
|
||||
return r.by_payment.map(function (p) {
|
||||
return '<tr><td class="perf-td-label">' + esc(p.method) + '</td><td class="perf-num">' + fmt(p.orders) +
|
||||
'</td><td class="perf-num">' + won(p.total) + '</td><td class="perf-num">' +
|
||||
(tot > 0 ? (p.total / tot * 100).toFixed(1) + "%" : "–") + "</td></tr>";
|
||||
}).join("");
|
||||
})() + "</tbody></table>"
|
||||
: "") +
|
||||
'<p class="perf-foot perf-muted">' + esc(r.formula) + ". 미결제 주문 " + fmt(r.unpaid_orders) +
|
||||
"건 제외. \"알 수 없는 채널\"은 카페24 열에 넣습니다 — 외부 마켓이면 어느 쇼핑몰인지 알려 주세요.</p>";
|
||||
|
||||
Reference in New Issue
Block a user