<!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>
  <link href="/static/css/176056/main.css?v=2" rel="stylesheet" />
  <title>BLNKA</title>
</head>

<body>
  <div class="page__bd">
    <div class="weui-tab">
      <div class="weui-tab__panel" id="p2">
        <div class="zy page" id="zy" onclick="showbg()">
          <img src="/static/images/176056/bj1.png" style="width: 100%; position: absolute; z-index: 1" />
          <img src="/static/images/176056/ti.png" style="
                width: 60%;
                position: absolute;
                top: 10%;
                left: 20%;
                z-index: 2;
              " />
          <img src="/static/images/176056/moon.png" style="
                width: 95%;
                position: absolute;
                bottom: 2%;
                left: 2%;
                z-index: 2;
              " />
          <img src="/static/images/176056/kk.png" style="
                width: 72%;
                position: absolute;
                top: 28%;
                left: 14%;
                z-index: 3;
              " />
          <img src="/static/images/176056/1.png" style="
                width: 30%;
                position: absolute;
                bottom: 8%;
                left: 33%;
                z-index: 3;
              " />
        </div>
        <div class="fwcx page" style="
              background: url(/static/images/176056/bj2.png);
              background-size: 100%100%;
            ">
          <div class="div1">
            <div class="div2">
              <img src="" id="labelImg" style="width: 45%" />
              <hr style="margin-top: 0.8rem; margin-bottom: 0.8rem" />
              <!-- 三维码 -->
              <div class="p p-3">
                <p>
                  请用手触摸实物标签上的结构三维码,是否有明显凹感，并认真核对是否与上图信息一致，相符则为真品，否则谨防假冒！
                </p>
              </div>
              <!-- 箱标 -->
              <div class="p p-2">
                <p>
                  请用手触摸实物标签上的结构三维码,是否有明显凹感，并认真核对是否与上图信息一致，相符则为真品，否则谨防假冒！
                </p>
              </div>
              <hr style="margin-top: 0.6rem; margin-bottom: 0.6rem" />
              <div class="info">
                <p>标签序号：<span id="cpidSpan"></span></p>
                <p>品牌：BLNKA布林卡</p>
                <p>查询次数：<span id="queryNum">0</span> 次</p>
                <p>首查时间：<span id="firstTime"></span></p>
              </div>
              <img src="/static/images/176056/zxzx.png" style="width: 15%; position: absolute; right: 1%; top: 50%"
                onclick="showTck()" />
              <div class="aidiv">
                <wx-open-launch-weapp id="launch-btn" style="display: block">
                  <script type="text/wxtag-template">
                      <style>
                          .btn {
                            border-radius: 10px;
                            font-size: 24px;
                            width: 58%;
                            margin: auto;
                            background: rgb(156, 156, 156);
                            color: black;
                            text-align: center;
                          }
                      </style>
                      <div class="btn"><b>AI 匹 配 验 证</b></div>
                    </script>
                </wx-open-launch-weapp>
                <p>点击按钮进行AI身份验证</p>
              </div>
              <div class="tips">
                <div>
                  <b style="flex: 1; color: rgb(251, 42, 42)">该产品为爱和美医疗科技集团有限公司正品标识,<br />请放心使用!</b>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="qyjs page">
          <img src="/static/images/176056/pp1.jpg" style="width: 100%" />
          <img src="/static/images/176056/pp2.jpg" style="width: 100%" />
          <img src="/static/images/176056/pp3.jpg" style="width: 100%" />
          <!-- <img
              src="/static/images/176056/zxzx.png"
              style="width: 15%; position: absolute; right: 1%; top: 50%"
              onclick="showTck()"
            /> -->
        </div>
        <div class="cpjs page">
          <div>
            <img src="/static/images/176056/lxwm.png" style="width: 25%" />
          </div>
          <div style="padding: 0.5rem 0">
            <img src="/static/images/176056/dh.png" style="width: 50%" />
          </div>
          <div style="text-align: center">
            <div>
              <img src="/static/images/176056/gzh.png" style="width: 35%" />
              <p>微信公众号</p>
            </div>
            <div>
              <img src="/static/images/176056/wb.png" style="width: 30%" />
              <p>微博</p>
            </div>
            <div>
              <img src="/static/images/176056/sph.png" style="width: 30%" />
              <p>微信视频号</p>
            </div>
            <div>
              <img src="/static/images/176056/xhs.png" style="width: 30%" />
              <p>小红书</p>
            </div>
          </div>
          <img src="/static/images/176056/zxzx.png" style="width: 15%; position: absolute; right: 1%; top: 50%"
            onclick="showTck()" />
        </div>
      </div>
      <div class="tabbar">
        <div class="weui-tabbar">
          <div id="cx" class="weui-tabbar__item">
            <img src="/static/images/176056/a1.png" style="width: 40%; height: 90%" class="yellow" />
            <img src="/static/images/176056/a.png" style="width: 40%; height: 90%" class="blue" />
          </div>
          <div id="qy" class="weui-tabbar__item">
            <img src="/static/images/176056/b.png" style="width: 40%; height: 90%" class="yellow" />
            <img src="/static/images/176056/b1.png" style="width: 40%; height: 90%" class="blue" />
          </div>
          <div id="cp" class="weui-tabbar__item">
            <img src="/static/images/176056/c.png" style="width: 40%; height: 90%" class="yellow" />
            <img src="/static/images/176056/c1.png" style="width: 40%; height: 90%" class="blue" />
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="bg" id="tck">
    <div style="background-color: white; padding: 1.2rem; border-radius: 10px">
      <div class="line">
        <div>
          <p>姓&emsp;&emsp;名：</p>
        </div>
        <div>
          <input id="input_name" type="text" class="bor" />
        </div>
      </div>
      <div class="line">
        <div>
          <p>联系电话：</p>
        </div>
        <div>
          <input id="input_phone" class="bor" type="number" />
        </div>
      </div>
      <div class="line">
        <div>
          <p>所在城市：</p>
        </div>
        <div>
          <input id="input_city" type="text" class="bor" />
        </div>
      </div>
      <div class="line">
        <div>
          <p>购买机构：</p>
        </div>
        <div>
          <input id="input_remark" type="text" class="bor" />
        </div>
      </div>
      <div style="margin-top: 0.5rem">
        <div>
          <div class="qd" onclick="onConfirm()">
            <b>确 认</b>
          </div>
        </div>
      </div>
    </div>
    <div>
      <img src="/static/images/176056/gb.png" style="width: 10%; padding-top: 1rem" onclick="hideTck()" />
    </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_176056_0");
    var pkg = tj_public.getCookie("package");
    var lat = 0;
    var lng = 0;
    var isFirst = true;

    wx.ready(function () {
      tj_public.getAddress(function (_lat, _lng) {
        lat = _lat;
        lng = _lng;
        loading.hide();
      });
      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") {
      $(".p-3").hide();
      $(".p-2").show();
      $(".aidiv").hide();
    }

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

    function showTck() {
      $("#tck").fadeIn();
    }

    function hideTck() {
      $("#tck").fadeOut();
    }

    function onConfirm() {
      var name = $("#input_name").val();
      var phone = $("#input_phone").val();
      var city = $("#input_city").val();
      var remark = $("#input_remark").val();
      if (name.trim().length < 2) {
        weui.alert("请填写您的姓名");
        return;
      }
      if (phone.trim().length !== 11) {
        weui.alert("请填写您的手机号码");
        return;
      }
      if (city.trim().length < 2) {
        weui.alert("请填写您所在的城市，以便我们能快速服务到您");
        return;
      }
      consumerLeaveMessage(name, phone, city, remark)
    }

    function getInfo() {
      loading = weui.loading("查询中");
      $.ajax({
        url: "/wx/label/scan_record/",
        data: {
          lat,
          lng,
          uid,
          compid: 176056,
          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("网络超时！");
        },
      });
    }

    function consumerLeaveMessage(name, phone, city, message) {
      $.ajax({
        url: '/company/leave_message/',
        type: 'post',
        data: {
          consumer_id: uid,
          company_id: 176056,
          label_code: cpid,
          name,
          tel: phone,
          address: city,
          message
        },
        success: function (res) {
          weui.toast('留言成功', 3000);
          hideTck()
        },
        error: function () {
          hideTck()
        }
      })
    }

    $(".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 () {
      if (isFirst) {
        getInfo();
      }
      isFirst = false
      $(".fwcx").show();
    });
    $("#qy").on("click", function () {
      $(".qyjs").show();
    });
    $("#cp").on("click", function () {
      $(".cpjs").show();
    });
    function showbg() {
      if (isFirst) {
        getInfo();
      }
      isFirst = false
      $(".page").hide();
      $(".fwcx").show();
    }
  </script>
</body>

</html>