<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>端午节活动</title>
    <style>
        html,
        body {
            margin: 0 auto;
            padding: 0;
            max-width: 450px;
            font-size: 100px;
        }

        html {
            background: #ffc362;
        }

        p {
            margin: 0;
        }

        .main_box {
            font-size: 0;
            position: relative;
        }

        .main_box img {
            width: 100%;
        }

        .container-wrap {
            position: absolute;
            width: 80%;
            top: 40%;
            left: 50%;
            transform: translate(-50%, 0);
        }

        .recharge-wrap {
            margin-bottom: 0.2rem;
        }

        .recharge-item:not(:last-child) {
            margin-bottom: 0.2rem;
        }

        .recharge-item.cur img {
            box-sizing: border-box;
            -webkit-filter: drop-shadow(0 0.08rem 0.12rem rgba(141, 41, 0, 0.53));
            filter: drop-shadow(0 0.08rem 0.12rem rgba(141, 41, 0, 0.53));
        }
    </style>
</head>

<body>
<main class="main_box">
    <img src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/bg2.jpg" alt=""/>
    <div class="container-wrap">
        <div class="recharge-wrap">
            <div class="recharge-item cur">
                <img
                        src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-58-focus.png"
                        data-src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-58.png"
                        data-active="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-58-focus.png"
                        data-active-status="1"
                        alt=""
                        data-href="{{$url[0]}}"
                />
            </div>
            <div class="recharge-item">
                <img
                        src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-100.png"
                        data-src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-100.png"
                        data-active="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-100-focus.png"
                        data-active-status="0"
                        alt=""
                        data-href="{{$url[1]}}"
                />
            </div>
            <div class="recharge-item">
                <img
                        src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-288.png"
                        data-src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-288.png"
                        data-active="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/inner-288-focus.png"
                        data-active-status="0"
                        alt=""
                        data-href="{{$url[2]}}"
                />
            </div>
        </div>
        <div class="to-recharge">
            @if($code == 0)
                <a href="{{$url[0]}}" id="pay"><img src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/doing.png" alt=""/></a>
            @elseif($code == 1)
                <a href="javascript:void(0)" id="pay"><img src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/un_do.png" alt=""/></a>
            @else
                <a href="javascript:void(0)" id="pay"><img src="https://cdn-novel.iycdm.com/h5/activity-2019-06-05/done.png" alt=""/></a>
            @endif
        </div>
    </div>
</main>
</body>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>
    // 按钮点击
    $(".recharge-wrap").delegate("img", "click", function () {
        $(".recharge-item").removeClass("cur");
        $(this)
                .parent()
                .addClass("cur");
        var url  =$(this).data("href");
        $('#pay').attr('href',url);
        var active = $(this).attr("data-active");
        var is_active = $(this).attr("data-active-status");
        if (!+is_active) {
            reset();
            $(this).attr("src", active);
            $(this).attr("data-active-status", 1);
        }
    });

    // 重置
    function reset() {
        var imgs = $(".recharge-item img");
        for (var i = 0; i < imgs.length; i++) {
            (function (index) {
                var img = imgs[i]
                var src = $(img).attr("data-src");
                $(img).attr("src", src);
                $(img).attr("data-active-status", 0);
            })(i)
        }
    }

    // 重置
    /*
    $(".to-recharge").delegate("img", "click", function () {
        console.log("去充值");
    })*/
</script>
</html>

