@extends('web.layouts.subpage') @php $mypageActive = $mypageActive ?? 'usage'; $attempt = $attempt ?? []; $order = $order ?? []; $items = $items ?? []; $pins = $pins ?? []; $pinsOpened = (bool)($pinsOpened ?? false); $canCancel = (bool)($canCancel ?? false); $backToListQuery = request()->only(['q', 'method', 'status', 'from', 'to', 'page']); $backToListQuery = array_filter($backToListQuery, fn($v) => $v !== null && $v !== ''); // 결제수단 한글 매핑 $methodLabel = function ($m) { $m = (string)$m; return match ($m) { 'card' => '카드', 'phone' => '휴대폰', 'wire' => '계좌이체', 'vact' => '가상계좌', default => $m ?: '-', }; }; // 리스트와 동일한 상태 라벨 $statusLabel = function () use ($attempt, $order) { $aCancel = (string)($attempt['cancel_status'] ?? 'none'); $oCancel = (string)($order['cancel_status'] ?? 'none'); // 결제 후 취소는 cancel_status=success로만 인식 if ($aCancel === 'success' || $oCancel === 'success') return '결제취소'; $aStatus = (string)($attempt['status'] ?? ''); $oPay = (string)($order['stat_pay'] ?? ''); if ($aStatus === 'paid' || $oPay === 'p') return '결제완료'; if ($aStatus === 'issued' || $oPay === 'w') return '입금대기'; // 화면 깨짐 방지용(원하면 숨겨도 됨) if ($aStatus === 'failed' || $oPay === 'f') return '결제실패'; return '진행중'; }; $st = $statusLabel(); $isCancelledAfterPaid = ($st === '결제취소'); // 취소 완료면 전표만 남김 $statusClass = function ($label) { return match ($label) { '결제취소' => 'pill--danger', '결제완료' => 'pill--ok', '입금대기' => 'pill--wait', '결제실패' => 'pill--danger', default => 'pill--muted', }; }; // 전표용 값 $attemptId = (int)($attempt['id'] ?? 0); $oid = (string)($order['oid'] ?? ''); $method = (string)($order['pay_method'] ?? ($attempt['pay_method'] ?? '')); $methodKor = $methodLabel($method); $amounts = (array)($order['amounts'] ?? []); $subtotal = (int)($amounts['subtotal'] ?? 0); $fee = (int)($amounts['fee'] ?? 0); $payMoney = (int)($amounts['pay_money'] ?? 0); // 상품명: 현재 전달받는 변수 기준 유지 (사용자 확인 완료) $productName = (string)($productname ?? ''); if ($productName === '') $productName = '-'; $itemName = (string)($items[0]['name'] ?? ''); if ($itemName === '') $itemName = '-'; // 수량 합계 $totalQty = 0; foreach ($items as $it) $totalQty += (int)($it['qty'] ?? 0); // 일시 (분까지) $createdAt = (string)($order['created_at'] ?? ($attempt['created_at'] ?? '')); $dateStr = $createdAt ? \Carbon\Carbon::parse($createdAt)->format('Y-m-d H:i') : '-'; // 핀 목록 "추후 조건" 대비: 지금은 보여줌 $showPinsNow = true; // 핀발행 완료 여부 (우선 pins 존재 기준) // 추후 서버에서 bool($pinsIssuedCompleted) 내려주면 그 값 우선 사용 권장 $isPinIssuedCompleted = (bool)($pinsIssuedCompleted ?? !empty($pins)); // 오른쪽 영역 배너 모드 조건 $useRightBannerMode = $isCancelledAfterPaid || $isPinIssuedCompleted; @endphp @section('title', '구매내역 상세') @section('subcontent')
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
← 목록
{{-- 상단: 전표 + 우측 영역(핀발행/배너) --}}
{{-- 좌측: 영수증형 전표 --}}
결제 영수증
{{ $dateStr }} · {{ $methodKor }}
{{ $st }}
{{ $productName }} [ {{ $itemName }} ]
결제번호 #{{ $attemptId ?: '-' }}
주문번호 {{ $oid ?: '-' }}
결제수단 {{ $methodKor }}
수량 {{ $totalQty }}
상품금액 {{ number_format($subtotal) }}원
고객수수료 {{ number_format($fee) }}원
결제금액 {{ number_format($payMoney) }}원
@if(!empty($order['cancel_last_msg']))
취소 처리 결과
{{ $order['cancel_last_msg'] }}
@endif
{{-- 우측: 핀발행 인터랙션 또는 안내 배너 --}}
@if(!$isCancelledAfterPaid) {{-- 핀 목록 --}} @if($showPinsNow)

핀 목록

핀 발행이 완료되면 이 영역에서 핀 정보를 확인할 수 있습니다. (현재는 UI 확인을 위해 표시 중)
@if(empty($pins))

표시할 핀이 없습니다.

@else @endif
@endif {{-- 취소 버튼은 맨 아래, 작게 --}}

결제 취소

핀을 확인/발행한 이후에는 취소가 제한될 수 있습니다.
결제 후 취소는 처리 시간이 소요될 수 있으며, 취소 결과는 본 페이지에 반영됩니다.
@if($canCancel)
@csrf
@else
현재 상태에서는 결제 취소가 불가능합니다.
@endif
@endif
@endsection