@tbox.cn/app-module-parking 1.0.0-alpha.1 → 1.0.0-alpha.11
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.
- package/AGENTS.md +3 -3
- package/dist/{chunk-SI5NHAIK.js → chunk-A5CEUOLD.js} +250 -245
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +104 -104
- package/package.json +12 -9
- package/src/client/cards/parking-info/index.tsx +10 -10
- package/src/client/cards/parking-payment/index.tsx +61 -60
- package/src/client/cards/parking-payment-records/index.tsx +87 -87
- package/src/client/cards/parking-payment-result/index.tsx +28 -15
- package/src/client/cards/parking-vehicle-management/PlateKeyboard.tsx +9 -9
- package/src/client/cards/parking-vehicle-management/index.tsx +33 -33
- package/src/client/index.ts +0 -2
- package/tbox.module.json +0 -1
- package/tsup.config.ts +0 -5
- package/dist/parking-BC2TJ5GU.css +0 -1306
- package/src/client/styles/parking.css +0 -1306
- package/src/client/types/css.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-parking",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "商圈停车模块:计费支付、车辆寻车、缴费记录与开票(codegen 源)。",
|
|
6
6
|
"exports": {
|
|
@@ -18,15 +18,16 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tbox.cn/app-contracts": "1.0.0-alpha.
|
|
22
|
-
"@tbox.cn/app-
|
|
23
|
-
"@tbox.cn/app-
|
|
24
|
-
"@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.
|
|
21
|
+
"@tbox.cn/app-contracts": "1.0.0-alpha.11",
|
|
22
|
+
"@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.11",
|
|
23
|
+
"@tbox.cn/app-contracts-mall": "1.0.0-alpha.11",
|
|
24
|
+
"@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.11"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"zod": "3.25.76",
|
|
28
28
|
"react": "18.3.1",
|
|
29
|
-
"@phosphor-icons/react": "2.1.10"
|
|
29
|
+
"@phosphor-icons/react": "2.1.10",
|
|
30
|
+
"@tbox.cn/app-agent-ui-kit": "^1.0.0-alpha.11"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/react": "18.3.31",
|
|
@@ -59,9 +60,11 @@
|
|
|
59
60
|
"access": "public"
|
|
60
61
|
},
|
|
61
62
|
"license": "MIT",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"@tbox.cn/app-agent-ui-kit": {
|
|
65
|
+
"optional": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
65
68
|
"scripts": {
|
|
66
69
|
"typecheck": "tsc --noEmit",
|
|
67
70
|
"test": "vitest run",
|
|
@@ -16,21 +16,21 @@ export function ParkingInfoCard(props: { data: ParkingInfoCardData }) {
|
|
|
16
16
|
const { data } = props;
|
|
17
17
|
const { subtitle, Icon } = KIND_META[data.kind];
|
|
18
18
|
return (
|
|
19
|
-
<section className="parking-info">
|
|
20
|
-
<header className="parking-info__head">
|
|
21
|
-
<span className="parking-info__head-icon">
|
|
19
|
+
<section className="parking-info w-full bg-card p-3.5 text-foreground">
|
|
20
|
+
<header className="parking-info__head mb-3 flex items-center gap-2">
|
|
21
|
+
<span className="parking-info__head-icon grid size-8 shrink-0 place-items-center rounded-md bg-primary-soft text-primary">
|
|
22
22
|
<Icon weight="duotone" size={24} />
|
|
23
23
|
</span>
|
|
24
|
-
<div className="parking-info__heading">
|
|
25
|
-
<h4>{data.title}</h4>
|
|
26
|
-
<p>{subtitle}</p>
|
|
24
|
+
<div className="parking-info__heading flex min-w-0 flex-col">
|
|
25
|
+
<h4 className="truncate text-base font-bold leading-5.5 text-foreground">{data.title}</h4>
|
|
26
|
+
<p className="mt-1 text-xs leading-4 text-secondary-foreground">{subtitle}</p>
|
|
27
27
|
</div>
|
|
28
28
|
</header>
|
|
29
|
-
<dl className="parking-info__entries">
|
|
29
|
+
<dl className="parking-info__entries grid gap-1.5">
|
|
30
30
|
{data.entries.map((e) => (
|
|
31
|
-
<div key={e.label} className="parking-info__entry">
|
|
32
|
-
<dt>{e.label}</dt>
|
|
33
|
-
<dd>{e.value}</dd>
|
|
31
|
+
<div key={e.label} className="parking-info__entry flex justify-between gap-2.5 rounded-md border-2 border-border bg-muted px-2.5 py-2.25 text-xs leading-4.5">
|
|
32
|
+
<dt className="shrink-0 text-secondary-foreground">{e.label}</dt>
|
|
33
|
+
<dd className="text-right font-medium break-words text-foreground">{e.value}</dd>
|
|
34
34
|
</div>
|
|
35
35
|
))}
|
|
36
36
|
</dl>
|
|
@@ -241,22 +241,22 @@ export function ParkingPaymentCard(props: {
|
|
|
241
241
|
].filter(Boolean).join(' · ');
|
|
242
242
|
|
|
243
243
|
return (
|
|
244
|
-
<section className="parking-payment">
|
|
245
|
-
<header className="parking-payment__hero">
|
|
246
|
-
<div className="parking-payment__hero-content">
|
|
247
|
-
<div className="parking-payment__hero-eyebrow">
|
|
248
|
-
<span>商场停车服务</span>
|
|
249
|
-
{isHistory && <span className="parking-payment__status">历史报价</span>}
|
|
244
|
+
<section className="parking-payment w-full overflow-hidden bg-card text-foreground">
|
|
245
|
+
<header className="parking-payment__hero relative h-41.5 overflow-hidden bg-[#f9f0df] bg-parking-hero">
|
|
246
|
+
<div className="parking-payment__hero-content absolute inset-0 flex flex-col bg-white-soft p-3.5">
|
|
247
|
+
<div className="parking-payment__hero-eyebrow flex items-center justify-between gap-2 text-xs font-semibold leading-4 text-foreground">
|
|
248
|
+
<span className="truncate">商场停车服务</span>
|
|
249
|
+
{isHistory && <span className="parking-payment__status shrink-0 rounded-full border border-border bg-card px-1.5 py-0.5 text-xs leading-4">历史报价</span>}
|
|
250
250
|
</div>
|
|
251
|
-
<div className="parking-payment__hero-main">
|
|
252
|
-
<strong>{data.plateNo}</strong>
|
|
253
|
-
<span>{parkingMeta || '停车费用以商场系统实时结果为准'}</span>
|
|
251
|
+
<div className="parking-payment__hero-main flex min-w-0 flex-1 flex-col justify-center">
|
|
252
|
+
<strong className="truncate text-3xl font-bold leading-8 tracking-wide text-foreground">{data.plateNo}</strong>
|
|
253
|
+
<span className="mt-1 truncate text-xs leading-4 text-foreground">{parkingMeta || '停车费用以商场系统实时结果为准'}</span>
|
|
254
254
|
</div>
|
|
255
255
|
{/* 车辆管理独立成卡(缴费卡只管缴费),这里只发一句 query 把它唤起来 */}
|
|
256
256
|
<div className="parking-payment__hero-actions">
|
|
257
257
|
<button
|
|
258
258
|
type="button"
|
|
259
|
-
className="parking-payment__hero-action"
|
|
259
|
+
className="parking-payment__hero-action inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-border bg-card px-2 py-1 text-xs font-medium leading-4 transition-colors hover:bg-muted disabled:cursor-default disabled:opacity-50"
|
|
260
260
|
disabled={isHistory}
|
|
261
261
|
onClick={() => sendCardAction(cardId, { type: 'sendMessage', value: VEHICLE_MANAGE_QUERY })}
|
|
262
262
|
>
|
|
@@ -267,70 +267,70 @@ export function ParkingPaymentCard(props: {
|
|
|
267
267
|
</div>
|
|
268
268
|
</header>
|
|
269
269
|
|
|
270
|
-
<div className="parking-payment__summary">
|
|
271
|
-
<div className="parking-payment__summary-item">
|
|
272
|
-
<small>已停时长</small>
|
|
273
|
-
<strong>{data.durationText ?? '—'}</strong>
|
|
270
|
+
<div className="parking-payment__summary grid grid-cols-3 border-b-2 border-border bg-card px-1.5 py-2.75">
|
|
271
|
+
<div className="parking-payment__summary-item flex min-w-0 flex-col items-center justify-center border-l-2 border-border px-1 text-center first:border-l-0">
|
|
272
|
+
<small className="max-w-full truncate text-xs leading-4 text-muted-foreground">已停时长</small>
|
|
273
|
+
<strong className="mt-1 max-w-full truncate text-sm font-bold leading-4.5 text-foreground">{data.durationText ?? '—'}</strong>
|
|
274
274
|
</div>
|
|
275
|
-
<div className="parking-payment__summary-item parking-payment__summary-item--benefit">
|
|
276
|
-
<small>优惠减免</small>
|
|
277
|
-
<strong>{discountText ?? '—'}</strong>
|
|
275
|
+
<div className="parking-payment__summary-item parking-payment__summary-item--benefit flex min-w-0 flex-col items-center justify-center border-l-2 border-border px-1 text-center">
|
|
276
|
+
<small className="max-w-full truncate text-xs leading-4 text-muted-foreground">优惠减免</small>
|
|
277
|
+
<strong className="mt-1 max-w-full truncate text-sm font-bold leading-4.5 text-foreground">{discountText ?? '—'}</strong>
|
|
278
278
|
</div>
|
|
279
|
-
<div className="parking-payment__summary-item parking-payment__summary-item--amount">
|
|
280
|
-
<small>当前应付</small>
|
|
281
|
-
<strong>{data.payableText}</strong>
|
|
279
|
+
<div className="parking-payment__summary-item parking-payment__summary-item--amount flex min-w-0 flex-col items-center justify-center border-l-2 border-border px-1 text-center">
|
|
280
|
+
<small className="max-w-full truncate text-xs leading-4 text-muted-foreground">当前应付</small>
|
|
281
|
+
<strong className="mt-1 max-w-full truncate text-sm font-bold leading-4.5 text-warning">{data.payableText}</strong>
|
|
282
282
|
</div>
|
|
283
283
|
</div>
|
|
284
284
|
|
|
285
|
-
<div className="parking-payment__body">
|
|
286
|
-
<section className="parking-payment__billing">
|
|
287
|
-
<header className="parking-payment__billing-head">
|
|
288
|
-
<div>
|
|
289
|
-
<span className="parking-payment__billing-icon">
|
|
285
|
+
<div className="parking-payment__body px-3 pb-2.75 pt-3">
|
|
286
|
+
<section className="parking-payment__billing rounded-xl border-2 border-border bg-card p-2.75">
|
|
287
|
+
<header className="parking-payment__billing-head flex items-center justify-between gap-2.25">
|
|
288
|
+
<div className="flex min-w-0 items-center gap-1.5">
|
|
289
|
+
<span className="parking-payment__billing-icon grid size-5.5 shrink-0 place-items-center rounded-md bg-primary-soft text-primary">
|
|
290
290
|
<CurrencyCircleDollar weight="duotone" size={18} />
|
|
291
291
|
</span>
|
|
292
|
-
<h4>停车费用</h4>
|
|
292
|
+
<h4 className="text-sm font-semibold leading-5 text-foreground">停车费用</h4>
|
|
293
293
|
</div>
|
|
294
294
|
</header>
|
|
295
|
-
<dl className="parking-payment__fees">
|
|
295
|
+
<dl className="parking-payment__fees m-0 mt-1.25">
|
|
296
296
|
{data.feeItems.map((f) => (
|
|
297
|
-
<div key={f.name} className="parking-payment__fee">
|
|
297
|
+
<div key={f.name} className="parking-payment__fee mt-1.75 flex items-center justify-between gap-2.25 text-xs leading-4.5 text-secondary-foreground">
|
|
298
298
|
<dt>{f.name}</dt>
|
|
299
|
-
<dd>{f.amountText}</dd>
|
|
299
|
+
<dd className="text-sm font-semibold text-foreground">{f.amountText}</dd>
|
|
300
300
|
</div>
|
|
301
301
|
))}
|
|
302
|
-
<div className="parking-payment__fee">
|
|
302
|
+
<div className="parking-payment__fee mt-1.75 flex items-center justify-between gap-2.25 text-xs leading-4.5 text-secondary-foreground">
|
|
303
303
|
<dt>停车总费用</dt>
|
|
304
|
-
<dd>{data.totalText}</dd>
|
|
304
|
+
<dd className="text-sm font-semibold text-foreground">{data.totalText}</dd>
|
|
305
305
|
</div>
|
|
306
306
|
{/* 自动生效的权益在这里陈述事实,不在「优惠」区当选项——用户对它没有决策权 */}
|
|
307
307
|
{autoAppliedBenefits.map((benefit) => (
|
|
308
|
-
<div key={benefit.benefitRef} className="parking-payment__fee parking-payment__fee--discount">
|
|
308
|
+
<div key={benefit.benefitRef} className="parking-payment__fee parking-payment__fee--discount mt-1.75 flex items-center justify-between gap-2.25 text-xs leading-4.5 text-secondary-foreground">
|
|
309
309
|
<dt>{benefit.title}</dt>
|
|
310
|
-
<dd>{formatDiscountText(benefit.discountText) ?? '已生效'}</dd>
|
|
310
|
+
<dd className="text-sm font-semibold text-foreground">{formatDiscountText(benefit.discountText) ?? '已生效'}</dd>
|
|
311
311
|
</div>
|
|
312
312
|
))}
|
|
313
313
|
{discountText && (
|
|
314
|
-
<div className="parking-payment__fee parking-payment__fee--discount">
|
|
314
|
+
<div className="parking-payment__fee parking-payment__fee--discount mt-1.75 flex items-center justify-between gap-2.25 text-xs leading-4.5 text-secondary-foreground">
|
|
315
315
|
<dt>优惠减免</dt>
|
|
316
|
-
<dd>{discountText}</dd>
|
|
316
|
+
<dd className="text-sm font-semibold text-foreground">{discountText}</dd>
|
|
317
317
|
</div>
|
|
318
318
|
)}
|
|
319
319
|
</dl>
|
|
320
|
-
<div className="parking-payment__billing-total">
|
|
321
|
-
<strong>当前应付</strong>
|
|
322
|
-
<b>{data.payableText}</b>
|
|
320
|
+
<div className="parking-payment__billing-total mt-2.25 flex items-center justify-between gap-2.25 border-t-2 border-border pt-2">
|
|
321
|
+
<strong className="text-sm leading-5 text-foreground">当前应付</strong>
|
|
322
|
+
<b className="text-2xl font-bold leading-6 text-warning">{data.payableText}</b>
|
|
323
323
|
</div>
|
|
324
324
|
</section>
|
|
325
325
|
|
|
326
326
|
|
|
327
327
|
{selectable.length > 0 && !isFreeOfCharge && (
|
|
328
|
-
<section className="parking-payment__benefit-picker" aria-label="停车优惠选择">
|
|
329
|
-
<div className="parking-payment__benefit-picker-head">
|
|
330
|
-
<h4>优惠</h4>
|
|
331
|
-
{repricing && <span className="parking-payment__benefit-repricing">重算中…</span>}
|
|
328
|
+
<section className="parking-payment__benefit-picker mt-2.25" aria-label="停车优惠选择">
|
|
329
|
+
<div className="parking-payment__benefit-picker-head mb-1.5 flex items-baseline justify-between">
|
|
330
|
+
<h4 className="m-0 text-xs font-semibold leading-4 text-secondary-foreground">优惠</h4>
|
|
331
|
+
{repricing && <span className="parking-payment__benefit-repricing text-xs text-primary">重算中…</span>}
|
|
332
332
|
</div>
|
|
333
|
-
<ul className="parking-payment__benefit-options">
|
|
333
|
+
<ul className="parking-payment__benefit-options m-0 flex list-none flex-col gap-1.5 p-0">
|
|
334
334
|
{selectable.map((benefit) => {
|
|
335
335
|
const checked = selectedRefs.includes(benefit.benefitRef);
|
|
336
336
|
// 已生效项的减免金额是服务端权威值,优先于 selectableBenefits 上的本地预估
|
|
@@ -339,23 +339,24 @@ export function ParkingPaymentCard(props: {
|
|
|
339
339
|
return (
|
|
340
340
|
<li key={benefit.benefitRef}>
|
|
341
341
|
<label
|
|
342
|
-
className={`parking-payment__benefit-option${checked ? ' parking-payment__benefit-option--on' : ''}`}
|
|
342
|
+
className={`parking-payment__benefit-option relative flex items-center gap-1.75 rounded-xl border-2 bg-card px-2.75 py-2 transition-colors ${checked ? 'border-primary bg-primary-soft shadow-sm parking-payment__benefit-option--on' : 'border-border'} ${isHistory || repricing || !repriceToken ? 'cursor-default opacity-55' : 'cursor-pointer'}`}
|
|
343
343
|
>
|
|
344
344
|
{/* 原生 input 保留在无障碍树内,视觉由 __check 承担 */}
|
|
345
345
|
<input
|
|
346
|
+
className="peer sr-only"
|
|
346
347
|
type="checkbox"
|
|
347
348
|
checked={checked}
|
|
348
349
|
disabled={isHistory || repricing || !repriceToken}
|
|
349
350
|
onChange={(e) => toggleBenefit(benefit.benefitRef, e.target.checked)}
|
|
350
351
|
/>
|
|
351
|
-
<span className=
|
|
352
|
+
<span className={`parking-payment__benefit-check inline-flex size-5 shrink-0 items-center justify-center rounded-full border-2 border-border-strong bg-card text-transparent transition-colors peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-primary ${checked ? 'border-primary bg-primary text-white' : ''}`} aria-hidden="true">
|
|
352
353
|
<Check size={14} weight="bold" />
|
|
353
354
|
</span>
|
|
354
|
-
<span className="parking-payment__benefit-option-copy">
|
|
355
|
-
<strong>{benefit.title}</strong>
|
|
355
|
+
<span className="parking-payment__benefit-option-copy min-w-0 flex-1">
|
|
356
|
+
<strong className="block truncate text-xs font-semibold leading-4.5 text-foreground">{benefit.title}</strong>
|
|
356
357
|
</span>
|
|
357
358
|
{amountText && (
|
|
358
|
-
<span className="parking-payment__benefit-amount">
|
|
359
|
+
<span className="parking-payment__benefit-amount shrink-0 text-sm font-bold leading-4.5 tabular-nums text-warning">
|
|
359
360
|
{amountText}
|
|
360
361
|
</span>
|
|
361
362
|
)}
|
|
@@ -364,18 +365,18 @@ export function ParkingPaymentCard(props: {
|
|
|
364
365
|
);
|
|
365
366
|
})}
|
|
366
367
|
</ul>
|
|
367
|
-
{dropNotice && <p className="parking-payment__benefit-notice">{dropNotice}</p>}
|
|
368
|
+
{dropNotice && <p className="parking-payment__benefit-notice mt-1.5 flex gap-1 rounded-md bg-warn-surface px-2 py-1.75 text-xs leading-4 text-warn-ink">{dropNotice}</p>}
|
|
368
369
|
</section>
|
|
369
370
|
)}
|
|
370
371
|
|
|
371
372
|
{(membership?.state === 'not_enrolled' || membership?.state === 'unauthenticated') && (
|
|
372
|
-
<div className="parking-payment__member-guide">
|
|
373
|
-
<span className="parking-payment__member-guide-icon"><Sparkle weight="fill" size={20} /></span>
|
|
374
|
-
<div>
|
|
375
|
-
<strong>{membership.state === 'not_enrolled' ? '入会后可使用会员停车权益' : '登录后查看会员停车权益'}</strong>
|
|
376
|
-
<small>权益以商场会员与停车系统实时结果为准</small>
|
|
373
|
+
<div className="parking-payment__member-guide mt-2.25 flex items-center gap-1.75 rounded-lg border-2 border-warn-border bg-warn-surface p-2.25">
|
|
374
|
+
<span className="parking-payment__member-guide-icon grid size-5.75 shrink-0 place-items-center rounded-md bg-warning text-white"><Sparkle weight="fill" size={20} /></span>
|
|
375
|
+
<div className="grid min-w-0 flex-1 gap-0.5">
|
|
376
|
+
<strong className="text-xs leading-4 text-warn-ink">{membership.state === 'not_enrolled' ? '入会后可使用会员停车权益' : '登录后查看会员停车权益'}</strong>
|
|
377
|
+
<small className="text-xs leading-3.5 text-warn-ink">权益以商场会员与停车系统实时结果为准</small>
|
|
377
378
|
</div>
|
|
378
|
-
<button type="button" disabled={isHistory} onClick={promptMembership}>
|
|
379
|
+
<button className="shrink-0 rounded-full border-0 bg-warning px-2.5 py-1.5 text-xs font-bold text-white" type="button" disabled={isHistory} onClick={promptMembership}>
|
|
379
380
|
{membership.state === 'not_enrolled' ? '立即入会' : '去登录'}
|
|
380
381
|
</button>
|
|
381
382
|
</div>
|
|
@@ -386,10 +387,10 @@ export function ParkingPaymentCard(props: {
|
|
|
386
387
|
服务端重算后报价与本按钮的金额随之刷新)。曾并列一个「不花积分直接支付」副入口,
|
|
387
388
|
它是第二条并行路径——勾着积分却点它就是自相矛盾的状态,故收敛掉。
|
|
388
389
|
*/}
|
|
389
|
-
<div className="parking-payment__actions">
|
|
390
|
+
<div className="parking-payment__actions mt-2.75 grid grid-cols-1 gap-1.5">
|
|
390
391
|
<button
|
|
391
392
|
type="button"
|
|
392
|
-
className="parking-payment__action parking-payment__action--primary"
|
|
393
|
+
className="parking-payment__action parking-payment__action--primary flex min-h-9 items-center justify-center gap-1 whitespace-nowrap rounded-full border-2 border-primary bg-primary px-2.5 text-sm font-bold text-white shadow-md disabled:border-border disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none"
|
|
393
394
|
disabled={submitDisabled}
|
|
394
395
|
title={submitTitle}
|
|
395
396
|
onClick={() => submit(submitBenefitRefs)}
|
|
@@ -416,7 +417,7 @@ export function ParkingPaymentCard(props: {
|
|
|
416
417
|
{/* 按钮为什么灰了必须说清楚,否则用户只会反复点。
|
|
417
418
|
紧跟按钮下方而非浮在优惠区与按钮之间——它解释的是这颗按钮的状态。 */}
|
|
418
419
|
{settlement && (
|
|
419
|
-
<p className={`parking-payment__settlement
|
|
420
|
+
<p className={`parking-payment__settlement mt-2.75 flex items-center gap-1 rounded-md px-2.25 py-1.75 text-xs leading-4 ${settlement.state === 'paid' ? 'bg-success-soft text-success' : settlement.state === 'failed' ? 'bg-danger-soft text-destructive' : 'bg-muted text-secondary-foreground'}`}>
|
|
420
421
|
{settlement.state === 'paid' ? (
|
|
421
422
|
<CheckCircle size={16} weight="fill" />
|
|
422
423
|
) : (
|
|
@@ -427,7 +428,7 @@ export function ParkingPaymentCard(props: {
|
|
|
427
428
|
)}
|
|
428
429
|
|
|
429
430
|
{!confirmToken && !isHistory && !settlement && (
|
|
430
|
-
<p className="parking-payment__token-expired">
|
|
431
|
+
<p className="parking-payment__token-expired mt-2.75 rounded-md border-2 border-danger-border bg-danger-soft px-2 py-1.75 text-xs leading-4 text-destructive">
|
|
431
432
|
支付授权已过期,请重新查询停车费后再支付
|
|
432
433
|
</p>
|
|
433
434
|
)}
|
|
@@ -436,7 +437,7 @@ export function ParkingPaymentCard(props: {
|
|
|
436
437
|
零费用时同样要出:「以出场实际计费为准」在此刻反而最要紧——现在免费不等于
|
|
437
438
|
出场时免费,超时就开始计费。只有 caveats 为空才整块不出。 */}
|
|
438
439
|
{data.caveats.length > 0 && (
|
|
439
|
-
<footer className="parking-payment__foot">
|
|
440
|
+
<footer className="parking-payment__foot mt-2.5 flex items-start gap-1 border-t-2 border-border pt-2.25 text-xs leading-4 text-muted-foreground [&_svg]:shrink-0 [&_svg]:text-primary">
|
|
440
441
|
<ShieldCheck size={14} />
|
|
441
442
|
{data.caveats.join(';')}
|
|
442
443
|
</footer>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* 点击任意记录行弹出底部半屏 Sheet 展示订单详情。
|
|
4
4
|
*/
|
|
5
5
|
import { useEffect, useId, useRef, useState } from 'react';
|
|
6
|
-
import { createPortal } from 'react-dom';
|
|
7
6
|
import { CaretDown, Receipt, X } from '@phosphor-icons/react';
|
|
7
|
+
import { Overlay } from '@tbox.cn/app-agent-ui-kit/overlay';
|
|
8
8
|
import { markSelfRendering, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
|
|
9
9
|
import { plateParts, recordStatusClass, recordStatusText } from '../view';
|
|
10
10
|
import type { ParkingPaymentRecordsCardData } from '@tbox.cn/app-contracts-mall';
|
|
@@ -13,6 +13,18 @@ type RecordItem = ParkingPaymentRecordsCardData['items'][number];
|
|
|
13
13
|
|
|
14
14
|
const PAGE_SIZE = 5;
|
|
15
15
|
|
|
16
|
+
const RECORD_TONE = {
|
|
17
|
+
paid: 'text-success',
|
|
18
|
+
refunded: 'text-warning',
|
|
19
|
+
closed: 'text-muted-foreground',
|
|
20
|
+
unknown: 'text-muted-foreground',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
function recordTone(status: string): string {
|
|
24
|
+
const key = status.toLowerCase() as keyof typeof RECORD_TONE;
|
|
25
|
+
return RECORD_TONE[key] ?? RECORD_TONE.unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
/** 底部半屏详情 Sheet(仿门店导览 ShopDetailSheet) */
|
|
17
29
|
function RecordDetailSheet(props: {
|
|
18
30
|
readonly open: boolean;
|
|
@@ -23,30 +35,17 @@ function RecordDetailSheet(props: {
|
|
|
23
35
|
readonly onClose: () => void;
|
|
24
36
|
}) {
|
|
25
37
|
const { open, record, isHistory, cardId, invoiceToken, onClose } = props;
|
|
26
|
-
const panelRef = useRef<HTMLElement>(null);
|
|
27
38
|
const closeButtonRef = useRef<HTMLButtonElement>(null);
|
|
28
39
|
const titleId = useId();
|
|
29
|
-
|
|
40
|
+
// 两段式关闭:先播退出动画(onExited)再交还父组件——父组件收到 onClose 会把 record 置空,
|
|
41
|
+
// 立刻归还就播不出退场动画。
|
|
42
|
+
const [closing, setClosing] = useState(false);
|
|
43
|
+
const requestClose = () => setClosing(true);
|
|
30
44
|
useEffect(() => {
|
|
31
|
-
if (
|
|
32
|
-
const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
33
|
-
const previousOverflow = document.body.style.overflow;
|
|
34
|
-
document.body.style.overflow = 'hidden';
|
|
35
|
-
closeButtonRef.current?.focus();
|
|
36
|
-
|
|
37
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
38
|
-
if (event.key === 'Escape') onCloseRef.current();
|
|
39
|
-
};
|
|
40
|
-
const onCloseRef = { current: onClose };
|
|
41
|
-
document.addEventListener('keydown', onKeyDown);
|
|
42
|
-
return () => {
|
|
43
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
44
|
-
document.body.style.overflow = previousOverflow;
|
|
45
|
-
previousFocus?.focus();
|
|
46
|
-
};
|
|
45
|
+
if (open) setClosing(false);
|
|
47
46
|
}, [open]);
|
|
48
47
|
|
|
49
|
-
if (!
|
|
48
|
+
if (!record) return null;
|
|
50
49
|
|
|
51
50
|
const act = (actionId: string, recordRef: string | number, token?: string) => {
|
|
52
51
|
if (!token || !cardId || isHistory) return;
|
|
@@ -57,80 +56,83 @@ function RecordDetailSheet(props: {
|
|
|
57
56
|
);
|
|
58
57
|
};
|
|
59
58
|
|
|
60
|
-
return
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
return (
|
|
60
|
+
<Overlay
|
|
61
|
+
open={open && !closing}
|
|
62
|
+
onDismiss={requestClose}
|
|
63
|
+
onExited={onClose}
|
|
64
|
+
placement="bottom"
|
|
65
|
+
labelledBy={titleId}
|
|
66
|
+
initialFocus={closeButtonRef}
|
|
67
|
+
exitMs={200}
|
|
68
|
+
rootClassName="parking-sheet group"
|
|
69
|
+
maskClassName="bg-scrim animate-[parking-sheet-fade-in_200ms_ease_both] group-data-[state=closed]:animate-[parking-sheet-fade-out_200ms_ease-in_both] motion-reduce:animate-none"
|
|
70
|
+
panelClassName="parking-sheet__panel flex max-h-[60vh] w-full flex-col rounded-t-xl bg-card shadow-[0_-8px_32px_rgba(0,0,0,0.12)] animate-[parking-sheet-in_240ms_cubic-bezier(0.22,0.72,0.24,1)_both] group-data-[state=closed]:animate-[parking-sheet-out_200ms_ease-in_both] motion-reduce:animate-none"
|
|
71
|
+
>
|
|
72
|
+
<header className="parking-sheet__header flex items-center justify-between border-b border-border px-3 pb-1.5 pt-2.5">
|
|
73
|
+
<h2 id={titleId} className="m-0 text-base font-bold text-foreground">订单详情</h2>
|
|
72
74
|
<button
|
|
73
75
|
ref={closeButtonRef}
|
|
74
76
|
type="button"
|
|
75
|
-
className="parking-sheet__close"
|
|
77
|
+
className="parking-sheet__close flex size-5 cursor-pointer items-center justify-center rounded-full border-0 bg-muted text-secondary-foreground hover:bg-neutral-soft"
|
|
76
78
|
aria-label="关闭订单详情"
|
|
77
|
-
onClick={
|
|
79
|
+
onClick={requestClose}
|
|
78
80
|
>
|
|
79
81
|
<X size={20} weight="bold" />
|
|
80
82
|
</button>
|
|
81
83
|
</header>
|
|
82
84
|
|
|
83
|
-
<div className="parking-sheet__body">
|
|
84
|
-
<div className="parking-sheet__plate">
|
|
85
|
-
<span className="parking-plate">
|
|
85
|
+
<div className="parking-sheet__body flex-1 overflow-y-auto px-3 pb-5 pt-2.5">
|
|
86
|
+
<div className="parking-sheet__plate mb-2">
|
|
87
|
+
<span className="parking-plate plate-lockup font-mono tabular-nums">
|
|
86
88
|
<b>{plateParts(record.plateNo)[0]}</b>
|
|
87
89
|
<span>{plateParts(record.plateNo)[1]}</span>
|
|
88
90
|
</span>
|
|
89
91
|
</div>
|
|
90
92
|
|
|
91
|
-
<dl className="parking-sheet__facts">
|
|
92
|
-
<div className="parking-sheet__fact-row">
|
|
93
|
-
<dt>订单号</dt>
|
|
94
|
-
<dd>{record.recordRef}</dd>
|
|
93
|
+
<dl className="parking-sheet__facts m-0 grid gap-1.5">
|
|
94
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
95
|
+
<dt className="text-xs text-secondary-foreground">订单号</dt>
|
|
96
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.recordRef}</dd>
|
|
95
97
|
</div>
|
|
96
|
-
<div className="parking-sheet__fact-row">
|
|
97
|
-
<dt>金额</dt>
|
|
98
|
-
<dd>{record.amountText}</dd>
|
|
98
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
99
|
+
<dt className="text-xs text-secondary-foreground">金额</dt>
|
|
100
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.amountText}</dd>
|
|
99
101
|
</div>
|
|
100
|
-
<div className="parking-sheet__fact-row">
|
|
101
|
-
<dt>状态</dt>
|
|
102
|
-
<dd className={recordStatusClass(record.status)}>
|
|
102
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
103
|
+
<dt className="text-xs text-secondary-foreground">状态</dt>
|
|
104
|
+
<dd className={`${recordStatusClass(record.status)} m-0 break-all text-right text-xs ${recordTone(record.status)}`}>
|
|
103
105
|
{recordStatusText(record.status, record.statusText)}
|
|
104
106
|
</dd>
|
|
105
107
|
</div>
|
|
106
108
|
{record.paidAtText && (
|
|
107
|
-
<div className="parking-sheet__fact-row">
|
|
108
|
-
<dt>支付时间</dt>
|
|
109
|
-
<dd>{record.paidAtText}</dd>
|
|
109
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
110
|
+
<dt className="text-xs text-secondary-foreground">支付时间</dt>
|
|
111
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.paidAtText}</dd>
|
|
110
112
|
</div>
|
|
111
113
|
)}
|
|
112
114
|
{record.plazaName && (
|
|
113
|
-
<div className="parking-sheet__fact-row">
|
|
114
|
-
<dt>广场</dt>
|
|
115
|
-
<dd>{record.plazaName}</dd>
|
|
115
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
116
|
+
<dt className="text-xs text-secondary-foreground">广场</dt>
|
|
117
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.plazaName}</dd>
|
|
116
118
|
</div>
|
|
117
119
|
)}
|
|
118
120
|
{record.parkName && (
|
|
119
|
-
<div className="parking-sheet__fact-row">
|
|
120
|
-
<dt>停车场</dt>
|
|
121
|
-
<dd>{record.parkName}</dd>
|
|
121
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
122
|
+
<dt className="text-xs text-secondary-foreground">停车场</dt>
|
|
123
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.parkName}</dd>
|
|
122
124
|
</div>
|
|
123
125
|
)}
|
|
124
126
|
{record.entryAtText && (
|
|
125
|
-
<div className="parking-sheet__fact-row">
|
|
126
|
-
<dt>入场时间</dt>
|
|
127
|
-
<dd>{record.entryAtText}</dd>
|
|
127
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
128
|
+
<dt className="text-xs text-secondary-foreground">入场时间</dt>
|
|
129
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.entryAtText}</dd>
|
|
128
130
|
</div>
|
|
129
131
|
)}
|
|
130
132
|
{record.exitAtText && (
|
|
131
|
-
<div className="parking-sheet__fact-row">
|
|
132
|
-
<dt>出场时间</dt>
|
|
133
|
-
<dd>{record.exitAtText}</dd>
|
|
133
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
134
|
+
<dt className="text-xs text-secondary-foreground">出场时间</dt>
|
|
135
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.exitAtText}</dd>
|
|
134
136
|
</div>
|
|
135
137
|
)}
|
|
136
138
|
</dl>
|
|
@@ -138,7 +140,7 @@ function RecordDetailSheet(props: {
|
|
|
138
140
|
{!isHistory && record.invoiceEligible && !record.invoiceIssued && invoiceToken && (
|
|
139
141
|
<button
|
|
140
142
|
type="button"
|
|
141
|
-
className="parking-sheet__invoice-btn"
|
|
143
|
+
className="parking-sheet__invoice-btn mt-2.5 inline-flex min-h-6.5 w-full cursor-pointer items-center justify-center gap-1.5 rounded-full border-2 border-primary-foreground bg-primary-soft px-3 text-xs text-primary"
|
|
142
144
|
data-action-id="parking.apply-invoice"
|
|
143
145
|
onClick={() => act('parking.apply-invoice', record.recordRef, invoiceToken)}
|
|
144
146
|
>
|
|
@@ -147,12 +149,10 @@ function RecordDetailSheet(props: {
|
|
|
147
149
|
</button>
|
|
148
150
|
)}
|
|
149
151
|
{!isHistory && record.invoiceIssued && (
|
|
150
|
-
<span className="parking-sheet__invoiced">已申请开票</span>
|
|
152
|
+
<span className="parking-sheet__invoiced mt-2.5 flex min-h-6.5 w-full items-center justify-center text-xs text-success">已申请开票</span>
|
|
151
153
|
)}
|
|
152
154
|
</div>
|
|
153
|
-
|
|
154
|
-
</div>,
|
|
155
|
-
document.body,
|
|
155
|
+
</Overlay>
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -172,27 +172,27 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
172
172
|
const invoiceToken = actionTokens?.['parking.apply-invoice'];
|
|
173
173
|
|
|
174
174
|
return (
|
|
175
|
-
<section className="parking-records">
|
|
176
|
-
<header className="parking-records__head">
|
|
177
|
-
<div className="parking-records__heading">
|
|
178
|
-
<span className="parking-records__head-icon">
|
|
175
|
+
<section className="parking-records w-full bg-card p-3.5 text-foreground">
|
|
176
|
+
<header className="parking-records__head mb-2.5 flex items-center justify-between gap-2">
|
|
177
|
+
<div className="parking-records__heading flex min-w-0 items-center gap-2">
|
|
178
|
+
<span className="parking-records__head-icon grid size-8 shrink-0 place-items-center rounded-md bg-primary-soft text-primary">
|
|
179
179
|
<Receipt weight="duotone" size={24} />
|
|
180
180
|
</span>
|
|
181
|
-
<div>
|
|
182
|
-
<h4>缴费记录</h4>
|
|
183
|
-
<p>近 6 个月停车缴费明细</p>
|
|
181
|
+
<div className="flex min-w-0 flex-col">
|
|
182
|
+
<h4 className="truncate text-base font-bold leading-5.5 text-foreground">缴费记录</h4>
|
|
183
|
+
<p className="mt-1 text-xs leading-4 text-secondary-foreground">近 6 个月停车缴费明细</p>
|
|
184
184
|
</div>
|
|
185
185
|
</div>
|
|
186
|
-
<span>共 {data.total} 条</span>
|
|
186
|
+
<span className="shrink-0 text-xs text-secondary-foreground">共 {data.total} 条</span>
|
|
187
187
|
</header>
|
|
188
188
|
{visible.length === 0 ? (
|
|
189
|
-
<div className="parking-records__empty">暂无缴费记录</div>
|
|
189
|
+
<div className="parking-records__empty py-5 text-center text-xs text-muted-foreground">暂无缴费记录</div>
|
|
190
190
|
) : (
|
|
191
|
-
<ul className="parking-records__list">
|
|
191
|
+
<ul className="parking-records__list m-0 grid list-none gap-1.5 p-0">
|
|
192
192
|
{visible.map((r) => (
|
|
193
193
|
<li
|
|
194
194
|
key={r.recordRef}
|
|
195
|
-
className="parking-records__row"
|
|
195
|
+
className="parking-records__row grid cursor-pointer grid-cols-[minmax(0,1fr)_auto] gap-x-2.5 gap-y-1 rounded-md border-2 border-border bg-muted px-2.5 py-2.25 transition-colors hover:border-primary-foreground hover:bg-primary-soft focus-visible:outline-none"
|
|
196
196
|
role={isHistory ? undefined : 'button'}
|
|
197
197
|
tabIndex={isHistory ? undefined : 0}
|
|
198
198
|
onClick={isHistory ? undefined : () => setSelectedRecord(r)}
|
|
@@ -207,19 +207,19 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
>
|
|
210
|
-
<div className="parking-records__main">
|
|
211
|
-
<span className="parking-records__plate parking-plate">
|
|
210
|
+
<div className="parking-records__main grid min-w-0 gap-1">
|
|
211
|
+
<span className="parking-records__plate parking-plate plate-lockup font-mono tabular-nums">
|
|
212
212
|
<b>{plateParts(r.plateNo)[0]}</b>
|
|
213
213
|
<span>{plateParts(r.plateNo)[1]}</span>
|
|
214
214
|
</span>
|
|
215
|
-
<small>
|
|
215
|
+
<small className="truncate text-xs leading-4 text-secondary-foreground">
|
|
216
216
|
{r.paidAtText}
|
|
217
217
|
{r.parkName ? ` · ${r.parkName}` : ''}
|
|
218
218
|
</small>
|
|
219
219
|
</div>
|
|
220
|
-
<div className="parking-records__amount">
|
|
221
|
-
<strong>{r.amountText}</strong>
|
|
222
|
-
<em className={recordStatusClass(r.status)}>
|
|
220
|
+
<div className="parking-records__amount grid content-start justify-items-end gap-0.5">
|
|
221
|
+
<strong className="text-base font-bold leading-5.5 text-foreground">{r.amountText}</strong>
|
|
222
|
+
<em className={`${recordStatusClass(r.status)} text-xs not-italic leading-4 ${recordTone(r.status)}`}>
|
|
223
223
|
{recordStatusText(r.status, r.statusText)}
|
|
224
224
|
</em>
|
|
225
225
|
</div>
|
|
@@ -230,7 +230,7 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
230
230
|
{collapsible && !isHistory && (
|
|
231
231
|
<button
|
|
232
232
|
type="button"
|
|
233
|
-
className="parking-records__more"
|
|
233
|
+
className="parking-records__more mt-2 flex min-h-7.5 w-full cursor-pointer items-center justify-center gap-1.5 rounded-md border-0 bg-muted text-xs text-secondary-foreground [&_svg]:transition-transform [&_svg[data-rotated]]:rotate-180"
|
|
234
234
|
aria-expanded={expanded}
|
|
235
235
|
onClick={() => setExpanded((v) => !v)}
|
|
236
236
|
>
|
|
@@ -239,10 +239,10 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
239
239
|
</button>
|
|
240
240
|
)}
|
|
241
241
|
{data.caveats.length > 0 && (
|
|
242
|
-
<p className="parking-records__caveats">{data.caveats.join(';')}</p>
|
|
242
|
+
<p className="parking-records__caveats mt-2.25 text-xs leading-4 text-muted-foreground">{data.caveats.join(';')}</p>
|
|
243
243
|
)}
|
|
244
244
|
{data.message && (
|
|
245
|
-
<p className="parking-records__message">{data.message}</p>
|
|
245
|
+
<p className="parking-records__message mt-2.25 rounded-md bg-primary-soft px-2 py-1.75 text-xs leading-4 text-primary">{data.message}</p>
|
|
246
246
|
)}
|
|
247
247
|
<RecordDetailSheet
|
|
248
248
|
open={!!selectedRecord}
|