<!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/css/104716/main.css?v=2" rel="stylesheet" />
    <title>贵州九淘酒业有限公司</title>
</head>

<body>
    <div class="page__bd">
        <div class="weui-tab">
            <div class="weui-tab__panel" id="p2">
                <div class="bg"><img src="/static/images/104716/bg.png"></div>
                <div class="fwcx page">
                    <div class="div1">
                        <div class="div2">
                            <img src="" id="labelImg" style="width: 45%;" />
                            <!-- 三维码 -->
                            <div class="p p-3">
                                <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>
                            <hr>
                            <div class="info">
                                <p>标签序号：<span id="cpidSpan"></span></p>
                                <p>生产单位：<span>贵州九淘酒业有限公司</span></p>
                                <p>查询次数：<span id="queryNum" class="queryNum">0</span> 次</p>
                                <p>首查时间：<span id="firstTime"></span></p>
                            </div>
                        </div>
                        <div class="tips">
                            您所查询的是贵州九淘酒业有限公司的<span>正牌产品标识</span>！感谢您的品尝！
                        </div>
                        <div class="aidiv">
                            <p>
                                您还可以点击下方按钮进行AI身份验证
                            </p>
                            <div id="ai" class="aibtn">AI匹配验证</div>
                        </div>
                    </div>
                </div>
                <div class="cpsy page">
                    <div class="div2 flex">
                        <div class="flex1">
                            <h1 class="subt cplb" style="font-size: .9rem;"></h1>
                            <p><span class="subt">产品种类: </span><span id="cpzl"></span> </p>
                            <p><span class="subt">产品类别: </span><span id="cplb" class="cplb"></span></p>
                            <p><span class="subt">产品价格: </span><span id="cpjg"></span></p>
                            <p><span class="subt">产品重量: </span><span id="zl"></span></p>
                        </div>
                        <div style="width: 50%;margin-left: .3rem;"><img src="" style="width: 100%;" id="cpimg"></div>
                    </div>
                    <div class="div2">
                        <p><span class="subt">运营单位: </span><span id="yydw">九淘沙全国品牌运营商贵州九淘酒业有限公司</span></p>
                        <p><span class="subt">生产厂家: </span><span id="sccj">贵州省仁怀市茅台镇金酱酒业有限公司</span></p>
                        <p><span class="subt">生产厂址: </span><span id="sccz">仁怀市茅台镇中华村</span></p>
                        <p><span class="subt">产&emsp;&emsp;地: </span><span id="cd">贵州省仁怀市</span></p>
                    </div>
                    <div class="div2">
                        <p><span class="subt">生产许可: </span><span id="scxk">SC11552038201700</span></p>
                        <p><span class="subt">执行标准: </span><span id="zxbz">GB/T26760-2011(优级)</span></p>
                        <p><span class="subt">入库时间: </span><span id="rksj"></span></p>
                        <p><span class="subt">出库时间: </span><span id="cksj"></span></p>
                    </div>
                    <div class="div2">
                        <p><span class="subt">经&ensp;销&ensp;商: </span><span id="jxs"></span></p>
                        <p><span class="subt">联系电话: </span><span id="lxdh"></span></p>
                        <p><span class="subt">销售区域: </span><span id="xsqy"></span></p>
                    </div>
                    <div class="div2" style="background: none;box-shadow: none;padding: 0 1rem;">
                        <p><span class="subt">溯源序列号: </span><span id="syxlh"></span></p>
                        <p><span class="subt">扫描次数: </span><span class="queryNum">0</span> 次</p>
                        <p style="color: #be0b02;">您所查询的产品是由 贵州九淘酒业有限公司 出品的正牌产品。感谢您的购买。</p>
                        <p><span class="subt location">您的位置: </span><span id="location"></span></p>
                    </div>
                </div>
                <div class="qyjs page">
                    <img src="/static/images/104716/qy/q-1.jpg">
                    <img src="/static/images/104716/qy/q-2.jpg">
                    <img src="/static/images/104716/qy/q-3.jpg">
                    <img src="/static/images/104716/qy/q-4.jpg">
                    <img src="/static/images/104716/qy/q-5.jpg">
                    <img src="/static/images/104716/qy/q-6.jpg">
                    <img src="/static/images/104716/qy/q-7.jpg">
                    <img src="/static/images/104716/qy/q-8.jpg">
                    <img src="/static/images/104716/qy/q-9.jpg">
                    <img src="/static/images/104716/qy/q-10.jpg">
                    <img src="/static/images/104716/qy/q-11.jpg">
                </div>
                <div class="cpjs page">
                    <img src="/static/images/104716/cp/1.jpg">
                    <img src="/static/images/104716/cp/2.jpg">
                    <img src="/static/images/104716/cp/3.jpg">
                    <img src="/static/images/104716/cp/4.jpg">
                    <img src="/static/images/104716/cp/5.jpg">
                    <img src="/static/images/104716/cp/6.jpg">
                    <img src="/static/images/104716/cp/7.jpg">
                    <img src="/static/images/104716/cp/8.jpg">
                    <img src="/static/images/104716/cp/9.jpg">
                    <img src="/static/images/104716/cp/10.jpg">
                    <img src="/static/images/104716/cp/11.jpg">
                    <img src="/static/images/104716/cp/12.jpg">
                    <img src="/static/images/104716/cp/13.jpg">
                </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/images/104716/cx.png" />
                        </div>
                        <p class="weui-tabbar__label">防伪查询</p>
                    </div>
                    <div id="qy" class="weui-tabbar__item">
                        <div class="weui-tabbar__icon">
                            <img src="/static/images/104716/qy.png" />
                        </div>
                        <p class="weui-tabbar__label">企业介绍</p>
                    </div>
                    <div id="cp" class="weui-tabbar__item">
                        <div class="weui-tabbar__icon">
                            <img src="/static/images/104716/cpjs.png" />
                        </div>
                        <p class="weui-tabbar__label">产品介绍</p>
                    </div>
                    <div id="sy" class="weui-tabbar__item">
                        <div class="weui-tabbar__icon">
                            <img src="/static/images/104716/sy.png" />
                        </div>
                        <p class="weui-tabbar__label">产品溯源</p>
                    </div>
                    <div id="wx" class="weui-tabbar__item">
                        <div class="weui-tabbar__icon">
                            <img src="/static/images/104716/wx.png" />
                        </div>
                        <p class="weui-tabbar__label">官方微信</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="/static/js/jquery-2.1.0.min.js"></script>
    <!-- <script src="/static/js/jquery-2.1.1.min.js"></script> -->
    <script src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.min.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script src="/static/js/public/public.js"></script>
    <script>
        $(function () {
            $('.weui-tabbar__item').on('click', function () {
                $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
                $('.page').hide();
                document.body.scrollTop = document.documentElement.scrollTop = 0;
                $('.page').animate({ scrollTop: 0 });
            });
            $('#cx').on('click', function () {
                $('.fwcx').show();
            });
            $('#sy').on('click', function () {
                $('.cpsy').show();
            });
            $('#qy').on('click', function () {
                $('.qyjs').show();
            });
            $('#cp').on('click', function () {
                $('.cpjs').show();
            });
            $('#wx').on('click', function () {
                window.location.href = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzg2ODQ3MDE5Mw==#wechat_redirect';
            });
            $('#ai').on('click', function () {
                window.location.href = 'https://tjfnew.china315net.com/tjswm/ai/route/route.ashx?compid=38050&cpid={{label_code}}';
            });
        });

        var pkg = tj_public.getCookie('package');
        if (pkg === '3') {
            $(".p-3").hide();
            $(".p-2").show();
            $(".aidiv").hide();
        }


        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)
            });

            let author = tj_public.getQueryString('access');
            if (author === '1') {
                access();
            }
            function access() {
                $('.aidiv').hide();
                $('.tips').show();
            }

            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: 104716, fwcode: label_code, contents: 1 },
                    success: function (res) {
                        if (res.e === '') {
                            tj_public.hideLoading();
                            $("#labelImg").attr("src", res.img);
                            $("#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());
                            }
							$("#location").text(res.address);
                            $("#cpimg").attr("src", "/media/" + res.product_photo);
                            // var contents = '';
                            // if (res.product_contents) {
                            //     contents = decodeURIComponent(res.product_contents);
                            // }
                            if (res.inventory.length > 0) {

                                for (var i = res.inventory.length - 1; i >= 0; i--) {
                                    var inv = res.inventory[i];
                                    if (inv.voucher_type === '成品入库') {
                                        if ($("#jxs").text() === '') {
                                            $("#jxs").text(inv.company);
                                            var company_id = inv.company_id;
                                            findCompany(company_id);
                                        }
                                        if (inv.company_id === 104716) {
                                            var shengchandate = new Date(inv.time.replace(/-/g, '/')).toLocaleDateString();
                                            $("#rksj").text(shengchandate);
                                        }
                                    }
                                    else if (inv.voucher_type === '销售出库' && inv.company_id === 104716) {
                                        var chuchangdate = new Date(inv.time.replace(/-/g, '/')).toLocaleDateString();
                                        $("#cksj").text(chuchangdate);
                                    }
                                }

                                $("#syxlh").text(res.bcode);
                                $("#location").text(res.address);
                            }

                            var product_id = res.product_id
                            if (product_id) {
                                $.ajax({
                                    url: '/product/detail/',
                                    data: {
                                        id: product_id
                                    },
                                    success: function (product) {
                                        console.log(product)
                                        $("#cpzl").text(product.series);
                                        $("#cplb").text(product.name);
                                        for (var p of product.props) {
                                            if (p.desc === '净含量') {
                                                $("#zl").text(p.value + p.unit);
                                            }
                                            else if (p.desc === '价格(瓶)') {
                                                $("#cpjg").text(p.value + p.unit);
                                            }
                                        }
                                        $("#scxk").text(product.pl);
                                        $("#zxbz").text(product.standard);

                                    }
                                })
                            }



                            // if (contents !== '') {
                            //     $("#syxx").html(contents);
                            //     $("#syxx").fadeIn();
                            // }
                        } else {
                            alert('网络超时！')
                        }
                    }, error: function () {
                        alert('网络超时！')
                    }
                })
            }
        });

        function findCompany(id) {
            $.ajax({
                url: '/company/detail/',
                data: {
                    id
                },
                success: function (res) {
                    if (res.e === '') {
                        $("#lxdh").text(res.cell_phone);
                        $("#xsqy").text(res.areas.join(','));
                    }
                }
            })
        }
    </script>
</body>

</html>