index.html 20.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711
<!DOCTYPE html>
<html lang="zh">
{include file="public/head"/}
<style>
    li {
        list-style-type: none;
    }

    ul {
        margin: 0;
    }

    .clear {
        clear: both;
    }

    body {
        background: rgba(249, 249, 249, 1);
    }

    /*菜单样式*/
    .content {
        width: 100%;
        font-size: 0;
        background: rgba(249, 249, 249, 1);
    }

    .content .navBarBox {
        width: 100%;
        height: 50px;
        background: rgba(0, 159, 142, 1);
    }

    .content .navBarBox ul {
        width: 1200px;
        height: 100%;
        margin: 0 auto;
        padding: 0;
        font-size: 16px;
        font-family: PingFangSC-Semibold;
        color: rgba(255, 255, 255, 1);
    }

    .content .navBarBox ul li {
        width: 144px;
        height: 100%;
        line-height: 50px;
        list-style-type: none;
        float: left;
    }

    .content .navBarBox ul li a {
        color: rgba(255, 255, 255, 1);
    }

    .content .titleImgContent {
        width: 100%;
        height: 146px;
    }

    .content .titleImgContent img {
        width: 100%;
        height: 100%;
    }

    /*主要内容*/
    .contentBox {
        width: 100%;
        margin-top: 12px;
    }

    .contentMain {
        margin: auto;
        width: 1200px;
    }

    .contentTop {
        height: 62px;
        line-height: 62px;
        margin-bottom: 10px;
        background: #fff;
    }

    .titleText {
        padding-left: 17px;
        height: 22px;
        line-height: 22px;
        font-size: 16px;
        font-family: PingFang SC;
        font-weight: 800;
        color: rgba(0, 159, 142, 1);
        vertical-align: middle;
    }

    .titleLine {
        line-height: 20px;
        display: inline-block;
        width: 6px;
        height: 20px;
        background: rgba(0, 159, 142, 1);
        opacity: 1;
        border-radius: 2px;
        vertical-align: middle;
    }

    .contentList {
        padding: 40px;
        margin-bottom: 12px;
        background-color: #FFFFFF;
    }

    .settledPayTip {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(69, 77, 87, 1);
    }

    .settledPayBlock {
        padding: 19px 0;
        display: inline-block;
        width: 182px;
        background: rgba(224, 186, 123, 1);
        border-radius: 2px;
        color: rgba(255, 255, 255, 1);
        text-align: center;
        margin: 22px 16px 0 0;
        cursor: pointer;
    }

    .settledPaySvip {
        background: rgba(255, 158, 4, 1);
    }

    .settledPayPrice {
        font-size: 24px;
        font-family: PingFang SC;
    }

    .settledPayText img {
        width: 20px;
        height: 20px;
    }

    .settledPayText span {
        vertical-align: middle;
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: bold;
    }

    .cityList {
        margin: 15px 0;
        padding: 24px 19px 24px 29px;
        width: 824px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(210, 216, 223, 1);
        border-radius: 8px;
    }

    .cityList .cityListTitle {
        display: inline-block;
        margin-bottom: 20px;
        font-size: 16px;
        font-family: PingFang SC;
        font-weight: 600;
        color: rgba(6, 18, 30, 1);
    }

    .cityList ul li {
        width: 80px;
        height: 32px;
        border-radius: 4px;
        line-height: 32px;
        text-align: center;
        cursor: pointer;
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 500;
        color: rgba(102, 105, 110, 1);
        float: left;
        margin-right: 6px;
        margin-bottom: 6px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(204, 210, 218, 1);
        white-space: nowrap;
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
        overflow: hidden;
    }

    .cityActive {
        border: 1px solid rgba(0, 169, 152, 1) !important;
        color: rgba(0, 159, 142, 1) !important;
    }

    .payBtn {
        background: rgba(0, 159, 142, 1);
        border-radius: 2px;
        color: #fff;
        width: 382px;
        height: 51px;
        font-size: 18px;
        font-family: PingFang SC;
        font-weight: 500;
        color: rgba(255, 255, 255, 1);
        border: 0;
    }

    .payBtn:hover, .payBtn:visited, .payBtn:focus {
        color: #fff;
        color: rgba(255, 255, 255, 1);
        border: 0;
    }

    .vipPrivilege {
        margin-top: 40px;
        margin-bottom: 80px;
        width: 812px;
    }

    .vipPrivilege div {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 400;
        line-height: 20px;
        color: rgba(102, 105, 110, 1);
    }

    .vipPrivilegeTitle {
        display: inline-block;
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 500;
        color: rgba(6, 18, 30, 1);
        margin-bottom: 6px;
    }


