<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.0/weui.min.css">
    <script src="/static/js/public/reset.js"></script>
    <link href="/static/css/public/reset.css" rel="stylesheet" />
    <link href="/static/css/public/public.css?v=1" rel="stylesheet" />
    <link href="/static/css/public/Activity.css" rel="stylesheet"/>
    <link href="/static/css/33267/index.css" rel="stylesheet" />
    <title>防伪查询</title>
</head>

<body>
    <div class="bd">
        <div class="flex1">
            <div class="logo">
                <img src="/static/images/33267/logo.png" class="logo-img">
            </div>
            <img src="/static/images/33267/banner.jpg">
        </div>
        <div class="flex2">
            <div class="flex2-div">
                <img src="" id="labelImg" style="width: 30%;">
                <div class="tips" id="tips1">
                    <p>1、请用手触摸实物标签上的结构三维码、圆圈及圈内文字是否有明显凹感！</p>
                    <p>
                        2、请认真核对实物标签上的结构三维码、序号、圆圈及圈内文字是否与左图一致！
                    </p>
                    <p>
                        3、以上两点都相符则为真品，否则谨防假冒!
                    </p>
                </div>
                <div class="tips" id="tips2">
                    <p>1、请用手触摸实物标签上的圆圈及圈内文字是否有明显凹感！</p>
                    <p>
                        2、请认真核对实物标签上的序号、圆圈及圈内文字是否与左图一致！
                    </p>
                    <p>
                        3、以上两点都相符则为真品，否则谨防假冒!
                    </p>
                </div>
            </div>
        </div>
        <div class="flex3">
            <img src="/static/images/33267/bg-2.jpg">
            <div class="info">
                <p>标签序号：<span id="cpidSpan"></span></p>
                <p>生产单位：四川远鸿小角楼酒业有限公司</p>
                <p>查询次数：<span id="queryNum"></span>次</p>
                <p>首查时间：<span id="firstTime"></span></p>
            </div>
        </div>
        <div class="popup" id="right">
            <img src="/static/images/33267/dg.png">
            <p>已通过AI识别，正品认证！</p>
        </div>
        <div class="popup" id="error">
            <img src="/static/images/33267/jsh.png">
            <p>验证未通过，谨防假冒！</p>
        </div>
        <!-- <div class="popup" id="blur">
            <img src="/static/images/33267/xl.png">
            <p>图片模糊，请重新拍照！</p>
        </div> -->
    </div>
    <div class="weui-tabbar">
        <div id="fwcx" class="weui-tabbar__item">
            <div class="weui-tabbar__icon">
                <img src="/static/images/33267/AI-1.png" id="unaccess" />
                <img src="/static/images/33267/AI-2.png" id="access" />
            </div>
            <p class="weui-tabbar__label" id="aiyz">AI验证</p>
        </div>
        <div id="qygw" class="weui-tabbar__item">
            <div class="weui-tabbar__icon">
                <img src="/static/images/33267/but-comp.png" />
            </div>
            <p class="weui-tabbar__label">企业官网</p>
        </div>
        <div id="cpjs" class="weui-tabbar__item">
            <div class="weui-tabbar__icon">
                <img src="/static/images/33267/but-prod.png" />
            </div>
            <p class="weui-tabbar__label">产品展示</p>
        </div>
    </div>

    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.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/Activity.js"></script>
    <script>
        tj_public.showLoading();
        tj_public.wxInit({
            wx_officail_account_id: 6,
            url: window.location.href
        })
        $(function () {

            var package = tj_public.getCookie('package');
            if (package === '3') {
                $("#fwcx").hide();
                $("#tips1").hide();
                $("#tips2").show();
            } 

            wx.ready(function () {
                tj_public.getAddress(function (lat, lng) {
                    getInfo(lat, lng)
                })
            })
            wx.error(function (res) {
                getInfo(0, 0)
            });


            let author = tj_public.getQueryString('access');
            if (author === '1') {
                access();
            } 
            else if (author === '0') {
                $('#error').fadeIn();
                setTimeout(function () {
                    $('#error').fadeOut();
                }, 2500);
            } 

            function access() {
                $('#aiyz').text('验证通过');
                $('#unaccess').hide();
                $('#access').show();
                $('#right').fadeIn();
                setTimeout(function () {
                    $('#right').fadeOut();
                }, 2500);
            }


            var uid = tj_public.getCookie('TJWX_consumer_id');
            var label_code = tj_public.getCookie('label_code');
			
                //getInfo(0, 0)

            function getInfo(lat, lng) {
                $.ajax({
                    url: '/wx/label/scan_record/',
                    data: { lat: lat, lng: lng, uid: uid, compid: 33267, fwcode: label_code },
                    success: function (res) {
                        if (res.e === '') {
                            tj_public.hideLoading();
                            $("#labelImg").attr("src", res.img);
							if(res.bcode){
								$("#cpidSpan").text(res.bcode); 
							}
							else{
								$("#cpidSpan").text(res.code); 
							}
                            $("#queryNum").text(res.cnt);
                            if (res.tm_1st) {
                                $("#firstTime").text(res.tm_1st);
                            }
                            else {
                                var myDate = new Date();
                                $("#firstTime").text(myDate.toLocaleString());
                            }
                            tj_activity.GetActivity(33267);
                        } else {
                            alert('网络超时！')
                        }
                    }, error: function () {
                        alert('网络超时！')
                    }
                })
            }


            $('.weui-tabbar__item').on('click', function () {
                // $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
                document.body.scrollTop = document.documentElement.scrollTop = 0;
            });
            $('#fwcx').on('click', function () {
                window.location.href = 'https://tjfnew.china315net.com/tjswm/ai/route/route.ashx?compid=36011&cpid={{label_code}}';
            });
            $('#qygw').on('click', function () {
                window.location.href = 'http://www.yhxjl.com/index.aspx';
            });
            $('#cpjs').on('click', function () {
                // $('#cp').show();
            });
        });


    </script>
</body>

</html>