b4edc16785
Commission keeps its inverted meaning (a drop is good). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
208 lines
14 KiB
HTML
208 lines
14 KiB
HTML
{% extends "erp_base.html" %}
|
|
|
|
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261013c" />{% endblock %}
|
|
|
|
{%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%}
|
|
|
|
{% block content %}
|
|
<section class="perf perf-settings" id="perf-settings">
|
|
{% include "performance/_tabs.html" %}
|
|
|
|
{# 일반 사용자(실적 권한)는 쇼핑몰별 수수료율만 — 사용·집계 토글·API 인증정보·연결 상태·아래 카드는 관리자만(서버 API 도 관리자만) #}
|
|
{% if is_admin and not key_info.ok %}
|
|
<div class="perf-notice is-warn">
|
|
<b>암호화 마스터 키가 없습니다.</b> {{ key_info.message }}
|
|
— 키가 없으면 API 인증정보를 저장할 수 없습니다(수수료 설정·대시보드는 사용 가능).
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="erp-card perf-card">
|
|
<div class="perf-card-head">
|
|
<h2 class="perf-h">쇼핑몰 설정</h2>
|
|
{% if is_admin %}
|
|
<span class="perf-muted">사용 · 매출 집계 · 수동 입력 · 수수료율은 바로 저장됩니다. API 인증정보는 [설정]에서 입력합니다.
|
|
수동 입력을 켜면 실적 일자별 표에서 그 쇼핑몰 날짜 칸에 매출을 직접 넣을 수 있습니다.</span>
|
|
{% else %}
|
|
<span class="perf-muted">쇼핑몰별 수수료율을 설정합니다. 바로 저장되며 실적 화면의 수수료·수수료 차감 매출에 반영됩니다.</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="erp-table-wrap">
|
|
<table class="perf-table perf-set-table">
|
|
<thead>
|
|
<tr>
|
|
<th class="perf-th-label">쇼핑몰</th>
|
|
{% if is_admin %}<th>사용</th>
|
|
<th>매출 집계</th>
|
|
<th>수동 입력</th>{% endif %}
|
|
<th>수수료율</th>
|
|
{% if is_admin %}<th>API 설정</th>
|
|
<th>연결 상태</th>{% endif %}
|
|
<th>마지막 동기화</th>
|
|
{% if is_admin %}<th></th>{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for r in rows %}
|
|
<tr data-code="{{ r.code }}" data-name="{{ r.name }}">
|
|
<th class="perf-td-label" scope="row">{{ r.name }}</th>
|
|
{% if is_admin %}
|
|
<td class="perf-center">
|
|
<label class="perf-switch" title="사용 여부">
|
|
<input type="checkbox" data-field="enabled"{% if r.enabled %} checked{% endif %} /><span></span>
|
|
</label>
|
|
</td>
|
|
<td class="perf-center">
|
|
<label class="perf-switch" title="매출 집계에 포함">
|
|
<input type="checkbox" data-field="include_in_sales"{% if r.include_in_sales %} checked{% endif %} /><span></span>
|
|
</label>
|
|
</td>
|
|
<td class="perf-center">
|
|
<label class="perf-switch" title="{% if r.manual_only %}수동 입력 전용 쇼핑몰 — API 연동이 없어 늘 켜져 있습니다{% else %}수동 입력 사용 — 켜면 실적 일자별 표에서 날짜 칸에 매출을 직접 입력(입력한 날은 API 값 대신){% endif %}">
|
|
<input type="checkbox" data-field="manual_input"{% if r.manual_input or r.manual_only %} checked{% endif %}{% if r.manual_only %} disabled{% endif %} /><span></span>
|
|
</label>
|
|
</td>
|
|
{% endif %}
|
|
<td class="perf-rate-cell">
|
|
<span class="perf-rate">{% if r.rate %}{{ r.rate }}%{% else %}<span class="perf-muted">미설정</span>{% endif %}</span>
|
|
<button type="button" class="erp-btn erp-btn-ghost erp-btn-sm" data-act="rate"
|
|
data-has-history="{{ 1 if r.rate_history else 0 }}">변경{% if r.rate_history > 1 %} · 이력 {{ r.rate_history }}{% endif %}</button>
|
|
</td>
|
|
{% if is_admin %}
|
|
<td>
|
|
{% if r.manual_only %}<span class="perf-pill">수동 입력 전용</span>
|
|
{% elif r.shared %}<span class="perf-pill">공통 연동</span>
|
|
{% elif r.configured %}<span class="perf-pill is-ok">설정완료</span>
|
|
{% else %}<span class="perf-pill">미설정</span>{% endif %}
|
|
{% if r.via_cafe24 %}<span class="perf-pill is-ok" title="카페24 마켓 통합관리로 들어온 이 쇼핑몰 주문을 카페24 수집 때 함께 반영합니다">카페24 경유</span>{% endif %}
|
|
</td>
|
|
<td>
|
|
<span class="perf-status st-{{ r.status }}"
|
|
title="마지막 연결 테스트: {{ when(r.last_test_at) }}{% if r.last_error %} 최근 오류({{ when(r.last_error_at) }}): {{ r.last_error }}{% endif %}">
|
|
<i></i>{{ r.status_label }}</span>
|
|
{% if r.last_error and r.status not in ('ok', 'disabled') %}<div class="perf-err">{{ r.last_error }}</div>{% endif %}
|
|
</td>
|
|
{% endif %}
|
|
<td class="perf-muted perf-nowrap" title="마지막 시도: {{ when(r.last_sync_at) }}">{{ when(r.last_success_sync_at) }}</td>
|
|
{% if is_admin %}
|
|
<td class="perf-nowrap">
|
|
{% if not r.manual_only %}
|
|
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" data-act="creds">설정</button>
|
|
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" data-act="test">연결 테스트</button>
|
|
{% endif %}
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p class="perf-foot perf-muted">
|
|
수수료율은 <b>적용 시작일</b>부터 반영되고, 그 전 실적은 예전 요율로 계산됩니다(과거 실적이 바뀌지 않음).
|
|
{% if is_admin %}상태에 마우스를 올리면 마지막 연결 테스트 시각과 최근 오류를 볼 수 있습니다.{% endif %}
|
|
</p>
|
|
</div>
|
|
|
|
{% if is_admin %}
|
|
<div class="perf-grid2">
|
|
<div class="erp-card perf-card">
|
|
<div class="perf-card-head"><h2 class="perf-h">인증정보 암호화</h2></div>
|
|
<dl class="perf-dl">
|
|
<dt>마스터 키</dt>
|
|
<dd>{% if key_info.ok %}<span class="perf-pill is-ok">설정됨 · 현재 v{{ key_info.current_version }}</span>
|
|
{% set olds = key_info.versions | reject('equalto', key_info.current_version) | list %}
|
|
{% if olds %}<span class="perf-muted">(예전 키 v{{ olds | join(', v') }} 보관 중)</span>{% endif %}
|
|
{% else %}<span class="perf-pill is-bad">미설정</span>{% endif %}</dd>
|
|
<dt>저장된 항목</dt>
|
|
<dd>{% for v, n in key_versions_in_use.items() %}v{{ v }}: {{ n }}개{% if not loop.last %}, {% endif %}{% else %}<span class="perf-muted">없음</span>{% endfor %}</dd>
|
|
</dl>
|
|
{% if stale_key_rows %}
|
|
<p class="perf-notice is-warn">예전 키로 암호화된 항목이 {{ stale_key_rows }}개 있습니다.
|
|
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" id="perf-rekey">현재 키로 다시 암호화</button></p>
|
|
{% endif %}
|
|
<p class="perf-foot perf-muted">
|
|
API 인증정보는 서버에서 AES-256-GCM 으로 암호화해 DB 에 저장합니다. 마스터 키(APP_ENCRYPTION_KEY)는 DB 가 아닌
|
|
서버 환경변수에만 있으며, 키를 잃으면 저장된 인증정보를 복구할 수 없으니 별도로 안전하게 보관하세요.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="erp-card perf-card">
|
|
<div class="perf-card-head"><h2 class="perf-h">과거 매출 가져오기</h2></div>
|
|
<p class="perf-muted">[매출 업데이트]는 최근 며칠만 가져옵니다. 처음 연동했거나 빠진 기간이 있으면 기간을 지정해 한 번에
|
|
가져오세요(연동된 쇼핑몰만, 최대 366일). 같은 주문은 덮어써서 여러 번 해도 중복되지 않습니다.</p>
|
|
<div class="perf-sample-form">
|
|
<input class="erp-input perf-date" type="date" id="perf-backfill-from" value="{{ default_sample_from }}" />
|
|
<span class="perf-muted">~</span>
|
|
<input class="erp-input perf-date" type="date" id="perf-backfill-to" value="{{ default_sample_to }}" />
|
|
<button type="button" class="erp-btn erp-btn-primary" id="perf-backfill">가져오기</button>
|
|
</div>
|
|
<div class="perf-notice" id="perf-backfill-result" hidden></div>
|
|
</div>
|
|
|
|
<div class="erp-card perf-card perf-card-wide">
|
|
<div class="perf-card-head"><h2 class="perf-h">쇼핑몰 원본 데이터 확인</h2></div>
|
|
<p class="perf-muted">쇼핑몰 API 를 기간(최대 31일)으로 실제 불러, 받은 항목·금액 합계를 보여 줍니다(저장하지 않음).
|
|
쇼핑몰 관리자 화면에서 매출이 있던 날을 넣고 결과를 알려 주시면 그 항목으로 매출 수집을 맞춥니다.
|
|
이름·연락처·주소 같은 개인정보는 값을 보이지 않습니다.<br>
|
|
· <b>네이버</b>: 결제일 기준 상품주문 전체(상태별 합계 포함)와 날짜별 "현재 규칙 매출" — 스마트스토어센터 매출과 비교해 주세요.<br>
|
|
· <b>11번가</b>: 주문·클레임·정산 조회 주소별 동작 여부. 정산은 정산일 기준일 수 있어 매출이 있던 날부터 넉넉히(예: 3주).<br>
|
|
· <b>GS샵</b>: 매출 내역·배송비 내역(매출인식일 기준)의 항목별 합계 — 협력사 포털 매출 화면의 같은 기간 숫자와 비교해 주세요.<br>
|
|
· <b>토스쇼핑</b>: 날짜별 매출·환불·순 거래액(= 저장되는 매출)과 주문 상태별·정산 항목 합계 — 토스쇼핑 파트너스의 같은 날 숫자와 비교해 주세요.<br>
|
|
· <b>쿠팡(윙)</b>: 판매자배송 발주서 + 로켓그로스 주문을 결제일로 모아 날짜별 매출 후보(할인 전·후, 취소분 뺀 값, 로켓그로스 따로)와 판매량 — WING 비즈니스 인사이트 → 판매분석에서 같은 날짜의 "매출(원)"·"판매량"과 비교해 주세요.</p>
|
|
<div class="perf-sample-form">
|
|
<select class="erp-input" id="perf-probe-code" aria-label="쇼핑몰">
|
|
<option value="naver">네이버</option>
|
|
<option value="elevenst">11번가</option>
|
|
<option value="gsshop">GS샵</option>
|
|
<option value="toss">토스쇼핑</option>
|
|
<option value="coupang">쿠팡(윙)</option>
|
|
</select>
|
|
<input class="erp-input perf-date" type="date" id="perf-probe-date" value="{{ default_sample_to }}" />
|
|
<span class="perf-muted">~</span>
|
|
<input class="erp-input perf-date" type="date" id="perf-probe-to" value="{{ default_sample_to }}" />
|
|
<button type="button" class="erp-btn erp-btn-outline" id="perf-probe">불러오기</button>
|
|
</div>
|
|
<div id="perf-probe-result"></div>
|
|
</div>
|
|
|
|
<div class="erp-card perf-card perf-card-wide">
|
|
<div class="perf-card-head"><h2 class="perf-h">카페24 매출 대조</h2></div>
|
|
<p class="perf-muted">카페24 관리자 → 통계 → 일별 매출내역과 같은 날짜를 비교합니다. 그날 결제 주문과 환불을 카페24 API 에서
|
|
바로 합산하며(저장하지 않음), 자체몰과 다른 마켓 연동 주문을 나눠 보여 줍니다.</p>
|
|
<div class="perf-sample-form">
|
|
<input class="erp-input perf-date" type="date" id="perf-recon-date" value="{{ default_sample_to }}" />
|
|
<button type="button" class="erp-btn erp-btn-outline" id="perf-recon">대조</button>
|
|
</div>
|
|
<div id="perf-recon-result"></div>
|
|
|
|
<h3 class="perf-h" style="margin:18px 0 6px">일별 한 번에 비교</h3>
|
|
<p class="perf-muted">카페24 일별 매출내역 표를 그대로 복사해 붙여 넣으면 날짜마다 결제합계·환불합계를 저장된 값과 비교합니다.
|
|
[API 값도 계산]을 켜면 지금 규칙으로 카페24에서 다시 계산한 값(저장 안 함)도 함께 보여 줘, 저장값만 틀린 날(다시 가져오면 해결)과
|
|
규칙이 틀린 날을 나눠 볼 수 있습니다. 날짜를 누르면 위 대조를 그날로 엽니다.</p>
|
|
<textarea class="erp-input perf-paste" id="perf-daily-paste" rows="5"
|
|
placeholder="2026-09-29(화) 47 116 2,475,300 … 2,477,800 158,000 2,319,800"></textarea>
|
|
<div class="perf-sample-form" style="margin-top:6px">
|
|
<label class="perf-muted"><input type="checkbox" id="perf-daily-live" /> API 값도 계산(느림)</label>
|
|
<button type="button" class="erp-btn erp-btn-outline" id="perf-daily-check">비교</button>
|
|
</div>
|
|
<div id="perf-daily-result"></div>
|
|
</div>
|
|
|
|
<div class="erp-card perf-card">
|
|
<div class="perf-card-head"><h2 class="perf-h">테스트 데이터</h2>
|
|
<span class="perf-muted">현재 {{ "{:,}".format(sample_count) }}건</span></div>
|
|
<p class="perf-muted">실제 API 연동 전 화면 확인용 모의 매출입니다(사용 중인 쇼핑몰 대상). 실제 데이터와 구분되어 한 번에 지울 수 있습니다.</p>
|
|
<div class="perf-sample-form">
|
|
<input class="erp-input perf-date" type="date" id="perf-sample-from" value="{{ default_sample_from }}" />
|
|
<span class="perf-muted">~</span>
|
|
<input class="erp-input perf-date" type="date" id="perf-sample-to" value="{{ default_sample_to }}" />
|
|
<button type="button" class="erp-btn erp-btn-outline" id="perf-sample-gen">생성</button>
|
|
<button type="button" class="erp-btn erp-btn-danger" id="perf-sample-del"{% if not sample_count %} disabled{% endif %}>모두 삭제</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</section>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}<script src="/static/performance.js?v=20261013a" defer></script>{% endblock %}
|