</style>
<style>
    /*支付方式部分样式*/
    .payModeBox {
        /*width: 1200px;*/
        /*height: 264px;*/
        /*background: rgba(255, 255, 255, 1);*/
        /*border-radius: 8px;*/
        /*margin: 0 auto 12px auto;*/
        margin: 15px 0;
        padding: 24px 19px 24px 29px;
        width: 824px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(210, 216, 223, 1);
        border-radius: 8px;
    }

    .payModeBox .title {
        display: inline-block;
        /*margin-bottom: 20px;*/
        font-size: 16px;
        font-family: PingFang SC;
        font-weight: 600;
        color: rgba(6, 18, 30, 1);
    }

    .payModeBox ul {
        width: 100%;
        padding: 0;
    }

    .payModeBox ul li {
        list-style-type: none;
        width: 100%;
        height: 68px;
        cursor: pointer;
    }

    .payModeBox ul li .imgBox {
        float: left;
        /*width: 76px;*/
        /*height: 100%;*/
        text-align: center;
        line-height: 68px;
    }

    .payModeBox ul li .contentBox {
        width: 715px;
        height: 100%;
        margin-left: 45px;
        /*overflow: hidden;*/
        border-bottom: 1px solid rgba(238, 238, 238, 1);
        padding-top: 20px;
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 400;
        line-height: 20px;
        color: rgba(6, 18, 30, 1);
    }
</style>
<style>
    /*提交订单部分样式*/
    .submitBox {
        width: 824px;
        height: 60px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(210, 216, 223, 1);
        border-radius: 8px;
        padding-left: 30px;
        display: flex;
        justify-content: space-between;
    }

    .submitBox p {
        display: inline-block;
        width: 160px;
        height: 56px;
        line-height: 56px;
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 500;
        color: rgba(140, 145, 152, 1);
        margin: 0;
    }

    .submitBox p:nth-child(3) {
        width: 680px;
        text-align: right;
        padding-right: 21px;
    }

    .submitBox p:nth-child(1) span {
        font-size: 16px;
        color: rgba(234, 50, 43, 1);
    }

    .submitBox .btn {
        width: 170px;
        height: 58px;
        background: rgba(0, 159, 142, 1);
        border: 0;
        font-size: 16px;
        font-family: PingFang SC;
        font-weight: 500;
        line-height: 22px;
        color: rgba(255, 255, 255, 1);
        border-radius: 0;
    }
</style>
<style>
    #payModal{
        display: none;
    }
    .modal-box {
        width: 716px;
        height: 438px;
        top: 25%;
        left: 50%;
        transform: translateX(-50%);
        z-index: 666;
        overflow: hidden;
        position: fixed;
        border: 6px solid #bbb;
        background-color: #fff;
        -webkit-animation: scale-in both cubic-bezier(.4, 0, 0, 1.5) .3s;
        animation: scale-in both cubic-bezier(.4, 0, 0, 1.5) .3s;
    }
    .modal-left {
        float: left;
        width: 333px;
        padding: 20px 50px 25px 45px;
    }
    #payModal .modal-qrcode {
        width: 210px;
        height: 210px;
        display: block;
        margin: 0 auto 20px;
    }
    .icon-qrcode {
        width: 16px;
        height: 16px;
        margin-right: 3px;
        position: relative;
        display: inline-block;
        vertical-align: middle;
        background-position: 0 -88px;
    }
    .modal-left .icon {
        font-size: 0;
        background-image: url(https://mpay.meituan.com/resource/cashier/img/icon-common@2x.rcJBe.png);
        background-size: 168px;
    }
    #payModal .modal-info {
        color: #f80;
        font-size: 12px;
        padding: 13px 0;
        text-align: center;
        background-color: #f7f7f7;
    }
    .modal-right {
        float: left;
    }
    #payModal p{
        font-size: 18px;
        text-align: center;
        line-height: 32px;
        margin-bottom: 16px;
    }
    #payModal .orange {
        color: #f80;
    }
    #payModal .modal-qr{
        padding-top: 20px;
        border: 1px solid #ddd;
    }
    .icon-clock {
        width: 12px;
        height: 12px;
        margin-right: 5px;
    }
    .icon-close {
        top: 13px;
        right: 13px;
        width: 13px;
        height: 13px;
        z-index: 5;
        cursor: pointer;
        position: absolute;
        background-position: -17px -88px;
    }
    .modal-right .icon {
        font-size: 0;
        background-image: url(https://mpay.meituan.com/resource/cashier/img/icon-common@2x.rcJBe.png);
        background-size: 168px;
    }
    #payModal .model-right img {
        width: 371px;
        height: 438px;
    }
