var u = require("../../common/vendor.js"),
  e = require("../../hooks/onMounted.js"),
  t = require("../../hooks/onShareAppMessage.js"),
  n = require("../../service/index.js"),
  r = require("../../enums/index.js"),
  a = require("../../config/index.js"),
  o = require("../../utils/util.js"),
  s = require("../../utils/navigate.js"),
  i = require("../../utils/common.js"),
  d = require("../../utils/vin.js");
require("../../hooks/useState.js"),
  require("../../store/app/index.js"),
  require("../../data/index.js"),
  require("../../utils/request.js"),
  require("../../constant/index.js"),
  Array || u.resolveComponent("uni-load-more")();
Math ||
  (
    u.unref(v) +
    function () {
      return "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
    } +
    u.unref(f) +
    u.unref(p) +
    u.unref(c) +
    u.unref(l)
  )();
var c = function () {
    return "../../components/popup-upload-tips/index.js";
  },
  l = function () {
    return "../../components/popup-pay-again/index.js";
  },
  f = function () {
    return "../../components/float-refresh/index.js";
  },
  v = function () {
    return "../../components/vehicle-number/index.js";
  },
  p = function () {
    return "../../components/popup-modify-vin/index.js";
  },
  E = {
    __name: "index",
    setup: function (c) {
      var l = u.ref(!0),
        f = u.ref(""),
        v = u.ref(""),
        p = u.ref({}),
        E = u.ref(!1),
        m = u.ref(!1),
        I = u.ref(!1),
        N = function () {
          var u = E.value || m.value || I.value;
          return "height: 100%; overflow: "
            .concat(u ? "hidden" : "visible", "; position: ")
            .concat(u ? "fixed" : "relative");
        },
        S = function () {
          return u._.find(p.value.productList, function (u) {
            return u.status === r.ProductStatusEnum.TO_BE_UPLOADED;
          });
        },
        _ = function () {
          var e = !1;
          return (
            !u._.find(p.value.productList, function (u) {
              return (
                u.product_id !== r.ProductTypeEnum.INSURANCE_MAINTAIN &&
                u.product_id !== r.ProductTypeEnum.ACCIDENT
              );
            }) &&
              p.value.vin &&
              (p.value.status === r.OrderStatusEnum.UNPAID && (e = !0),
              u._.find(p.value.productList, function (u) {
                return u.status === r.ProductStatusEnum.TO_BE_UPLOADED;
              }) && (e = !0)),
            e
          );
        },
        P = function () {
          u.index.setClipboardData({ data: v.value }).then(function () {
            o.showToast("订单编号已复制");
          });
        },
        O = function () {
          u.index.setClipboardData({ data: p.value.vin }).then(function () {
            o.showToast("VIN车架号已复制");
          });
        },
        T = function (u) {
          var e = u.order_no,
            t = u.product_id,
            n = u.status;
          i.openReport({ orderNo: e, productId: t, status: n });
        },
        A = function () {
          o.showToast("已经帮您催了，请耐心等待一会儿...");
        },
        h = function () {
          i.queryWithoutDrivingLicense({ orderNo: v.value }).then(function () {
            s.redirectTo({ url: "/pages/upload-success/index" });
          });
        },
        y = function () {
          m.value = !1;
        },
        D = function () {
          x(r.PayMethodEnum.WECHAT_PAY);
        },
        C = function () {
          I.value = !1;
        },
        g = function (u) {
          x(u), (I.value = !1);
        },
        x = function (u) {
          o.showLoading("支付中"),
            n
              .payOrderAgain({ payMethod: u, order_no: v.value })
              .then(function (e) {
                i.payForOrder({ payMethod: u, data: e })
                  .then(function (u) {
                    var e = u.orderNo;
                    s.redirectTo({
                      url: "/pages/pay-success/index",
                      params: { orderNo: e },
                    });
                  })
                  .catch(function (u) {
                    var e = u.orderNo;
                    s.redirectTo({
                      url: "/pages/pay-fail/index",
                      params: { orderNo: e },
                    });
                  });
              });
        },
        L = function () {
          E.value = !0;
        },
        U = function () {
          E.value = !1;
        },
        j = function (u) {
          0 !== u.length
            ? u.length < 17
              ? o.showToast("请输入完整的VIN车架号")
              : d.validateVIN(u)
              ? i.modifyVin({ orderNo: v.value, vin: u }).then(function () {
                  setTimeout(function () {
                    return R();
                  }, 500);
                })
              : o.showToast("车架号有误，请检查后重新输入")
            : o.showToast("请输入VIN车架号");
        },
        M = function (u) {
          u.detail.path && switchTab({ url: u.detail.path });
        },
        R = function () {
          (l.value = !0),
            o.showLoading(),
            n.getOrderDetail({ order_no: v.value }).then(function (u) {
              (p.value = u), (l.value = !1), o.hideLoading();
            });
        };
      return (
        e.onMounted(function (e) {
          u.index.$on("updateOrderDetail", function () {
            return R();
          }),
            (v.value = e.orderNo),
            (f.value = e.productName),
            u.index.setNavigationBarTitle({
              title: "".concat(e.productName, "-订单信息"),
            }),
            R();
        }, !1),
        t.onShareAppMessage(),
        function (e, t) {
          return u.e(
            { a: N(), b: !l.value },
            l.value
              ? {}
              : u.e(
                  {
                    c:
                      p.value.carBrand &&
                      (p.value.carBrand.logo || p.value.carBrand.name),
                  },
                  p.value.carBrand &&
                    (p.value.carBrand.logo || p.value.carBrand.name)
                    ? {
                        d: p.value.carBrand.logo,
                        e: u.t(p.value.carBrand.name),
                      }
                    : {},
                  { f: u.t(p.value.order_no), g: u.o(P), h: p.value.car_no },
                  p.value.car_no ? { i: u.p({ data: p.value.car_no }) } : {},
                  { j: p.value.vin },
                  p.value.vin ? { k: u.t(p.value.vin), l: u.o(O) } : {},
                  { m: p.value.total_money },
                  p.value.total_money
                    ? { n: u.t((p.value.total_money / 100).toFixed(2)) }
                    : {},
                  { o: p.value.status === u.unref(r.OrderStatusEnum).UNPAID },
                  (p.value.status, u.unref(r.OrderStatusEnum).UNPAID, {}),
                  { p: p.value.status === u.unref(r.OrderStatusEnum).PAID },
                  p.value.status === u.unref(r.OrderStatusEnum).PAID
                    ? { q: u.t(u.unref(i.getOrderStatus)(p.value.productList)) }
                    : {},
                  { r: p.value.status === u.unref(r.OrderStatusEnum).REFUND },
                  (p.value.status, u.unref(r.OrderStatusEnum).REFUND, {}),
                  { s: p.value.status === u.unref(r.OrderStatusEnum).COMPLETE },
                  (p.value.status, u.unref(r.OrderStatusEnum).COMPLETE, {}),
                  {
                    t: u.t(p.value.create_time),
                    v:
                      (p.value.status === u.unref(r.OrderStatusEnum).PAID ||
                        p.value.status ===
                          u.unref(r.OrderStatusEnum).COMPLETE) &&
                      p.value.payInfo,
                  },
                  (p.value.status !== u.unref(r.OrderStatusEnum).PAID &&
                    p.value.status !== u.unref(r.OrderStatusEnum).COMPLETE) ||
                    !p.value.payInfo
                    ? {}
                    : { w: u.t(p.value.payInfo.update_time) },
                  {
                    x:
                      (p.value.status === u.unref(r.OrderStatusEnum).PAID ||
                        p.value.status ===
                          u.unref(r.OrderStatusEnum).COMPLETE) &&
                      p.value.payInfo,
                  },
                  (p.value.status !== u.unref(r.OrderStatusEnum).PAID &&
                    p.value.status !== u.unref(r.OrderStatusEnum).COMPLETE) ||
                    !p.value.payInfo
                    ? {}
                    : { y: u.t(p.value.payInfo.trade_no) },
                  {
                    z:
                      (p.value.status === u.unref(r.OrderStatusEnum).PAID ||
                        p.value.status ===
                          u.unref(r.OrderStatusEnum).COMPLETE) &&
                      p.value.payInfo,
                  },
                  (p.value.status !== u.unref(r.OrderStatusEnum).PAID &&
                    p.value.status !== u.unref(r.OrderStatusEnum).COMPLETE) ||
                    !p.value.payInfo
                    ? {}
                    : u.e(
                        { A: [1, 2].indexOf(p.value.payInfo.source_from) > -1 },
                        ([1, 2].indexOf(p.value.payInfo.source_from), {}),
                        { B: 3 === p.value.payInfo.source_from },
                        (p.value.payInfo.source_from, {})
                      ),
                  { C: p.value.productList },
                  p.value.productList
                    ? {
                        D: u.f(p.value.productList, function (e, t, n) {
                          return u.e(
                            {
                              a: u.t(
                                u.unref(i.getProduct)(e.product_id).product_name
                              ),
                              b: u.t(
                                u.unref(i.getProduct)(e.product_id).product_desc
                              ),
                              c:
                                p.value.status !==
                                  u.unref(r.OrderStatusEnum).REFUND &&
                                e.status ===
                                  u.unref(r.ProductStatusEnum).IN_QUERY,
                            },
                            p.value.status !==
                              u.unref(r.OrderStatusEnum).REFUND &&
                              e.status === u.unref(r.ProductStatusEnum).IN_QUERY
                              ? {
                                  d: "b85a2168-1-" + n,
                                  e: u.p({
                                    iconType: "snow",
                                    iconSize: 20,
                                    status: "loading",
                                    showText: !1,
                                  }),
                                }
                              : {},
                            p.value.status !== u.unref(r.OrderStatusEnum).REFUND
                              ? u.e(
                                  {
                                    f:
                                      e.status ===
                                      u.unref(r.ProductStatusEnum).SUCCESS,
                                  },
                                  e.status ===
                                    u.unref(r.ProductStatusEnum).SUCCESS
                                    ? {
                                        g: u.o(function (u) {
                                          return T(e);
                                        }, e.id),
                                      }
                                    : {},
                                  {
                                    h:
                                      e.status ===
                                        u.unref(r.ProductStatusEnum).FAIL &&
                                      (e.product_id ==
                                        u.unref(r.ProductTypeEnum)
                                          .INSURANCE_MAINTAIN ||
                                        e.product_id ===
                                          u.unref(r.ProductTypeEnum).ACCIDENT),
                                  },
                                  e.status !==
                                    u.unref(r.ProductStatusEnum).FAIL ||
                                    (e.product_id !=
                                      u.unref(r.ProductTypeEnum)
                                        .INSURANCE_MAINTAIN &&
                                      e.product_id !==
                                        u.unref(r.ProductTypeEnum).ACCIDENT)
                                    ? {}
                                    : {
                                        i: u.o(function (u) {
                                          return T(e);
                                        }, e.id),
                                      },
                                  {
                                    j:
                                      e.status ===
                                      u.unref(r.ProductStatusEnum).IN_QUERY,
                                  },
                                  e.status ===
                                    u.unref(r.ProductStatusEnum).IN_QUERY
                                    ? { k: u.o(A, e.id) }
                                    : {},
                                  {
                                    l:
                                      e.status ===
                                        u.unref(r.ProductStatusEnum).FAIL &&
                                      e.product_id !==
                                        u.unref(r.ProductTypeEnum)
                                          .INSURANCE_MAINTAIN &&
                                      e.product_id !==
                                        u.unref(r.ProductTypeEnum).ACCIDENT,
                                  },
                                  (e.status ===
                                    u.unref(r.ProductStatusEnum).FAIL &&
                                    e.product_id !==
                                      u.unref(r.ProductTypeEnum)
                                        .INSURANCE_MAINTAIN &&
                                    (e.product_id,
                                    u.unref(r.ProductTypeEnum).ACCIDENT),
                                  {})
                                )
                              : {},
                            { m: e.id }
                          );
                        }),
                        E: p.value.status !== u.unref(r.OrderStatusEnum).REFUND,
                      }
                    : {},
                  { F: p.value.status !== u.unref(r.OrderStatusEnum).REFUND },
                  p.value.status !== u.unref(r.OrderStatusEnum).REFUND
                    ? u.e(
                        { G: S() },
                        S()
                          ? u.e(
                              { H: p.value.vin },
                              p.value.vin
                                ? {
                                    I: u.o(function (u) {
                                      return e.product, void (m.value = !0);
                                    }),
                                  }
                                : {},
                              {
                                J: u.o(function (u) {
                                  return (
                                    e.product,
                                    void i
                                      .chooseDrivingLicense({
                                        orderNo: v.value,
                                      })
                                      .then(function () {
                                        s.redirectTo({
                                          url: "/pages/upload-success/index",
                                        });
                                      })
                                  );
                                }),
                              }
                            )
                          : {},
                        { K: _() },
                        _() ? { L: u.o(L) } : {},
                        {
                          M:
                            p.value.status ===
                            u.unref(r.OrderStatusEnum).UNPAID,
                        },
                        p.value.status === u.unref(r.OrderStatusEnum).UNPAID
                          ? { N: u.o(D) }
                          : {}
                      )
                    : {},
                  {
                    O: u.unref(a.appName),
                    P: u.o(M),
                    Q: u.o(R),
                    R: u.p({ loading: l.value }),
                    S: u.o(U),
                    T: u.o(j),
                    U: u.p({ visible: E.value, "copy-vin": p.value.vin }),
                    V: u.o(y),
                    W: u.o(h),
                    X: u.p({ visible: m.value }),
                    Y: u.o(C),
                    Z: u.o(g),
                    aa: u.p({ visible: I.value }),
                  }
                )
          );
        }
      );
    },
  },
  m = u._export_sfc(E, [["__scopeId", "data-v-b85a2168"]]);
(E.__runtimeHooks = 2), wx.createPage(m);
