<!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/32597/main.css?v=2" rel="stylesheet" />
    <title>岁月留香</title>
    <style>
        .app {
            width: 100%;
            height: 100%;
            background: #141414;
            display: none;
        }
    </style>
</head>

<body>
    <div class="app">
        <div class="weui-tab">
            <div class="weui-tab__panel">
                <div class="logo">
                    <img src="/static/images/32597/1.png" id="pimg">
                </div>
                <div id="fwcx" class="page">
                    <div class="title">
                        <img src="/static/images/32597/2.png">
                    </div>
                    <!-- <div class="row input">
                    <input type="text" id="input_yzm" placeholder="请输入防伪码">
                    <span id="verify">查&ensp;询</span>
                </div> -->
                    <div class="info">
                        <img src="" id="labelImg" style="width: 100%;margin: 1rem 0;" />
                        <!-- 三维码 -->
                        <div class="para" id="warn_swm">
                            <p id="tips_swm" style="margin-bottom: 1rem;">
                                请认真核对实物标签上文字特征是否与上图信息一致，该标签为多层结构材料，拥有材料专利，非印刷墨迹堆叠，用手触摸是否有物理凹感，相符则为真品，否则谨防假冒！</p>
                            <p>标签序号：<span id="cpidSpan"></span></p>
                            <p>产品名称：<span id="pname">岁月留香</span></p>
                            <p>生产单位：<span>武夷山市叶嘉岩茶业有限公司</span></p>
                            <p>查询次数：<span id="queryNum">1</span> 次</p>
                            <p>首查时间：<span id="firstTime"></span></p>
                        </div>
                        <div class="tips">
                            <div class="div3">
                                恭喜您验证通过！您所查询的是武夷山市叶嘉岩茶业有限公司<span>正品产品标识！</span>
                            </div>
                            <div class="aibtn btn2">扫一扫匹配验证</div>
                        </div>
                        <div class="aidiv" style="display: none;">
                            <p style="font-size: .7rem;">
                                您还可以点击下方按钮进行AI身份验证
                            </p>
                            <div id="ai" class="aibtn">扫一扫匹配验证</div>
                        </div>
                    </div>
                </div>
                <div id="qyjs" class="page">
                    <div class="title">
                        <img src="/static/images/32597/14.png">
                    </div>
                    <div id="qyjj">
                        <div class="para">
                            溪谷留香的前身是于2006年成立的叶嘉岩茶厂，“叶嘉”之名出自苏轼的《叶嘉传》，意在恪守叶嘉的“清白可爱”。西南大学博士生导师、著名茶学家刘勤晋教授游历武夷山，品饮首席制茶师叶家亮的岩茶后，赞其有岩韵之滋味，有感写下一诗，云：“望岩见奇桂，溪谷留香韵。叶嘉有传人，勇夺瑞草魁。”叶家亮先生秉持着“一生专往做一事”的理念，于2013年创立了品牌“溪谷留香”，旨在打造“茶文化、茶产业、茶科技”全方位高标准的中国岩茶代表品牌。
                        </div>
                    </div>
                    <div class="title">
                        <img src="/static/images/32597/15.png">
                    </div>
                    <div class="contact">
                        <div class="row">
                            <span class="th">官网地址</span>
                            <span class="td"
                                style="word-break: break-all;">https://h5.youzan.com/v2/showcase/homepage?alias=151xks924</span>
                        </div>
                        <div class="row">
                            <span class="th">公司地址</span>
                            <span>武夷山市武夷街道公馆村公馆路2号</span>
                        </div>
                        <div class="row">
                            <span class="th">联系电话</span>
                            <span>400-1005-513</span>
                        </div>
                    </div>
                </div>
                <div id="cpxx" class="page">
                    <div class="prodDesc">
                        <div class="title">
                            <img src="/static/images/32597/11.png">
                        </div>
                        <div class="para" id="prodDesc"></div>
                    </div>
                    <div class="title">
                        <img src="/static/images/32597/12.png">
                    </div>
                    <div class="list" id="prodInfo"></div>
                    <div class="title">
                        <img src="/static/images/32597/13.png">
                    </div>
                    <div class="list" id="proInventory"></div>
                    <div class="list" id="proContent" style="margin: 1rem 0;"></div>
                </div>
            </div>
            <div class="weui-tabbar">
                <div id="cp" class="weui-tabbar__item weui-bar__item_on">
                    <p class="weui-tabbar__label">产品信息</p>
                </div>
                <div id="qy" class="weui-tabbar__item">
                    <p class="weui-tabbar__label">公司信息</p>
                </div>
                <div id="cx" class="weui-tabbar__item">
                    <p class="weui-tabbar__label">防伪查询</p>
                </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://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>




        var uid = tj_public.getCookie('TJWX_consumer_id');
        var label_code = tj_public.getCookie('label_code');
        var cpid = "{{label_code}}";
        var pid = '';
        var pname = '';
        // cpid = parseFloat(cpid);
        // var pk = tj_public.getCookie('package');

        if (cpid.startsWith("1077") || cpid.startsWith("1192") || cpid.startsWith("1175") || cpid.startsWith("1081")) {
            // if (cpid == '107704630774') {
            getProdid();
        }
        else {
            loadPage();
        }

        function loadPage() {
            if (cpid.startsWith("1190") || pname.startsWith("岁月留香")) {
                document.title = '岁月留香';
                // $(".aidiv").show();
                console.log('岁月留香')
            }
            if (cpid.startsWith("1175") || pname.startsWith("溪谷留香")) {
                document.title = '溪谷留香';
                $('#pname').text("溪谷留香");
                $('#pimg').attr('src', '/static/images/32597/16.png?v=2');
                $('.weui-tab__panel').css('background', '#281205')
                console.log('溪谷留香')
            }
            if (cpid.startsWith("1191") || (cpid.startsWith("1192") && pid == "") || pname.startsWith("叶嘉岩")) {
                document.title = '叶嘉岩';
                $('#pname').text("叶嘉岩");
                $('#pimg').attr('src', '/static/images/32597/yjy.png');
                $('.weui-tab__panel').css('background', '#ea5513')
                $('.weui-tab__panel').css('color', '#eeca9a')
                $('#qyjj').html(`
                    <p>
                        品牌创始人叶家亮先生<br>
                        2006年创立叶嘉岩茶厂<br>
                        推出“叶嘉岩”品牌<br>
                        “叶嘉”之名出自北宋大文豪苏轼《叶嘉传》<br>
                        意在恪守叶嘉的<br>
                        “风味恬淡，清白可爱，颇负其名，有济世之才”<br>
                        之茶人精神<br>
                        匠心制茶，诚信做人
                    </p>
                `)
                console.log('叶嘉岩')
            }
            $('.app').show();
        }


        var cpidf = parseFloat(cpid);
        if (cpidf >= 119201285732 && cpidf <= 119201964303) {
            $('#tips_swm').text("请认真核对实物标签特征是否与上图信息一致，该标签为多层结构材料，拥有材料专利，非印刷墨迹堆叠，用手触摸是否有物理凹感，相符则为真品，否则谨防假冒！");
        }


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


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



        function getProdid() {
            $.ajax({
                url: '/wx/ajax/get_product/',
                data: { compid: 32597, label_code: cpid },
                success: function (res) {
                    if (res.e === '') {
                        console.log(res)
                        pid = res.id;
                        pname = res.name;
                        loadPage();
                    }
                }
            })
        }


        // getInfo(0, 0)
        function getInfo(lat, lng) {
            $.ajax({
                url: '/wx/label/scan_record/',
                data: { lat: lat, lng: lng, uid: uid, compid: 32597, 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());
                        }
                        if (res.product_photo) {
                            $("#cpimg").attr("src", "/media/" + res.product_photo);
                        }
                        var product_id = res.product_id
                        if (pid != "") {
                            product_id = pid;
                        }
                        if (res.inventory[0] && res.inventory[1]) {
                            $('#proInventory').html(`
                                <!-- <div class="row">
                                    <span class="th">经销商别名：</span>
                                    <span class="td">${res.inventory[0].to_company}</span>
                                </div> -->
                                <div class="row">
                                    <span class="th">分销日期：</span>
                                    <span class="td">${res.inventory[1].time}</span>
                                </div>
                            `);
                        }
                        if (product_id) {
                            $.ajax({
                                url: '/product/detail/',
                                data: {
                                    id: product_id
                                },
                                success: function (product) {
                                    console.log(product);
									$("#proContent").html(decodeURIComponent(product.contents))
                                    var props = product.props;
                                    $("#prodDesc").text(product.desc);
                                    if (!product.desc || product.desc == "") {
                                        $(".prodDesc").hide();
                                    }
                                    // var time = res.inventory[1].time.substring(5);
                                    var html = `
                                            <div class="row">
                                                <span class="th">品名：</span>
                                                <span class="td">${product.name}</span>
                                            </div>
                                            `

                                    if (res.inventory[0]) {
                                        html += `
                                            <div class="row">
                                                <span class="th">包装日期：</span>
                                                <span class="td">${res.inventory[0].time}</span>
                                            </div>
                                            <div class="row">
                                                <span class="th">包装批次：</span>
                                                <span class="td">${res.inventory[0].voucher_no}</span>
                                            </div>
                                        `}
                                    for (var p of props) {
                                        html += `
                                                <div class="row">
                                                    <span class="th">${p.desc}：</span>
                                                    <span class="td">${p.value + (p.unit ? p.unit : '')}</span>
                                                </div>
											`
                                    }
                                    $("#prodInfo").html(html)
                                }
                            })
                        }

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

        $('#verify').on('click', function () {
            tj_public.checkYzm(checkYzmCallback);
        })

        function checkYzmCallback() {
            $('.info').show();
        }

        $('.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();
        });
        $('#qy').on('click', function () {
            $('#qyjs').show();
        });
        $('#cp').on('click', function () {
            $('#cpxx').show();
        });
        $('#ai').on('click', function () {
            window.location.href = 'https://tjfnew.china315net.com/tjswm/ai/route/route.ashx?compid=55379&cpid={{label_code}}';
        });

    </script>
</body>

</html>