</style>
<body>
{include file="public/header"/}
<!--主要内容-->
<div class="content">
    {include file="public/nav"}
    <!--主要内容-->
    <div class="contentBox">
        <div class="contentMain">
            <div class="contentTop">
                <span class="titleLine"></span>
                <span class="titleText">
                    入驻缴费
                </span>
            </div>
            <div class="contentList">
                <div class="settledPayTip">感谢您对工品达平台的支持和信赖,请确认缴费信息</div>
                <div>
                    <div class="settledPayBlock settledPaySvip" data-type="1">
                          <span id="totalPrice" class="settledPayPrice">
                             {$price.vipprice}
                          </span>
                        <div class="settledPayText">
                            <img src="__CDN__/assets/store/images/vip.png" alt="">
                            <span>VIP</span>
                        </div>
                    </div>
                    <div class="settledPayBlock" data-type="2">
                        <span class="settledPayPrice">
                         {$price.svipprice}
                        </span>
                        <div class="settledPayText">
                            <img src="__CDN__/assets/store/images/vip.png" alt="">
                            <span>SVIP</span>
                        </div>
                    </div>
                </div>

                <div class="cityList">
                    <span class="cityListTitle">
                          城市列表
                    </span>
                    <ul>
                        {foreach name="$province" item="p"}
                        <li class="{eq name='$key' value='0'}cityActive{/eq}" data-id="{$p.id}"
                            onclick="cityClick(this)">{$p.name}
                        </li>
                        {/foreach}
                        <div class="clear"></div>
                    </ul>
                </div>

                <!--支付方式-->
                <div class="payModeBox">
                    <p class="title">支付方式</p>
                    <ul>
                        <li onclick="changePayMode(this,'weChat')" class="check_pay_type" data-pay_type="1">
                            <div class="imgBox">
                                <img class="checkImg" src="__CDN__/assets/store/images/checkbox_orange.png" alt="img">
                            </div>
                            <div class="contentBox">
                                <img src="__CDN__/assets/store/images/weixin.png" alt="img">
                                微信支付
                            </div>
                        </li>
                        <li onclick="changePayMode(this,'aliPay')" data-pay_type="2">
                            <div class="imgBox">
                                <img class="checkImg" src="__CDN__/assets/store/images/radioUnSelect.png" alt="img">
                            </div>
                            <div class="contentBox">
                                <img src="__CDN__/assets/store/images/zhufubao.png" alt="img">
                                支付宝
                            </div>
                        </li>
                        <!--<li onclick="changePayMode(this,'yunPay')" data-pay_type="3">
                            <div class="imgBox">
                                <img class="checkImg" src="__CDN__/assets/store/images/radioUnSelect.png" alt="img">
                            </div>
                            <div class="contentBox">
                                <img src="__CDN__/assets/store/images/yunshanfu.png" alt="img">
                                云闪付
                            </div>
                        </li>-->
                    </ul>
                </div>
                <!--提交订单-->
                <div class="submitBox">
                    <p>应付总额:<span>¥{$price.vipprice}</span></p>
                    <button id="button" type="button" class="btn payBtn" onclick="pay()">提交订单</button>
                </div>
                <!--<button type="button" class="btn payBtn" onclick="pay()">立即缴费</button>-->
                <div class="vipPrivilege">
                     <span class="vipPrivilegeTitle">
                     会员特权
                     </span>
                    <div>
                        会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权
                        详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员
                        特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情
                        会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权详情会员特权 详情会员特权详情会员特权详情会员特权详情
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--支付窗口-->
<div id="payModal">
    <div class="modal-box">
        <div class="modal-left">
            <p>
                <span>请使用 </span>
                <span class="orange">微信 </span>
                <i class="icon icon-qrcode"></i>
                <span class="orange"> 扫一扫</span><br>扫描二维码支付
            </p>
            <div class="modal-qr">
                <img class="modal-qrcode"
                     src=""
                     alt="您的浏览器版本太低, 请升级您的浏览器">
                <div class="modal-info">
                    <img class="icon-clock" src="__CDN__/assets/store/images/clock.png">
                    <span>二维码有效时长为2小时, 请尽快支付</span>
                </div>
            </div>
        </div>
        <div class="modal-right"><i class="icon icon-close"></i><img
                src="https://mpay.meituan.com/resource/cashier/img/weixin-qrcode.1xf1oN.jpg" alt="微信扫码">
        </div>
    </div>
