@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')
표시할 핀이 없습니다.
@else