<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.0/weui.min.css">
    <script src="/static/js/public/reset.js"></script>
    <link href="/static/css/public/reset.css" rel="stylesheet" />
    <link href="/static/css/public/public.css" rel="stylesheet" />
    <link href="/static/css/public/swiper.css" rel="stylesheet" />
    <link href="/static/css/109214/main.css" rel="stylesheet" />
    <title>山西杏缘村酒业有限公司</title>

</head>

<body>
    <div class="page__bd">
        <div class="weui-tab">
            <div class="weui-tab__panel" id="p2" style="position:relative;z-index:99">
                <div class="award-home" style="display: none;">
                    <div class="banner"><span>您</span><span>中</span><span>奖</span><span>啦</span></div>
                    <div class="content">
                        <div class="amount" id="award_name">5元</div>
                        <div class="text">
                            <p>恭喜您中奖</p>
                            <p>领取后红包自动汇入您零钱内</p>
                        </div>
                        <div class="btn" id="award_confirm">立即领取</div>
                    </div>
                </div>
                <div class="container_home">
                    <div class="tips_first">
                        <div class="tips_home">
                            <img src="/static/images/109214/1.png?v=1" />
                            <div class="a-home">
                                <p>长按识别二维码，进入店铺主页</p>
                                <p>销售热线：400-6828-618</p>
                                <img class="close " src="/static/images/109214/close.png" />
                            </div>
                        </div>

                    </div>
                    <div id="record-list" class="record-list">
                        <div class="record-list-text">中</div>
                        <div class="record-list-text">奖</div>
                        <div class="record-list-text">记</div>
                        <div class="record-list-text">录</div>
                    </div>
                </div>
                <div class="container_recordlist" style="display: none;">
                    <img class="container_recordlist-close " src="/static/images/109214/close.png" />
                    <div class="banner">中奖记录</div>
                    <div class="list">
                        <ul id="myrecords">

                        </ul>
                    </div>
                </div>
                <div class="container_zw" style="display: none;">
                    <div class="zw-tips">
                        <!--<img class="img_close" src="/static/images/109214/close.png" />-->
                        <div class="div2 page">
                            <!--<img src="" id="labelImg" />-->
                            <img src="" id="labelImg" />
                            <!-- 三维码 -->
                            <div class="p p-3">
                                <p>
                                    请用手触摸实物标签上的结构三维码，是否有明显凹感，
                                    并认真核对否与上图信息一致，相符则为真品，否则谨防假冒!
                                </p>
                            </div>
                            <div class="p p-2" style="display:none">
                                <p>
                                    请认真核对实物标签上文字特征是否与上图信息一致，
                                    并用手触摸是否有物理凹凸感，非印刷墨迹堆叠，相符则为真品，否则谨防假冒!
                                </p>
                            </div>
                            <hr>
                            <div class="info">
                                <p>标签序号：<span style="color:red;" id="cpidSpan"></span></p>
                                <p>产品名称：杏缘村</p>
                                <p>企业名称：山西杏缘村酒业有限公司</p>
                                <p>查询次数：<span style="color:red;" id="queryNum"></span>次</p>
                                <p>首查时间：<span id="firstTime"></span></p>
                            </div>
                            <div class="tips">
                                恭喜您验证通过！您所查询的产品是山西杏缘村酒业有限公司的<span>正牌产品标识!</span>
                            </div>
                            <div class="aidiv">
                                <p class="p-tips" style="font-size: .7rem;">
                                    您还可以点击下方按钮进行AI身份验证!
                                </p>
                                <button id="ai" class="aibtn">AI匹配验证</button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="container_qy">
                    <img src="/static/images/109214/12.jpg" style=" width: 100%;" />
                    <div class="cp-info">
                        <p>&emsp;&emsp;山西杏缘村酒业有限公司主营白酒，产于中国山西省汾阳市杏花村，品种齐全、价格合理。公司重信用、守承诺、保证产品质量，与多家零售商与代理商建立了长期稳定的合作关系，在消费者当中也享有较高地位。产品主要销往全国十几个省、市和地区，以多种特色的经营模式、薄利多销的原则，赢得了广大客户的信任。
                        </p>
                    </div>
                </div>
                <div class="container_cp">
                    <div id="carousel" class="swiper-container">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"> <img style="width:100%"
                                    src="/static/images/109214/wrapper-red.jpg?v=2" /></div>
                            <div class="swiper-slide"> <img style="width:100%"
                                    src="/static/images/109214/wrapper-black.jpg?v=2" /></div>
                            <div class="swiper-slide"> <img style="width:100%"
                                    src="/static/images/109214/wrapper-cyan.jpg?v=2" /></div>
                            <div class="swiper-slide"> <img style="width:100%"
                                    src="/static/images/109214/wrapper-yellow.jpg?v=2" /></div>
                        </div>
                        <div class="swiper-pagination"></div>

                    </div>
                    <div class="cp-info">
                        <p>&emsp;&emsp;杏缘村酒产于中国山西省汾阳市杏花村，以特选优质高粱、大曲、水为原料，采用代代相传的独特工艺，结合高科技，经以陶坛窖藏酿制而成。香气优雅、醇厚谐调、绵甜爽净、回味悠长，是清香型白酒中的典范产品。
                        </p>
                    </div>

                    <img src="/static/images/109214/home.png?v=1" style=" width: 100%;" />

                </div>


            </div>
            <div class="zhezhao" style="z-index:98"></div>
            <div class="tabbar">
                <div class="weui-tabbar">
                    <div id="zw" class="weui-tabbar__item weui-bar__item_on">
                        <div class="weui-tabbar__icon">
                            <img id="zw-check" src="/static/images/109214/11.png" />
                        </div>
                        <p class="weui-tabbar__label">防伪查询</p>
                    </div>
                    <div id="qy" class="weui-tabbar__item">
                        <div class="weui-tabbar__icon">
                            <img id="cp-check" src="/static/images/109214/15.png" />
                        </div>
                        <p class="weui-tabbar__label">企业介绍</p>
                    </div>
                    <div id="cp" class="weui-tabbar__item">
                        <div class="weui-tabbar__icon">
                            <img id="qy-check" src="/static/images/109214/21.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://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 src="/static/js/public/swiper.js"></script>
    <script> 
        function mySwiper() {
            var carousel = new Swiper("#carousel", {
                speed: 1000,
                autoplay: {
                    delay: 2000,
                    stopOnLast: false,
                    disableOnInteraction: false,
                },
                effect: 'slide',
                loop: true,
                roundLengths: true,
                pagination: {
                    el: '.swiper-pagination'
                },
                scrollbar: {
                    el: '.swiper-scrollbar',
                },
            })
        }

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

        wx.ready(function () {
            tj_public.getAddress(function (lat, lng) {
                getInfo(lat, lng)
            })
        })
        wx.error(function (res) {
            getInfo(0, 0)
        });
        var author = tj_public.getQueryString('access');
        if (author === '1') {
            access();
        }

        function access() {
            $('.tips').show();
            $('.tips #id').show();
            $('.p-tips').hide();
            $('.aibtn').attr("style", "background:rgb(112,112,112)");
            $('.aibtn').attr("disabled", "disabled");

        }

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

        function getInfo(weidu, jingdu) {
            $.ajax({
                url: '/wx/label/scan_record/',
                data: { lat: weidu, lng: jingdu, uid, compid: 109214, fwcode: label_code },
                success: function (res) {
                    if (res.e === '') {
                        tj_public.hideLoading();
                        $("#labelImg").attr("src", res.img);
                        $("#cpidSpan").text(res.bcode);
                        if (res.bcode) {
                            $("#cpidSpan").text(res.bcode);
                        }
                        else {
                            $("#cpidSpan").text(res.code);
                        }

                        $("#queryNum").text(res.cnt);
                        if (res.tm_1st) {
                            $("#firstTime").text(res.tm_1st);
                        }
                        else {
                            var myDate = new Date();
                            $("#firstTime").text(myDate.toLocaleString());
                        }
                    } else {
                        alert('网络超时！')
                    }
                }, error: function () {
                    alert('网络超时！')
                }
            })
        }


        $('#record-list').on('click', function () {
            close_tck()
            $(".container_qy").hide();
            $(".container_cp").hide();
            $(".container_zw").hide();
            //$(".record-list").hide();
            $(".container_recordlist").show();
        });
        $('#zw').on('click', function () {
            close_tck()
            //$(".record-list").hide();
            $(".container_qy").hide()
            $(".container_cp").hide()
            $(".container_recordlist").hide()
            $(".container_zw").show()
            //$(".zhezhao").show()
            $("#zw-check").attr("src", "/static/images/109214/10.png")
            $("#qy-check").attr("src", "/static/images/109214/15.png")
            $("#cp-check").attr("src", "/static/images/109214/21.png")


        });
        $('#cp').on('click', function () {
            close_tck()
            //$(".record-list").hide();
            $(".container_recordlist").hide()
            $(".container_cp").show()
            $(".container_zw").hide()
            $(".container_qy").hide()
            $(".zhezhao").hide()
            $("#zw-check").attr("src", "/static/images/109214/11.png")
            $("#qy-check").attr("src", "/static/images/109214/13.png")
            $("#cp-check").attr("src", "/static/images/109214/21.png")
            mySwiper()

        });
        $('#qy').on('click', function () {
            close_tck()
            //$(".record-list").hide();
            $(".container_qy").show()
            $(".container_recordlist").hide()
            $(".container_cp").hide()
            $(".container_zw").hide()
            $(".zhezhao").hide()
            $("#zw-check").attr("src", "/static/images/109214/11.png")
            $("#qy-check").attr("src", "/static/images/109214/15.png")
            $("#cp-check").attr("src", "/static/images/109214/20.png")


        });
		$(".container_recordlist-close").click(function(){
			$(".container_recordlist").hide();
		})

        function show_tck() {
            $('#a-msg').fadeIn()
        }

        function close_tck() {
            $('.tips_first').hide()
        }
        $(".close").click(function () {
            close_tck()
        });


        $('.weui-tabbar__item').on('click', function () {
            // $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
        });

        $('#ai').on('click', function () {
            window.location.href = 'https://tjfnew.china315net.com/tjswm/ai/route/route.ashx?compid=36636&cpid={{label_code}}';
        });

        GetActivity();
        function GetActivity() {
            $.ajax({
                url: '/wx/ajax/get_activity/',
                data: {
                    company_id: 109214
                },
                success: function (res) {
                    if (res.e === '') {
                        if (res.award.code == 200) {
						
                            $(".award-home").show();
                            $('.container_home').hide()
                            $('.container_recordlist').hide()
                            $(".zhezhao").show()
							$("#award_name").text(res.award.data.name)
                            $("#award_confirm").click(function () {
                                _GetAward(res.award.winner_id, '', '');
                            })
                        }
                        else {
                            if (res.award.code === 401) {
                                alert(res.award.reason + ', 奖品:' + res.award.data.name)
                            }
                            else {
								if(res.award.reason)
									alert(res.award.reason)
                            }

                        }
                    }
                }
            })
        }

        // 领取奖品
        function _GetAward(winner_id, name, phone) {
            tj_public.showLoading();
            $.ajax({
                type: 'GET',
                data: {
                    winner_id,
                    name,
                    phone
                },
                url: '/sales/ajax/winner/redeem/',
                success: function (res) {
                    tj_public.hideLoading();
                    if (res.e === '') {
                        alert('领取成功！');
                        $('.container_home').show()
                        $(".zhezhao").hide()
                        $(".award-home").hide()
                        $(".container_recordlist").hide()
                        _GetUserRecords();
                    }
                    else {
                        alert(res.e);
                    }

                },
                error: function () {
                    tj_public.hideLoading();
                    alert('连接服务器失败');
                }
            });
        }
        _GetUserRecords();
        // 获取用户的中奖记录
        function _GetUserRecords() {
            $.ajax({
                type: 'GET',
                data: {
                    consumer_id: '{{consumer_id}}',
                    company_id: 109214
                },
                url: '/wx/consumer/winner/record/',
                success: function (res) {
                    if (res.e === '') {
                        var records = res.records;
                        var html = '';
                        for (let i = 0; i < records.length; i++) {
							var r = records[i]
                            html += `
                                <li>${r.tm_redeemed} &nbsp;&nbsp;&nbsp; ${r.award_name}</li>
                            
                            `
                        }
                        $("#myrecords").html(html);
                    }
                    // else {
                    //     alert(res.e);
                    // }

                },
                error: function () {
                    alert('连接服务器失败');
                }
            });
        }

    </script>
</body>

</html>