<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta content="telephone=no" name="format-detection">
    <meta name="wap-font-scale" content="no">
    <title></title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="layer-v3.1.0/layer.css">
    <link rel="stylesheet" href="css/indexLi.css?v='23123121'">
    <script src="js/fsize.js"></script>
    <style>
        body {
            background: #FFF;
        }

        .paypal-false-btn {
            background: #FF57A0;
        }

        .paypal-tips {
            color: #333;
        }

        .layui-layer-setwin .layui-layer-close2 {
            display: none !important;
        }

        .layui-layer-page .layui-layer-content {
            border-radius: 0.4rem !important;
        }

        .yourclass2 {
            border-radius: 0.4rem !important;
        }

        .paypal-big-box {
            width: 8.9rem;
            position: relative;
            margin: 0 auto;
            height: 6rem;
            background: url(./img/payoneerbigBox.png) no-repeat;
            background-size: 100% 100%;
            overflow: hidden;
        }

        .paypal-layer .paypal-layer-content :nth-child(2) {
            color: #333;
        }

        .payoneerTaxInfo {
            font-size: 0.373rem;
            text-decoration: underline;
            width: 100%;
            text-align: center;
            margin-top: 5.8rem;
        }
    </style>
</head>

<body>
    <div style="height: 1rem;"></div>
    <div class="paypal-big-box">
        <p class="paypal-true-p1">Payoneer:<span class="paypal-big-mall"></span></p>
        <p class="paypal-true-p2"></p>
        <div class="paypal-input"><span class="money-logo">$</span><input oninput="value=value.replace(/[^\d]/g,'')"
                type="text" placeholder=""></div>
        <p class="paypal-true-p3"></p>
    </div>
    <div class="paypal-false-btn "></div>

    <div class="payoneerTaxInfo"><a href="../help/payoneerTaxHelp.html"></a></div>
    <!-- <p class="paypal-tips-b"><a
            href="https://www.paypal.com/hk/webapps/mpp/ua/useragreement-full?locale.x=zh_HK#exhibit_"></a></p> -->
    <div class="paypal-layer">
        <div class="paypal-layer-content">
            <p></p>
            <p></p>
        </div>
        <div class="paypal-layer-btnBox">
            <div class="paypal-layer-no"></div>
            <div class="paypal-layer-yes"></div>
        </div>
    </div>
