var e = require("../../common/vendor.js"),
  n = require("../../hooks/onMounted.js"),
  t = require("../../hooks/onShow.js"),
  r = require("../../hooks/onShareAppMessage.js"),
  u = require("../../hooks/useState.js"),
  o = require("../../data/index.js"),
  i = require("../../utils/navigate.js"),
  a = require("../../service/index.js"),
  c = require("../../enums/index.js");
require("../../utils/util.js"),
  require("../../constant/index.js"),
  require("../../config/index.js"),
  require("../../store/app/index.js"),
  require("../../utils/request.js"),
  Math || (e.unref(s) + e.unref(f))();
var s = function () {
    return "../../components/popup-order/index.js";
  },
  f = function () {
    return "../../components/popup-coupon/index.js";
  },
  d = {
    __name: "index",
    setup: function (s) {
      var f = u.useState(),
        d = f.totalOrderNum,
        p = f.setTotalOrderNum,
        l = f.actionList,
        m = e.ref(!1),
        v = e.ref(""),
        h = e.ref(!1),
        g = e.ref(0),
        T = function () {
          var e = m.value || h.value;
          return "height: 100%; overflow: "
            .concat(e ? "hidden" : "visible", "; position: ")
            .concat(e ? "fixed" : "relative");
        },
        E = function () {
          a.getOrderNum().then(function (n) {
            var t = n.num;
            p({ totalOrderNum: t }),
              t > 0 && e.index.showTabBarRedDot({ index: 1 });
          });
        },
        j = function (e) {
          var n = e.url,
            t = e.params;
          i.navigateTo({ url: n, params: t });
        },
        x = function () {
          m.value = !1;
        },
        S = function () {
          (h.value = !1), g.value++;
        };
      return (
        n.onMounted(function () {
          e.index.$on("refreshOrderDetail", function (n) {
            return (function (n) {
              a.getOrderDetail({ order_no: n })
                .then(function (n) {
                  var t = e._.find(n.productIdList, function (e) {
                    return e.status === c.ProductStatusEnum.TO_BE_UPLOADED;
                  });
                  n.status === c.OrderStatusEnum.UNPAID
                    ? (v.value = "存在一笔待支付订单")
                    : (v.value = t ? "存在待上传行驶证订单" : ""),
                    (m.value = !!v.value);
                })
                .catch(function () {
                  m.value = !1;
                });
            })(n);
          }),
            e.index.$on("refreshOrderNum", function () {
              0 === d.value && E();
            }),
            E(),
            g.value++;
        }, !1),
        t.onShow(function () {
          (!e.index.getStorageSync("fisrtIn") ||
            e.index.getStorageSync("fisrtIn") < 2) &&
            1 === g.value &&
            (setTimeout(function () {
              h.value = !0;
            }, 500),
            console.log("onShow"));
        }),
        r.onShareAppMessage(),
        function (n, t) {
          return e.e(
            { a: T(), b: 0 === e.unref(l).length },
            0 === e.unref(l).length
              ? {
                  c: e.f([1, 2, 3, 4, 5, 6, 7, 8], function (e, n, t) {
                    return { a: n };
                  }),
                }
              : {},
            { d: e.unref(l).length > 0 },
            e.unref(l).length > 0
              ? {
                  e: e.f(e.unref(l), function (n, t, r) {
                    return e.e(
                      {
                        a: n.icon,
                        b: e.t(n.name),
                        c:
                          n.params.productType ===
                          e.unref(c.ProductTypeEnum).OVERALL,
                      },
                      (n.params.productType,
                      e.unref(c.ProductTypeEnum).OVERALL,
                      {}),
                      {
                        d:
                          n.params.productType ===
                          e.unref(c.ProductTypeEnum).VEHICLE_INFO,
                      },
                      (n.params.productType,
                      e.unref(c.ProductTypeEnum).VEHICLE_INFO,
                      {}),
                      {
                        e:
                          n.params.productType ===
                          e.unref(c.ProductTypeEnum).VEHICLE_STATUS,
                      },
                      (n.params.productType,
                      e.unref(c.ProductTypeEnum).VEHICLE_STATUS,
                      {}),
                      {
                        f: t,
                        g: e.o(function (e) {
                          return j(n);
                        }, t),
                      }
                    );
                  }),
                }
              : {},
            {
              f: e.f(e.unref(o.theActionList2), function (n, t, r) {
                return e.e(
                  { a: e.t(n.name), b: e.t(n.desc), c: n.icon, d: 0 === t },
                  {},
                  { e: 1 === t },
                  {},
                  {
                    f: t,
                    g: e.n(t >= 2 ? "action-content2-item-top" : ""),
                    h: e.n(0 === t ? "action-content2-item-0" : ""),
                    i: e.n(1 === t ? "action-content2-item-1" : ""),
                    j: e.n(2 === t ? "action-content2-item-2" : ""),
                    k: e.n(3 === t ? "action-content2-item-3" : ""),
                    l: e.o(function (e) {
                      return j(n);
                    }, t),
                  }
                );
              }),
              g: e.o(x),
              h: e.p({ visible: m.value, title: v.value }),
              i: e.o(S),
              j: e.p({ visible: h.value }),
            }
          );
        }
      );
    },
  },
  p = e._export_sfc(d, [["__scopeId", "data-v-45f75add"]]);
(d.__runtimeHooks = 2), wx.createPage(p);
