<!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/t/wx_fed/weui-source/res/2.5.4/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>
    <style>
      html,
      body {
        height: 100%;
      }
      body {
        background: url(/static/images/177923/bg.jpg) no-repeat;
        background-size: 100% 100%;
        overflow: auto;
      }
      .container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
      }
      .wrapper {
        flex: 1;
        width: 100%;
        padding: 1rem 0;
        overflow: auto;
      }
      .logo {
        height: 6rem;
        margin: 1rem 0;
        text-align: center;
      }
      .info-box {
        width: 90%;
        margin: 0 auto;
        height: 100%;
        border: 1px solid #427f7e;
        border-radius: 10px;
        background-color: rgba(255, 255, 255, 0.9);
        overflow: auto;
      }
      .fwimg {
        display: block;
        margin: 1rem auto;
        width: 5rem;
        height: 5rem;
      }
      .warn {
        width: 90%;
        margin: 0 auto;
        padding: 0.5rem 0;
        border-top: 1px solid #474141;
        border-bottom: 1px solid #474141;
        font-size: 0.7rem;
      }
      .info {
        width: 80%;
        margin: 1rem auto;
        font-size: 0.75rem;
      }
      .info span {
        margin-left: 2px;
      }
      .tips{
        width: 80%;
        margin: 1rem auto;
        font-size: 0.75rem;
        color: #2faf6b;
      }
    </style>
    <title>福建省茶言筱筑生态茶业有限公司</title>
  </head>

  <body>
    <div class="container">
      <div class="wrapper">
        <div class="info-box">
          <img id="labelImg" class="fwimg" src="" />
          <div class="warn" id="p-3">
            <p>1、请用手触摸实物标签上的结构三维码是否有物理凹感！</p>
            <p>2、请认真核对实物标签上的结构三维码序号是否与上图一致！</p>
            <p>3、以上两点都相符则为真品，否则谨防假冒！</p>
          </div>
          <!-- <div class="warn" id="p-2" style="display: none">
            <p>1、请用手触摸实物标签上的结构三维码是否有物理凹感！</p>
            <p>2、请认真核对实物标签上的结构三维码序号是否与上图一致！</p>
            <p>3、以上两点都相符则为真品，否则谨防假冒！</p>
          </div> -->
          <div class="info">
            <p>标签序号：<span id="cpidSpan"></span></p>
            <p>首查时间：<span id="firstTime"></span></p>
            <p>已查次数：<span id="queryNum"></span></p>
          </div>

          <div class="tips" style="display: none;">
            <b>该产品为福建省茶言筱筑生态茶业有限公司正品标识,请放心使用!</b>
          </div>

          <wx-open-launch-weapp id="launch-btn" style="display: block">
            <script type="text/wxtag-template">
              <div style="display: block;width: 200px;margin:0 auto 20px;border: 2px solid #c7ac78;border-radius: 10px;padding:5px;text-align: center;">
                  <div style="border: 4px solid #c1a26e;padding:8px 0;font-size: 16px;">
                      <b>AI验证</b>
                  </div>
              </div>
            </script>
          </wx-open-launch-weapp>

        </div>
      </div>
      <div class="logo">
        <img src="/static/images/177923/logo.png" style="width: 6rem" />
      </div>
    </div>

    <script
      type="text/javascript"
      src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"
    ></script>
    <script
      type="text/javascript"
      src="https://res.wx.qq.com/t/wx_fed/weui.js/res/1.2.13/weui.min.js"
    ></script>
    <script src="/static/js/jquery-2.1.0.min.js"></script>
    <script src="/static/js/public/public.js"></script>
    <script>
      var loading = weui.loading("加载中");

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

      var cpid = tj_public.getCookie("label_code");
      var uid = tj_public.getCookie("TJWXUSR_177923_0");
      var pkg = tj_public.getCookie("package");
      var lat = 0;
      var lng = 0;

      wx.ready(function () {
        tj_public.getAddress(function (_lat, _lng) {
          lat = _lat;
          lng = _lng;
          getInfo()
        });
        if (pkg === "3") {
          return;
        }
        var uuid = tj_public.getUuid(8, 16);
        tj_public.configLaunchWeappBtn({
          el: "launch-btn",
          username: "gh_4290b605146b",
          extraData: {
            cpid,
            uid,
            uuid,
            os: "davis",
          },
          onLaunch: function () {
            tj_public.checkMiniprogramAIStatus(
              {
                cpid,
                consumer_id: uid,
                uuid,
              },
              function (state) {
                if (state == 1) {
                  access();
                }
              }
            );
          },
        });
      });

      wx.error(function (res) {
        loading.hide();
      });

      if (pkg === "3") {

      }

      function access() {
        $("#launch-btn").hide();
        $(".tips").show();
      }

      function getInfo() {
        //loading = weui.loading("查询中");
        $.ajax({
          url: "/wx/label/scan_record/",
          data: {
            lat,
            lng,
            uid,
            compid: 177923,
            fwcode: cpid,
          },
          success: function (res) {
            loading.hide();
            if (res.bcode) {
              $("#cpidSpan").text(res.bcode);
            } else {
              $("#cpidSpan").text(res.code);
            }

            $("#queryNum").text(res.cnt);
            $("#firstTime").text(res.tm_1st);
            $("#labelImg").attr("src", res.img);
          },
          error: function () {
            loading.hide();
            weui.alert("网络超时！");
          },
        });
      }
    </script>
  </body>
</html>