</body>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="layer-v3.1.0/layer/layer.js"></script>
<script src="../../lib/langchange.js?v=100000"></script>
<script>
    $('title').html(langList[langType].payoneer20);
    $('.paypal-true-p2').html(langList[langType].payoneer15);

    $('.paypal-input input').attr('placeholder', langList[langType].payoneer16);
    $('.paypal-true-p3').html(langList[langType].payoneer17 + '$<span class="paypal-money">--</span>,<span class="paypal-all" style="color: #2ADAAB;">' + langList[langType].payoneer18 + '</span>');
    $('.paypal-false-btn ').html(langList[langType].payoneer10);

    $('.paypal-layer-content p').eq(0).html(langList[langType].cashreal13 + ' <span class="layer-money">--</span>' + langList[langType].cashreal14 + ' <br>' + langList[langType].cashreal15 + '<span class="layer-mall">--</span>' + langList[langType].cashreal16);
    $('.paypal-layer-content p').eq(1).html(langList[langType].payoneer21);
    $('.paypal-layer-no').html(langList[langType].payoneer4);
    $('.paypal-layer-yes').html(langList[langType].payoneer5);
    $('.paypal-tips-b a').html(langList[langType].payoneer19);
    $('.payoneerTaxInfo a').html(langList[langType].payoneer22);

    $('.payoneerTaxInfo a')[0].href += window.location.search
    //呼叫帮助
    try {
        var obj2 = {
            "cid": 9,
            "reqCode": new Date().getTime(),
            "data": {
                msg: '是否分享或帮助',
                shareType: 0,
                helpType: 1
            }
        }
        var obj = JSON.stringify(obj2);
        localStorage.help = 'payoneer'
        appCollaboration(obj)

    }
    catch (err) {
        console.log(err)
    }

    var data = getRequest()
    if (sessionStorage.bbb == undefined || sessionStorage.bbb == "undefined") {
        sessionStorage.bbb = data.uid;
        sessionStorage.lang = data.lang;
        sessionStorage.kkk = data.token;
    }


    $.ajax({
        url: $ip + '/withdraw/getbindway.html',
        type: "post",
        data: {
            os: "WEB",
            cid: "web_gw",
            lang: 2,
            uid: sessionStorage.bbb,
            token: sessionStorage.kkk
        },
        success: function (msg) {
            var data = JSON.parse(msg);
            console.log(data);
            btnOK = true;
            $(".paypal-big-mall").text(data.cardaddr);
            $(".paypal-money").text(parseInt(data.cashamount / 10) * 10);
            $('.paypal-input input').val(parseInt(data.cashamount / 10) * 10)
            if ($('.paypal-input input').val() > 49) {
                $(".paypal-false-btn").addClass("paypal-btn-ok");
            }
            //全部提現
            $(".paypal-all").on("click", function () {
                $('.paypal-input input').val(parseInt(data.cashamount / 10) * 10)
            })
            //輸入金額
            $('.paypal-input input').on("input", function () {
                if ($('.paypal-input input').val().length > 1 && $('.paypal-input input').val() % 10 != 0) {
                    $('.paypal-input input').val(parseInt($('.paypal-input input').val() / 10) * 10);
                    layer.msg(langList[langType].cashreal27)
                }

                if ($('.paypal-input input').val() > parseInt(data.cashamount / 10) * 10) {
                    $('.paypal-input input').val(parseInt(data.cashamount / 10) * 10);
                    layer.msg(langList[langType].cashreal14);
                }
                else if ($('.paypal-input input').val() < 50) {
                    $(".paypal-false-btn").removeClass("paypal-btn-ok");
                }
                else if ($('.paypal-input input').val() > 49) {
                    $(".paypal-false-btn").addClass("paypal-btn-ok");
                }
            })
            $(".paypal-btn-ok").on("click", function () {
                if (btnOK == true) {
                    btnOK = false;
                    $(".layer-money").text($(".paypal-input input").val());
                    $(".layer-mall").text($(".paypal-big-mall").text())
                    if ($('.paypal-input input').val() > 49) {
                        $.ajax({
                            url: $ip + '/withdraw/queryCashData.html',
                            type: "post",
                            data: {
                                os: "WEB",
                                cid: "web_gw",
                                lang: 2,
                                uid: sessionStorage.bbb,
                                token: sessionStorage.kkk,
                                amount: $('.paypal-input input').val()
                            },
                            success: function (res) {
                                var result = JSON.parse(res);
                                if (result.code == 1) {
                                    $('.totalCost').html(result.cashBonds);
                                    $('.taxCost').html(result.rateBonds);
                                    layer.open({
                                        type: 1,
                                        title: false,
                                        shadeClose: false,
                                        skin: 'yourclass2',
                                        area: ['7.2rem', '4.6rem'],
                                        content: $(".paypal-layer"),
                                    });
                                } else {
                                    layer.msg(result.msg)
                                }

                            }
                        })

                    } else {
                        layer.msg(langList[langType].cashreal32)
                        btnOK = true;
                    }

                }
            })

        }
    })

    $(".paypal-layer-no").on("click", function () {
        layer.closeAll()
        btnOK = true;
    })
    $(".paypal-layer-yes").on("click", function () {
        paypalGet()
    })
    function paypalGet() {
        if ($('.paypal-input input').val() > 49) {
            $.ajax({
                url: $ip + '/withdraw/payoneerApply.html',
                type: "post",
                data: {
                    os: "WEB",
                    cid: "h5_firefly",
                    lang: 2,
                    uid: sessionStorage.bbb,
                    amount: $('.paypal-input input').val(),
                    token: sessionStorage.kkk
                },
                success: function (msg) {
                    var data = JSON.parse(msg);
                    console.log(data);
                    if (data.code == 1) {
                        sessionStorage.payNum = data.wid;
                        window.location.href = 'withdrawEnd.html';
                    } else {
                        layer.msg(data.msg)
                        btnOK = true;
                    }
                }
            })
        } else {
            layer.msg(langList[langType].cashreal32);
        }

    }
</script>

</html>