app/js/index-cab50064.js

754 lines
23 KiB
JavaScript
Raw Permalink Normal View History

2025-02-13 08:26:53 +08:00
/* empty css */ /* empty css */ import { C as e } from "./index-325f2a5d.js";
/* empty css */ /* empty css */ import {
H as t,
K as a,
J as l,
a1 as o,
a0 as s,
I as i,
j as n,
ae as r,
a2 as d,
c as u,
ah as c,
ad as p,
aY as v,
a6 as f,
v as h,
a9 as g,
ab as m,
M as x,
a3 as y,
ao as w,
aZ as b,
aJ as k,
an as C,
L as O,
as as j,
at as _,
aK as T,
aw as $,
P as z,
Q as V,
w as P,
a_ as S,
D as I,
a8 as R,
a7 as A,
aG as q,
_ as B,
a$ as K,
aC as F,
o as L,
m as W,
p as D,
h as E,
f as J,
e as U,
r as Y,
n as Z,
t as G,
F as H,
i as M,
R as Q,
} from "./index-476be0bb.js";
import { u as X } from "./use-id-50eda0ee.js";
import { u as N } from "./use-tab-status-b7c46689.js";
const [ee, te] = t("dropdown-menu"),
ae = {
overlay: a,
zIndex: l,
duration: o(0.2),
direction: s("down"),
activeColor: String,
closeOnClickOutside: a,
closeOnClickOverlay: a,
swipeThreshold: l,
},
le = Symbol(ee);
var oe = i({
name: ee,
props: ae,
setup(e, { slots: t }) {
const a = X(),
l = n(),
o = n(),
s = n(0),
{ children: i, linkChildren: y } = r(le),
w = d(l),
b = u(() => i.some((e) => e.state.showWrapper)),
k = u(() => e.swipeThreshold && i.length > +e.swipeThreshold),
C = u(() => {
if (b.value && c(e.zIndex)) return { zIndex: +e.zIndex + 1 };
}),
O = () => {
i.forEach((e) => {
e.toggle(!1);
});
},
j = () => {
if (o.value) {
const t = g(o);
"down" === e.direction
? (s.value = t.bottom)
: (s.value = m.value - t.top);
}
},
_ = (t, l) => {
const { showPopup: o } = t.state,
{ disabled: s, titleClass: n } = t;
return h(
"div",
{
id: "".concat(a, "-").concat(l),
role: "button",
tabindex: s ? void 0 : 0,
class: [te("item", { disabled: s, grow: k.value }), { [x]: !s }],
onClick: () => {
var e;
s ||
((e = l),
i.forEach((t, a) => {
a === e
? t.toggle()
: t.state.showPopup && t.toggle(!1, { immediate: !0 });
}));
},
},
[
h(
"span",
{
class: [
te("title", {
down: o === ("down" === e.direction),
active: o,
}),
n,
],
style: { color: o ? e.activeColor : "" },
},
[h("div", { class: "van-ellipsis" }, [t.renderTitle()])]
),
]
);
};
return (
p({ close: O }),
y({ id: a, props: e, offset: s, updateOffset: j }),
v(l, () => {
e.closeOnClickOutside && O();
}),
f(
"scroll",
() => {
b.value && j();
},
{ target: w, passive: !0 }
),
() => {
var e;
return h("div", { ref: l, class: te() }, [
h(
"div",
{
ref: o,
style: C.value,
class: te("bar", { opened: b.value, scrollable: k.value }),
},
[i.map(_)]
),
null == (e = t.default) ? void 0 : e.call(t),
]);
}
);
},
});
const [se, ie] = t("dropdown-item");
const ne = V(
i({
name: se,
inheritAttrs: !1,
props: {
title: String,
options: k(),
disabled: Boolean,
teleport: [String, Object],
lazyRender: a,
modelValue: C,
titleClass: C,
},
emits: [
"open",
"opened",
"close",
"closed",
"change",
"update:modelValue",
],
setup(t, { emit: a, slots: l, attrs: o }) {
const s = y({ showPopup: !1, transition: !0, showWrapper: !1 }),
{ parent: i, index: n } = w(le);
if (!i) return;
const r = (e) => () => a(e),
d = r("open"),
u = r("close"),
c = r("opened"),
v = () => {
(s.showWrapper = !1), a("closed");
},
f = (e) => {
t.teleport && e.stopPropagation();
},
g = (l) => {
const { activeColor: o } = i.props,
n = l.value === t.modelValue;
return h(
e,
{
role: "menuitem",
key: String(l.value),
icon: l.icon,
title: l.text,
class: ie("option", { active: n }),
style: { color: n ? o : "" },
tabindex: n ? 0 : -1,
clickable: !0,
onClick: () => {
(s.showPopup = !1),
l.value !== t.modelValue &&
(a("update:modelValue", l.value), a("change", l.value));
},
},
{
value: () => {
if (n)
return h(
z,
{ class: ie("icon"), color: o, name: "success" },
null
);
},
}
);
},
m = () => {
const { offset: e } = i,
{
zIndex: a,
overlay: r,
duration: p,
direction: m,
closeOnClickOverlay: x,
} = i.props,
y = O(a);
return (
"down" === m
? (y.top = "".concat(e.value, "px"))
: (y.bottom = "".concat(e.value, "px")),
j(
h("div", $({ style: y, class: ie([m]), onClick: f }, o), [
h(
T,
{
show: s.showPopup,
"onUpdate:show": (e) => (s.showPopup = e),
role: "menu",
class: ie("content"),
overlay: r,
position: "down" === m ? "top" : "bottom",
duration: s.transition ? p : 0,
lazyRender: t.lazyRender,
overlayStyle: { position: "absolute" },
"aria-labelledby": "".concat(i.id, "-").concat(n.value),
closeOnClickOverlay: x,
onOpen: d,
onClose: u,
onOpened: c,
onClosed: v,
},
{
default: () => {
var e;
return [
t.options.map(g),
null == (e = l.default) ? void 0 : e.call(l),
];
},
}
),
]),
[[_, s.showWrapper]]
)
);
};
return (
p({
state: s,
toggle: (e = !s.showPopup, t = {}) => {
e !== s.showPopup &&
((s.showPopup = e),
(s.transition = !t.immediate),
e && (i.updateOffset(), (s.showWrapper = !0)));
},
renderTitle: () => {
if (l.title) return l.title();
if (t.title) return t.title;
const e = t.options.find((e) => e.value === t.modelValue);
return e ? e.text : "";
},
}),
() =>
t.teleport
? h(b, { to: t.teleport }, { default: () => [m()] })
: m()
);
},
})
),
re = V(oe),
[de, ue, ce] = t("list");
const pe = V(
i({
name: de,
props: {
error: Boolean,
offset: o(300),
loading: Boolean,
disabled: Boolean,
finished: Boolean,
scroller: Object,
errorText: String,
direction: s("down"),
loadingText: String,
finishedText: String,
immediateCheck: a,
},
emits: ["load", "update:error", "update:loading"],
setup(e, { emit: t, slots: a }) {
const l = n(e.loading),
o = n(),
s = n(),
i = N(),
r = d(o),
c = u(() => e.scroller || r.value),
v = () => {
R(() => {
if (
l.value ||
e.finished ||
e.disabled ||
e.error ||
!1 === (null == i ? void 0 : i.value)
)
return;
const { direction: a } = e,
n = +e.offset,
r = g(c);
if (!r.height || A(o)) return;
let d = !1;
const u = g(s);
(d = "up" === a ? r.top - u.top <= n : u.bottom - r.bottom <= n),
d && ((l.value = !0), t("update:loading", !0), t("load"));
});
},
m = () => {
if (e.finished) {
const t = a.finished ? a.finished() : e.finishedText;
if (t) return h("div", { class: ue("finished-text") }, [t]);
}
},
x = () => {
t("update:error", !1), v();
},
y = () => {
if (e.error) {
const t = a.error ? a.error() : e.errorText;
if (t)
return h(
"div",
{
role: "button",
class: ue("error-text"),
tabindex: 0,
onClick: x,
},
[t]
);
}
},
w = () => {
if (l.value && !e.finished && !e.disabled)
return h("div", { class: ue("loading") }, [
a.loading
? a.loading()
: h(
q,
{ class: ue("loading-icon") },
{ default: () => [e.loadingText || ce("loading")] }
),
]);
};
return (
P(() => [e.loading, e.finished, e.error], v),
i &&
P(i, (e) => {
e && v();
}),
S(() => {
l.value = e.loading;
}),
I(() => {
e.immediateCheck && v();
}),
p({ check: v }),
f("scroll", v, { target: c, passive: !0 }),
() => {
var t;
const i = null == (t = a.default) ? void 0 : t.call(a),
n = h("div", { ref: s, class: ue("placeholder") }, null);
return h(
"div",
{ ref: o, role: "feed", class: ue(), "aria-busy": l.value },
[
"down" === e.direction ? i : n,
w(),
m(),
y(),
"up" === e.direction ? i : n,
]
);
}
);
},
})
);
const ve = { class: "px-12 py-7" },
fe = { class: "flex items-center flex-wrap justify-between" },
he = ["onClick"],
ge = { class: "px-12 py-7" },
me = { class: "flex items-center flex-wrap justify-between" },
xe = ["onClick"],
ye = { class: "mt-12 px-12 text-center" },
we = { class: "flex py-12 rounded-4 bg-#e9e9e9 text-12" },
be = { class: "w-30%" },
ke = { class: "w-27%" },
Ce = { class: "flex-1" },
Oe = { class: "w-30%" },
je = { key: 0, class: "w-27% text-main" },
_e = { key: 1, class: "w-27%" },
Te = { key: 2, class: "w-27% text-#199D2A" },
$e = { key: 3, class: "w-27% text-#CD2727" },
ze = { class: "flex-1" },
Ve = B(
{
__name: "index",
props: {
title: { type: String, required: !0 },
leftOption: { type: Array, required: !0 },
rightOption: { type: Array, required: !0 },
leftValue: { required: !0 },
rightValue: { required: !0 },
valueKey: { type: Array, required: !0 },
listTitle: { type: Array, required: !0 },
ajaxFun: Function,
},
emits: ["update:leftValue", "update:rightValue"],
setup(e, { emit: t }) {
const a = e,
{ leftValue: l, rightValue: o } = K(a, t),
s = n(a.leftOption[0].text),
i = n(null),
r = n(a.rightOption[0].text),
d = n(null),
{
list: u,
loading: c,
finished: p,
onLoad: v,
form: f,
refreshing: g,
onRefresh: m,
} = (function (e, t) {
const a = n(!1),
l = n(!1),
o = n(!1),
s = y({ page: 1, size: 10, ...e });
P(
() => s.time,
(e) => {
d();
}
),
P(
() => s.status,
(e) => {
d();
}
),
P(
() => s.date,
(e) => {
d();
}
);
const i = n([]),
r = n(),
d = () => {
(s.page = 1),
(i.value = []),
(l.value = !1),
(o.value = !1),
(a.value = !0),
u();
},
u = () => {
t &&
t(s).then((e) => {
var t, o;
const n =
(null == (t = e.data) ? void 0 : t.list) ||
(null == (o = e.data) ? void 0 : o.ranking) ||
e.data;
(r.value = e.data),
1 === e.code &&
((i.value =
n instanceof Array
? i.value.concat(n)
: i.value.concat(n.data)),
(a.value = !1),
n instanceof Array
? n.length < s.size
? (l.value = !0)
: s.page++
: "data" in n &&
(n.data.length < s.size
? (l.value = !0)
: s.page++));
});
};
return {
refreshing: o,
list: i,
data: r,
loading: a,
finished: l,
onLoad: u,
form: s,
Func: t,
onRefresh: d,
};
})({ page: 1, size: 20, status: l, time: o }, a.ajaxFun);
return (t, a) => {
const n = ne,
f = re,
g = pe,
m = F("normal-layout");
return (
L(),
W(
m,
{
flex: "",
title: t.$t(e.title),
"bg-color": "#fff",
"nav-bg-color": "#fff",
"text-color": "#000",
backType: 0,
},
{
default: D(() => [
h(
f,
{ "active-color": "#5B56E8" },
{
default: D(() => [
h(
n,
{ title: t.$t(E(s)), ref_key: "leftItemRef", ref: i },
{
default: D(() => [
J("div", ve, [
J("div", fe, [
(L(!0),
U(
H,
null,
Y(
e.leftOption,
(e) => (
L(),
U(
"div",
{
class: Z([
"flex items-center justify-center w-46% h-36 bg-#f2f2f2 text-12 rounded-4 my-8",
{
"left-active": E(l) === e.value,
},
]),
key: e.value,
onClick: (t) =>
(({ text: e, value: t }) => {
(s.value = e),
(l.value = t),
i.value.toggle();
})(e),
},
G(t.$t(e.text)),
11,
he
)
)
),
128
)),
]),
]),
]),
_: 1,
},
8,
["title"]
),
h(
n,
{
title: t.$t(E(r)),
ref_key: "rightItemRef",
ref: d,
},
{
default: D(() => [
J("div", ge, [
J("div", me, [
(L(!0),
U(
H,
null,
Y(
e.rightOption,
(e) => (
L(),
U(
"div",
{
class: Z([
"flex items-center justify-center w-46% h-36 bg-#f2f2f2 text-12 rounded-4 my-8",
{
"left-active": E(o) === e.value,
},
]),
key: e.value,
onClick: (t) =>
(({ text: e, value: t }) => {
(r.value = e),
(o.value = t),
d.value.toggle();
})(e),
},
G(t.$t(e.text)),
11,
xe
)
)
),
128
)),
]),
]),
]),
_: 1,
},
8,
["title"]
),
]),
_: 1,
}
),
J("div", ye, [
J("div", we, [
J("div", be, G(t.$t(e.listTitle[0])), 1),
J("div", ke, G(t.$t(e.listTitle[1])), 1),
J("div", Ce, G(t.$t(e.listTitle[2])), 1),
]),
h(
g,
{
loading: E(c),
"onUpdate:loading":
a[0] || (a[0] = (e) => (Q(c) ? (c.value = e) : null)),
finished: E(p),
"finished-text": t.$t("没有更多了"),
"loading-text": t.$t("加载中..."),
onLoad: E(v),
},
{
default: D(() => [
(L(!0),
U(
H,
null,
Y(
E(u),
(a, l) => (
L(),
U(
"div",
{
class:
"flex py-12 text-12 van-hairline--bottom",
key: a.id,
},
[
J("div", Oe, G(a[e.valueKey[0]]), 1),
a.order_no
? M("", !0)
: (L(),
U("div", je, G(a[e.valueKey[1]]), 1)),
(1 != a.status && 0 != a.status) ||
!a.order_no
? M("", !0)
: (L(),
U("div", _e, G(t.$t("出款中")), 1)),
2 == a.status && a.order_no
? (L(), U("div", Te, G(t.$t("成功")), 1))
: M("", !0),
3 == a.status && a.order_no
? (L(), U("div", $e, G(t.$t("失败")), 1))
: M("", !0),
J("div", ze, G(a[e.valueKey[2]]), 1),
]
)
)
),
128
)),
]),
_: 1,
},
8,
[
"loading",
"finished",
"finished-text",
"loading-text",
"onLoad",
]
),
]),
]),
_: 1,
},
8,
["title"]
)
);
};
},
},
[["__scopeId", "data-v-303919d0"]]
);
export { Ve as R };