<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minmum-scale=1.0,user-scalable=no"/>

    <script src="/static/js/public/reset.js"></script>
    <link rel="stylesheet" href="/static/css/public/reset.css"/>
    <link rel="stylesheet" href="/static/css/public/public.css"/>
    <link href="/static/css/134665/1/main.css?V=4" rel="stylesheet"/>
    <title>直呼裕炜酒业有限责任公司</title>
	<style>
		#proContent hr{
			border-style: dashed;
			border-color: lightgray;
		}
	</style>
</head>

<body>
<div class="container">

    <div id="proContent" style="display:none">
        <div class="top">
            <div class="product">
                <img src="/static/images/134665/1/pro-1.jpg"/>

            </div>
            <div class="product">
                <img src="/static/images/134665/1/pro-2.jpg"/>

            </div>

        </div>
        <div class="xuxian">
        </div>
        <div class="info" style="font-size: 15px;margin-left: 2rem;">
        </div>
        <div class="xuxian">
        </div>
    </div>

    <div class="verify">
        <p class="p1">验证码 认证</p>
        <p class="p2">请输入标签上的12位序号</p>
        <div class="v-input">
            <input id="input" type="text" placeholder="请输入标签序号"/>
        </div>
        <button id="ai">确认</button>
    </div>

    <div class="v-result-true">
        <p class="p1"> 防伪查询结果 </p>
        <div class="result-tips">
            您好，您所查询的是直呼裕炜酒业有限责任公司（直呼裕炜酒业（贵州）有限公司）的正品产品，请放心消费！
        </div>
        <div class="result-tips-false">
            您好，该码已被查询<span id="queryNum"></span>次,首次查询时间为：<span id="firstTime"></span>,该号码已经失效，谨防假冒！
        </div>
    </div>
    <div class="v-result-false">
        <p>您输入的标签序号有误，请重新输入！</p>
        <div id="rebtn">好的</div>
    </div>

</div>

<script src="/static/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="/static/js/public/public.js"></script>
<script>

    tj_public.showLoading();
    tj_public.wxInit({
        wx_officail_account_id: 6,
        url: window.location.href
    })

    $(function () {

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

        var uid = tj_public.getCookie('TJWX_consumer_id');
        var label_code = tj_public.getCookie('label_code');
        var cnt = 0;

        function getInfo(lat, lng) {
            $.ajax({
                url: '/wx/label/scan_record/',
                data: {lat: lat, lng: lng, uid: uid, compid: 134665, fwcode: label_code, contents: 1},
                success: function (res) {
                    if (res.e === '') {
                        tj_public.hideLoading();
                        $("#labelImg").attr("src", res.img);
                        if (res.bcode) {
                            $("#cpidSpan").text(res.bcode);
                        }
                        $("#queryNum").text(res.cnt);
                        if (res.tm_1st) {
                            $("#firstTime").text(res.tm_1st);
                        } else {
                            var myDate = new Date();
                            $("#firstTime").text(myDate.toLocaleString());
                        }
                        cnt = res.cnt;

                        if (res.cnt > 0) {
                            $("#firstTime").text(res.tm);
                        } else {
                            var myDate = new Date();
                            $("#firstTime").text(myDate.toLocaleString());
                        }

                        var product_id = res.product_id
                        if (product_id) {
                            $("#proContent").html(decodeURIComponent(res.product_contents))
                        }
						$("#proContent").fadeIn();

                    } else {
                        alert('网络超时！')
                    }
                }, error: function () {
                    alert('网络超时！')
                }
            })
        }

        $('#ai').on('click', function () {
            var vcpid = $("#input").val().trim();
            if (vcpid == label_code) {
                if (cnt > 0) {
                    $(".verify").hide();
                    $(".v-result-true").fadeIn();
                    $(".result-tips-false").fadeIn();
                } else {
                    $(".verify").hide();
                    $(".v-result-true").fadeIn();
                    $(".result-tips").fadeIn();
                }
            } else {
                $(".v-result-false").show();
            }
        });

        $('#rebtn').on('click', function () {
            $(".v-result-false").hide();
        })

    });


</script>
</body>

</html>