Files
console-dev/app/pages/orders/[id].vue
T

1639 lines
81 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script>
/**
* 订单/账单详情与旧支付路由共用页:展示订单、流水、转账凭证和支付入口;取消前重读订单,支付完成后从服务端刷新状态。
*/
import "~/assets/styles/PaymentDialog.BNFKQF1U.css";
import "~/assets/styles/_id_.gjoJy9S8.css";
import { toDisplayString } from "vue";
import { renderList } from "vue";
import { onMounted } from "vue";
import { normalizeClass } from "vue";
import { createBlock } from "vue";
import { ref } from "vue";
import { withCtx } from "vue";
import { createCommentVNode } from "vue";
import { mergeProps } from "vue";
import { computed } from "vue";
import { isRef } from "vue";
import { createElementBlock } from "vue";
import { Fragment } from "vue";
import { createElementVNode } from "vue";
import { createTextVNode } from "vue";
import { unref } from "vue";
import { defineComponent } from "vue";
import { createVNode } from "vue";
import { openBlock } from "vue";
import { useRoute } from "#app";
import { useRouter } from "#app";
import { NuxtLink } from "#components";
import { useApi } from "~/lib/auth.js";
import dialog from "openvue/dialog";
import button from "openvue/button";
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
import message from "openvue/message";
import { n as product_name_n } from "~/lib/product-name.js";
import { r as product_name_r } from "~/lib/product-name.js";
import { a as dict_a } from "~/lib/dict.js";
import { o as dict_o } from "~/lib/dict.js";
import { r as dict_r } from "~/lib/dict.js";
import { s as dict_s } from "~/lib/dict.js";
import PaymentDialog from "~/components/PaymentDialog.vue";
import tag from "openvue/tag";
import skeleton from "openvue/skeleton";
import { t as bandwidth_display_t } from "~/lib/bandwidth-display.js";
import { logoUrl } from "~/utils/brand.js";
// 仅从符合续费周期格式的描述中提取商品名,避免把日期区间重复显示成产品标题。
function D(e) {
let t = e.description?.trim() || ``,
n = e.product_name?.trim() || ``,
r = (t || n).split(/\r?\n/, 1)[0] || ``,
i = r.match(
/^(.+?)\s+[((]\d{4}-\d{2}-\d{2}(?:\s+\d{2}(?::\d{2}){0,2})?\s+-\s+\d{4}-\d{2}-\d{2}(?:\s+\d{2}(?::\d{2}){0,2})?[))]\s*$/,
);
if (!i) return ``;
let a = (e) => e.replace(/\s+/g, ` `).trim();
return !n || a(n) === a(t) || a(n) === a(r) ? i[1].trim() : n;
}
var ue = {
key: 0,
class: `receipt`,
},
de = {
key: 0,
class: `payment-success`,
},
fe = {
class: `success-actions`,
},
pe = {
class: `receipt-nav`,
"aria-label": `订单导航`,
},
me = {
class: `receipt-layout`,
},
he = {
class: `receipt`,
},
ge = {
class: `receipt-header`,
},
_e = {
class: `receipt-heading`,
},
ve = {
class: `receipt-icon`,
},
ye = {
class: `receipt-items`,
},
be = {
key: 0,
},
xe = {
class: `receipt-product-name`,
},
Se = {
key: 1,
},
Ce = {
key: 0,
},
we = {
key: 1,
},
Te = {
class: `receipt-description`,
},
Ee = {
key: 0,
class: `receipt-empty`,
},
De = {
class: `receipt-total`,
},
Oe = {
key: 0,
class: `bank-transfer-panel`,
},
ke = {
class: `bank-transfer-heading`,
},
Ae = {
key: 0,
},
je = {
key: 1,
},
Me = {
key: 2,
},
Ne = {
key: 0,
class: `bank-transfer-upload`,
},
Pe = [`disabled`],
Fe = {
key: 0,
role: `status`,
},
Ie = {
key: 1,
},
Le = {
key: 1,
class: `bank-voucher-list`,
},
Re = {
class: `bank-transfer-actions`,
},
ze = {
key: 1,
class: `receipt-transactions`,
},
Be = {
key: 0,
class: `transaction-error`,
},
Ve = {
key: 1,
class: `receipt-empty`,
},
He = {
class: `receipt-total`,
},
Ue = {
key: 2,
class: `credit-note`,
},
We = {
key: 0,
class: `receipt-payment`,
},
Ge = {
key: 1,
class: `receipt-actions`,
},
O = _plugin_vue_export_helper_t(
defineComponent({
__name: `[id]`,
setup(g) {
let S = useRoute(),
O = useApi(),
k = String(S.params.id || S.query?.id || ``),
A = computed(() => S.path?.endsWith(`/pay`)),
Ke = computed(() => S.path?.endsWith(`/paid`)),
qe = useRouter(),
j = ref(null),
Je = ref(!0),
M = ref(``),
N = ref([]),
P = ref(!1),
F = ref(!0),
I = ref(``),
Ye = ref([]),
Xe = {
artificial: `人工入账`,
credit: `余额支付`,
credit_limit: `信用额支付`,
};
// 在实际支付渠道列表中按标识查找显示名称。
function L(e) {
let t = e?.trim().toLowerCase();
return (
(t &&
Ye.value
.find((e) => e.name.toLowerCase() === t)
?.title?.trim()) ||
``
);
}
// 渠道名称先使用服务端配置,再回落到已知余额/信用额类型或原始名称。
function Ze(e) {
let t = e?.trim() || ``;
return L(t) || Xe[t.toLowerCase()] || t || `—`;
}
let Qe = computed(() => {
let e = j.value?.gateway_sign?.trim() || ``,
t = j.value?.gateway?.trim() || ``;
return L(e) || L(t) || Ze(t || e);
});
// 支付渠道元信息单独加载,失败不阻止订单详情展示。
async function $e() {
try {
let e = await O.get(`/gateway`);
Ye.value = e.list ?? [];
} catch {}
}
onMounted($e);
let R = ref(!1),
z = ref(!0);
// 轻量刷新当前订单,用于支付、凭证或取消后的状态同步。
async function B() {
try {
let e = await O.get(`/order/${k}`);
e.order && (j.value = e.order);
} catch {}
}
// 只接收与当前 ID 匹配的订单更新,避免支付组件更新其他订单。
function et(e) {
String(e.id) === k && (j.value = e);
}
// 交易流水有独立错误与加载状态;失败不把未加载的金额显示成已支付零元。
async function V() {
((P.value = !0), (F.value = !1), (I.value = ``));
try {
let e = await O.get(`/order/${k}/transaction_record`);
((N.value = e.list ?? []), (F.value = !0));
} catch (e) {
I.value = e instanceof Error ? e.message : `交易流水暂时无法加载`;
} finally {
P.value = !1;
}
}
// 旧 pay 路由支付完成进入 paid 路由;普通详情则刷新订单及流水。
function tt() {
if (((R.value = !1), A.value)) {
qe.push(`/orders/order/paid?id=${k}`);
return;
}
(B(), V());
}
onMounted(async () => {
try {
let e = await O.get(`/order/${k}`);
if (!e.order || !e.order.id) {
M.value = `订单不存在或已删除`;
return;
}
((j.value = e.order), await V());
} catch (e) {
M.value = e instanceof Error ? e.message : `加载失败`;
} finally {
Je.value = !1;
}
});
let nt = computed(() => j.value?.items?.some((e) => !!D(e)) ?? !1);
// 订单项标题优先使用已清理的产品名,缺失时回落到描述。
function rt(e) {
return (
product_name_n(D(e) || e.product_name) ||
e.description?.trim() ||
`—`
);
}
function it(e) {
return (
!!D(e) ||
(nt.value && !!e.description && e.product_name === e.description)
);
}
let at = computed(() => {
let e = j.value?.items?.[0];
return (
product_name_n(e && (D(e) || e.product_name)) ||
dict_s(j.value?.type || ``)
);
}),
ot = computed(() =>
(j.value?.items ?? []).map((e) => e.product_name),
);
// 订单项说明统一通过产品与带宽展示工具整理,保留真实配置含义。
function st(e) {
return bandwidth_display_t(product_name_r(e.description, ot.value));
}
let ct = computed(() =>
j.value?.status === `Paid`
? j.value.amount
: F.value
? N.value
.reduce((e, t) => e + Number(t.amount || 0), 0)
.toFixed(2)
: `—`,
),
H = ref(!1),
U = ref(!1),
W = ref(``),
G = ref(``),
K = ref([]),
q = ref(!1),
J = ref(!1),
Y = ref(``),
X = ref(!1),
lt = [`WaitUpload`, `WaitReview`, `ReviewFail`],
ut = computed(() => !!j.value && lt.includes(j.value.status)),
Z = computed(() => j.value?.status === `WaitReview`),
Q = computed(
() =>
[`WaitUpload`, `ReviewFail`].includes(j.value?.status || ``) &&
K.value.length > 0 &&
!q.value &&
!J.value,
);
// 上传凭证后仅保存服务端 save_name 标识;附件上传期间阻止重复选择处理。
async function dt(e) {
let t = e.target,
n = Array.from(t.files ?? []);
if (((t.value = ``), n.length && !q.value)) {
((q.value = !0), (Y.value = ``));
try {
let e = await Promise.all(n.map((e) => O.upload(e)));
K.value = [
...K.value,
...e.map((e) => e.save_name).filter(Boolean),
];
} catch (e) {
Y.value = e instanceof Error ? e.message : `凭证上传失败,请重试`;
} finally {
q.value = !1;
}
}
}
// 尚未提交审核时允许移除本地待提交附件,不代表删除服务端历史凭证。
function ft(e) {
J.value || (K.value = K.value.filter((t, n) => n !== e));
}
// 只有允许上传凭证的订单且附件已就绪才提交;提交后进入 WaitReview 并再次读取订单。
async function pt() {
if (j.value && Q.value && !J.value) {
((J.value = !0), (Y.value = ``));
try {
(await O.put(`/order/${k}/voucher`, {
voucher: [...K.value],
}),
(j.value = {
...j.value,
status: `WaitReview`,
}),
(G.value = `转账凭证已提交,等待审核`),
(K.value = []),
await B());
} catch (e) {
Y.value = e instanceof Error ? e.message : `提交审核失败,请重试`;
} finally {
J.value = !1;
}
}
}
// 从人工转账凭证流程切换到其他支付方式,实际可用渠道由重新加载的订单决定。
async function mt() {
if (j.value && !X.value && ut.value) {
((X.value = !0), (Y.value = ``));
try {
(await O.put(`/order/${k}/gateway`),
(G.value = `已切换支付方式,请重新选择付款渠道`),
await B());
} catch (e) {
Y.value =
e instanceof Error ? e.message : `切换支付方式失败,请重试`;
} finally {
X.value = !1;
}
}
}
let $ = computed(
() =>
!!j.value &&
j.value.type !== `on_demand` &&
[`Unpaid`, `WaitUpload`, `WaitReview`, `ReviewFail`].includes(
j.value.status,
),
);
// 仅对可取消状态打开确认框,按需订单不走此取消入口。
function ht() {
$.value && !U.value && ((W.value = ``), (H.value = !0));
}
// 确认取消时再次读取订单并重新检查状态,再执行删除,减少使用过期详情误操作。
async function gt() {
if (H.value && $.value && !U.value && j.value) {
((U.value = !0), (W.value = ``));
try {
let e = await O.get(`/order/${k}`);
if (!e.order?.id) throw Error(`订单不存在或已删除`);
if (((j.value = e.order), !$.value))
throw Error(`订单状态已更新,当前订单无法取消`);
(await O.del(`/order/${k}`),
(j.value = {
...j.value,
status: `Cancelled`,
}),
(H.value = !1),
(G.value = `订单已取消`),
await B());
} catch (e) {
W.value = e instanceof Error ? e.message : `取消失败,请稍后重试`;
} finally {
U.value = !1;
}
}
}
// 调用浏览器打印当前订单视图,不另行生成服务端发票。
function _t() {
window.print();
}
// 订单项、交易流水、凭证审核与支付分开显示;取消确认读取最新状态,打印仅针对当前详情视图。
return (n, a) => {
let l = skeleton,
g = message,
y = NuxtLink,
b = button,
x = tag,
E = PaymentDialog,
D = dialog;
return (
openBlock(),
createElementBlock(
`div`,
{
class: normalizeClass([
`receipt-page`,
{
"payment-page": unref(A),
},
]),
},
[
unref(Je)
? (openBlock(),
createElementBlock(`div`, ue, [
createVNode(l, {
height: `480px`,
}),
]))
: unref(M)
? (openBlock(),
createBlock(
g,
{
key: 1,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(toDisplayString(unref(M)), 1),
]),
_: 1,
},
))
: unref(j)
? (openBlock(),
createElementBlock(
Fragment,
{
key: 2,
},
[
unref(Ke) && unref(j).status === `Paid`
? (openBlock(),
createElementBlock(`section`, de, [
(a[11] ||= createElementVNode(
`i`,
{
class: `pi pi-check-circle`,
},
null,
-1,
)),
(a[12] ||= createElementVNode(
`p`,
null,
`支付成功`,
-1,
)),
createElementVNode(
`strong`,
null,
`¥` + toDisplayString(unref(j).amount),
1,
),
createElementVNode(`dl`, null, [
createElementVNode(`div`, null, [
(a[4] ||= createElementVNode(
`dt`,
null,
`订单号`,
-1,
)),
createElementVNode(
`dd`,
null,
`#` + toDisplayString(unref(j).id),
1,
),
]),
createElementVNode(`div`, null, [
(a[5] ||= createElementVNode(
`dt`,
null,
`支付时间`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(
(`formatTime` in n
? n.formatTime
: unref(dict_r))(unref(j).pay_time),
),
1,
),
]),
createElementVNode(`div`, null, [
(a[6] ||= createElementVNode(
`dt`,
null,
`订单类型`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(
(`orderTypeLabel` in n
? n.orderTypeLabel
: unref(dict_s))(unref(j).type),
),
1,
),
]),
createElementVNode(`div`, null, [
(a[7] ||= createElementVNode(
`dt`,
null,
`商品名称`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(unref(at)),
1,
),
]),
createElementVNode(`div`, null, [
(a[8] ||= createElementVNode(
`dt`,
null,
`支付方式`,
-1,
)),
createElementVNode(
`dd`,
null,
toDisplayString(unref(Qe)),
1,
),
]),
]),
createElementVNode(`div`, fe, [
createVNode(
b,
{
"as-child": ``,
label: `返回首页`,
severity: `secondary`,
outlined: ``,
},
{
default: withCtx((e) => [
createVNode(
y,
mergeProps(
{
to: `/`,
class: e.class,
},
e.a11yAttrs,
),
{
default: withCtx(() => [
...(a[9] ||= [
createElementVNode(
`span`,
{
class: `p-button-label`,
},
`返回首页`,
-1,
),
]),
]),
_: 1,
},
16,
[`class`],
),
]),
_: 1,
},
),
createVNode(
b,
{
"as-child": ``,
label: `查看订单`,
},
{
default: withCtx((e) => [
createVNode(
y,
mergeProps(
{
to: `/orders`,
class: e.class,
},
e.a11yAttrs,
),
{
default: withCtx(() => [
...(a[10] ||= [
createElementVNode(
`span`,
{
class: `p-button-label`,
},
`查看订单`,
-1,
),
]),
]),
_: 1,
},
16,
[`class`],
),
]),
_: 1,
},
),
]),
]))
: (openBlock(),
createElementBlock(
Fragment,
{
key: 1,
},
[
createElementVNode(`nav`, pe, [
createVNode(
y,
{
to: unref(A)
? `/orders/${unref(j).id}`
: unref(S).path?.startsWith(
`/bills/`,
)
? `/finance?tab=bills`
: `/orders`,
},
{
default: withCtx(() => [
(a[13] ||= createElementVNode(
`i`,
{
class: `pi pi-arrow-left`,
"aria-hidden": `true`,
},
null,
-1,
)),
createTextVNode(
toDisplayString(
unref(A)
? `返回订单详情`
: unref(S).path?.startsWith(
`/bills/`,
)
? `返回账单`
: `返回订单`,
),
1,
),
]),
_: 1,
},
8,
[`to`],
),
createElementVNode(
`span`,
null,
`订单 #` + toDisplayString(unref(j).id),
1,
),
]),
unref(G)
? (openBlock(),
createBlock(
g,
{
key: 0,
severity: `success`,
closable: !1,
class: `receipt-feedback`,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(unref(G)),
1,
),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
createElementVNode(`div`, me, [
createElementVNode(`article`, he, [
createElementVNode(
`div`,
{
class: `receipt-print-head`,
},
[
createElementVNode(`img`, {
src: logoUrl,
alt: `破碎工坊云`,
class: `receipt-print-logo`,
}),
createElementVNode(
`div`,
{
class: `receipt-print-meta`,
},
[
createElementVNode(
`strong`,
null,
`订单凭据`,
),
createElementVNode(
`span`,
null,
`订单号 #` +
toDisplayString(
unref(j).id,
),
1,
),
],
),
],
),
createElementVNode(`header`, ge, [
createElementVNode(`div`, _e, [
createElementVNode(`span`, ve, [
createElementVNode(
`i`,
{
class: normalizeClass([
`pi`,
unref(j).type === `renew`
? `pi-sync`
: unref(j).type ===
`recharge`
? `pi-wallet`
: `pi-shopping-cart`,
]),
"aria-hidden": `true`,
},
null,
2,
),
]),
createElementVNode(`div`, null, [
createElementVNode(
`h2`,
null,
toDisplayString(
(`orderTypeLabel` in n
? n.orderTypeLabel
: unref(dict_s))(
unref(j).type,
),
) +
` - ` +
toDisplayString(unref(at)),
1,
),
createElementVNode(
`p`,
null,
`下单时间:` +
toDisplayString(
(`formatTime` in n
? n.formatTime
: unref(dict_r))(
unref(j).create_time,
),
),
1,
),
]),
]),
unref(A)
? createCommentVNode(``, !0)
: (openBlock(),
createBlock(
x,
{
key: 0,
class: `receipt-status`,
value:
unref(j).status === `Unpaid`
? `未支付`
: (`orderStatusLabel` in n
? n.orderStatusLabel
: unref(dict_a))(
unref(j).status,
),
severity:
unref(j).status === `Unpaid`
? `danger`
: (`orderStatusSeverity` in
n
? n.orderStatusSeverity
: unref(dict_o))(
unref(j).status,
),
icon:
unref(j).status === `Unpaid`
? `pi pi-info-circle`
: void 0,
},
null,
8,
[`value`, `severity`, `icon`],
)),
]),
createElementVNode(`section`, ye, [
(a[15] ||= createElementVNode(
`div`,
{
class: `receipt-table-head`,
},
[
createElementVNode(
`b`,
null,
`描述`,
),
createElementVNode(
`b`,
null,
`单价`,
),
],
-1,
)),
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(j).items || [],
(t) => (
openBlock(),
createElementBlock(
`div`,
{
key: t.id,
class: `receipt-item`,
},
[
it(t)
? (openBlock(),
createElementBlock(
`div`,
be,
[
createElementVNode(
`p`,
xe,
toDisplayString(
rt(t),
),
1,
),
],
))
: (openBlock(),
createElementBlock(
`div`,
Se,
[
(unref(j).items
?.length || 0) > 1
? (openBlock(),
createElementBlock(
`strong`,
Ce,
toDisplayString(
unref(
product_name_n,
)(
t.product_name,
),
),
1,
))
: createCommentVNode(
``,
!0,
),
t.host_name
? (openBlock(),
createElementBlock(
`p`,
we,
toDisplayString(
t.host_name,
),
1,
))
: createCommentVNode(
``,
!0,
),
createElementVNode(
`p`,
Te,
toDisplayString(
st(t) ||
unref(
product_name_n,
)(
t.product_name,
) ||
`—`,
),
1,
),
],
)),
createElementVNode(
`b`,
null,
`¥` +
toDisplayString(
t.amount,
),
1,
),
],
)
),
),
128,
)),
unref(j).items?.length
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
Ee,
`暂无订单明细`,
)),
createElementVNode(`div`, De, [
(a[14] ||= createElementVNode(
`b`,
null,
`合计:`,
-1,
)),
createElementVNode(
`strong`,
null,
`¥` +
toDisplayString(
unref(j).amount,
),
1,
),
]),
]),
!unref(A) && unref(ut)
? (openBlock(),
createElementBlock(`section`, Oe, [
createElementVNode(`div`, ke, [
createElementVNode(
`div`,
null,
[
(a[16] ||=
createElementVNode(
`h3`,
{
id: `bank-voucher-label`,
},
`银行转账凭证`,
-1,
)),
unref(Z)
? (openBlock(),
createElementBlock(
`p`,
Ae,
`凭证已提交,当前正在审核,请勿重复提交。`,
))
: unref(j)
?.review_fail_reason
? (openBlock(),
createElementBlock(
`p`,
je,
`上次审核未通过:` +
toDisplayString(
unref(j)
.review_fail_reason,
),
1,
))
: (openBlock(),
createElementBlock(
`p`,
Me,
`上传转账回执后提交审核,支持多张图片或 PDF。`,
)),
],
),
createVNode(
x,
{
value: unref(Z)
? `待审核`
: unref(j)?.status ===
`ReviewFail`
? `审核驳回`
: `待上传`,
severity: unref(Z)
? `warn`
: unref(j)?.status ===
`ReviewFail`
? `danger`
: `info`,
},
null,
8,
[`value`, `severity`],
),
]),
unref(Z)
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`div`,
Ne,
[
createElementVNode(
`input`,
{
id: `bank-voucher-files`,
"aria-labelledby": `bank-voucher-label`,
type: `file`,
accept: `image/*,.pdf`,
multiple: ``,
disabled:
unref(q) ||
unref(J),
onChange: dt,
},
null,
40,
Pe,
),
unref(q)
? (openBlock(),
createElementBlock(
`span`,
Fe,
`正在上传凭证…`,
))
: (openBlock(),
createElementBlock(
`span`,
Ie,
`可多选凭证文件,上传完成后点击提交审核。`,
)),
],
)),
unref(K).length
? (openBlock(),
createElementBlock(`ul`, Le, [
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(K),
(t, n) => (
openBlock(),
createElementBlock(
`li`,
{
key: `${t}-${n}`,
},
[
createElementVNode(
`span`,
null,
toDisplayString(
t,
),
1,
),
createVNode(
b,
{
icon: `pi pi-times`,
"aria-label": `移除凭证`,
severity: `secondary`,
text: ``,
size: `small`,
disabled:
unref(J),
onClick: (
e,
) => ft(n),
},
null,
8,
[
`disabled`,
`onClick`,
],
),
],
)
),
),
128,
)),
]))
: createCommentVNode(``, !0),
unref(Y)
? (openBlock(),
createBlock(
g,
{
key: 2,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(
unref(Y),
),
1,
),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
createElementVNode(`div`, Re, [
unref(Z)
? createCommentVNode(``, !0)
: (openBlock(),
createBlock(
b,
{
key: 0,
label: `提交审核`,
icon: `pi pi-send`,
loading: unref(J),
disabled: !unref(Q),
onClick: pt,
},
null,
8,
[`loading`, `disabled`],
)),
createVNode(
b,
{
label: `切换支付方式`,
icon: `pi pi-wallet`,
severity: `secondary`,
outlined: ``,
loading: unref(X),
disabled:
unref(X) || unref(J),
onClick: mt,
},
null,
8,
[`loading`, `disabled`],
),
]),
]))
: createCommentVNode(``, !0),
unref(A)
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(`section`, ze, [
(a[18] ||= createElementVNode(
`div`,
{
class: `receipt-tx-head`,
},
[
createElementVNode(
`b`,
null,
`交易时间`,
),
createElementVNode(
`b`,
null,
`支付方式`,
),
createElementVNode(
`b`,
null,
`金额`,
),
],
-1,
)),
(openBlock(!0),
createElementBlock(
Fragment,
null,
renderList(
unref(N),
(t, r) => (
openBlock(),
createElementBlock(
`div`,
{
key: r,
class: `receipt-tx`,
},
[
createElementVNode(
`span`,
null,
toDisplayString(
(`formatTime` in n
? n.formatTime
: unref(dict_r))(
t.create_time,
),
),
1,
),
createElementVNode(
`span`,
null,
toDisplayString(
t.description?.trim()
? unref(
product_name_r,
)(
Ze(
t.description,
),
[
t.product_name,
...unref(
ot,
),
],
)
: unref(Qe),
),
1,
),
createElementVNode(
`b`,
null,
`¥` +
toDisplayString(
t.amount,
),
1,
),
],
)
),
),
128,
)),
unref(I)
? (openBlock(),
createElementBlock(
`div`,
Be,
[
createVNode(
g,
{
severity: `warn`,
closable: !1,
},
{
default: withCtx(
() => [
createTextVNode(
toDisplayString(
unref(I),
),
1,
),
],
),
_: 1,
},
),
createVNode(
b,
{
label: `重试加载流水`,
icon: `pi pi-refresh`,
severity: `secondary`,
outlined: ``,
loading: unref(P),
onClick: V,
},
null,
8,
[`loading`],
),
],
))
: unref(N).length
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(
`p`,
Ve,
`暂无数据`,
)),
createElementVNode(`div`, He, [
(a[17] ||= createElementVNode(
`b`,
null,
`已付金额`,
-1,
)),
createElementVNode(
`strong`,
null,
`¥` +
toDisplayString(unref(ct)),
1,
),
]),
Number(unref(j).credit) > 0
? (openBlock(),
createElementBlock(
`p`,
Ue,
`余额抵扣:¥` +
toDisplayString(
unref(j).credit,
),
1,
))
: createCommentVNode(``, !0),
])),
]),
unref(A)
? (openBlock(),
createElementBlock(`div`, We, [
(a[19] ||= createElementVNode(
`p`,
null,
`支付完成后我们会尽快处理您的订单`,
-1,
)),
createVNode(
E,
{
modelValue: unref(z),
"onUpdate:modelValue": (a[0] ||=
(e) =>
isRef(z)
? (z.value = e)
: null),
"order-id": unref(j).id,
amount: String(unref(j).amount),
inline: ``,
onSuccess: tt,
onUpdated: et,
},
null,
8,
[
`modelValue`,
`order-id`,
`amount`,
],
),
]))
: createCommentVNode(``, !0),
]),
unref(A)
? createCommentVNode(``, !0)
: (openBlock(),
createElementBlock(`div`, Ge, [
createVNode(b, {
label: `打印`,
icon: `pi pi-print`,
severity: `secondary`,
outlined: ``,
onClick: _t,
}),
unref($)
? (openBlock(),
createBlock(
b,
{
key: 0,
label: `取消订单`,
icon: `pi pi-times-circle`,
severity: `secondary`,
outlined: ``,
disabled: unref(U),
onClick: ht,
},
null,
8,
[`disabled`],
))
: createCommentVNode(``, !0),
unref(j).status === `Unpaid`
? (openBlock(),
createBlock(
b,
{
key: 1,
"as-child": ``,
label: `立即支付`,
icon: `pi pi-check`,
},
{
default: withCtx((e) => [
createVNode(
y,
mergeProps(
{
to: `/orders/order/pay?id=${unref(j).id}`,
class: e.class,
},
e.a11yAttrs,
),
{
default: withCtx(() => [
...(a[20] ||= [
createElementVNode(
`i`,
{
class: `p-button-icon pi pi-check`,
"aria-hidden": `true`,
},
null,
-1,
),
createElementVNode(
`span`,
{
class: `p-button-label`,
},
`立即支付`,
-1,
),
]),
]),
_: 1,
},
16,
[`to`, `class`],
),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
])),
],
64,
)),
],
64,
))
: createCommentVNode(``, !0),
createVNode(
D,
{
visible: unref(H),
"onUpdate:visible": (a[2] ||= (e) =>
isRef(H) ? (H.value = e) : null),
header: `取消订单`,
modal: ``,
draggable: !1,
closable: !unref(U),
"close-on-escape": !unref(U),
style: {
width: `420px`,
},
},
{
footer: withCtx(() => [
createVNode(
b,
{
label: `保留订单`,
severity: `secondary`,
outlined: ``,
disabled: unref(U),
onClick: (a[1] ||= (e) => (H.value = !1)),
},
null,
8,
[`disabled`],
),
createVNode(
b,
{
label: `确认取消`,
severity: `danger`,
loading: unref(U),
disabled: !unref($),
onClick: gt,
},
null,
8,
[`loading`, `disabled`],
),
]),
default: withCtx(() => [
createElementVNode(
`p`,
null,
`确认取消订单 #` +
toDisplayString(unref(j)?.id) +
`?取消后将无法继续支付,需要时可重新下单。`,
1,
),
unref(W)
? (openBlock(),
createBlock(
g,
{
key: 0,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(toDisplayString(unref(W)), 1),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
]),
_: 1,
},
8,
[`visible`, `closable`, `close-on-escape`],
),
unref(j)
? (openBlock(),
createBlock(
E,
{
key: 3,
modelValue: unref(R),
"onUpdate:modelValue": (a[3] ||= (e) =>
isRef(R) ? (R.value = e) : null),
"order-id": unref(j).id,
amount: String(unref(j).amount),
onSuccess: tt,
onUpdated: et,
},
null,
8,
[`modelValue`, `order-id`, `amount`],
))
: createCommentVNode(``, !0),
],
2,
)
);
};
},
}),
[[`__scopeId`, `data-v-b3b3cd9c`]],
);
export {};
export default O;
</script>