<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.0/weui.min.css">
    <link href="/static/css/public/reset.css" rel="stylesheet" />
    <link href="/static/css/public/public.css" rel="stylesheet" />
    <script src="/static/js/public/reset.js"></script>
    <link href="/static/181695/css/main.css" rel="stylesheet" />
    <title>北京同仁堂股份有限公司同仁堂药酒厂</title>
</head>

<body style="background: linear-gradient(rgb(102, 166, 255),rgb(136, 246, 254)) ">
    <div class="page__bd">
        <div class="weui-tab">
            <div class="weui-tab__panel" id="p2">
                <div class="fwcx page">
                    <div class="div1">
                        <div class="div2">
                            <img src="" id="labelImg" style="width: 45%;" />
                            <div class="hr"></div>
                            <!-- 三维码 -->
                            <div class="p p-3" id="warn_swm" style="padding:0 .6rem">
                                <p>1、请用手触摸实物标签上的结构三维码是否有物理凹感！</p>
                                <p>
                                    2、请认真核对实物标签上的结构三维码是否与上图一致！
                                </p>
                                <p>
                                    3、以上两点都相符则为真品，否则谨防假冒!
                                </p>
                            </div>
                            <!-- 箱标 -->
                            <!-- <div class="p p-2">
                                <p>1、请用手触摸实物标签上的真迹防伪文字是否有物理凹感！</p>
                                <p>
                                    2、请认真核对实物标签上的信息是否与上图一致！
                                </p>
                                <p>
                                    3、以上两点都相符则为真品，否则谨防假冒!
                                </p>
                            </div> -->
                            <div class="hr"></div>
                            <div class="info">
                                <p>标签序号：<span id="cpidSpan"></span></p>
                                <p>首查时间：<span id="firstTime"></span></p>
                                <p>已查次数：<span id="queryNum">0</span> 次</p>
                            </div>

                        </div>
                        <div class="div3">
                            <b>·本产品为北京同仁堂股份有限公司同仁堂药酒厂生产的<span id="prodName">xxxxx</span>酒</b>
                            <div class="tips">
                                <b>·本产品为北京同仁堂股份有限公司同仁堂药酒厂正品标识，请放心使用！</b>
                            </div>
                        </div>
                        <div class="aidiv">
                            <!-- <div id="ai" class="aibtn"><b>AI验证</b></div> -->
                            <wx-open-launch-weapp id="launch-btn" style="display: block;">
                                <script type="text/wxtag-template">
                                    <style>
                                        .btn {
                                            border-radius: 23px;
                                            font-size: 15px;
                                            width: 52%;
                                            line-height: 3;
                                            margin: auto;
                                            background: #086b95;
                                            color: white;
                                            text-align: center;
                                            font-weight: 600;
                                        }
                                    </style>
                                    <div class="btn">AI验证</div>
                                </script>
                            </wx-open-launch-weapp>
                        </div>
                    </div>
                </div>


            </div>
            <div class="tabbar">
                <div class="weui-tabbar">
                    <div id="cx" class="weui-tabbar__item weui-bar__item_on">
                        <div class="weui-tabbar__icon">
                            <img src="/static/181695/img/but-forgery.png" />
                        </div>
                        <p class="weui-tabbar__label">防伪查询</p>
                    </div>

                </div>
            </div>
        </div>
    </div>

    <script src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.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/jquery-2.1.0.min.js"></script>
    <script src="/static/js/public/public.js"></script>
    <script>
        tj_public.showLoading();
        // tj_public.hideLoading();
        var uid = tj_public.getCookie('TJWX_consumer_id');
        var label_code = tj_public.getCookie('label_code');
        tj_public.wxInit({
            wx_officail_account_id: 6,
            url: window.location.href
        })

            wx.ready(function () {
                if (uid) {
                    tj_public.getAddress(function (lat, lng) {
                        getInfo(lat, lng)
                    })
                    var uuid = tj_public.getUuid(8, 16);
                    tj_public.configLaunchWeappBtn({
                        el: 'launch-btn',
                        username: 'gh_4290b605146b',
                        extraData: {
                            cpid:label_code,
                            uid,
                            uuid,
                            os: 'davis'
                        },
                        onLaunch: function () {
                            tj_public.checkMiniprogramAIStatus(
                                {
                                    label_code,
                                    consumer_id: uid,
                                    uuid,
                                }, function (state) {
                                    if (state == 1) {
                                        access();
                                    }
                                })
                        }
                    })
                }
            })
            wx.error(function (res) {
                if (uid) {
                    getInfo(0, 0);
                }
            });

            function access() {
                $('.aidiv').hide();
                $('.tips').show();
            }

            var pk = tj_public.getCookie('package');
            if (pk === '3') {
                $("#warn_swm").html(`
                    <p>1、请用手触摸实物标签上的结构防伪文字是否有明显凹感！</p>
                    <p>2、请认真核对实物标签上的结构防伪文字和序号是否与上图一致！</p>
                    <p>3、以上两点都相符则为真品，否则谨防假冒！</p>`);
                $(".aidiv").hide();
            }

            function getInfo(lat, lng) {
                $.ajax({
                    url: '/wx/label/scan_record/',
                    data: { lat: lat, lng: lng, uid: uid, compid: 181695, fwcode: label_code, contents: 1 },
                    success: function (res) {
                        if (res.e === '') {
                            tj_public.hideLoading();
                            $("#labelImg").attr("src", res.img);
                            $("#cpidSpan").text(res.code);
                            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());
                            }

                            var product_id = res.product_id
                            if (product_id) {
                                $.ajax({
                                    url: '/product/detail/',
                                    data: {
                                        id: product_id
                                    },
                                    success: function (product) {
                                        var props = product.props;
                                        $("#prodName").text(product.name);
                                    }
                                })
                            }

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

    </script>
</body>

</html>