<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1, minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <script src="/static/js/public/reset.js"></script>
    <link href="/static/css/public/reset.css" rel="stylesheet" />
    <link href="/static/css/public/public.css" rel="stylesheet" />
    <link href="/static/css/public/swiper.css" rel="stylesheet" />
    <link href="/static/css/30371/indexSwm.css" rel="stylesheet" />
    <link href="/static/css/30371/main.css?v=5" rel="stylesheet" />
    <title>壹支好酉</title>
</head>

<body>
    <div class="main">
        <div id="carousel" class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide">
                    <img src="/static/images/30371/hy.jpg" class="banner" />
                </div>
            </div>
        </div>

        <div class="navigation">
            <div class="subtitle">精彩点击</div>
            <div class="appcenter-container shadowbox container-all base-margin">

                <div class="appcenter-wrapper">
                    <div class="appcenter-inner">
                        <div id="lphb">
                            <img src="/static/images/30371/chcx.png" />
                            <p>礼品红包</p>
                        </div>
                    </div>
                    <div class="appcenter-inner">
                        <div onclick="window.location.href='https://www.jialaibo.com/addons/yun_shop/?menu#/wx-scheme-tool?i=24&kdtId=1'">
                            <img src="/static/images/30371/t8.png" />
                            <p>旗舰商城</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="subtitle container-product">产品展示</div>
            <div class=" container-product">
                <div class="appcenter-wrapper2">
                    <div class="product-inners">
                        <div>
                            <img src="/static/images/30371/t2.jpg" />
                        </div>
                        <p class="product-text">壹支好酉</p>
                    </div>
                    <div class="product-inners">
                        <div>
                            <img src="/static/images/30371/t3.jpg" />
                        </div>
                        <p class="product-text">五粮液</p>
                    </div>
                    <div class="product-inners">
                        <div>
                            <img src="/static/images/30371/t1.jpg" />
                        </div>
                        <p class="product-text">古井年份8</p>
                    </div>
                    <div class="product-inners">
                        <div>
                            <img src="/static/images/30371/t4.jpg" />
                        </div>
                        <p class="product-text">铂金汉酱</p>
                    </div>
                    <div class="product-inners">
                        <div>
                            <img src="/static/images/30371/t5.jpg" />
                        </div>
                        <p class="product-text">赖茅传承蓝</p>
                    </div>
                    <div class="product-inners">
                        <div>
                            <img src="/static/images/30371/t6.jpg" />
                        </div>
                        <p class="product-text">壹支好酉</p>
                    </div>
                </div>
            </div>
            <div style="height:3rem;"></div>
        </div>
        <div class="tips_msg" id="a-msg">
            <img onclick="close_tck()" class="img_close" src="/static/images/30371/关闭.png" />

            <div class="label">
                <img id="labelImg" src="" />
            </div>
            <div style="width:92%;margin:0 auto;">
                <div id="warn_swm">
                    <p>1、请用手触摸实物标签上的结构三维码，是否有明显凹感！</p>
                    <p>2、请认真核对实物标签上的三维码、序号是否与上图采集信息一致！</p>
                    <p>3、以上两点都相符则为真品，否则谨防假冒！</p>
                    <p class="last-pp">4、您还可以点击下方按钮进行AI身份验证！</p>
                </div>
                <div id="warn_box" style="display:none">
                    <p>1、请用手触摸实物标签上的结构防伪特征圆圈、文字是否有明显凹感！</p>
                    <p>2、请认真核对实物标签上的结构防伪特征圆圈、文字序号是否与上面采集图信息一致！</p>
                    <p>3、以上两点都相符则为真品，否则谨防假冒！</p>
                </div>

                <div class="ai-tips" id="authorBox">
                    <p>恭喜您验证通过！您所查询的是河南壹支好酉商贸有限公司的<b class="zp">正牌产品标识</b>！</p>
                </div>
                <div style="margin-top:1rem;">
                    <div class="aibtn  animated fadeIn" id="ai">AI匹配验证</div>
                </div>
            </div>

        </div>

        <div class="active" id="active-msg" style="display: none;">
            <div id="first" class="active1" style="display: none;">
                <div class="active-p">
                    <p>您好！恭喜您验证通过！该产品是正品！</p>
                </div>
                <div class="active-bgimg">
                    <div class="active-main" id="active-info">
                        <h1>恭喜您</h1>
                        <h1>中<span id="active-award"></span></h1>
                    </div>
                </div>
                <div class="active-button">
                    <div id="ljlq">
                        <p class="ljlq">立即领取</p>
                    </div>
                </div>
            </div>

            <div id="second" class="active2">
                <div class="active-p">
                    <p>请认真填写以下信息，以便我们核实！</p>
                </div>
                <div class="active-main2">
                    <div class="active-tipmsg">
                        <div class="active-input">姓名</div>
                        <div style="width:60%;">
                            <input id="input_name" placeholder="&emsp;请输入您的姓名" class="input" />
                        </div>
                    </div>
                    <div class="active-tipmsg">
                        <div class="active-input">手机号码</div>
                        <div style="width:60%;">
                            <input id="input_phone" placeholder="&emsp;请输入您的手机号码" class="input" />
                        </div>
                    </div>
                    <div class="active-button">
                        <div id="sure">
                            <p class="ljlq">确定</p>
                        </div>
                    </div>
                </div>
            </div>
            <div id="third" class="active3">
                <div class="p-tips">
                    <p>恭喜您领取成功！</p>
                    <p>请留意微信红包提示信息！</p>
                </div>
                <div class="active-button">
                    <div id="back-first">
                        <p class="ljlq">返回首页</p>
                    </div>
                </div>
            </div>
            <div id="forth" class="active3">
                <div class="p-tips">
                    <p>改码已被验证！</p>
                    <p>红包已被领取！</p>
                </div>
                <div class="active-button">
                    <div id="sured">
                        <p class="ljlq">确定</p>
                    </div>
                </div>
            </div>

        </div>

    </div>
    <input type="hidden" id="Taward" value="{{award.data}}" />

    <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
    <script src="/static/js/jquery-2.1.0.min.js"></script>
    <script src="/static/js/public/public.js"></script>
    <script src="/static/js/public/swiper.js"></script>
    <script>
        let isAccess = tj_public.getQueryString('access');
        tj_public.wxInit({
            wx_officail_account_id: 15,
            url: window.location.href
        })
        tj_public.showLoading();

        wx.ready(function () {
            tj_public.getAddress(function (lat, lng) {
                getInfo(lat, lng)
            })
            // if(isAccess==='1'){ 
            //     history.replaceState(null, null, "?label_code={{label_code}}&access=0");
            // }
        })
        wx.error(function (res) {
            getInfo(0, 0)
        });
        function getInfo(lat, lng) {
            $.ajax({
                url: '/wx/label/scan_record/',
                data: { lat: lat, lng: lng, uid: '{{consumer_id}}', compid: '{{company_id}}', fwcode: '{{label_code}}' },
                success: function (res) {
                    if (res.e === '') {
                        tj_public.hideLoading();
                        $("#labelImg").attr("src", res.img);
                    } else {
                        alert('网络超时！')
                    }
                }, error: function () {
                    alert('网络超时！')
                }
            })
        }



        var package = tj_public.getCookie('package');
        if (package === '3') {
            $("#ai").hide();
            $("#warn_swm").hide();
            $("#warn_box").show();
        }
        function access() {
            //$("#a-msg").fadeIn();
            //$("#authorBox").fadeIn();
            $("#ai").hide();
        }

        var carousel = new Swiper("#carousel", {
            speed: 1000,
            autoplay: {
                disableOnInteraction: false,
            }, effect: 'slide',
            loop: true, roundLengths: true,
            pagination: {
                el: '.swiper-pagination'
            }
        })
        function show_tck() {
            $('#a-msg').fadeIn()
        }

        function close_tck() {
            $('#a-msg').hide()
        }
        $('#ai').on('click', function () {
            //window.location.href = 'https://tjfnew.china315net.com/tjswm/ai/route/route.ashx?compid=34487&cpid={{label_code}}';
			window.location.href = window.location.href+"?access=1";
        });
        $("#lphb").click(function(){
            //window.location.href = 'https://tjfnew.china315net.com/tjswm/ai/route/route.ashx?compid=34487&cpid={{label_code}}';
			window.location.href = window.location.href+"?access=1";
        })

        if (isAccess === '1') {
            access();


            {% ifequal award.code 200 %}
            var award = JSON.parse($("#Taward").val())
            var winner_id = '{{award.winner_id}}'
            inIt(award, winner_id);

            {% endifequal %}
        }

        function inIt(award, winner_id) {

            $("#first").show(); 
            $("#active-msg").fadeIn();
            $("#active-award").text(award.name);

            $('#ljlq').on('click', function () {
                $('#first').hide()
                $('#second').show()
            });

            $('#sure').on('click', function () {

                var name = $("#input_name").val();
                if (name.trim().length < 2) {
                    alert('请输入正确的姓名！');
                    return;
                }
                var phone = $("#input_phone").val();
                if (!(/^1[3456789]\d{9}$/.test(phone))) {
                    alert('请输入正确的手机号码！');
                    return;
                }



                GetAward(winner_id,name,phone);

            });
            $('#sured').on('click', function () {
                $('#active-msg').hide()
            });
            $("#back-first").on('click', function () {
                $('#active-msg').fadeOut()
            });
        }

        var isGet = false;
        function GetAward(winner_id,name,phone) {
            if (isGet) {
                return;
            }
            isGet = true
            tj_public.showLoading();
            $.ajax({
                type: 'GET',
                data: {
                    winner_id,
                    name,
                    phone
                },
                url: '/sales/ajax/winner/redeem/',
                success: function (res) {
                    if (res.e === '') {
                        alert('领取成功！');
                        tj_public.hideLoading();

                        GetAwardSuccess();
                    }
                    else {
                        alert(res.e);
                    }

                },
                error: function () {
                    alert('连接服务器失败');
                }
            });
        }

        function GetAwardSuccess() {

            //$('#first').hide()
            $('#second').hide();
            $("#third").fadeIn();
        }

    </script>
</body>

</html>