<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0;">
    <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/114775/index.css" rel="stylesheet" />
    <title>燃力臣</title>
</head>

<body>
    {% verbatim %}
    <div id="app">
        <div class="main" style="display: none;">
            <div class="upper">
                <div class="lg-img">
                    <img src="/static/images/114775/fa.png" />
                    <p class="lg-img-p" style="color: width;">警告</p>
                </div>
                <div class="info">
                    <p>严禁经销商查询</p>
                </div>
                <div style="width: 58% ; height:2px ;background-color: white;"></div>
                <div class="info-t">
                    <p>如果你是消费者</p>
                    <p>请输入真实的购买价格</p>
                </div>
                <div>
                    <div class="mui-card">
                        <div class="amount"
                            style="height: 2rem;font-size: 18px;margin-bottom: 0.5rem;border-radius: 5px;">
                            <span>￥</span><input id="data" type="number" placeholder="请输入金额" />
                        </div>
                        <input type="button"
                            style="width: 100%;border-radius: 5px;font-size: 14px;line-height: 2.8; background-color:rgb(255, 237, 125)"
                            value="查询" onclick="verifying()" />
                    </div>
                </div>
            </div>
            <div>
                <img src="/static/images/114775/gd-1.png" class="cpimg" style="width: 100%;">
            </div>
        </div>
        <div class="main2" style="display: none;">
            <div class="upper-1">
                <div class="text">
                    <p>全国统一零售价<span id="price"></span>元</p>
                </div>
                <div class="text1">
                    <p>亲，你好</p>
                    <p>你所购产品为官方正品，请放心使用！</p>
                    <p>本次查询防伪码为：<span style="color: red;" id="cpidSpan"></span></p>
                    <p>为该防伪码第<span style="color: red;" id="queryNum">1</span>次被查询</p>
                    <p style="display:none">你所购买的产品为：<span style="color: red;" id="cpname"></span></p>
                    <p>销售者姓名为：<span style="color: red;" id="xsname"></span></p>
                    <p>销售者微信号为：<span style="color: red;" id="xswx"></span></p>
                    <p>第一次查询时间为：<span style="color: red;" id="firstTime"></span></p>
                </div>
                <div class="peer" v-for="(item, index) in history" :key="index">
                    <div class="circle">
                    </div>
                    <div class="text2">
                        <p>第{{ index+1 }}次查询时间为：{{ item.tm }}</p>
                    </div>
                </div>
                <div class="picture" style="text-align: right;">
                    <img src="/static/images/114775/gd-1.png" class="cpimg cpimg2" style="width: 14rem;" />
                </div>
            </div>
        </div>
    </div>
    {% endverbatim %}


    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></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/swiper.js"></script>
    <script>
		
		var price = '99'
		var product_id = 0;
	
        function verifying() {
			if(!product_id){
				alert("网络超时，请稍候再试！");
				return;
			}
            var val = document.getElementById("data").value;
            if (val == price) {
                $('.main').hide();
                $('.main2').show();
            }
            else {
                alert("您所购买的不是正品！");
            }
        }

        tj_public.showLoading();
        // tj_public.hideLoading();
        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() {
            }

            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: 114775, fwcode: label_code, contents: 1 },
                    success: function (res) {
                        if (res.e === '') {
                            tj_public.hideLoading();
                            $('.main').fadeIn();
                            $("#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());
                            }
                            app.history = res.history;
							if (res.product_id == 3639) {
								$('.cpimg').attr('src', "/static/images/114775/hc-1.png");
								$('.cpimg2').css('width', "100%");
								$('#cpname').text('燃力臣嗨吃管家，1盒5组，5袋果饮，5袋糖果，一箱27盒')
								$("#cpname").parent().show();
								price = '99'
							}
							if (res.product_id == 3640) {
								$('.cpimg').attr('src', "/static/images/114775/kf-1.png");
								$('#cpname').text('燃力臣燃卡防弹咖啡，1盒15条， 1条30克，一箱14盒')
								$("#cpname").parent().show();
								price = '318'
							}
							product_id = res.product_id;
							$("#price").text(price)
							
							var inventory = res.inventory
							if(inventory.length>0){
								var inv = inventory[inventory.length-1];
								if(inv.to_company!=""){
									$("#xsname").text(inv.to_company)
									$("#xswx").text(inv.to_company_phone)
								}
								
							}

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

            var app = new Vue({
                el: '#app',
                data: {
                    history: [],
                },
            })

        })

    </script>
</body>

</html>