/* portal/commerce/public/order-detail.js — 주문 상세: 상태·금액·입금 안내·다음 단계·취소 가능 단계·남는 서비스. 처리 중이면 주기 갱신. */ (() => { const el = document.getElementById('order'); const esc = aw.esc; const money = (n, c) => Number(n).toLocaleString('ko-KR') + (c === 'KRW' ? '원' : ' ' + c); async function load() { try { const { order: o } = await aw.api('GET', `/api/commerce/orders/${el.dataset.id}`); const pi = o.payment_instructions || {}; const kind = o.status === 'approved' ? 'done' : ['rejected', 'expired', 'cancelled'].includes(o.status) ? 'failed' : 'waiting'; el.innerHTML = `
${esc(o.nextStep)}
${o.remaining ? `${esc(o.remaining)}
` : ''}${esc(pi.bank || '')} ${esc(pi.account || '')} (예금주 ${esc(pi.holder || '')})
${esc(pi.note || '')}
` : ''}| 항목 | 수량 | 적용 대상 | 단가 | 세금 | 합계 |
|---|---|---|---|---|---|
| ${esc(i.name)} | ${i.qty} | ${i.target_type === 'site' ? '사이트 ' + esc(i.target_id || '') : '사용자 그룹'} | ${money(i.unit_price, o.currency)} | ${money(i.tax, o.currency)} | ${money(i.amount + i.tax, o.currency)} |
입금 기한 ${o.policyNotes.paymentDeadlineDays}일 · 미납 ${o.policyNotes.restrictionAfterUnpaidDays}일 후 ${esc(o.policyNotes.restrictionEffect || '')}
` : ''}