<?php
namespace platyFramework;

/**
 * 주문 성공 창
 *
 * @var ptyshopOrderItemModel $orderItem
 * @var string $userId
 */
?>
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="data:image/x-icon" type="image/x-icon">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="/modules/ptyshop/resources/app.css">
    <link rel="stylesheet" href="/modules/ptyshop/resources/app2.css">

    <link rel="stylesheet" href="/static/css/v15/app.css?2021021621">
    <link rel="stylesheet" href="/static/css/v15/sale09_app.css?2021021621>">
    <link rel="icon" href="data:;base64,iVBORw0KGgo=">
    <script src="/static/js/jquery-3.1.1.min.js"></script>
    <script src="/static/js/clipboard.min.js"></script>
    <script src="/static/js/common.js?2021021621"></script><!-- // 공통 -->
    <script src="/static/js/commonLib.js?2021021621"></script><!-- // 앱간 인터페이스 -->
    <title>굿즈쉐어</title>
</head>
<script type="text/javascript">
    var DEEP = 'intent://jasonpay_salepoison';
    var AGENT = 'web';

    $(document).ready(function () {
        //플친맺기
        $('.plus_link').click(function () {
            window.location.href = DEEP + "?view=kakaofriendhome#Intent;scheme=view;end ";
        });
        //상담하기
        $('.plus_link2').click(function () {
            window.location.href = DEEP + "?view=kakaofriendchat#Intent;scheme=view;end ";
        });

        //AdBrix
        // window.CL.callNative(1008, '{"totalAmount":6800,"orderId":"161554153015766","list":[{"productId":10016099,"productName":"DCOVERS \\ub514\\ucee4\\ubc84\\uc2a4 \\uba74, \\ucfe8\\ub860,\\ub808\\uc778\\ubcf4\\uc6b0 (\\ub0a8\\uc5ec\\uacf5\\uc6a9)","price":6800,"quantity":1,"deliveryCharge":0}]}', AGENT);
    });
</script>

<body class="complete_payment">
<div class="complete_message">
    <?
    switch ($orderItem->paid) {
        case -1:
            $msg = "주문 및 결제가 진행중입니다";
            break;
        case 0:
            $msg = "결제가 실패되었습니다";
            break;
        case 1:
            $msg = "주문이 완료되었습니다";
            break;
        case 2:
            $msg = "결제 대기 중입니다";
            break;
    } ?>
    <p class="phrase"><?= $msg ?></p>
</div>
<?
$paidResult = json_decode($orderItem->paidResult, true);
//ptyDebug($orderItem);
//ptyDebug($paidResult);
?>
<? if ($orderItem->payMethod == "vbank") { ?>
    <div class="order_info">
        <h1 class="title">무통장 입금정보</h1>
        <dl class="individual">
            <dt>입금은행</dt>
            <dd><?= $paidResult['inicis']['approvalResult']['P_FN_NM'] ?></dd>
        </dl>
        <dl class="individual">
            <dt>입금계좌</dt>
            <dd><?= $paidResult['inicis']['approvalResult']['P_VACT_NUM'] ?></dd>
        </dl>
        <dl class="individual">
            <dt>예금주</dt>
            <dd><?= $paidResult['inicis']['approvalResult']['P_VACT_NAME'] ?></dd>
        </dl>
        <dl class="individual">
            <dt>입금기한</dt>
            <dd><?
                $date = sprintf("%s년 %s월 %s일",
                    substr($paidResult['inicis']['approvalResult']['P_VACT_DATE'], 0, 4),
                    substr($paidResult['inicis']['approvalResult']['P_VACT_DATE'], 4, 2),
                    substr($paidResult['inicis']['approvalResult']['P_VACT_DATE'], 6, 2));
                echo $date;
                ?></dd>
        </dl>
        <dl class="individual">
            <dt>결제금액</dt>
            <dd class="total_price"><strong><?= number_format($orderItem->price) ?></strong><span>원</span>
            </dd>
        </dl>
    </div>
<? } ?>
<div class="order_info">
    <h1 class="title">주문 정보</h1>
    <dl class="individual">
        <dt>주문번호</dt>
        <dd><?= $orderItem->orderId ?></dd>
    </dl>
    <dl class="individual">
        <dt>상품명</dt>
        <dd><span class="name"><?= $orderItem->title ?></span></dd>
    </dl>
    <? if (false) { ?>
        <dl class="individual">
            <dt>상품금액</dt>
            <dd class="price"><strong><?= number_format($orderItem->price) ?></strong><span>원</span></dd>
        </dl>
        <dl class="individual">
            <dt>배송비</dt>
            <dd class="price"><strong></strong><span>원</span></dd>
        </dl>
    <? } ?>
    <dl class="individual">
        <dt>결제방식</dt>
        <dd><?= $orderItem->getPaymethodTitle() ?></dd>
    </dl>
    <dl class="individual">
        <dt>결제금액</dt>
        <dd class="total_price"><strong><?= number_format($orderItem->price) ?></strong><span>원</span></dd>
    </dl>
</div>

<div class="delivery_info">
    <h1 class="title">배송 정보</h1>
    <dl class="individual">
        <dt>수령자</dt>
        <dd><?= $orderItem->deliveryName ?></dd>
    </dl>
    <dl class="individual">
        <dt>배송지</dt>
        <dd><? echo "{$orderItem->deliveryAddress1} {$orderItem->deliveryAddress2}" ?></dd>
    </dl>
    <dl class="individual">
        <dt>연락처</dt>
        <dd class="telephone"><?= $orderItem->getPhoneNumberFormat($orderItem->deliveryPhoneNumber) ?></dd>
    </dl>
    <dl class="individual">
        <dt>배송메모</dt>
        <dd><?= $orderItem->deliveryMemo ?></dd>
    </dl>
</div>

<div class="button_area">
    <a href="{{home}}/?userId=<?= urlencode($userId) ?>" class="button_home">홈으로</a>
    <a href="/ptyshop/order/get/?userId=<?= urlencode($userId) ?>" class="buttom_order">주문/배송 조회</a>
    <!--    <a href="/cart/get/?uid=a27b1d76-d4aa-3f11-b384-d6b8431e6a51" class="button_home">홈으로</a>-->
    <!--    <a href="/order/get/?uid=a27b1d76-d4aa-3f11-b384-d6b8431e6a51" class="buttom_order">주문/배송 조회</a>-->
</div>

</body>

</html>