2024-01-16 22:53:42 +08:00

301 lines
12 KiB
JavaScript

var e = require("../../common/vendor.js"),
u = require("../../hooks/onMounted.js"),
r = require("../../hooks/onShareAppMessage.js"),
n = require("../../hooks/useState.js"),
i = require("../../enums/index.js"),
o = require("../../service/index.js"),
t = require("../../utils/util.js"),
c = require("../../utils/common.js"),
a = require("../../utils/navigate.js");
require("../../config/index.js"),
require("../../constant/index.js"),
require("../../store/app/index.js"),
require("../../data/index.js"),
require("../../utils/request.js"),
Array || e.resolveComponent("uni-countdown")();
Math ||
(
e.unref(p) +
function () {
return "../../uni_modules/uni-countdown/components/uni-countdown/uni-countdown.js";
} +
e.unref(d)
)();
var d = function () {
return "../../components/divider/index.js";
},
p = function () {
return "../../components/vehicle-number/index.js";
},
l = {
__name: "index",
setup: function (d) {
var p = n.useState(),
l = p.insuranceMaintainProduct,
v = p.accidentProduct,
m = p.vehicleFiveProduct,
E = p.saliProduct,
_ = p.saliCheckProduct,
y = p.commercialInsuranceProduct,
f = p.violationProduct,
s = p.vehicleStatusProduct,
N = e.ref(!0),
T = e.ref(null),
A = e.ref(i.QueryTypeEnum.VIN),
P = e.ref("02"),
I = e.ref(""),
C = e.ref(""),
L = e.ref({}),
g = e.ref(null),
S = e.ref([]),
h = e.ref(0),
x = function () {
var e = new Date().getHours();
return e >= 9 && e <= 21;
},
M = function (e) {
h.value = Number(e.detail.value);
},
b = function (e) {
g.value = e.detail.value;
},
V = function () {
var e = S.value[h.value],
u = {
product: null,
money: null,
vin: null,
car_no: null,
type: null,
};
(u.product = e.product_id),
(u.money = Number((100 * Number(e.price)).toFixed(2))),
(u.vin = I.value),
(u.car_no = C.value),
(u.type = P.value),
(u.payMethod = g.value),
A.value === i.QueryTypeEnum.VIN && (u.car_no = null),
A.value === i.QueryTypeEnum.VEHICLE_NO && (u.vin = null),
T.value !== i.ProductTypeEnum.SALI_CHECK && (u.type = null),
e.product_id === i.ProductTypeEnum.OVERALL &&
(u.product = [l.value.product_id, v.value.product_id].join(",")),
t.showLoading("支付中"),
o.createOrder(u).then(function (e) {
c.payForOrder({ payMethod: g.value, data: e })
.then(function (e) {
var u = e.orderNo;
a.redirectTo({
url: "/pages/pay-success/index",
params: { orderNo: u },
});
})
.catch(function (e) {
var u = e.orderNo;
a.redirectTo({
url: "/pages/pay-fail/index",
params: { orderNo: u },
});
});
});
};
return (
u.onMounted(function (u) {
(T.value = u.productType),
(A.value = u.queryType),
(P.value = u.vehicleType),
(I.value = u.vin),
(C.value = u.vehicleNo),
c.isSupportWeChatPay()
? (g.value = i.PayMethodEnum.WECHAT_PAY)
: c.isSupportAliPay()
? (g.value = i.PayMethodEnum.ALI_PAY)
: (g.value = null),
(T.value != i.ProductTypeEnum.OVERALL &&
T.value != i.ProductTypeEnum.INSURANCE_MAINTAIN &&
T.value != i.ProductTypeEnum.ACCIDENT) ||
((S.value = [
{
product_id: i.ProductTypeEnum.OVERALL,
origin_price: (
Number(l.value.origin_price) + Number(v.value.origin_price)
).toFixed(2),
price: (
Number(l.value.price) +
Number(v.value.price) -
10
).toFixed(2),
product_name: "综合车况",
product_desc: "维保、出险一起查,全面还原真实车况",
recommend: !0,
},
l.value,
v.value,
]),
T.value == i.ProductTypeEnum.OVERALL && (h.value = 0),
T.value == i.ProductTypeEnum.INSURANCE_MAINTAIN && (h.value = 1),
T.value == i.ProductTypeEnum.ACCIDENT && (h.value = 2)),
(T.value != i.ProductTypeEnum.SALI &&
T.value != i.ProductTypeEnum.COMMERICAL_INSURANCE) ||
((S.value = [y.value, E.value]),
T.value == i.ProductTypeEnum.COMMERICAL_INSURANCE &&
(h.value = 0),
T.value == i.ProductTypeEnum.SALI && (h.value = 1)),
T.value == i.ProductTypeEnum.SALI_CHECK && (S.value = [_.value]),
T.value == i.ProductTypeEnum.VEHICLE_FIVE && (S.value = [m.value]),
T.value == i.ProductTypeEnum.VIOLATION && (S.value = [f.value]),
T.value == i.ProductTypeEnum.VEHICLE_STATUS &&
(S.value = [s.value]),
Promise.resolve().then(function () {
o.getPriceList({
vin: A.value === i.QueryTypeEnum.VIN ? I.value : "",
}).then(function (u) {
if (u) {
var r = e._.find(u, function (e) {
return (
e.product_id === i.ProductTypeEnum.INSURANCE_MAINTAIN
);
}),
n = e._.find(u, function (e) {
return e.product_id === i.ProductTypeEnum.ACCIDENT;
}),
o = e._.find(u, function (e) {
return e.product_id === i.ProductTypeEnum.VEHICLE_FIVE;
}),
c = e._.find(u, function (e) {
return (
e.product_id === i.ProductTypeEnum.COMMERICAL_INSURANCE
);
}),
a = e._.find(u, function (e) {
return e.product_id === i.ProductTypeEnum.SALI;
}),
d = e._.find(u, function (e) {
return e.product_id === i.ProductTypeEnum.VEHICLE_STATUS;
}),
p = e._.cloneDeep(S.value);
e._.each(p, function (e) {
e.product_id === i.ProductTypeEnum.OVERALL &&
((e.origin_price = (
Number(r.origin_price) + Number(n.origin_price)
).toFixed(2)),
(e.price = (
Number(r.price) +
Number(n.price) -
10
).toFixed(2))),
e.product_id === i.ProductTypeEnum.INSURANCE_MAINTAIN &&
((e.origin_price = Number(r.origin_price).toFixed(2)),
(e.price = Number(r.price).toFixed(2))),
e.product_id === i.ProductTypeEnum.ACCIDENT &&
((e.origin_price = Number(n.origin_price).toFixed(2)),
(e.price = Number(n.price).toFixed(2))),
e.product_id === i.ProductTypeEnum.VEHICLE_FIVE &&
((e.origin_price = Number(o.origin_price).toFixed(2)),
(e.price = Number(o.price).toFixed(2))),
e.product_id === i.ProductTypeEnum.COMMERICAL_INSURANCE &&
((e.origin_price = Number(c.origin_price).toFixed(2)),
(e.price = Number(c.price).toFixed(2))),
e.product_id === i.ProductTypeEnum.SALI &&
((e.origin_price = Number(a.origin_price).toFixed(2)),
(e.price = Number(a.price).toFixed(2))),
e.product_id === i.ProductTypeEnum.VEHICLE_STATUS &&
((e.origin_price = Number(d.origin_price).toFixed(2)),
(e.price = Number(d.price).toFixed(2)));
}),
(S.value = p);
}
(N.value = !1), t.hideLoading();
});
});
}),
r.onShareAppMessage(),
function (u, r) {
return e.e(
{ a: !N.value },
N.value
? {}
: e.e(
{
b: A.value === e.unref(i.QueryTypeEnum).VIN && L.value.name,
},
A.value === e.unref(i.QueryTypeEnum).VIN && L.value.name
? {
c: L.value.logo,
d: e.t(L.value.name),
e: e.t(L.value.vin),
}
: e.e(
{ f: A.value === e.unref(i.QueryTypeEnum).VEHICLE_NO },
A.value === e.unref(i.QueryTypeEnum).VEHICLE_NO
? { g: e.p({ data: C.value, "font-size": "32rpx" }) }
: {},
{ h: A.value === e.unref(i.QueryTypeEnum).VIN },
A.value === e.unref(i.QueryTypeEnum).VIN
? { i: e.t(I.value) }
: {}
),
{
j: e.f(S.value, function (u, r, n) {
return e.e(
{ a: e.t(u.product_name), b: u.recommend },
(u.recommend, {}),
{
c: e.t(u.origin_price),
d: e.t(u.price),
e: e.t(u.product_desc),
f: h.value === r ? 1 : "",
g: r,
h: h.value === r,
i: r,
}
);
}),
k: e.o(M),
l: !x(),
},
(x(), {}),
{
m:
T.value == e.unref(i.ProductTypeEnum).SALI ||
T.value ==
e.unref(i.ProductTypeEnum).COMMERICAL_INSURANCE,
},
(T.value == e.unref(i.ProductTypeEnum).SALI ||
(T.value, e.unref(i.ProductTypeEnum).COMMERICAL_INSURANCE),
{}),
{
n: e.p({
minute: 10,
"font-size": 28,
color: "#ffffff",
"splitor-color": "#FA5E29",
"background-color": "#FA5E29",
}),
o: e.t(
S.value[h.value].origin_price - S.value[h.value].price
),
p: e.unref(c.isSupportWeChatPay)(),
},
e.unref(c.isSupportWeChatPay)()
? {
q: e.unref(i.PayMethodEnum).WECHAT_PAY,
r: g.value === e.unref(i.PayMethodEnum).WECHAT_PAY,
}
: {},
{ s: e.unref(c.isSupportAliPay)() },
e.unref(c.isSupportAliPay)()
? {
t: e.unref(i.PayMethodEnum).ALI_PAY,
v: g.value === e.unref(i.PayMethodEnum).ALI_PAY,
}
: {},
{ w: e.o(b), x: e.t(S.value[h.value].price), y: e.o(V) }
)
);
}
);
},
},
v = e._export_sfc(l, [["__scopeId", "data-v-0986fd70"]]);
(l.__runtimeHooks = 2), wx.createPage(v);