</div>
{include file="public/footer"/}
{include file="public/js"/}
<script>
    var order_id = '';//用于判断订单状态
    var order_status = 1;//用于判断订单状态
    var payMode = 1;//默认支付方式
    var unitPrice = {$price.vipprice};
    var svipPrice = {$price.svipprice};
    var selectCity = '';

    function cityClick(obj) {
        if ($(obj).hasClass('cityActive')) {
            $(obj).removeClass('cityActive');
        } else {
            $(obj).addClass('cityActive');
        }
        var num = $('.cityActive').length;
        var price = (unitPrice * num).toFixed(2);
        $('#totalPrice').html(price);
        $('.submitBox').find('span').html("¥" + price);
    }

    //选择购买类型
    $('.settledPayBlock').click(function () {
        $(this).addClass('settledPaySvip');
        $(this).siblings('.settledPayBlock').removeClass('settledPaySvip');
        var type = $(this).attr('data-type');
        if (type == 2) {
            //超级vip
            $('.cityList').hide();
            $('.submitBox').find('span').html("¥" + svipPrice);
        } else {
            //普通vip
            $('.cityList').show();
            var num = $('.cityActive').length;
            var price = (unitPrice * num).toFixed(2);
            $('#totalPrice').html(price);
            $('.submitBox').find('span').html("¥" + price);
        }
    });

    //修改支付方式
    function changePayMode(obj, type) {
        $(obj).siblings('.check_pay_type').removeClass('check_pay_type');
        $(obj).addClass('check_pay_type');
        $(obj).find('.checkImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png');
        $(obj).siblings('li').find('.checkImg').attr('src', '__CDN__/assets/store/images/radioUnSelect.png');
        if (type == 1) {
            payMode = 1;
        } else if (type == 2) {
            payMode = 2;
        } else {
            payMode = 3;
        }
    }

    //立即缴费
    function pay() {
        var vip_type = $('.settledPaySvip').attr('data-type');//会员类型
        var province_ids_length = $('.cityActive').length;//省份id
        var province_ids = [];
        if (vip_type == 1) {
            //普通会员
            if (province_ids_length == '' || province_ids_length == undefined) {
                toast('请至少选择一个省份~');
                return false;
            }
            //获取省份id
            $($('.cityActive')).each(function (key, c) {
                province_ids.push($('.cityActive').eq(key).attr('data-id'));
            });
            province_ids = province_ids.toString();
        }
        console.log(province_ids);
        var pay_type = payMode;
        if (pay_type == '' || pay_type == undefined) {
            toast('请选择支付方式');
            return false;
        }
        //创建订单
        $.ajax({
            url: "{:url('vip/create_order')}",
            type: "POST",
            data: {'vip_type': vip_type, 'province_ids': province_ids, 'pay_type': pay_type},
            success: function (res) {
                console.log(res);
                if (res.code == 1) {
                    if (pay_type == 1) {
                        //微信支付
                        order_id = res.data.viporder_id;
                        $('#payModal').show();
                        $('.modal-left .modal-qrcode').attr('src',res.data.url);
                    } else if (pay_type == 2) {
                        //支付宝支付
                        order_id = res.data.viporder_id;
                        window.open(res.data.url);
                    }
                } else {
                    toast(res.msg);
                    return false;
                }
            },
            error: function (res) {
                toast('与服务器断开连接');
            }
        });
        //关闭按钮
        $('.icon-close').click(function(){
            $("#payModal").hide();
        })
    }

    setInterval(function(){order_pay()},3000);
    //检测订单支付状态
    function order_pay() {
        console.log(order_id);console.log(order_status);
        if(order_id != '' && order_status != 2){
            $.ajax({
                url:"{:url('index/vip/order_pay')}",
                type:"POST",
                data:{'order_id':order_id},
                success:function(res){
                    console.log(res);
                    if(res.code == 1){
                        order_id = '';
                        order_status = 2;
                        toast('支付成功');
                        setTimeout(function(){
                            window.location.href = res.url;
                        },3000);
                        // window.location.href = res.url;
                    }
                },
                error:function(res){
                    toast('与服务器断开连接')
                }
            })
        }
    }
</script>
</body>
</html>