var e = require("../../common/vendor.js"),
  t = require("../../hooks/onMounted.js"),
  u = require("../../hooks/onShareAppMessage.js"),
  n = require("../../service/index.js"),
  r = require("../../enums/index.js"),
  o = require("../../utils/util.js"),
  a = require("../../utils/navigate.js"),
  s = require("../../utils/common.js");
require("../../hooks/useState.js"),
  require("../../store/app/index.js"),
  require("../../data/index.js"),
  require("../../config/index.js"),
  require("../../constant/index.js"),
  require("../../utils/request.js"),
  Array || e.resolveComponent("uni-load-more")();
Math ||
  (
    e.unref(p) +
    function () {
      return "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
    } +
    e.unref(l) +
    e.unref(c) +
    e.unref(f) +
    e.unref(i) +
    e.unref(d)
  )();
var i = function () {
    return "../../components/popup-upload-tips/index.js";
  },
  d = function () {
    return "../../components/popup-pay-again/index.js";
  },
  c = function () {
    return "../../components/float-refresh/index.js";
  },
  f = function () {
    return "../../components/float-back-to-top/index.js";
  },
  l = function () {
    return "../../components/empty/index.js";
  },
  p = function () {
    return "../../components/vehicle-number/index.js";
  },
  v = {
    __name: "index",
    setup: function (i) {
      var d = e.ref([
          { title: "全部", status: 0 },
          { title: "待付款", status: 4 },
          { title: "待上传", status: 5 },
          { title: "查询中", status: 2 },
          { title: "查询成功", status: 1 },
        ]),
        c = e.ref(0),
        f = e.ref(!0),
        l = e.ref(!1),
        p = e.ref(!1),
        v = e.ref(1),
        m = e.ref(r.PageStatusEnum.LOADING),
        E = e.ref([]),
        _ = e.ref(!1),
        g = e.ref(!1),
        S = e.ref(!1),
        N = e.ref(null),
        P = function () {
          var e = g.value || S.value;
          return "height: 100%; overflow: "
            .concat(e ? "hidden" : "visible", "; position: ")
            .concat(e ? "fixed" : "relative");
        },
        h = function (t) {
          return e._.find(t.productList, function (e) {
            return e.status === r.ProductStatusEnum.TO_BE_UPLOADED;
          });
        },
        I = function (e) {
          var t = e.order_no,
            u = e.product_id,
            n = e.status;
          s.openReport({ orderNo: t, productId: u, status: n });
        },
        T = function () {
          o.showToast("已经帮您催了，请耐心等待一会儿...");
        },
        A = function () {
          s.queryWithoutDrivingLicense({ orderNo: N.value.order_no }).then(
            function () {
              a.navigateTo({ url: "/pages/upload-success/index" }),
                (g.value = !1);
            }
          );
        },
        O = function () {
          g.value = !1;
        },
        x = function () {
          S.value = !1;
        },
        y = function (e) {
          D(e), (S.value = !1);
        },
        D = function (e) {
          o.showLoading("支付中"),
            n
              .payOrderAgain({ payMethod: e, order_no: N.value.order_no })
              .then(function (t) {
                s.payForOrder({ payMethod: e, data: t })
                  .then(function (e) {
                    var t = e.orderNo;
                    a.navigateTo({
                      url: "/pages/pay-success/index",
                      params: { orderNo: t },
                    });
                  })
                  .catch(function (e) {
                    var t = e.orderNo;
                    a.navigateTo({
                      url: "/pages/pay-fail/index",
                      params: { orderNo: t },
                    });
                  });
              });
        },
        L = function () {
          return m.value === r.PageStatusEnum.NOMORE
            ? Promise.resolve()
            : ((m.value = r.PageStatusEnum.LOADING),
              n
                .getOrderList({
                  page: v.value,
                  status: d.value[c.value].status,
                })
                .then(function (t) {
                  var u = t.data,
                    n = t.per_page;
                  0 === u.length && 0 === E.value.length
                    ? (p.value = !0)
                    : ((p.value = !1),
                      u.length < n && (m.value = r.PageStatusEnum.NOMORE),
                      1 === v.value
                        ? (E.value = u)
                        : (E.value = e._.concat(E.value, u)));
                }));
        },
        j = function () {
          o.showLoading(),
            (_.value = !0),
            (m.value = ""),
            (v.value = 1),
            L().then(function () {
              (_.value = !1),
                o.hideLoading(),
                e.index.stopPullDownRefresh(),
                e.index.pageScrollTo({ scrollTop: 0, duration: 100 });
            });
        };
      return (
        t.onMounted(function (t) {
          var u = t.tabIndex;
          e.index.$on("updateMyOrderList", function (e) {
            j();
          }),
            (c.value = u || 0),
            L().then(function () {
              (f.value = !1),
                o.hideLoading(),
                e.index.pageScrollTo({ scrollTop: 0, duration: 100 });
            });
        }),
        e.onPullDownRefresh(function () {
          j();
        }),
        e.onReachBottom(function () {
          v.value++, L();
        }),
        e.onPageScroll(function (t) {
          var u = t.scrollTop;
          l.value = u >= e.index.getSystemInfoSync().windowHeight / 3;
        }),
        u.onShareAppMessage(),
        function (t, u) {
          return e.e(
            { a: P(), b: !f.value },
            f.value
              ? {}
              : e.e(
                  {
                    c: e.f(d.value, function (t, u, n) {
                      return {
                        a: e.t(t.title),
                        b: e.n(c.value === u ? "active" : ""),
                        c: u,
                        d: e.o(function (t) {
                          return (function (t) {
                            var u = t.index;
                            c.value !== u &&
                              ((v.value = 1),
                              (m.value = ""),
                              (E.value = []),
                              (c.value = u),
                              o.showLoading(),
                              L().then(function () {
                                o.hideLoading(),
                                  e.index.pageScrollTo({
                                    scrollTop: 0,
                                    duration: 100,
                                  });
                              }));
                          })({ index: u });
                        }, u),
                      };
                    }),
                    d: !p.value,
                  },
                  p.value
                    ? {}
                    : {
                        e: e.f(E.value, function (t, u, n) {
                          return e.e(
                            {
                              a: e.t(
                                e.unref(s.getProduct)(t.product_id).product_name
                              ),
                              b: t.status === e.unref(r.OrderStatusEnum).UNPAID,
                            },
                            (t.status, e.unref(r.OrderStatusEnum).UNPAID, {}),
                            { c: t.status === e.unref(r.OrderStatusEnum).PAID },
                            t.status === e.unref(r.OrderStatusEnum).PAID
                              ? {
                                  d: e.t(
                                    e.unref(s.getOrderStatus)(t.productList)
                                  ),
                                }
                              : {},
                            {
                              e: t.status === e.unref(r.OrderStatusEnum).REFUND,
                            },
                            (t.status, e.unref(r.OrderStatusEnum).REFUND, {}),
                            {
                              f:
                                t.status ===
                                e.unref(r.OrderStatusEnum).COMPLETE,
                            },
                            (t.status, e.unref(r.OrderStatusEnum).COMPLETE, {}),
                            { g: e.t(t.order_no), h: t.car_name },
                            t.car_name ? { i: e.t(t.car_name) } : {},
                            { j: t.car_no },
                            t.car_no
                              ? {
                                  k: "2e6df7a1-0-" + n,
                                  l: e.p({ data: t.car_no }),
                                }
                              : {},
                            { m: t.vin },
                            t.vin
                              ? {
                                  n: e.t(
                                    (t.vin || "")
                                      .toString()
                                      .replace(/^(.{5}).{6}/, "$1******")
                                  ),
                                }
                              : {},
                            { o: e.t(t.create_time), p: t.productList },
                            t.productList
                              ? {
                                  q: e.f(t.productList, function (u, o, a) {
                                    return e.e(
                                      {
                                        a: e.t(
                                          e.unref(s.getProduct)(u.product_id)
                                            .product_name
                                        ),
                                        b: e.t(
                                          e.unref(s.getProduct)(u.product_id)
                                            .product_desc
                                        ),
                                        c:
                                          t.status !==
                                            e.unref(r.OrderStatusEnum).REFUND &&
                                          u.status ===
                                            e.unref(r.ProductStatusEnum)
                                              .IN_QUERY,
                                      },
                                      t.status !==
                                        e.unref(r.OrderStatusEnum).REFUND &&
                                        u.status ===
                                          e.unref(r.ProductStatusEnum).IN_QUERY
                                        ? {
                                            d: "2e6df7a1-1-" + n + "-" + a,
                                            e: e.p({
                                              iconType: "snow",
                                              iconSize: 20,
                                              status: "loading",
                                              showText: !1,
                                            }),
                                          }
                                        : {},
                                      t.status !==
                                        e.unref(r.OrderStatusEnum).REFUND
                                        ? e.e(
                                            {
                                              f:
                                                u.status ===
                                                e.unref(r.ProductStatusEnum)
                                                  .SUCCESS,
                                            },
                                            u.status ===
                                              e.unref(r.ProductStatusEnum)
                                                .SUCCESS
                                              ? {
                                                  g: e.o(function (e) {
                                                    return I(u);
                                                  }, u.id),
                                                }
                                              : {},
                                            {
                                              h:
                                                u.status ===
                                                  e.unref(r.ProductStatusEnum)
                                                    .FAIL &&
                                                (u.product_id ==
                                                  e.unref(r.ProductTypeEnum)
                                                    .INSURANCE_MAINTAIN ||
                                                  u.product_id ===
                                                    e.unref(r.ProductTypeEnum)
                                                      .ACCIDENT),
                                            },
                                            u.status !==
                                              e.unref(r.ProductStatusEnum)
                                                .FAIL ||
                                              (u.product_id !=
                                                e.unref(r.ProductTypeEnum)
                                                  .INSURANCE_MAINTAIN &&
                                                u.product_id !==
                                                  e.unref(r.ProductTypeEnum)
                                                    .ACCIDENT)
                                              ? {}
                                              : {
                                                  i: e.o(function (e) {
                                                    return I(u);
                                                  }, u.id),
                                                },
                                            {
                                              j:
                                                u.status ===
                                                e.unref(r.ProductStatusEnum)
                                                  .IN_QUERY,
                                            },
                                            u.status ===
                                              e.unref(r.ProductStatusEnum)
                                                .IN_QUERY
                                              ? { k: e.o(T, u.id) }
                                              : {},
                                            {
                                              l:
                                                u.status ===
                                                  e.unref(r.ProductStatusEnum)
                                                    .FAIL &&
                                                u.product_id !==
                                                  e.unref(r.ProductTypeEnum)
                                                    .INSURANCE_MAINTAIN &&
                                                u.product_id !==
                                                  e.unref(r.ProductTypeEnum)
                                                    .ACCIDENT,
                                            },
                                            (u.status ===
                                              e.unref(r.ProductStatusEnum)
                                                .FAIL &&
                                              u.product_id !==
                                                e.unref(r.ProductTypeEnum)
                                                  .INSURANCE_MAINTAIN &&
                                              (u.product_id,
                                              e.unref(r.ProductTypeEnum)
                                                .ACCIDENT),
                                            {})
                                          )
                                        : {},
                                      { m: u.id }
                                    );
                                  }),
                                  r:
                                    t.status !==
                                    e.unref(r.OrderStatusEnum).REFUND,
                                }
                              : {},
                            {
                              s: t.status !== e.unref(r.OrderStatusEnum).REFUND,
                            },
                            t.status !== e.unref(r.OrderStatusEnum).REFUND
                              ? e.e(
                                  {
                                    t:
                                      t.status ===
                                      e.unref(r.OrderStatusEnum).UNPAID,
                                  },
                                  t.status === e.unref(r.OrderStatusEnum).UNPAID
                                    ? {
                                        v: e.o(function (e) {
                                          return (
                                            (u = t),
                                            (N.value = u),
                                            void D(r.PayMethodEnum.WECHAT_PAY)
                                          );
                                          var u;
                                        }, t.order_no),
                                      }
                                    : {},
                                  { w: h(t) },
                                  h(t)
                                    ? e.e(
                                        {
                                          x: e.o(function (e) {
                                            return (
                                              (u = t),
                                              void s
                                                .chooseDrivingLicense({
                                                  orderNo: u.order_no,
                                                })
                                                .then(function () {
                                                  a.navigateTo({
                                                    url: "/pages/upload-success/index",
                                                  });
                                                })
                                            );
                                            var u;
                                          }, t.order_no),
                                          y:
                                            t.vin ||
                                            t.type ===
                                              e.unref(r.ProductTypeEnum)
                                                .VIOLATION,
                                        },
                                        t.vin ||
                                          t.type ===
                                            e.unref(r.ProductTypeEnum).VIOLATION
                                          ? {
                                              z: e.o(function (e) {
                                                return (
                                                  (u = t),
                                                  (g.value = !0),
                                                  void (N.value = u)
                                                );
                                                var u;
                                              }, t.order_no),
                                            }
                                          : {}
                                      )
                                    : {}
                                )
                              : {},
                            {
                              A: t.order_no,
                              B: e.o(function (e) {
                                return (function (e) {
                                  var t = e.order_no,
                                    u = e.product_id;
                                  a.navigateTo({
                                    url: "/pages/order-detail/index",
                                    params: {
                                      orderNo: t,
                                      productName: s.getProduct(u).product_name,
                                    },
                                  });
                                })(t);
                              }, t.order_no),
                            }
                          );
                        }),
                        f: E.value.length,
                        g: e.p({ iconType: "snow", status: m.value }),
                      },
                  { h: p.value },
                  p.value ? { i: e.p({ info: "暂无订单记录" }) } : {},
                  {
                    j: e.o(j),
                    k: e.p({ loading: _.value }),
                    l: e.p({ visible: l.value }),
                    m: e.o(O),
                    n: e.o(A),
                    o: e.p({ visible: g.value }),
                    p: e.o(x),
                    q: e.o(y),
                    r: e.p({ visible: S.value }),
                  }
                )
          );
        }
      );
    },
  },
  m = e._export_sfc(v, [["__scopeId", "data-v-2e6df7a1"]]);
(v.__runtimeHooks = 3), wx.createPage(m);
