payvipcard.html 15.2 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
<script type="text/javascript" src="__PUBLIC__/js/rem_new.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<meta charset="UTF-8">
<title>购买会员卡</title>
<include file="public/header"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/user_new_vipcard.css"/>
<link rel="stylesheet" href="__STATIC__/css/public.css?v=__CSSVERSION__">
<link rel="stylesheet" type="text/css" href="__STATIC__/swiper/css/swiper.min.css"/>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>

<style>
    .vipcard { margin: 0 15px;  }
    .vipcard ul li {padding: 0 10px; border-radius: 4px; margin: 15px 0 0; }
    .vipcard ul li .top {  position: relative;border-bottom-style: dashed; border-bottom-width: 2px; }
    .li1 .top {  border-color: #4f85df;}
    .li2 .top { border-color: #ae1da0; }
    .li3 .top {  border-color: #ec7b51;  }
    .vipcard ul li .ly, .vipcard ul li .ry {
        position: absolute;  bottom: -12.5px;
        margin-top: -12.5px;   width: 25px;
        height: 25px; border-radius: 50%;
        background-color: #fff
    }
    .vipcard ul li .ly { left: -22.5px; }
    .vipcard ul li .ry { right: -22.5px;}
    .vipcard ul li .bottom {text-align: center; padding: 10px 0;}
    /*flix等分*/
    .disfx {
        display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
        display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
        display: -ms-flexbox; /* TWEENER - IE 10 */
        display: -webkit-flex; /* NEW - Chrome */
        display: flex;
        font-size: 0;
    }
    .fx1 {
        -webkit-flex: 1; flex: 1; /* for uc */
        -webkit-box-flex: 1; -moz-box-flex: 1;  -ms-flex: 1;
    }
    .vipcard ul li .top { padding: 15px 0; }
    .top .disfx .fx1:first-child img { width: 25px; }
    .top .disfx .fx1:last-child { font-size: 12px; color: #fff; text-align: right  }

    .top .num {
        font-size: 0.24rem;
        /*color: #fff;*/
        text-align: center;
        /*padding: 8px 0 0;*/
    }
    .top .num em {  font-size: 16px; }
    .bottom .buynew {
        display: inline-block;
        /*padding: 3px 10px;*/
        border-radius: 24px;
        color: #333;
        background-color: #ecba95;
        font-size: 0.25rem;
        padding: 0.03rem 0.18rem;
        /*background-color: rgba(255, 255, 255, 0.5)*/
    }

    .layermbtn { border-top: 1px #ddd solid; background-color: #fff;  }
    .layermbtn > span, .layermbtn span:first-child { background-color: #fff; color: #666;  }
    .layermbtn span:first-child {  border-right: 1px #ddd solid;  width: calc(50% - 1px); }

    /*弹窗*/
    .yqmbox {
        position: relative;
        padding: 18px 20px 0;
        text-align: center;
    }

    .titimg {
        width: 51%;
        height: 124%;
        position: absolute;
        left:30%;
        top: -28%;
    }

    /*.yqmbox p {*/
    /*font-size: 18px;*/
    /*margin-bottom: 15px;*/
    /*}*/

    .yqmbox input, .yqmbox input:hover {
        border: 0;
        width: 2rem;
        font-size: 0.18rem;
        margin-bottom: 0.01rem;
        color: #d4d4d4;
        height: 0.25rem; background: #fff;
    }

    .yqmbox .yzmyz {
        display: inline-block;
        border-radius: 0.24rem;
        /*   background-color: #c3172d;*/
        /*-moz-box-shadow: 3px 3px 5px #e7a1aa;*/
        /*-webkit-box-shadow: 3px 3px 5px #e7a1aa;*/
        /*box-shadow: 3px 3px 5px #e7a1aa;*/
        color: #fff;
        padding: 0.07rem 0.1rem;
        width: 1.6rem;
        margin-top: 0.3rem;
        font-size: 0.22rem;
    }
    .yqmbox .yzmyz1 {

        /*margin-right: 40px;*/
    }
    .yqmbox dl {
    }

    .yqmbox dl dt {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .yqmbox dl dd {
        color: #999;
        text-align: left;
        font-size: 12px;
    }

    .yqmbox dl dd em {
        color: #c3172d;
    }

    .show_buy_div{
        position:absolute;top: 30%; left:50%; margin:0 0 -1rem -2.2rem; display: none;
        width: 4.5rem; height: 5rem; border:none; border-radius: 0.14rem; background: #fff;
        z-index: 444;
    }
    .back_div{ position:fixed; width: 100%; height: 100%; background: rgba(0,0,0,0.5);top: 0; left: 0;display: none;}
    input::-webkit-input-placeholder {
        /* placeholder颜色  */
        color: #d4d4d4;
        /* placeholder字体大小  */
        font-size: 12px;

    }
    .yqmbox input, .yqmbox input:hover {
        border: 0;
        width: 2rem;
        font-size: 0.28rem;
        margin-bottom: 0.05rem;
        padding-top: 0.06rem;
        color: #d4d4d4;
        height: 0.25rem;
    }
    .word_name{
        margin-bottom: 0.06rem !important;
        height: 0.3rem !important;
    }

</style>
<body style="background: #666">
<!-- 单个卡购买 -->
<div class="show_buy_div"></div>
<form action="/Mobile/Payment/getPay" method="post" name="points" id="points" style="display: none;">
    <input name="stoid" id="stoid" value="{$Think.request.stoid}" type="hidden">
    <input id="recharge_type" name="recharge_type" value="3" type="hidden">
    <input type="hidden" value="" id="code1" name="code" />
    <input type="hidden" value="" id="staff1" name="staff" />
    <input type="hidden" value="{$cardid}" id="cardid" name="cardid" />
    <input type="hidden" value="{$item.fee}" id="fee" name="fee" />
    <input type="hidden" value="{$item.Newcorrprice}" id="Newcorrprice" name="newcorrprice" />
    <input type="hidden" value="{$item.ExpiryDate}" id="ex_days" name="ex_days" />
    <input type="hidden" value="{$item.keys}" id="keys" name="keys" />
</form>

<input type="hidden" value="{$iscard}" id="iscard" />
<input type="hidden" value="{$isyaoqingma}" id="isyaoqingma" />
<input type="hidden" value="{$is_salesman}" id="is_salesman" />

</body>
<script>
    $(function () {
        //---判断会员有没有注册---
        var uid=getCookie("user_mobile");
        if($.trim(uid)=="" || uid==undefined){
            layer.open({
                content:"您还不是会员,请先绑定", time: 1
            });
            setTimeout(function () {
                window.location.href='/index.php/Mobile/User/login/stoid/'+stoid+'?oldurl='+ encodeURI( window.location.href);
            },1000)

            $(".layermbox").addClass("dn");
            return false;
        }

        var time = Math.random() * 100;
        var iscard=$("#iscard").val();
        if(iscard!="1"){
            layer.open({
                content: "请联系商家升级等级卡功能",
                time: 1
                //btn:"确定"
            });
            setTimeout(function () {
                window.location.href = "/index.php/mobile/index/index/stoid/{$Think.request.stoid}";
            }, 1000);
             return false;
        }

        //----- 判断是不是购买了等级卡 -----
        $.ajax({
            url: "/index.php?m=Mobile&c=User&a=check_is_card&stoid=" + $("#stoid").val() + "&t=" + time,
            success: function (data) {
                if (data.code == 0) {
                    $("#recharge_type").val(3);
                } else {
                    layer.open({
                        content: "您已经购买了等级卡",
                        time: 1
                        //btn:"确定"
                    });
                    setTimeout(function () {
                        window.location.href = "/index.php/mobile/user/cardinfo/stoid/" + $("#stoid").val();
                    }, 1000);
                }
            }
        });

        //---开始购买卡---
        buycard();

    });

    //点击购买
    function  buycard() {

            var t = layer.open({shadeClose: false, type: 2, content: '提交中'});
            //先判断等级卡数量
            $.ajax({
                type: 'post',
                url: "/index.php?m=Mobile&c=User&a=is_djk&stoid={$Think.request.stoid}" ,
                dataType: 'json',
                success: function (data) {

                    //    layer.close(index);
                    layer.close(t);
                    if (data.code == 1) {

                        var is_daogou=$("#is_daogou").val();
                        var is_fengxiang=$("#is_fengxiang").val();
                        //是导购进来买  或者 分享进来购买
                        if(is_daogou || is_fengxiang){
                            buy_now();
                        }else{
                            var str="";
                            var isyaoqingma=$("#isyaoqingma").val();
                            var is_salesman=$("#is_salesman").val();
                            // <a class="yzmyz" href="javascript:void(0);" onclick="validcode();">验证邀请码</a>

                            //邀请码或者营业员有勾的情况下
                            if(isyaoqingma=="1" || is_salesman=="1"){
                                str= '  <div class="rel ba-imgs" style="background: url(\'__STATIC__/images/user_card/show_buy_div_img.png\') no-repeat;background-size:100% 100%;">  ' +
                                    '  <img class="titimg" src="__STATIC__/images/user_card/title-images.png" alt=""> </div>   ' +
                                    '  <div class="yqmbox">   <p class="fs028" style="color: #444;">请完善下面信息</p>  ';

                                //要求要有邀请码
                                if(isyaoqingma=="1" ) {

                                    str+= '<div class="flex invitation_card_frame gliding_line"><img class="invitation_card" src="__STATIC__/images/user_card/invitation_card.png">  ' +
                                        ' <input class="maleft" type="tel"  maxlength="12" id="code" placeholder="输入邀请码(推荐人手机号码)" style="height: 0.3rem;\n' +
                                        'width: 2.85rem;"></div> ';

                                }

                                if(is_salesman=="1" ) {
                                    str+= '<div class="flex invitation_card_frame gliding_line fs018"><img class="invitation_card" src="__STATIC__/images/user_card/sales_clerk.png">' +
                                        '<input class="maleft word_name" maxlength="4" id="staff" placeholder="输入营业员"> </div>';
                                }

                                str+=    '<br><div class="flex jc_center" style="width: 100%">  ' +
                                    '<a class="yzmyz yzmyz1 sales_clerk_img fs018" style="background: url(\'__STATIC__/images/user_card/queinding.png\') no-repeat;background-size:100% 100%;" href="javascript:void(0);" id="okpay" onclick="okpay()">确认购买</a>   ' +
                                    '</div></div><div class="close_layui-frame flex jc_center">\n' +
                                    '<img  class="close_layui"src="__STATIC__/images/user_card/close_layui.png" onclick="goBack()">\n' +
                                    '</div></div>';
                            }


                            if(str!="") {
                                $(".back_div").show();
                                $(".show_buy_div").show();
                                $(".show_buy_div").html(str);
                            }else{

                                //什么都没勾的情况下
                                buy_now();
                            }
                        }
                    } else {

                        layer.open({
                            content:'请联系商家升级等级卡功能',
                            time: 1
                            //btn:"确定"
                        })
                        return false;
                    }
                }
            });

    }

    //确认购买
    function okpay() {
        var code=$("#code").val();
        var staff=$("#staff").val();
        var getmobile="{$userinfo['mobile']}";

        var isyaoqingma=$("#isyaoqingma").val();
        var is_salesman=$("#is_salesman").val();


        var regMobile=/^1[34578]\d{9}$/;
        if (!regMobile.test(code)){

            layer.open({ content:'请输入有效手机号码', time: 2 });
            return false;
        }
        if(code=="" && isyaoqingma=="1")
        {
            layer.open({ content:'请输入有效邀请码', time: 2 })
            return false;
        }
        if(code!="" && isyaoqingma=="0" && code==getmobile) {
            layer.open({  content:'邀请人不能自己!', time: 2  })
            $("#code").val("");
            return false;
        }
        if(staff=="" && is_salesman=="1")
        {
            layer.open({  content:'请输入营业员', time: 2  })
            return false;
        }
        if(cardid=="")
        {
            layer.open({  content:'请先选择要购买等级卡', time: 2 })
            return false;
        }
        //--校验邀请码和营业员--
        var url="/index.php?m=Mobile&c=User&a=checkvipcard&stoid={$Think.request.stoid}";
        if(code!="" && code!=undefined){ url+="&mobile=" + code; }
        if(staff!="" && staff!=undefined){ url+="&staffno=" + staff; }
        var gosumbit=0;
        if(is_salesman=="1" || isyaoqingma== "1") {
            $.ajax({
                type: 'post',
                url: url,
                dataType: 'json',
                success: function (data) {
                    if(data.msg==null) data.msg='';
                    if(data.msg.toString() == "") {
                        gosumbit=1;
                        msg="通过验证";
                        $("#points").submit();
                    }
                    else
                    {

                        switch (data.msg.toString()) {
                            case "1":
                                msg="邀请码不能为空";$("#code").val("");
                                break;
                            case "2":
                            case "3":
                                msg="邀请人不是等级会员";$("#code").val("");
                                break;
                            case "4":
                                msg="该邀请码推荐人数已达限制";$("#code").val("");
                                break;
                            case "-8":
                                msg="邀请人不能填自已";$("#code").val("");
                                break;
                            default:
                                msg=data.msg.toString();
                                if(msg.indexOf('营业')!=-1){ $("#staff").val(""); }
                                else{
                                    $("#code").val("");
                                }
                                break;
                        }
                        layer.open({
                            content:msg,
                            time: 2
                        })
                        return false;
                    }
                }
            });
        }
        else {
            $("#code1").val(code);
            $("#staff1").val(staff);
            $("#cardid").val(cardid);
            $("#fee").val(paymoney);
            $("#points").submit();
        }
    }

    function buy_now() {
       $("#points").submit();
    }

    function goBack(){
        document.referrer === '' ?
            window.location.href = '/index.php/mobile/user/index/stoid/{$Think.request.stoid}' :
            window.history.go(-1);
    }


</script>
</html>