<!DOCTYPE html>
<html lang="en">
  <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"
    />
    <script src="/static/js/public/reset.js"></script>
    <title>吉林康庄大道农业发展有限公司</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      html,
      body {
        width: 100%;
        height: 100%;
      }

      .container {
        height: 100%;
        width: 100%;
        background-color: #f5f5f3;
        overflow: auto;
      }

      .container .btn {
        width: 8rem;
        padding: 10px 0;
        text-align: center;
        border-radius: 1.8rem;
        font-size: 0.8rem;
        font-size: 16px;
        color: #fff;
        background-color: #259362;
      }

      /* .container #launch-btn{

      } */

      .container .top-bg {
        position: relative;
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        height: 11rem;
        width: 100%;
        background-image: url("/static/images/180087/头部背景.png");
        background-size: 100% 100%;
      }

      .top-bg .icon {
        margin-top: -2rem;
        margin-bottom: 0.5rem;
        height: 5rem;
      }
      .top-bg .title-img {
        width: 10rem;
      }
      /* 防伪相关内容 */
      .top-bg .anti-content-box {
        position: absolute;
        top: 9rem;
        left: 50%;
        transform: translate(-50%);
        padding: 0.5rem 0;
        width: calc(100% - 1.5rem);
        height: 20rem;
        font-size: 0.8rem;
        background-color: #fff;
        border: 1px solid #259362;
        border-radius: 8px;
      }

      .anti-content-box .anti-code-img {
        width: 100%;
        text-align: center;
      }
      .anti-content-box .anti-code-img img {
        height: 8rem;
      }

      .anti-content-box .described {
        margin: 0.5rem;
        padding: 0.4rem 0.5rem;
        height: 3.5rem;
        line-height: 1.4rem;
        border-top: 1px solid #000;
        border-bottom: 1px solid #000;
      }

      .anti-content-box .checkinfo {
        padding-left: 1rem;
        width: 100%;
        box-sizing: border-box;
      }

      .anti-content-box .checkresult {
        text-align: center;
        color: #259362;
      }

      .anti-content-box .btns {
        position: absolute;
        top: 20rem;
        left: 50%;
        transform: translate(-50%);
        padding-bottom: 2rem;
      }

      .anti-content-box .btns .btn {
        margin-top: 0.5rem;
      }

      /* 溯源相关内容 */

      .top-bg .suyuan-content-box {
        position: absolute;
        top: 8rem;
        left: 50%;
        transform: translate(-50%);
        padding: 0.5rem 0;
        width: calc(100% - 1.5rem);
        font-size: 0.8rem;
      }

      .suyuan-content-box .card-box {
        margin: 0.5rem 0;
        width: 100%;
        padding: 0.5rem;
        background-color: #fff;
        border: 1px solid #259362;
        border-radius: 8px;
      }

      .suyuan-content-box .suyuan-btn {
        margin-top: 1rem;
        width: 100%;
        display: flex;
        justify-content: center;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="top-bg">
        <img src="/static/images/180087/icon.png" class="icon" />
        <!-- 防伪png -->
        <img
          src="/static/images/180087/防伪查询.png"
          class="title-img type-anti"
        />
        <!-- 溯源png -->
        <img
          src="/static/images/180087/溯源信息.png"
          class="title-img type-suyuan"
          style="visibility: hidden"
        />

        <!-- 防伪内容盒子 -->
        <div id="fw" class="anti-content-box type-anti" style="display: none">
          <!-- 防伪 三维码 -->
          <div class="anti-code-img">
            <img id="labelImg" src="" />
          </div>
          <!-- 介绍描述 -->
          <div class="described">
            请认真核对实物标签上的烫金三维码是否与上图一致，相符则为正品，否则谨防假冒!
          </div>
          <!-- 防伪查询信息 -->
          <div class="checkinfo">
            <p>首查时间：<span id="firstTime"></span></p>
            <p>已查次数：<span id="queryNum"></span>次</p>
          </div>
          <!-- 防伪查询结果 -->
          <div class="checkresult" style="display: none">
            <p>该产品为</p>
            <b>吉林康庄大道农业发展有限公司</b>
            <p>正品标识，请放心使用!</p>
          </div>
          <!--防伪底部按钮 -->
          <div class="btns" style="margin-top: 1rem;">
            <div id="aidiv">
              <wx-open-launch-weapp
                id="launch-btn"
                style="display: block; width: 8rem; border-radius: 1.8rem;overflow: hidden;"
              >
                <script type="text/wxtag-template">
                  <style>
                      .btn {
                        width: 100%;
                        padding: 10px 0;
                        text-align: center;
                        font-size: 16px;
                        background-color: #259362;
                        color: #fff;
                      }
                  </style>
                  <div class="btn">AI识别</div>
                </script>
              </wx-open-launch-weapp>
              <!-- <div class="btn">AI识别</div> -->
            </div>
            <div class="btn" onclick="showSyPage();">返回溯源</div>
          </div>
        </div>

        <!-- 溯源内容盒子 -->
        <div
          id="sy"
          class="suyuan-content-box type-suyuan"
          style="display: block"
        >
          <div class="card-box">
            <p style="display: none">品种名称：<span id="pzmc"></span></p>
            <p style="display: none">收货单位：<span id="shdw"></span></p>
            <p>
              总经销：<span id="zjx">康庄大道 (长春) 种业科技有限公司</span>
            </p>
            <p>登记编号：<span id="djbh">国审玉20220140</span></p>
          </div>
          <div class="card-box">
            <p>
              生产经营许可证号：<span id="xkz"
                >B（吉）农种许字（2019）第0134号</span
              >
            </p>
            <p>公司名称：<span id="gsmc">吉林康庄大道农业发展有限公司</span></p>
            <p>厂家：<span id="cj">吉林康庄大道农业发展有限公司</span></p>
            <p>地址：<span id="dz">吉林省白城市洮南市车力乡立业村</span></p>
          </div>

          <!-- 溯源页面按钮 -->
          <div class="suyuan-btn">
            <div class="btn" onclick="showFwPage();">防伪查询</div>
          </div>
        </div>
      </div>
    </div>
  </body>
  <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 company_id = 180087;
    var cpid = tj_public.getCookie("label_code");
    var uid = tj_public.getCookie("TJWXUSR_" + company_id + "_0");
    var pkg = tj_public.getCookie("package");

    wx.ready(function () {
      tj_public.getAddress(function (lat, lng) {
        getInfo(lat, lng);
      });
      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(
            {
              label_code: cpid,
              consumer_id: uid,
              uuid,
            },
            function (state) {
              if (state == 1) {
                access();
              }
            }
          );
        },
      });
    });

    wx.error(function (res) {
      getInfo(0, 0);
    });

    if (pkg === "3") {
      $("#aidiv").hide();
    }

    function access() {
      $("#aidiv").hide();
      $(".checkresult").show();
    }

    function getInfo(lat, lng) {
      $.ajax({
        url: "/wx/label/scan_record/",
        data: {
          lat,
          lng,
          uid,
          compid: company_id,
          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);
          if (res.product_name) {
            $("#pzmc").text(res.product_name).parent().show();
          }
          if (res.agent_name) {
            $("#shdw").text(res.agent_name).parent().show();
          }
        },
        error: function () {
          loading.hide();
          weui.alert("网络超时！");
        },
      });
    }

    function showFwPage() {
      $("#sy").hide();
      $("#fw").fadeIn();
    }

    function showSyPage() {
      $("#fw").hide();
      $("#sy").fadeIn();
    }
  </script>
</html>
