@huyooo/ui 2.1.20 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1287 +0,0 @@
1
- /* empty css */
2
- /* empty css */
3
- /* empty css */
4
- /* empty css */
5
- /* empty css */
6
- import { U as At } from "./userMenuModal-D-nDaYqM.js";
7
- /* empty css */
8
- /* empty css */
9
- import { g as I } from "./apiClients-CWSwNzGk.js";
10
- import { ref as y, onUnmounted as Ue, defineComponent as zt, computed as X, openBlock as l, createElementBlock as v, Fragment as Z, createVNode as c, unref as a, isRef as Tt, withCtx as s, createElementVNode as n, toDisplayString as r, createBlock as V, createTextVNode as g, createCommentVNode as E, renderList as We, normalizeClass as Le } from "vue";
11
- import { Modal as Ee, Button as k, Popconfirm as ee, Tabs as Ot, TabPane as te, Spin as ve, Empty as Re, Progress as Wt, Tooltip as pe, Tag as G, Message as D } from "@arco-design/web-vue";
12
- import { useBillingSubscriptionSummary as Lt } from "./useBillingSubscriptionSummary-BC3G0N4t.js";
13
- import { u as Et, b as Rt, a as Bt } from "./useBillingStatusOptions-C6edto7H.js";
14
- import { u as $t } from "./useAuthkitCreateAndUpdate-COI5KVPJ.js";
15
- import { g as Ft } from "./runtime-DDJRAtkv.js";
16
- import { C as ge } from "./CustomTable-BY0oHLXc.js";
17
- import { C as Be } from "./index-BYH7DaQf.js";
18
- import { _ as Ht } from "./_plugin-vue_export-helper-CHgC5LLL.js";
19
- function Ut(i, d) {
20
- return i ? i.acquiredBy === "subscribe" ? d > 0 ? "修改订阅" : "" : d > 0 ? "升级" : "" : d > 0 ? "订阅" : "查看价格方案";
21
- }
22
- function In(i, d, m = !0) {
23
- return m ? i ? !!Ut(i, d) : !0 : !1;
24
- }
25
- function $e(i, d) {
26
- return i ? d || (i.kind === "beta" ? "内测资格" : "已开通") : "未订阅";
27
- }
28
- function Fe(i) {
29
- return (i == null ? void 0 : i.acquiredBy) === "subscribe" ? "当前周期结束" : "权益有效期至";
30
- }
31
- function fe(i) {
32
- return Number(i ?? 0).toLocaleString(void 0, {
33
- minimumFractionDigits: 2,
34
- maximumFractionDigits: 2
35
- });
36
- }
37
- function Dt(i) {
38
- return Number(i ?? 0).toLocaleString();
39
- }
40
- function me(i) {
41
- const d = typeof i == "number" ? i : Number(i);
42
- return Number.isFinite(d) ? Math.abs(d) > 0 && Math.abs(d) < 0.01 ? d.toLocaleString("zh-CN", {
43
- minimumFractionDigits: 0,
44
- maximumFractionDigits: 6
45
- }) : d.toLocaleString("zh-CN", {
46
- minimumFractionDigits: 2,
47
- maximumFractionDigits: 2
48
- }) : "0.00";
49
- }
50
- function Mt(i) {
51
- const d = typeof i == "number" ? i : Number(i);
52
- return !Number.isFinite(d) || d === 0 ? me(0) : `${d > 0 ? "+" : "-"}${me(Math.abs(d))}`;
53
- }
54
- const Yt = {
55
- // earn
56
- recharge: "充值",
57
- referral: "推荐奖励",
58
- signup: "注册奖励",
59
- subscription: "订阅赠送",
60
- activity: "活动奖励",
61
- bonus: "奖励",
62
- rule: "规则奖励",
63
- trigger: "触发奖励",
64
- // consume
65
- consume: "消费",
66
- ai_usage: "AI 消费",
67
- service_usage: "服务消费",
68
- continuous_service_usage: "连续服务消费",
69
- // reversal / clawback
70
- consume_reversal: "消费退还",
71
- earn_clawback: "发放追回",
72
- service_usage_reversal: "服务消费退还",
73
- refund: "退款扣除",
74
- // adjust
75
- increase: "人工增加",
76
- decrease: "人工扣减",
77
- batch_increase: "批量增加",
78
- batch_decrease: "批量扣减",
79
- // 其他
80
- exchange: "兑换",
81
- adjust: "调整"
82
- };
83
- function qt(i) {
84
- return i != null && i.trim() ? Yt[i] ?? i : "-";
85
- }
86
- const ye = {
87
- earn: {
88
- label: "获得",
89
- tagColor: "green"
90
- },
91
- consume: {
92
- label: "消费",
93
- tagColor: "red"
94
- },
95
- reversal: {
96
- label: "退还",
97
- tagColor: "arcoblue"
98
- },
99
- clawback: {
100
- label: "追回",
101
- tagColor: "orange"
102
- },
103
- adjust: {
104
- label: "调整",
105
- tagColor: "purple"
106
- }
107
- };
108
- function De(i) {
109
- return i in ye;
110
- }
111
- function Vt(i) {
112
- return De(i) ? ye[i].label : i || "-";
113
- }
114
- function jt(i) {
115
- return De(i) ? ye[i].tagColor : "gray";
116
- }
117
- async function Kt(i, d) {
118
- if (i === "recharge") {
119
- const {
120
- data: m,
121
- error: f
122
- } = await I().billing.pointsRecharge.verifyPayment.post({
123
- orderId: d
124
- });
125
- if (f || !m)
126
- return {
127
- success: !1,
128
- status: "error",
129
- message: (f == null ? void 0 : f.message) || "查询充值结果失败",
130
- error: f
131
- };
132
- const b = m;
133
- return {
134
- success: !!(b.success || b.status === "paid"),
135
- status: b.status || "unknown",
136
- message: b.message,
137
- pointsAdded: b.pointsAdded
138
- };
139
- }
140
- if (i === "subscription") {
141
- const {
142
- data: m,
143
- error: f
144
- } = await I().billing.invoices.verifyPayment.post({
145
- orderId: d
146
- });
147
- if (f || !m)
148
- return {
149
- success: !1,
150
- status: "error",
151
- message: (f == null ? void 0 : f.message) || "查询订阅支付结果失败",
152
- error: f
153
- };
154
- const b = m;
155
- return {
156
- success: !!(b.success || b.status === "paid"),
157
- status: b.status || "unknown",
158
- message: b.message
159
- };
160
- }
161
- return {
162
- success: !1,
163
- status: "unsupported",
164
- message: "暂不支持的支付场景"
165
- };
166
- }
167
- const Gt = 3e3;
168
- function Me() {
169
- const i = y(!1), d = y("");
170
- let m = null;
171
- function f() {
172
- m && (clearInterval(m), m = null);
173
- }
174
- async function b(_, S) {
175
- i.value = !0;
176
- const h = await Kt(_, S);
177
- return i.value = !1, h;
178
- }
179
- function O(_) {
180
- f();
181
- const S = async () => {
182
- var C, U;
183
- const h = await b(_.scene, _.orderId);
184
- if (h.error) {
185
- f(), (C = _.onError) == null || C.call(_, h.error);
186
- return;
187
- }
188
- if (h.success) {
189
- f(), _.onSuccess(h);
190
- return;
191
- }
192
- d.value = h.message || "等待支付确认...", (U = _.onWaiting) == null || U.call(_, h);
193
- };
194
- S(), m = setInterval(() => {
195
- S();
196
- }, Gt);
197
- }
198
- return Ue(f), {
199
- checking: i,
200
- statusText: d,
201
- startPolling: O,
202
- stopPolling: f,
203
- verifyNow: b
204
- };
205
- }
206
- function xn(i) {
207
- const d = y("loading"), m = y("正在确认支付结果..."), {
208
- checking: f,
209
- statusText: b,
210
- startPolling: O,
211
- stopPolling: _,
212
- verifyNow: S
213
- } = Me();
214
- async function h(C, U) {
215
- d.value = "loading", m.value = "正在确认支付结果...", O({
216
- scene: C,
217
- orderId: U,
218
- onSuccess: (x) => {
219
- d.value = "success", m.value = x.message || "支付成功", window.setTimeout(() => {
220
- window.location.replace(i());
221
- }, 1200);
222
- },
223
- onWaiting: (x) => {
224
- m.value = x.message || b.value || "等待支付确认...";
225
- },
226
- onError: (x) => {
227
- d.value = "failed", m.value = x instanceof Error ? x.message : "确认支付失败";
228
- }
229
- });
230
- }
231
- return {
232
- phase: d,
233
- message: m,
234
- checking: f,
235
- statusText: b,
236
- confirmPayment: h,
237
- stopPolling: _,
238
- verifyNow: S
239
- };
240
- }
241
- function Jt(i) {
242
- return /^https?:\/\//i.test(i) || i.startsWith("//");
243
- }
244
- function Qt() {
245
- const {
246
- config: i
247
- } = Ft();
248
- if (i.openPricing) {
249
- i.openPricing();
250
- return;
251
- }
252
- const d = i.pricingUrl || "/Pricing";
253
- if (Jt(d)) {
254
- window.open(d, "_blank", "noopener,noreferrer");
255
- return;
256
- }
257
- window.location.assign(d);
258
- }
259
- const Xt = {
260
- pending: "退款申请已提交,等待财务审核",
261
- approved: "财务已审核通过,款项尚未原路退回",
262
- rejected: "财务未通过该退款申请",
263
- processing: "退款正在原路处理中,请耐心等待",
264
- success: "退款已成功原路退回",
265
- failed: "退款执行失败,请联系客服处理"
266
- };
267
- function He(i) {
268
- return Xt[i] ?? "";
269
- }
270
- const Zt = {
271
- class: "content"
272
- }, ea = {
273
- key: 0,
274
- class: "current-subscription-card"
275
- }, ta = {
276
- class: "subscription-header"
277
- }, aa = {
278
- class: "subscription-info"
279
- }, na = {
280
- class: "subscription-actions"
281
- }, ia = {
282
- class: "subscription-details"
283
- }, sa = {
284
- key: 0,
285
- class: "detail-item"
286
- }, oa = {
287
- key: 1,
288
- class: "detail-item"
289
- }, la = {
290
- key: 2,
291
- class: "detail-item"
292
- }, ra = {
293
- key: 3,
294
- class: "detail-item"
295
- }, ua = {
296
- class: "label"
297
- }, ca = {
298
- key: 4,
299
- class: "detail-item warning"
300
- }, da = {
301
- key: 5,
302
- class: "detail-item warning"
303
- }, va = {
304
- key: 6,
305
- class: "detail-item"
306
- }, pa = {
307
- key: 1,
308
- class: "no-subscription-row"
309
- }, ga = {
310
- class: "overview-grid"
311
- }, fa = {
312
- class: "overview-card"
313
- }, ma = {
314
- class: "overview-card__value"
315
- }, ya = {
316
- key: 0,
317
- class: "overview-card__meta"
318
- }, ba = {
319
- class: "overview-card"
320
- }, _a = {
321
- class: "overview-card__value"
322
- }, ha = {
323
- key: 0,
324
- class: "quotas-loading"
325
- }, wa = {
326
- key: 1,
327
- class: "no-quotas"
328
- }, Pa = {
329
- key: 2,
330
- class: "quotas-grid"
331
- }, ka = {
332
- class: "quota-header"
333
- }, Sa = {
334
- class: "quota-name"
335
- }, Ca = {
336
- class: "quota-period"
337
- }, Ia = {
338
- class: "quota-progress"
339
- }, xa = {
340
- class: "quota-detail"
341
- }, Na = {
342
- key: 0
343
- }, Aa = {
344
- key: 1
345
- }, za = {
346
- key: 2,
347
- class: "reset-time"
348
- }, Ta = ["title"], Oa = {
349
- key: 1
350
- }, Wa = {
351
- key: 0,
352
- class: "invoice-actions"
353
- }, La = {
354
- key: 1,
355
- class: "invoice-actions"
356
- }, Ea = {
357
- key: 2
358
- }, Ra = {
359
- class: "points-panel"
360
- }, Ba = {
361
- class: "points-balance-card"
362
- }, $a = {
363
- class: "points-balance-value"
364
- }, Fa = {
365
- key: 0,
366
- class: "points-loading"
367
- }, Ha = {
368
- key: 1,
369
- class: "points-empty"
370
- }, Ua = {
371
- key: 2,
372
- class: "points-package-grid"
373
- }, Da = ["onClick"], Ma = {
374
- class: "points-package-name"
375
- }, Ya = {
376
- class: "points-package-value"
377
- }, qa = {
378
- class: "points-package-meta"
379
- }, Va = {
380
- class: "points-package-extra"
381
- }, ja = {
382
- class: "points-pay-row"
383
- }, Ka = {
384
- key: 0
385
- }, Ga = {
386
- key: 1
387
- }, Ja = {
388
- key: 1
389
- }, Qa = {
390
- key: 0,
391
- class: "invoice-actions"
392
- }, Xa = {
393
- key: 1
394
- }, Za = ["title"], en = {
395
- key: 1
396
- }, tn = {
397
- class: "payment-wait-content"
398
- }, an = {
399
- class: "payment-wait-summary"
400
- }, nn = {
401
- class: "payment-wait-icon"
402
- }, sn = {
403
- class: "payment-wait-tip"
404
- }, on = {
405
- class: "payment-wait-actions"
406
- }, ln = /* @__PURE__ */ zt({
407
- __name: "PaySubscriptions",
408
- emits: ["confirm", "cancel"],
409
- setup(i, {
410
- expose: d,
411
- emit: m
412
- }) {
413
- const f = m, {
414
- changeType: b,
415
- show: O
416
- } = $t(f), _ = y("overview"), {
417
- product: S,
418
- price: h,
419
- entitlement: C,
420
- quotas: U,
421
- pointsBalance: x,
422
- loading: be,
423
- refresh: W
424
- } = Lt(), N = X(() => C.value), w = X(() => !C.value || C.value.acquiredBy !== "subscribe" || !h.value || !S.value ? null : {
425
- id: C.value.sourceId,
426
- productId: S.value.id,
427
- productName: S.value.name,
428
- priceId: h.value.id,
429
- interval: h.value.interval || void 0,
430
- intervalCount: h.value.intervalCount || void 0,
431
- unitAmount: h.value.unitAmount || void 0,
432
- currency: h.value.currency || void 0,
433
- status: C.value.status,
434
- currentPeriodEnd: C.value.endAt,
435
- cancelAtPeriodEnd: !!C.value.cancelAtPeriodEnd,
436
- pendingChange: C.value.pendingChange
437
- }), ae = Et(), ne = Rt(), ie = Bt(), _e = y([]), se = y(!1), R = y({
438
- current: 1,
439
- pageSize: 10,
440
- total: 0,
441
- showTotal: !0,
442
- showPageSize: !0,
443
- pageSizeOptions: [10, 20, 50, 100]
444
- }), M = y([]), B = y(""), oe = y(!1), le = y(!1), Y = y(!1), A = y(null), {
445
- checking: Ye,
446
- statusText: T,
447
- startPolling: qe,
448
- stopPolling: re,
449
- verifyNow: Ve
450
- } = Me(), q = y(!1), he = y([]), ue = y(!1), $ = y({
451
- current: 1,
452
- pageSize: 10,
453
- total: 0,
454
- showTotal: !0,
455
- showPageSize: !0,
456
- pageSizeOptions: [10, 20, 50, 100]
457
- }), we = y([]), ce = y(!1), F = y({
458
- current: 1,
459
- pageSize: 10,
460
- total: 0,
461
- showTotal: !0,
462
- showPageSize: !0,
463
- pageSizeOptions: [10, 20, 50, 100]
464
- }), J = X(() => M.value.find((e) => e.id === B.value)), je = X(() => be.value), Ke = [{
465
- dataIndex: "id",
466
- slotName: "id",
467
- title: "账单 ID",
468
- minWidth: 280
469
- }, {
470
- dataIndex: "productName",
471
- title: "价格方案",
472
- minWidth: 180
473
- }, {
474
- dataIndex: "billingType",
475
- slotName: "billingType",
476
- title: "账单类型",
477
- minWidth: 120
478
- }, {
479
- dataIndex: "total",
480
- slotName: "total",
481
- title: "金额",
482
- minWidth: 110
483
- }, {
484
- dataIndex: "status",
485
- slotName: "status",
486
- title: "状态",
487
- minWidth: 110
488
- }, {
489
- dataIndex: "refund",
490
- slotName: "refund",
491
- title: "退款状态",
492
- minWidth: 150
493
- }, {
494
- dataIndex: "tradeNo",
495
- title: "交易号",
496
- minWidth: 320,
497
- cellClassName: "mono-value"
498
- }, {
499
- dataIndex: "periodStart",
500
- title: "周期开始",
501
- minWidth: 180
502
- }, {
503
- dataIndex: "periodEnd",
504
- title: "周期结束",
505
- minWidth: 180
506
- }, {
507
- dataIndex: "paidAt",
508
- title: "支付时间",
509
- minWidth: 180
510
- }, {
511
- dataIndex: "expireAt",
512
- title: "支付有效期",
513
- minWidth: 180
514
- }, {
515
- dataIndex: "createAt",
516
- title: "创建时间",
517
- minWidth: 180
518
- }, {
519
- dataIndex: "actions",
520
- slotName: "actions",
521
- title: "操作",
522
- width: 190,
523
- fixed: "right",
524
- cellClassName: "invoice-actions-cell"
525
- }], Ge = [{
526
- dataIndex: "packageName",
527
- title: "套餐",
528
- minWidth: 180
529
- }, {
530
- dataIndex: "price",
531
- slotName: "price",
532
- title: "金额",
533
- minWidth: 110
534
- }, {
535
- dataIndex: "totalPoints",
536
- slotName: "points",
537
- title: "积分",
538
- minWidth: 120
539
- }, {
540
- dataIndex: "status",
541
- slotName: "status",
542
- title: "状态",
543
- minWidth: 110
544
- }, {
545
- dataIndex: "refund",
546
- slotName: "refund",
547
- title: "退款状态",
548
- minWidth: 150
549
- }, {
550
- dataIndex: "outTradeNo",
551
- title: "订单号",
552
- minWidth: 260,
553
- cellClassName: "mono-value"
554
- }, {
555
- dataIndex: "expireAt",
556
- title: "支付有效期",
557
- minWidth: 180
558
- }, {
559
- dataIndex: "createAt",
560
- title: "创建时间",
561
- minWidth: 180
562
- }, {
563
- dataIndex: "actions",
564
- slotName: "actions",
565
- title: "操作",
566
- width: 120,
567
- fixed: "right",
568
- cellClassName: "invoice-actions-cell"
569
- }], Je = [{
570
- dataIndex: "type",
571
- slotName: "type",
572
- title: "类型",
573
- minWidth: 100,
574
- align: "center"
575
- }, {
576
- dataIndex: "subType",
577
- slotName: "subType",
578
- title: "场景",
579
- minWidth: 140,
580
- ellipsis: !0,
581
- tooltip: !0
582
- }, {
583
- dataIndex: "amount",
584
- slotName: "amount",
585
- title: "变动积分",
586
- minWidth: 120,
587
- align: "right"
588
- }, {
589
- dataIndex: "balance",
590
- slotName: "balance",
591
- title: "变动后余额",
592
- minWidth: 120,
593
- align: "right"
594
- }, {
595
- dataIndex: "description",
596
- title: "说明",
597
- minWidth: 300,
598
- ellipsis: !0,
599
- tooltip: !0
600
- }, {
601
- dataIndex: "orderId",
602
- slotName: "orderId",
603
- title: "订单号",
604
- minWidth: 260,
605
- cellClassName: "mono-value"
606
- }, {
607
- dataIndex: "createAt",
608
- title: "时间",
609
- minWidth: 180
610
- }];
611
- function Qe(e) {
612
- return ae.getStatusColor(e);
613
- }
614
- function Xe(e) {
615
- return ae.getStatusLabel(e);
616
- }
617
- function Pe(e) {
618
- return ne.getStatusColor(e);
619
- }
620
- function ke(e) {
621
- return ne.getStatusLabel(e);
622
- }
623
- function Ze(e) {
624
- return ie.getStatusColor(e);
625
- }
626
- function et(e) {
627
- return ie.getStatusLabel(e);
628
- }
629
- function tt(e) {
630
- return e ? {
631
- new_subscription: "新购",
632
- upgrade: "升级",
633
- downgrade: "降级",
634
- renewal: "续费",
635
- subscription: "订阅"
636
- }[e] || e : "-";
637
- }
638
- function Se() {
639
- var e;
640
- return ((e = x.value) == null ? void 0 : e.totalPoints) ?? 0;
641
- }
642
- function Ce(e) {
643
- return Se() >= e.totalPoints;
644
- }
645
- function at(e) {
646
- return `退款将原路退钱,并扣除 ${L(e.totalPoints)} 积分。当前余额 ${L(Se())}。提交后将进入人工审核,确定申请退款吗?`;
647
- }
648
- function nt(e) {
649
- return {
650
- day: "每天",
651
- week: "每周",
652
- month: "每月",
653
- year: "每年",
654
- lifetime: "不重置"
655
- }[e] || e;
656
- }
657
- function Ie(e, t = 1) {
658
- const u = t > 1 ? `每 ${t} ` : "按", P = {
659
- day: `${u}天`,
660
- week: `${u}周`,
661
- month: `${u}月`,
662
- year: `${u}年`
663
- };
664
- return e ? P[e] || e : "-";
665
- }
666
- function it(e, t, u = 1) {
667
- if (typeof e != "number") return "-";
668
- const P = Ie(t, u).replace("按", "").replace("每 ", "");
669
- return `¥${(e / 100).toFixed(2)} / ${P}`;
670
- }
671
- function L(e) {
672
- return Dt(e);
673
- }
674
- function st(e) {
675
- return typeof e == "number" ? me(e) : "-";
676
- }
677
- function ot(e) {
678
- return e > 0 ? "point-history-amount-positive" : e < 0 ? "point-history-amount-negative" : "";
679
- }
680
- function lt() {
681
- O.value = !1, f("cancel");
682
- }
683
- function de() {
684
- Qt();
685
- }
686
- async function rt() {
687
- await Promise.all([ae.statusOptionsApi(), ne.statusOptionsApi(), ie.statusOptionsApi()]);
688
- }
689
- async function ut() {
690
- await W();
691
- }
692
- async function xe(e) {
693
- e === "points" ? ($.value.current = 1, await Promise.all([ct(), H()])) : e === "usage" ? (F.value.current = 1, await K()) : e === "invoices" && (R.value.current = 1, await j());
694
- }
695
- async function j() {
696
- se.value = !0;
697
- const {
698
- data: e,
699
- error: t
700
- } = await I().billing.invoices.my.post({
701
- current: R.value.current,
702
- pageSize: R.value.pageSize
703
- });
704
- if (se.value = !1, t || !e)
705
- return;
706
- const u = e;
707
- _e.value = u.items ?? [], R.value.total = u.count ?? 0;
708
- }
709
- async function H() {
710
- ue.value = !0;
711
- const {
712
- data: e,
713
- error: t
714
- } = await I().billing.pointsRecharge.orders.post({
715
- page: $.value.current,
716
- pageSize: $.value.pageSize
717
- });
718
- if (ue.value = !1, t || !e)
719
- return;
720
- const u = e;
721
- he.value = u.items ?? [], $.value.total = u.count ?? 0;
722
- }
723
- async function K() {
724
- ce.value = !0;
725
- const {
726
- data: e,
727
- error: t
728
- } = await I().billing.pointsHistory.find.post({
729
- page: F.value.current,
730
- pageSize: F.value.pageSize
731
- });
732
- if (ce.value = !1, t || !e)
733
- return;
734
- const u = e;
735
- we.value = u.items ?? [], F.value.total = u.count ?? 0;
736
- }
737
- async function ct() {
738
- oe.value = !0;
739
- const {
740
- data: e,
741
- error: t
742
- } = await I().billing.pointsRecharge.packages.post();
743
- if (oe.value = !1, t || !e)
744
- return;
745
- const u = e;
746
- M.value = u.packages ?? [], M.value.length > 0 && !B.value && (B.value = M.value[0].id);
747
- }
748
- async function dt() {
749
- var P;
750
- if (!B.value) return;
751
- le.value = !0, A.value = null, T.value = "";
752
- const {
753
- data: e,
754
- error: t
755
- } = await I().billing.pointsRecharge.createOrder.post({
756
- packageId: B.value,
757
- payType: "alipay"
758
- });
759
- if (le.value = !1, t || !e)
760
- return;
761
- const u = e;
762
- if (!u.alipayUrl) {
763
- D.error("获取支付链接失败");
764
- return;
765
- }
766
- A.value = {
767
- orderId: u.orderId,
768
- packageName: ((P = J.value) == null ? void 0 : P.name) || "积分充值",
769
- priceYuan: u.priceYuan,
770
- totalPoints: u.totalPoints
771
- }, window.open(u.alipayUrl, "_blank", "noopener,noreferrer"), Y.value = !0, vt(u.orderId), await H();
772
- }
773
- function vt(e) {
774
- T.value = "等待支付确认...", qe({
775
- scene: "recharge",
776
- orderId: e,
777
- onSuccess: async (t) => {
778
- var P;
779
- const u = t.pointsAdded || ((P = A.value) == null ? void 0 : P.totalPoints) || 0;
780
- Y.value = !1, A.value = null, T.value = "", D.success(`充值成功,已到账 ${L(u)} 积分`), await W(), await H(), await K();
781
- },
782
- onWaiting: (t) => {
783
- T.value = t.message || "等待支付确认...";
784
- },
785
- onError: (t) => {
786
- T.value = t instanceof Error ? t.message : "查询支付状态失败";
787
- }
788
- });
789
- }
790
- async function pt() {
791
- var t, u;
792
- if (!((t = A.value) != null && t.orderId)) return;
793
- const e = await Ve("recharge", A.value.orderId);
794
- if (e.error) {
795
- T.value = e.message || "查询支付状态失败";
796
- return;
797
- }
798
- if (e.success) {
799
- const P = e.pointsAdded || ((u = A.value) == null ? void 0 : u.totalPoints) || 0;
800
- re(), Y.value = !1, A.value = null, T.value = "", D.success(`充值成功,已到账 ${L(P)} 积分`), await W(), await H(), await K();
801
- return;
802
- }
803
- T.value = e.message || "等待支付确认...";
804
- }
805
- function Ne() {
806
- re(), Y.value = !1, A.value = null, T.value = "", H();
807
- }
808
- async function gt(e) {
809
- const {
810
- data: t,
811
- error: u
812
- } = await I().billing.invoices.pay.post({
813
- id: e.id
814
- });
815
- u || !(t != null && t.alipayUrl) || window.open(t.alipayUrl, "_blank", "noopener,noreferrer");
816
- }
817
- async function ft(e) {
818
- const {
819
- error: t
820
- } = await I().billing.invoices.cancel.post({
821
- id: e.id,
822
- reason: "用户取消待支付订阅账单"
823
- });
824
- t || (D.success("账单已取消"), await W(), await j());
825
- }
826
- async function mt(e) {
827
- if (q.value) return;
828
- q.value = !0;
829
- const {
830
- error: t
831
- } = await I().billing.refund.applySubscription.post({
832
- invoiceId: e.id,
833
- reason: "用户申请订阅退款"
834
- });
835
- q.value = !1, !t && (D.success("退款申请已提交,等待人工审核"), await W(), await j());
836
- }
837
- async function yt(e) {
838
- if (q.value) return;
839
- if (!Ce(e)) {
840
- D.warning("账户积分不足,无法退款");
841
- return;
842
- }
843
- q.value = !0;
844
- const {
845
- error: t
846
- } = await I().billing.refund.apply.post({
847
- orderId: e.id,
848
- reason: "用户申请充值退款"
849
- });
850
- q.value = !1, !t && (D.success("退款申请已提交,等待人工审核"), await W(), await H());
851
- }
852
- async function bt() {
853
- if (!w.value) return;
854
- const {
855
- error: e
856
- } = await I().billing.subscriptions.cancel.post({
857
- subscriptionId: w.value.id,
858
- cancelAtPeriodEnd: !0
859
- });
860
- e || await W();
861
- }
862
- async function _t() {
863
- if (!w.value) return;
864
- const {
865
- error: e
866
- } = await I().billing.subscriptions.resume.post({
867
- subscriptionId: w.value.id
868
- });
869
- e || await W();
870
- }
871
- function ht(e) {
872
- R.value.current = e, j();
873
- }
874
- function wt(e) {
875
- R.value.pageSize = e, R.value.current = 1, j();
876
- }
877
- function Pt(e) {
878
- $.value.current = e, H();
879
- }
880
- function kt(e) {
881
- $.value.pageSize = e, $.value.current = 1, H();
882
- }
883
- function St(e) {
884
- F.value.current = e, K();
885
- }
886
- function Ct(e) {
887
- F.value.pageSize = e, F.value.current = 1, K();
888
- }
889
- function It(e) {
890
- return (e == null ? void 0 : e.target) === "points" ? "points" : (e == null ? void 0 : e.target) === "usage" ? "usage" : (e == null ? void 0 : e.target) === "invoices" || (e == null ? void 0 : e.target) === "subscriptions" ? "invoices" : ((e == null ? void 0 : e.target) === "quotas", "overview");
891
- }
892
- function xt(e) {
893
- xe(String(e));
894
- }
895
- function Nt(e, t) {
896
- O.value = t, b.value = "编辑", _.value = It(e), t && (rt(), ut(), xe(_.value));
897
- }
898
- return Ue(() => {
899
- re();
900
- }), d({
901
- setData: Nt
902
- }), (e, t) => (l(), v(Z, null, [c(a(Ee), {
903
- visible: a(O),
904
- "onUpdate:visible": t[1] || (t[1] = (u) => Tt(O) ? O.value = u : null),
905
- loading: !1,
906
- "body-class": "SubscriptionsbodyClass",
907
- "mask-closable": !1,
908
- footer: !1,
909
- width: a(At),
910
- "unmount-on-close": "",
911
- onCancel: lt
912
- }, {
913
- title: s(() => [...t[3] || (t[3] = [g(" 订阅与积分 ", -1)])]),
914
- default: s(() => {
915
- var u, P, Ae, ze, Te, Oe;
916
- return [n("div", Zt, [N.value ? (l(), v("div", ea, [n("div", ta, [n("div", aa, [n("h3", null, r(a($e)(N.value, (u = a(S)) == null ? void 0 : u.name)), 1)]), n("div", na, [N.value && N.value.acquiredBy !== "subscribe" ? (l(), V(a(k), {
917
- key: 0,
918
- type: "primary",
919
- size: "small",
920
- onClick: de
921
- }, {
922
- default: s(() => [...t[4] || (t[4] = [g(" 立即订阅 ", -1)])]),
923
- _: 1
924
- })) : (P = w.value) != null && P.cancelAtPeriodEnd ? (l(), V(a(k), {
925
- key: 1,
926
- type: "primary",
927
- size: "small",
928
- onClick: _t
929
- }, {
930
- default: s(() => [...t[5] || (t[5] = [g(" 恢复订阅 ", -1)])]),
931
- _: 1
932
- })) : w.value ? (l(), v(Z, {
933
- key: 2
934
- }, [c(a(k), {
935
- type: "primary",
936
- size: "small",
937
- onClick: de
938
- }, {
939
- default: s(() => [...t[6] || (t[6] = [g(" 修改订阅 ", -1)])]),
940
- _: 1
941
- }), c(a(ee), {
942
- content: "取消后订阅将在当前周期结束时失效,确定取消吗?",
943
- onOk: bt
944
- }, {
945
- default: s(() => [c(a(k), {
946
- type: "outline",
947
- size: "small",
948
- status: "warning"
949
- }, {
950
- default: s(() => [...t[7] || (t[7] = [g(" 取消订阅 ", -1)])]),
951
- _: 1
952
- })]),
953
- _: 1
954
- })], 64)) : E("", !0)])]), n("div", ia, [w.value ? (l(), v("div", sa, [t[8] || (t[8] = n("span", {
955
- class: "label"
956
- }, "价格方案:", -1)), n("span", null, r((Ae = a(S)) == null ? void 0 : Ae.name), 1)])) : E("", !0), w.value ? (l(), v("div", oa, [t[9] || (t[9] = n("span", {
957
- class: "label"
958
- }, "计费周期:", -1)), n("span", null, r(Ie(w.value.interval, w.value.intervalCount)), 1)])) : E("", !0), w.value ? (l(), v("div", la, [t[10] || (t[10] = n("span", {
959
- class: "label"
960
- }, "价格:", -1)), n("span", null, r(it(w.value.unitAmount, w.value.interval, w.value.intervalCount)), 1)])) : E("", !0), (ze = N.value) != null && ze.endAt ? (l(), v("div", ra, [n("span", ua, r(a(Fe)(N.value)) + ":", 1), n("span", null, r(N.value.endAt), 1)])) : E("", !0), (Te = w.value) != null && Te.cancelAtPeriodEnd ? (l(), v("div", ca, [...t[11] || (t[11] = [n("span", {
961
- class: "label"
962
- }, "订阅将于周期结束后停止", -1)])])) : (Oe = w.value) != null && Oe.pendingChange ? (l(), v("div", da, [t[12] || (t[12] = n("span", {
963
- class: "label"
964
- }, "到期后变更为:", -1)), n("span", null, r(w.value.pendingChange.productName || "新方案"), 1)])) : E("", !0), a(x) ? (l(), v("div", va, [t[13] || (t[13] = n("span", {
965
- class: "label"
966
- }, "积分余额:", -1)), n("span", null, r(a(fe)(a(x).totalPoints)), 1)])) : E("", !0)])])) : (l(), v("div", pa, [t[15] || (t[15] = n("span", {
967
- class: "no-subscription-text"
968
- }, "您当前尚未订阅任何套餐", -1)), c(a(k), {
969
- type: "primary",
970
- size: "small",
971
- onClick: de
972
- }, {
973
- default: s(() => [...t[14] || (t[14] = [g("立即订阅", -1)])]),
974
- _: 1
975
- })])), c(a(Ot), {
976
- "active-key": _.value,
977
- "onUpdate:activeKey": t[0] || (t[0] = (o) => _.value = o),
978
- class: "subscription-tabs",
979
- onChange: xt
980
- }, {
981
- default: s(() => [c(a(te), {
982
- key: "overview",
983
- title: "概览"
984
- }, {
985
- default: s(() => {
986
- var o, p, Q;
987
- return [n("div", ga, [n("div", fa, [t[16] || (t[16] = n("div", {
988
- class: "overview-card__label"
989
- }, "当前权益", -1)), n("div", ma, r(a($e)(N.value, (o = a(S)) == null ? void 0 : o.name)), 1), (p = N.value) != null && p.endAt ? (l(), v("div", ya, r(a(Fe)(N.value)) + ":" + r(N.value.endAt), 1)) : E("", !0)]), n("div", ba, [t[17] || (t[17] = n("div", {
990
- class: "overview-card__label"
991
- }, "积分余额", -1)), n("div", _a, r(a(fe)((Q = a(x)) == null ? void 0 : Q.totalPoints)), 1), t[18] || (t[18] = n("div", {
992
- class: "overview-card__meta"
993
- }, "用于 AI 模型调用和按量服务消费", -1))])]), je.value ? (l(), v("div", ha, [c(a(ve))])) : a(U).length === 0 ? (l(), v("div", wa, [c(a(Re), {
994
- description: "暂无配额限制"
995
- })])) : (l(), v("div", Pa, [(l(!0), v(Z, null, We(a(U), (z) => (l(), v("div", {
996
- key: z.featureKey,
997
- class: "quota-card"
998
- }, [n("div", ka, [n("span", Sa, r(z.name), 1), n("span", Ca, r(nt(z.period)), 1)]), n("div", Ia, [c(a(Wt), {
999
- percent: z.percentage,
1000
- status: z.percentage >= 90 ? "danger" : z.percentage >= 70 ? "warning" : "normal"
1001
- }, null, 8, ["percent", "status"])]), n("div", xa, [z.unlimited ? (l(), v("span", Na, "无限制")) : (l(), v("span", Aa, "已使用 " + r(z.used) + " / " + r(z.limit), 1)), z.resetsAt ? (l(), v("span", za, r(z.resetsAt) + " 重置", 1)) : E("", !0)])]))), 128))]))];
1002
- }),
1003
- _: 1
1004
- }), c(a(te), {
1005
- key: "invoices",
1006
- title: "订阅账单"
1007
- }, {
1008
- default: s(() => [c(ge, {
1009
- columns: Ke,
1010
- data: _e.value,
1011
- loading: se.value,
1012
- pagination: R.value,
1013
- onPageChange: ht,
1014
- onPageSizeChange: wt
1015
- }, {
1016
- id: s(({
1017
- record: o
1018
- }) => [n("span", {
1019
- class: "copyable-id mono-value",
1020
- title: o.id
1021
- }, [n("span", null, r(o.id), 1), c(Be, {
1022
- value: o.id,
1023
- message: "账单 ID 已复制"
1024
- }, null, 8, ["value"])], 8, Ta)]),
1025
- status: s(({
1026
- record: o
1027
- }) => [c(a(G), {
1028
- color: Qe(o.status)
1029
- }, {
1030
- default: s(() => [g(r(Xe(o.status)), 1)]),
1031
- _: 2
1032
- }, 1032, ["color"])]),
1033
- billingType: s(({
1034
- record: o
1035
- }) => [g(r(tt(o.billingType)), 1)]),
1036
- refund: s(({
1037
- record: o
1038
- }) => [o.refund ? (l(), V(a(pe), {
1039
- key: 0,
1040
- content: a(He)(o.refund.status)
1041
- }, {
1042
- default: s(() => [c(a(G), {
1043
- color: Pe(o.refund.status)
1044
- }, {
1045
- default: s(() => [g(r(ke(o.refund.status)), 1)]),
1046
- _: 2
1047
- }, 1032, ["color"])]),
1048
- _: 2
1049
- }, 1032, ["content"])) : (l(), v("span", Oa, "-"))]),
1050
- total: s(({
1051
- record: o
1052
- }) => [g(" ¥" + r((o.total / 100).toFixed(2)), 1)]),
1053
- actions: s(({
1054
- record: o
1055
- }) => [o.status === "open" ? (l(), v("div", Wa, [c(a(k), {
1056
- type: "primary",
1057
- status: "warning",
1058
- size: "small",
1059
- onClick: (p) => gt(o)
1060
- }, {
1061
- default: s(() => [...t[19] || (t[19] = [g(" 去支付 ", -1)])]),
1062
- _: 1
1063
- }, 8, ["onClick"]), c(a(ee), {
1064
- content: "取消后可重新发起支付,订阅方案不会变更。确定取消吗?",
1065
- onOk: (p) => ft(o)
1066
- }, {
1067
- default: s(() => [c(a(k), {
1068
- type: "secondary",
1069
- status: "warning",
1070
- size: "small"
1071
- }, {
1072
- default: s(() => [...t[20] || (t[20] = [g("取消支付", -1)])]),
1073
- _: 1
1074
- })]),
1075
- _: 1
1076
- }, 8, ["onOk"])])) : o.status === "paid" && !o.refund ? (l(), v("div", La, [c(a(ee), {
1077
- content: "提交后将进入人工审核,审核通过后原路退款。确定申请退款吗?",
1078
- onOk: (p) => mt(o)
1079
- }, {
1080
- default: s(() => [c(a(k), {
1081
- type: "secondary",
1082
- size: "small"
1083
- }, {
1084
- default: s(() => [...t[21] || (t[21] = [g(" 申请退款 ", -1)])]),
1085
- _: 1
1086
- })]),
1087
- _: 1
1088
- }, 8, ["onOk"])])) : (l(), v("span", Ea, "-"))]),
1089
- _: 1
1090
- }, 8, ["data", "loading", "pagination"])]),
1091
- _: 1
1092
- }), c(a(te), {
1093
- key: "points",
1094
- title: "积分账户"
1095
- }, {
1096
- default: s(() => {
1097
- var o;
1098
- return [n("div", Ra, [n("div", Ba, [n("div", null, [t[22] || (t[22] = n("div", {
1099
- class: "points-balance-label"
1100
- }, "当前积分余额", -1)), n("div", $a, r(a(fe)((o = a(x)) == null ? void 0 : o.totalPoints)), 1), t[23] || (t[23] = n("div", {
1101
- class: "points-balance-tip"
1102
- }, "充值后实时到账。退款需账户积分不少于该单充值积分。", -1))]), c(a(k), {
1103
- loading: a(be),
1104
- onClick: a(W)
1105
- }, {
1106
- default: s(() => [...t[24] || (t[24] = [g("刷新余额", -1)])]),
1107
- _: 1
1108
- }, 8, ["loading", "onClick"])]), t[28] || (t[28] = n("div", {
1109
- class: "points-section-header"
1110
- }, [n("h4", null, "充值套餐")], -1)), oe.value ? (l(), v("div", Fa, [c(a(ve))])) : M.value.length === 0 ? (l(), v("div", Ha, [c(a(Re), {
1111
- description: "暂无充值套餐"
1112
- })])) : (l(), v("div", Ua, [(l(!0), v(Z, null, We(M.value, (p) => (l(), v("button", {
1113
- key: p.id,
1114
- type: "button",
1115
- class: Le(["points-package", {
1116
- "points-package--selected": B.value === p.id
1117
- }]),
1118
- onClick: (Q) => B.value = p.id
1119
- }, [n("span", Ma, r(p.name), 1), n("span", Ya, r(L(p.totalPoints)) + " 积分", 1), n("span", qa, "¥" + r(p.priceYuan), 1), n("span", Va, " 基础 " + r(L(p.points)) + " · 赠送 " + r(L(p.bonus)), 1)], 10, Da))), 128))])), n("div", ja, [J.value ? (l(), v("span", Ka, " 应付 ¥" + r(J.value.priceYuan) + ",获得 " + r(L(J.value.totalPoints)) + " 积分 ", 1)) : (l(), v("span", Ga, "请选择充值套餐")), c(a(k), {
1120
- type: "primary",
1121
- loading: le.value,
1122
- disabled: !B.value,
1123
- onClick: dt
1124
- }, {
1125
- default: s(() => [...t[25] || (t[25] = [g(" 立即充值 ", -1)])]),
1126
- _: 1
1127
- }, 8, ["loading", "disabled"])]), t[29] || (t[29] = n("div", {
1128
- class: "points-section-header"
1129
- }, [n("h4", null, "充值记录")], -1)), c(ge, {
1130
- columns: Ge,
1131
- data: he.value,
1132
- loading: ue.value,
1133
- pagination: $.value,
1134
- onPageChange: Pt,
1135
- onPageSizeChange: kt
1136
- }, {
1137
- price: s(({
1138
- record: p
1139
- }) => [g(" ¥" + r(p.priceYuan), 1)]),
1140
- points: s(({
1141
- record: p
1142
- }) => [g(r(L(p.totalPoints)), 1)]),
1143
- status: s(({
1144
- record: p
1145
- }) => [c(a(G), {
1146
- color: Ze(p.status)
1147
- }, {
1148
- default: s(() => [g(r(et(p.status)), 1)]),
1149
- _: 2
1150
- }, 1032, ["color"])]),
1151
- refund: s(({
1152
- record: p
1153
- }) => [p.refund ? (l(), V(a(pe), {
1154
- key: 0,
1155
- content: a(He)(p.refund.status)
1156
- }, {
1157
- default: s(() => [c(a(G), {
1158
- color: Pe(p.refund.status)
1159
- }, {
1160
- default: s(() => [g(r(ke(p.refund.status)), 1)]),
1161
- _: 2
1162
- }, 1032, ["color"])]),
1163
- _: 2
1164
- }, 1032, ["content"])) : (l(), v("span", Ja, "-"))]),
1165
- actions: s(({
1166
- record: p
1167
- }) => [p.status === "paid" && !p.refund ? (l(), v("div", Qa, [Ce(p) ? (l(), V(a(ee), {
1168
- key: 0,
1169
- content: at(p),
1170
- onOk: (Q) => yt(p)
1171
- }, {
1172
- default: s(() => [c(a(k), {
1173
- type: "secondary",
1174
- size: "small"
1175
- }, {
1176
- default: s(() => [...t[26] || (t[26] = [g(" 申请退款 ", -1)])]),
1177
- _: 1
1178
- })]),
1179
- _: 1
1180
- }, 8, ["content", "onOk"])) : (l(), V(a(pe), {
1181
- key: 1,
1182
- content: "账户积分不足,无法退款"
1183
- }, {
1184
- default: s(() => [c(a(k), {
1185
- type: "secondary",
1186
- size: "small",
1187
- disabled: ""
1188
- }, {
1189
- default: s(() => [...t[27] || (t[27] = [g(" 积分不足 ", -1)])]),
1190
- _: 1
1191
- })]),
1192
- _: 1
1193
- }))])) : (l(), v("span", Xa, "-"))]),
1194
- _: 1
1195
- }, 8, ["data", "loading", "pagination"])])];
1196
- }),
1197
- _: 1
1198
- }), c(a(te), {
1199
- key: "usage",
1200
- title: "积分流水"
1201
- }, {
1202
- default: s(() => [c(ge, {
1203
- columns: Je,
1204
- data: we.value,
1205
- loading: ce.value,
1206
- pagination: F.value,
1207
- onPageChange: St,
1208
- onPageSizeChange: Ct
1209
- }, {
1210
- type: s(({
1211
- record: o
1212
- }) => [c(a(G), {
1213
- color: a(jt)(o.type)
1214
- }, {
1215
- default: s(() => [g(r(a(Vt)(o.type)), 1)]),
1216
- _: 2
1217
- }, 1032, ["color"])]),
1218
- subType: s(({
1219
- record: o
1220
- }) => [g(r(a(qt)(o.subType)), 1)]),
1221
- amount: s(({
1222
- record: o
1223
- }) => [n("span", {
1224
- class: Le(ot(o.amount))
1225
- }, r(a(Mt)(o.amount)), 3)]),
1226
- balance: s(({
1227
- record: o
1228
- }) => [g(r(st(o.balance)), 1)]),
1229
- orderId: s(({
1230
- record: o
1231
- }) => [o.orderId ? (l(), v("span", {
1232
- key: 0,
1233
- class: "copyable-id mono-value",
1234
- title: o.orderId
1235
- }, [n("span", null, r(o.orderId), 1), c(Be, {
1236
- value: o.orderId,
1237
- message: "订单号已复制"
1238
- }, null, 8, ["value"])], 8, Za)) : (l(), v("span", en, "-"))]),
1239
- _: 1
1240
- }, 8, ["data", "loading", "pagination"])]),
1241
- _: 1
1242
- })]),
1243
- _: 1
1244
- }, 8, ["active-key"])])];
1245
- }),
1246
- _: 1
1247
- }, 8, ["visible", "width"]), c(a(Ee), {
1248
- visible: Y.value,
1249
- "onUpdate:visible": t[2] || (t[2] = (u) => Y.value = u),
1250
- title: "等待支付完成",
1251
- footer: !1,
1252
- "mask-closable": !1,
1253
- width: 380,
1254
- onCancel: Ne
1255
- }, {
1256
- default: s(() => {
1257
- var u, P;
1258
- return [n("div", tn, [n("div", an, [n("span", null, r(((u = A.value) == null ? void 0 : u.packageName) || "积分充值"), 1), n("strong", null, "¥" + r(((P = A.value) == null ? void 0 : P.priceYuan) || "0.00"), 1)]), n("div", nn, [c(a(ve), {
1259
- size: 32
1260
- })]), n("div", sn, [t[30] || (t[30] = n("span", null, "支付宝收银台已在浏览器打开", -1)), n("small", null, r(a(T) || "请在支付宝页面完成支付,支付成功后这里会自动刷新余额"), 1)]), n("div", on, [c(a(k), {
1261
- onClick: Ne
1262
- }, {
1263
- default: s(() => [...t[31] || (t[31] = [g("取消", -1)])]),
1264
- _: 1
1265
- }), c(a(k), {
1266
- type: "primary",
1267
- loading: a(Ye),
1268
- onClick: pt
1269
- }, {
1270
- default: s(() => [...t[32] || (t[32] = [g(" 我已完成支付 ", -1)])]),
1271
- _: 1
1272
- }, 8, ["loading"])])])];
1273
- }),
1274
- _: 1
1275
- }, 8, ["visible"])], 64));
1276
- }
1277
- }), Nn = /* @__PURE__ */ Ht(ln, [["__scopeId", "data-v-ae9ecdfa"]]);
1278
- export {
1279
- Nn as P,
1280
- xn as a,
1281
- Ut as b,
1282
- fe as f,
1283
- $e as g,
1284
- In as s,
1285
- Me as u,
1286
- Kt as v
1287
- };