var e = require("../../common/vendor.js"),
  n = require("../../hooks/onMounted.js"),
  t = require("../../hooks/onShareAppMessage.js"),
  a = require("../../service/index.js"),
  o = require("../../constant/index.js"),
  i = require("../../utils/util.js"),
  r = require("../../utils/common.js"),
  u = require("../../utils/navigate.js"),
  c = require("../../config/index.js");
require("../../hooks/useState.js"),
  require("../../store/app/index.js"),
  require("../../enums/index.js"),
  require("../../data/index.js"),
  require("../../utils/request.js"),
  Math || (e.unref(d) + e.unref(s) + e.unref(l))();
var s = function () {
    return "../../components/empty/index.js";
  },
  d = function () {
    return "../../components/divider/index.js";
  },
  l = function () {
    return "../../components/float-share/index.js";
  },
  v = {
    __name: "index",
    setup: function (s) {
      var d = e.ref(!0),
        l = e.ref(!1),
        v = e.ref({}),
        f = e.ref([]),
        g = e.ref(!0),
        h = null,
        m = function () {
          h.show().catch(function () {
            h.load()
              .then(function () {
                return h.show();
              })
              .catch(function (e) {
                console.log("激励视频 广告显示失败", e);
              });
          });
        };
      return (
        n.onMounted(function (n) {
          i.showLoading("努力查询中"),
            e.wx$1.createRewardedVideoAd &&
              ((h = e.wx$1.createRewardedVideoAd({
                adUnitId: c.mpWeixinVideoUnitAd,
              })).onLoad(function () {
                g.value = n.showMask;
              }),
              h.onError(function (e) {
                (g.value = !1), console.log("视频激励广告拉取失败", e);
              }),
              h.onClose(function (t) {
                if (t && t.isEnded) {
                  var a = e.index.getStorageSync("loadRewardedVideoAdCount"),
                    o = new Date().getFullYear(),
                    r = new Date().getMonth() + 1,
                    c = new Date().getDate();
                  if (a) {
                    var s = JSON.parse(a),
                      d = s.date,
                      l = s.count;
                    d !== "".concat(o, "-").concat(r, "-").concat(c)
                      ? e.index.setStorageSync(
                          "loadRewardedVideoAdCount",
                          JSON.stringify({
                            date: "".concat(o, "-").concat(r, "-").concat(c),
                            count: 1,
                          })
                        )
                      : l < 2 &&
                        e.index.setStorageSync(
                          "loadRewardedVideoAdCount",
                          JSON.stringify({
                            date: "".concat(o, "-").concat(r, "-").concat(c),
                            count: 2,
                          })
                        );
                  } else
                    e.index.setStorageSync(
                      "loadRewardedVideoAdCount",
                      JSON.stringify({
                        date: "".concat(o, "-").concat(r, "-").concat(c),
                        count: 1,
                      })
                    );
                  u.redirectTo({
                    url: "/pages/vehicle-info-detail/index",
                    params: { vin: n.vin, showMask: !1 },
                  }),
                    console.log("视频激励广告播放完毕");
                } else i.showToast("看完广告后自动解锁剩余车辆信息~");
              })),
            a
              .getVehicleInfoDetail({ vin: n.vin })
              .then(function (e) {
                e
                  ? ((f.value = r.getVehicleInfoList(e.detail)), (v.value = e))
                  : (l.value = !0);
              })
              .catch(function () {
                l.value = !0;
              })
              .finally(function () {
                (d.value = !1), i.hideLoading();
              });
        }, !1),
        t.onShareAppMessage(),
        function (n, t) {
          return e.e(
            { a: !d.value },
            d.value
              ? {}
              : e.e(
                  { b: !l.value },
                  l.value
                    ? {}
                    : e.e(
                        {
                          c: v.value.logo,
                          d: e.t(v.value.name),
                          e: e.t(
                            (v.value.vin || "")
                              .toString()
                              .replace(/^(.{5}).{6}/, "$1******")
                          ),
                          f: v.value.comfuelconsumption,
                        },
                        v.value.comfuelconsumption
                          ? { g: e.t(v.value.comfuelconsumption) }
                          : {},
                        { h: v.value.environmentalstandards },
                        v.value.environmentalstandards
                          ? { i: e.t(v.value.environmentalstandards) }
                          : {},
                        {
                          j: e.f(f.value, function (n, t, a) {
                            return e.e(
                              {
                                a: e.t(n.name),
                                b: e.t(n.value || "-"),
                                c: t >= 3 && g.value ? 1 : "",
                                d: t >= 20 && g.value ? 1 : "",
                              },
                              g.value ? { e: e.o(m, t) } : {},
                              {
                                f:
                                  !g.value &&
                                  t + 1 === parseInt(f.value.length / 2),
                              },
                              g.value || t + 1 !== parseInt(f.value.length / 2)
                                ? {}
                                : { g: e.unref(c.mpWeixinBannerUnitAd) },
                              { h: t }
                            );
                          }),
                          k: g.value,
                          l: e.t(e.unref(o.disclaimer)),
                        }
                      ),
                  { m: l.value },
                  l.value ? { n: e.p({ info: "抱歉~！没有查到数据哦" }) } : {}
                )
          );
        }
      );
    },
  },
  f = e._export_sfc(v, [["__scopeId", "data-v-4dace52a"]]);
(v.__runtimeHooks = 2), wx.createPage(f);
