@tbox.cn/app-module-parking 0.10.11 → 1.0.0-alpha.6
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-KT2OXQJ5.js} +198 -179
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +20 -20
- package/package.json +5 -8
- 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 +68 -56
- 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
|
@@ -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;
|
|
@@ -58,21 +70,21 @@ function RecordDetailSheet(props: {
|
|
|
58
70
|
};
|
|
59
71
|
|
|
60
72
|
return createPortal(
|
|
61
|
-
<div className="parking-sheet" role="presentation">
|
|
62
|
-
<div className="parking-sheet__mask" aria-hidden="true" onClick={onClose} />
|
|
73
|
+
<div className="parking-sheet fixed inset-0 z-[1000]" role="presentation">
|
|
74
|
+
<div className="parking-sheet__mask absolute inset-0 bg-scrim animate-[parking-sheet-fade-in_200ms_ease_both]" aria-hidden="true" onClick={onClose} />
|
|
63
75
|
<section
|
|
64
76
|
ref={panelRef}
|
|
65
|
-
className="parking-sheet__panel"
|
|
77
|
+
className="parking-sheet__panel absolute inset-x-0 bottom-0 flex max-h-[60vh] 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]"
|
|
66
78
|
role="dialog"
|
|
67
79
|
aria-modal="true"
|
|
68
80
|
aria-labelledby={titleId}
|
|
69
81
|
>
|
|
70
|
-
<header className="parking-sheet__header">
|
|
71
|
-
<h2 id={titleId}>订单详情</h2>
|
|
82
|
+
<header className="parking-sheet__header flex items-center justify-between border-b border-border px-3 pb-1.5 pt-2.5">
|
|
83
|
+
<h2 id={titleId} className="m-0 text-base font-bold text-foreground">订单详情</h2>
|
|
72
84
|
<button
|
|
73
85
|
ref={closeButtonRef}
|
|
74
86
|
type="button"
|
|
75
|
-
className="parking-sheet__close"
|
|
87
|
+
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
88
|
aria-label="关闭订单详情"
|
|
77
89
|
onClick={onClose}
|
|
78
90
|
>
|
|
@@ -80,57 +92,57 @@ function RecordDetailSheet(props: {
|
|
|
80
92
|
</button>
|
|
81
93
|
</header>
|
|
82
94
|
|
|
83
|
-
<div className="parking-sheet__body">
|
|
84
|
-
<div className="parking-sheet__plate">
|
|
85
|
-
<span className="parking-plate">
|
|
95
|
+
<div className="parking-sheet__body flex-1 overflow-y-auto px-3 pb-5 pt-2.5">
|
|
96
|
+
<div className="parking-sheet__plate mb-2">
|
|
97
|
+
<span className="parking-plate plate-lockup font-mono tabular-nums">
|
|
86
98
|
<b>{plateParts(record.plateNo)[0]}</b>
|
|
87
99
|
<span>{plateParts(record.plateNo)[1]}</span>
|
|
88
100
|
</span>
|
|
89
101
|
</div>
|
|
90
102
|
|
|
91
|
-
<dl className="parking-sheet__facts">
|
|
92
|
-
<div className="parking-sheet__fact-row">
|
|
93
|
-
<dt>订单号</dt>
|
|
94
|
-
<dd>{record.recordRef}</dd>
|
|
103
|
+
<dl className="parking-sheet__facts m-0 grid gap-1.5">
|
|
104
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
105
|
+
<dt className="text-xs text-secondary-foreground">订单号</dt>
|
|
106
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.recordRef}</dd>
|
|
95
107
|
</div>
|
|
96
|
-
<div className="parking-sheet__fact-row">
|
|
97
|
-
<dt>金额</dt>
|
|
98
|
-
<dd>{record.amountText}</dd>
|
|
108
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
109
|
+
<dt className="text-xs text-secondary-foreground">金额</dt>
|
|
110
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.amountText}</dd>
|
|
99
111
|
</div>
|
|
100
|
-
<div className="parking-sheet__fact-row">
|
|
101
|
-
<dt>状态</dt>
|
|
102
|
-
<dd className={recordStatusClass(record.status)}>
|
|
112
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
113
|
+
<dt className="text-xs text-secondary-foreground">状态</dt>
|
|
114
|
+
<dd className={`${recordStatusClass(record.status)} m-0 break-all text-right text-xs ${recordTone(record.status)}`}>
|
|
103
115
|
{recordStatusText(record.status, record.statusText)}
|
|
104
116
|
</dd>
|
|
105
117
|
</div>
|
|
106
118
|
{record.paidAtText && (
|
|
107
|
-
<div className="parking-sheet__fact-row">
|
|
108
|
-
<dt>支付时间</dt>
|
|
109
|
-
<dd>{record.paidAtText}</dd>
|
|
119
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
120
|
+
<dt className="text-xs text-secondary-foreground">支付时间</dt>
|
|
121
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.paidAtText}</dd>
|
|
110
122
|
</div>
|
|
111
123
|
)}
|
|
112
124
|
{record.plazaName && (
|
|
113
|
-
<div className="parking-sheet__fact-row">
|
|
114
|
-
<dt>广场</dt>
|
|
115
|
-
<dd>{record.plazaName}</dd>
|
|
125
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
126
|
+
<dt className="text-xs text-secondary-foreground">广场</dt>
|
|
127
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.plazaName}</dd>
|
|
116
128
|
</div>
|
|
117
129
|
)}
|
|
118
130
|
{record.parkName && (
|
|
119
|
-
<div className="parking-sheet__fact-row">
|
|
120
|
-
<dt>停车场</dt>
|
|
121
|
-
<dd>{record.parkName}</dd>
|
|
131
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
132
|
+
<dt className="text-xs text-secondary-foreground">停车场</dt>
|
|
133
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.parkName}</dd>
|
|
122
134
|
</div>
|
|
123
135
|
)}
|
|
124
136
|
{record.entryAtText && (
|
|
125
|
-
<div className="parking-sheet__fact-row">
|
|
126
|
-
<dt>入场时间</dt>
|
|
127
|
-
<dd>{record.entryAtText}</dd>
|
|
137
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
138
|
+
<dt className="text-xs text-secondary-foreground">入场时间</dt>
|
|
139
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.entryAtText}</dd>
|
|
128
140
|
</div>
|
|
129
141
|
)}
|
|
130
142
|
{record.exitAtText && (
|
|
131
|
-
<div className="parking-sheet__fact-row">
|
|
132
|
-
<dt>出场时间</dt>
|
|
133
|
-
<dd>{record.exitAtText}</dd>
|
|
143
|
+
<div className="parking-sheet__fact-row flex justify-between gap-2.5">
|
|
144
|
+
<dt className="text-xs text-secondary-foreground">出场时间</dt>
|
|
145
|
+
<dd className="m-0 break-all text-right text-xs text-foreground">{record.exitAtText}</dd>
|
|
134
146
|
</div>
|
|
135
147
|
)}
|
|
136
148
|
</dl>
|
|
@@ -138,7 +150,7 @@ function RecordDetailSheet(props: {
|
|
|
138
150
|
{!isHistory && record.invoiceEligible && !record.invoiceIssued && invoiceToken && (
|
|
139
151
|
<button
|
|
140
152
|
type="button"
|
|
141
|
-
className="parking-sheet__invoice-btn"
|
|
153
|
+
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
154
|
data-action-id="parking.apply-invoice"
|
|
143
155
|
onClick={() => act('parking.apply-invoice', record.recordRef, invoiceToken)}
|
|
144
156
|
>
|
|
@@ -147,7 +159,7 @@ function RecordDetailSheet(props: {
|
|
|
147
159
|
</button>
|
|
148
160
|
)}
|
|
149
161
|
{!isHistory && record.invoiceIssued && (
|
|
150
|
-
<span className="parking-sheet__invoiced">已申请开票</span>
|
|
162
|
+
<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
163
|
)}
|
|
152
164
|
</div>
|
|
153
165
|
</section>
|
|
@@ -172,27 +184,27 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
172
184
|
const invoiceToken = actionTokens?.['parking.apply-invoice'];
|
|
173
185
|
|
|
174
186
|
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">
|
|
187
|
+
<section className="parking-records w-full bg-card p-3.5 text-foreground">
|
|
188
|
+
<header className="parking-records__head mb-2.5 flex items-center justify-between gap-2">
|
|
189
|
+
<div className="parking-records__heading flex min-w-0 items-center gap-2">
|
|
190
|
+
<span className="parking-records__head-icon grid size-8 shrink-0 place-items-center rounded-md bg-primary-soft text-primary">
|
|
179
191
|
<Receipt weight="duotone" size={24} />
|
|
180
192
|
</span>
|
|
181
|
-
<div>
|
|
182
|
-
<h4>缴费记录</h4>
|
|
183
|
-
<p>近 6 个月停车缴费明细</p>
|
|
193
|
+
<div className="flex min-w-0 flex-col">
|
|
194
|
+
<h4 className="truncate text-base font-bold leading-5.5 text-foreground">缴费记录</h4>
|
|
195
|
+
<p className="mt-1 text-xs leading-4 text-secondary-foreground">近 6 个月停车缴费明细</p>
|
|
184
196
|
</div>
|
|
185
197
|
</div>
|
|
186
|
-
<span>共 {data.total} 条</span>
|
|
198
|
+
<span className="shrink-0 text-xs text-secondary-foreground">共 {data.total} 条</span>
|
|
187
199
|
</header>
|
|
188
200
|
{visible.length === 0 ? (
|
|
189
|
-
<div className="parking-records__empty">暂无缴费记录</div>
|
|
201
|
+
<div className="parking-records__empty py-5 text-center text-xs text-muted-foreground">暂无缴费记录</div>
|
|
190
202
|
) : (
|
|
191
|
-
<ul className="parking-records__list">
|
|
203
|
+
<ul className="parking-records__list m-0 grid list-none gap-1.5 p-0">
|
|
192
204
|
{visible.map((r) => (
|
|
193
205
|
<li
|
|
194
206
|
key={r.recordRef}
|
|
195
|
-
className="parking-records__row"
|
|
207
|
+
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
208
|
role={isHistory ? undefined : 'button'}
|
|
197
209
|
tabIndex={isHistory ? undefined : 0}
|
|
198
210
|
onClick={isHistory ? undefined : () => setSelectedRecord(r)}
|
|
@@ -207,19 +219,19 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
221
|
>
|
|
210
|
-
<div className="parking-records__main">
|
|
211
|
-
<span className="parking-records__plate parking-plate">
|
|
222
|
+
<div className="parking-records__main grid min-w-0 gap-1">
|
|
223
|
+
<span className="parking-records__plate parking-plate plate-lockup font-mono tabular-nums">
|
|
212
224
|
<b>{plateParts(r.plateNo)[0]}</b>
|
|
213
225
|
<span>{plateParts(r.plateNo)[1]}</span>
|
|
214
226
|
</span>
|
|
215
|
-
<small>
|
|
227
|
+
<small className="truncate text-xs leading-4 text-secondary-foreground">
|
|
216
228
|
{r.paidAtText}
|
|
217
229
|
{r.parkName ? ` · ${r.parkName}` : ''}
|
|
218
230
|
</small>
|
|
219
231
|
</div>
|
|
220
|
-
<div className="parking-records__amount">
|
|
221
|
-
<strong>{r.amountText}</strong>
|
|
222
|
-
<em className={recordStatusClass(r.status)}>
|
|
232
|
+
<div className="parking-records__amount grid content-start justify-items-end gap-0.5">
|
|
233
|
+
<strong className="text-base font-bold leading-5.5 text-foreground">{r.amountText}</strong>
|
|
234
|
+
<em className={`${recordStatusClass(r.status)} text-xs not-italic leading-4 ${recordTone(r.status)}`}>
|
|
223
235
|
{recordStatusText(r.status, r.statusText)}
|
|
224
236
|
</em>
|
|
225
237
|
</div>
|
|
@@ -230,7 +242,7 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
230
242
|
{collapsible && !isHistory && (
|
|
231
243
|
<button
|
|
232
244
|
type="button"
|
|
233
|
-
className="parking-records__more"
|
|
245
|
+
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
246
|
aria-expanded={expanded}
|
|
235
247
|
onClick={() => setExpanded((v) => !v)}
|
|
236
248
|
>
|
|
@@ -239,10 +251,10 @@ export function ParkingPaymentRecordsCard(props: {
|
|
|
239
251
|
</button>
|
|
240
252
|
)}
|
|
241
253
|
{data.caveats.length > 0 && (
|
|
242
|
-
<p className="parking-records__caveats">{data.caveats.join(';')}</p>
|
|
254
|
+
<p className="parking-records__caveats mt-2.25 text-xs leading-4 text-muted-foreground">{data.caveats.join(';')}</p>
|
|
243
255
|
)}
|
|
244
256
|
{data.message && (
|
|
245
|
-
<p className="parking-records__message">{data.message}</p>
|
|
257
|
+
<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
258
|
)}
|
|
247
259
|
<RecordDetailSheet
|
|
248
260
|
open={!!selectedRecord}
|
|
@@ -8,6 +8,18 @@ import type { ParkingPaymentResultCardData } from '@tbox.cn/app-contracts-mall';
|
|
|
8
8
|
|
|
9
9
|
const ICONS = { paid: CheckCircle, cancelled: WarningCircle, unknown: Clock } as const;
|
|
10
10
|
|
|
11
|
+
const RESULT_ICON = {
|
|
12
|
+
paid: 'bg-success text-white',
|
|
13
|
+
cancelled: 'bg-muted text-secondary-foreground',
|
|
14
|
+
unknown: 'bg-warning-soft text-warning',
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
const RESULT_AMOUNT = {
|
|
18
|
+
paid: 'text-success',
|
|
19
|
+
cancelled: 'text-foreground',
|
|
20
|
+
unknown: 'text-foreground',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
11
23
|
export function ParkingPaymentResultCard(props: {
|
|
12
24
|
data: ParkingPaymentResultCardData;
|
|
13
25
|
cardId: string;
|
|
@@ -18,41 +30,42 @@ export function ParkingPaymentResultCard(props: {
|
|
|
18
30
|
const cls = paymentResultClass(data.status);
|
|
19
31
|
const Icon = ICONS[cls === 'parking-result--paid' ? 'paid' : cls === 'parking-result--cancelled' ? 'cancelled' : 'unknown'];
|
|
20
32
|
const token = actionTokens?.['parking.refresh-payment'];
|
|
33
|
+
const tone = cls.replace('parking-result--', '') as keyof typeof RESULT_ICON;
|
|
21
34
|
|
|
22
35
|
return (
|
|
23
|
-
<section className={`parking-result ${cls}`}>
|
|
24
|
-
<header className="parking-result__head">
|
|
25
|
-
<span className=
|
|
36
|
+
<section className={`parking-result ${cls} grid w-full gap-2.5 bg-card p-3.5 text-foreground`}>
|
|
37
|
+
<header className="parking-result__head flex items-center gap-2">
|
|
38
|
+
<span className={`parking-result__icon grid size-8 shrink-0 place-items-center rounded-full ${RESULT_ICON[tone]}`}>
|
|
26
39
|
<Icon size={30} weight="fill" />
|
|
27
40
|
</span>
|
|
28
|
-
<div className="parking-result__heading">
|
|
29
|
-
<h4>{paymentResultText(data.status)}</h4>
|
|
30
|
-
<small>{data.message}</small>
|
|
41
|
+
<div className="parking-result__heading min-w-0 flex-1">
|
|
42
|
+
<h4 className="text-base font-bold leading-5.5 text-foreground">{paymentResultText(data.status)}</h4>
|
|
43
|
+
<small className="block text-xs leading-4 text-secondary-foreground">{data.message}</small>
|
|
31
44
|
</div>
|
|
32
45
|
</header>
|
|
33
46
|
|
|
34
47
|
{data.amountText && (
|
|
35
|
-
<div className="parking-result__amount-row">
|
|
36
|
-
<b className=
|
|
48
|
+
<div className="parking-result__amount-row flex items-baseline gap-1.5">
|
|
49
|
+
<b className={`parking-result__amount text-3xl font-bold leading-8 tabular-nums ${RESULT_AMOUNT[tone]}`}>{data.amountText}</b>
|
|
37
50
|
{/* CANCELLED 是终态:这笔钱没付成,不是「待确认」 */}
|
|
38
|
-
<span>{data.status === 'PAID' ? '已支付' : data.status === 'CANCELLED' ? '未支付' : '待确认'}</span>
|
|
51
|
+
<span className="text-xs text-secondary-foreground">{data.status === 'PAID' ? '已支付' : data.status === 'CANCELLED' ? '未支付' : '待确认'}</span>
|
|
39
52
|
</div>
|
|
40
53
|
)}
|
|
41
54
|
|
|
42
55
|
{/* 离场时限是缴费后最要紧的一句:超时重新计费,比金额更需要被看见 */}
|
|
43
56
|
{data.leaveNotice && (
|
|
44
|
-
<p className="parking-result__leave">
|
|
57
|
+
<p className="parking-result__leave flex items-center gap-1.5 rounded-lg border-2 border-warn-border bg-warn-surface px-2.5 py-2 text-xs font-semibold leading-4 text-warn-ink">
|
|
45
58
|
<Clock size={16} weight="fill" />
|
|
46
59
|
{data.leaveNotice}
|
|
47
60
|
</p>
|
|
48
61
|
)}
|
|
49
62
|
|
|
50
63
|
{data.details && data.details.length > 0 && (
|
|
51
|
-
<dl className="parking-result__details">
|
|
64
|
+
<dl className="parking-result__details grid gap-1.75 rounded-md bg-muted px-3 py-2.75">
|
|
52
65
|
{data.details.map((d) => (
|
|
53
|
-
<div key={d.label}>
|
|
54
|
-
<dt>{d.label}</dt>
|
|
55
|
-
<dd>{d.value}</dd>
|
|
66
|
+
<div key={d.label} className="flex items-baseline justify-between gap-2.5">
|
|
67
|
+
<dt className="text-xs leading-4 text-secondary-foreground">{d.label}</dt>
|
|
68
|
+
<dd className="text-right text-xs font-semibold leading-4 break-words text-foreground">{d.value}</dd>
|
|
56
69
|
</div>
|
|
57
70
|
))}
|
|
58
71
|
</dl>
|
|
@@ -61,7 +74,7 @@ export function ParkingPaymentResultCard(props: {
|
|
|
61
74
|
{data.retryable && data.paymentRef && !isHistory && (
|
|
62
75
|
<button
|
|
63
76
|
type="button"
|
|
64
|
-
className="parking-result__refresh"
|
|
77
|
+
className="parking-result__refresh min-h-8.5 cursor-pointer rounded-full border-2 border-primary-foreground bg-primary-soft px-4.5 text-xs font-semibold text-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
65
78
|
disabled={!token}
|
|
66
79
|
onClick={() => {
|
|
67
80
|
if (!token || isHistory) return;
|
|
@@ -27,7 +27,7 @@ export function PlateKeyboard(props: {
|
|
|
27
27
|
<button
|
|
28
28
|
type="button"
|
|
29
29
|
key={key}
|
|
30
|
-
className="parking-kb__key"
|
|
30
|
+
className="parking-kb__key h-6.5 min-w-0 rounded-sm bg-card text-xs font-semibold tabular-nums transition active:scale-95 active:bg-muted disabled:opacity-35"
|
|
31
31
|
data-kb-key={key}
|
|
32
32
|
disabled={isKeyDisabled(state, key)}
|
|
33
33
|
title={key === '台' ? '暂不支持台湾地区车牌' : undefined}
|
|
@@ -39,11 +39,11 @@ export function PlateKeyboard(props: {
|
|
|
39
39
|
|
|
40
40
|
if (state.panel === 'province') {
|
|
41
41
|
return (
|
|
42
|
-
<div className="parking-kb" role="group" aria-label="车牌省份键盘">
|
|
42
|
+
<div className="parking-kb mt-1 grid grid-cols-10 gap-1.5 rounded-lg bg-muted p-1.5" role="group" aria-label="车牌省份键盘">
|
|
43
43
|
{PLATE_PROVINCES.map(charKey)}
|
|
44
44
|
<button
|
|
45
45
|
type="button"
|
|
46
|
-
className="parking-kb__key parking-kb__key--fn
|
|
46
|
+
className="parking-kb__key parking-kb__key--fn col-span-2 h-6.5 min-w-0 rounded-sm bg-muted text-xs font-medium text-secondary-foreground transition active:scale-95 active:bg-neutral-soft disabled:opacity-35"
|
|
47
47
|
data-kb-action="letters"
|
|
48
48
|
onClick={() => onSwitchPanel('alnum')}
|
|
49
49
|
>
|
|
@@ -51,7 +51,7 @@ export function PlateKeyboard(props: {
|
|
|
51
51
|
</button>
|
|
52
52
|
<button
|
|
53
53
|
type="button"
|
|
54
|
-
className="parking-kb__key parking-kb__key--fn
|
|
54
|
+
className="parking-kb__key parking-kb__key--fn col-span-3 h-6.5 min-w-0 rounded-sm bg-muted text-xs font-medium text-secondary-foreground transition active:scale-95 active:bg-neutral-soft disabled:opacity-35"
|
|
55
55
|
data-kb-action="backspace"
|
|
56
56
|
aria-label="退格"
|
|
57
57
|
onClick={onBackspace}
|
|
@@ -60,7 +60,7 @@ export function PlateKeyboard(props: {
|
|
|
60
60
|
</button>
|
|
61
61
|
<button
|
|
62
62
|
type="button"
|
|
63
|
-
className="parking-kb__key parking-kb__key--done
|
|
63
|
+
className="parking-kb__key parking-kb__key--done col-span-4 h-6.5 min-w-0 rounded-sm bg-primary text-xs font-semibold text-white transition active:bg-[var(--tbox-primary-dark,#2368ec)] disabled:opacity-35"
|
|
64
64
|
data-kb-action="done"
|
|
65
65
|
onClick={onDone}
|
|
66
66
|
>
|
|
@@ -71,14 +71,14 @@ export function PlateKeyboard(props: {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<div className="parking-kb" role="group" aria-label="车牌字母数字键盘">
|
|
74
|
+
<div className="parking-kb mt-1 grid grid-cols-10 gap-1.5 rounded-lg bg-muted p-1.5" role="group" aria-label="车牌字母数字键盘">
|
|
75
75
|
{PLATE_DIGITS.map(charKey)}
|
|
76
76
|
{PLATE_LETTERS.slice(0, 10).map(charKey)}
|
|
77
77
|
{PLATE_LETTERS.slice(10, 20).map(charKey)}
|
|
78
78
|
{[...PLATE_LETTERS.slice(20), ...PLATE_SPECIAL_LAST, '台'].map(charKey)}
|
|
79
79
|
<button
|
|
80
80
|
type="button"
|
|
81
|
-
className="parking-kb__key parking-kb__key--fn
|
|
81
|
+
className="parking-kb__key parking-kb__key--fn col-span-3 h-6.5 min-w-0 rounded-sm bg-muted text-xs font-medium text-secondary-foreground transition active:scale-95 active:bg-neutral-soft disabled:opacity-35"
|
|
82
82
|
data-kb-action="province"
|
|
83
83
|
onClick={() => onSwitchPanel('province')}
|
|
84
84
|
>
|
|
@@ -86,7 +86,7 @@ export function PlateKeyboard(props: {
|
|
|
86
86
|
</button>
|
|
87
87
|
<button
|
|
88
88
|
type="button"
|
|
89
|
-
className="parking-kb__key parking-kb__key--fn
|
|
89
|
+
className="parking-kb__key parking-kb__key--fn col-span-3 h-6.5 min-w-0 rounded-sm bg-muted text-xs font-medium text-secondary-foreground transition active:scale-95 active:bg-neutral-soft disabled:opacity-35"
|
|
90
90
|
data-kb-action="backspace"
|
|
91
91
|
aria-label="退格"
|
|
92
92
|
onClick={onBackspace}
|
|
@@ -95,7 +95,7 @@ export function PlateKeyboard(props: {
|
|
|
95
95
|
</button>
|
|
96
96
|
<button
|
|
97
97
|
type="button"
|
|
98
|
-
className="parking-kb__key parking-kb__key--done
|
|
98
|
+
className="parking-kb__key parking-kb__key--done col-span-4 h-6.5 min-w-0 rounded-sm bg-primary text-xs font-semibold text-white transition active:bg-[var(--tbox-primary-dark,#2368ec)] disabled:opacity-35"
|
|
99
99
|
data-kb-action="done"
|
|
100
100
|
onClick={onDone}
|
|
101
101
|
>
|
|
@@ -127,13 +127,13 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
127
127
|
|
|
128
128
|
/** 分格车牌输入:格子只负责显示,真实输入落在覆盖其上的透明 input 上。 */
|
|
129
129
|
const renderPlateField = () => (
|
|
130
|
-
<div className="parking-vm__plate-field">
|
|
131
|
-
<span className="parking-vm__plate-label">车牌</span>
|
|
130
|
+
<div className="parking-vm__plate-field mb-1.75 flex items-center gap-2.25">
|
|
131
|
+
<span className="parking-vm__plate-label shrink-0 text-sm font-semibold text-foreground">车牌</span>
|
|
132
132
|
{/* 容器不再挂 onClick:格子 span 已接管点击,冒泡到容器会覆盖格位光标 */}
|
|
133
|
-
<div className="parking-vm__plate-cells">
|
|
133
|
+
<div className="parking-vm__plate-cells relative flex min-w-0 flex-1 cursor-text items-center gap-1">
|
|
134
134
|
<input
|
|
135
135
|
ref={plateInputRef}
|
|
136
|
-
className="parking-vm__plate-native"
|
|
136
|
+
className="parking-vm__plate-native pointer-events-none absolute inset-0 w-full cursor-text border-0 bg-transparent p-0 text-transparent caret-transparent outline-none"
|
|
137
137
|
value={plate}
|
|
138
138
|
maxLength={PLATE_CELL_COUNT}
|
|
139
139
|
autoCapitalize="characters"
|
|
@@ -155,11 +155,11 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
155
155
|
return (
|
|
156
156
|
<Fragment key={i}>
|
|
157
157
|
{/* 分隔点是格子的兄弟而非子节点:嵌进格子会吃掉它的宽度,让第 3 格明显变窄 */}
|
|
158
|
-
{i === 2 && <i className="parking-vm__plate-dot" aria-hidden="true" />}
|
|
158
|
+
{i === 2 && <i className="parking-vm__plate-dot size-1 shrink-0 rounded-full bg-border-strong" aria-hidden="true" />}
|
|
159
159
|
<span
|
|
160
160
|
className={[
|
|
161
|
-
'parking-vm__plate-cell',
|
|
162
|
-
active ? 'parking-vm__plate-cell--active' : '',
|
|
161
|
+
'parking-vm__plate-cell flex h-10.5 min-w-0 flex-1 items-center justify-center rounded-md border-2 border-transparent bg-muted text-base font-semibold tabular-nums transition-colors',
|
|
162
|
+
active ? 'parking-vm__plate-cell--active border-primary bg-card' : '',
|
|
163
163
|
].filter(Boolean).join(' ')}
|
|
164
164
|
onClick={() => handleCellsClick(i)}
|
|
165
165
|
>
|
|
@@ -203,20 +203,20 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
203
203
|
const showEnrollGuide = data.membership?.state === 'not_enrolled' && !isHistory;
|
|
204
204
|
|
|
205
205
|
return (
|
|
206
|
-
<section className={`parking-vm${showCompose ? ' parking-vm--composing' : ''}`}>
|
|
207
|
-
<header className="parking-vm__head">
|
|
208
|
-
<span className="parking-vm__head-icon">
|
|
206
|
+
<section className={`parking-vm grid w-full gap-2.75 bg-card p-3.5 text-foreground ${showCompose ? ' parking-vm--composing' : ''}`}>
|
|
207
|
+
<header className="parking-vm__head mb-3 flex items-center gap-2">
|
|
208
|
+
<span className="parking-vm__head-icon grid size-8 shrink-0 place-items-center rounded-md bg-primary-soft text-primary">
|
|
209
209
|
<Car weight="duotone" size={24} />
|
|
210
210
|
</span>
|
|
211
|
-
<div className="parking-vm__heading">
|
|
212
|
-
<h4>{showCompose ? '添加车辆' : '我的车辆'}</h4>
|
|
213
|
-
<p>车辆用于缴费与权益折扣</p>
|
|
211
|
+
<div className="parking-vm__heading flex min-w-0 flex-1 flex-col">
|
|
212
|
+
<h4 className="truncate text-base font-bold leading-5.5 text-foreground">{showCompose ? '添加车辆' : '我的车辆'}</h4>
|
|
213
|
+
<p className="mt-1 text-xs leading-4 text-secondary-foreground">车辆用于缴费与权益折扣</p>
|
|
214
214
|
</div>
|
|
215
215
|
{showCompose
|
|
216
216
|
? canCancel && (
|
|
217
217
|
<button
|
|
218
218
|
type="button"
|
|
219
|
-
className="parking-vm__head-btn"
|
|
219
|
+
className="parking-vm__head-btn inline-flex shrink-0 items-center gap-1 rounded-full border-0 bg-muted px-2.25 py-1 text-xs text-secondary-foreground active:opacity-70"
|
|
220
220
|
onClick={() => {
|
|
221
221
|
setComposing(false);
|
|
222
222
|
setPlate('');
|
|
@@ -231,7 +231,7 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
231
231
|
: !isHistory && (
|
|
232
232
|
<button
|
|
233
233
|
type="button"
|
|
234
|
-
className="parking-vm__head-btn parking-vm__head-btn--add"
|
|
234
|
+
className="parking-vm__head-btn parking-vm__head-btn--add inline-flex shrink-0 items-center gap-1 rounded-full border-0 bg-primary-soft px-2.25 py-1 text-xs font-semibold text-primary active:opacity-70"
|
|
235
235
|
disabled={!bindToken || boundLimit}
|
|
236
236
|
title={boundLimit ? '最多绑定 3 辆车' : undefined}
|
|
237
237
|
onClick={() => {
|
|
@@ -262,11 +262,11 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
262
262
|
)}
|
|
263
263
|
<button
|
|
264
264
|
type="button"
|
|
265
|
-
className={`parking-vm__primary-btn
|
|
265
|
+
className={`parking-vm__primary-btn flex min-h-9 w-full 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 ${bindingAction === 'bind' ? ' opacity-70' : ''}`}
|
|
266
266
|
disabled={isBindingPending || isHistory || !bindToken || !valid}
|
|
267
267
|
onClick={() => act('parking.bind-vehicle', bindToken)}
|
|
268
268
|
>
|
|
269
|
-
{bindingAction === 'bind' && <span className="parking-vm__spinner" aria-hidden="true" />}
|
|
269
|
+
{bindingAction === 'bind' && <span className="parking-vm__spinner inline-flex size-5.5 shrink-0 animate-spin rounded-full border-[3px] border-white-line border-t-white" aria-hidden="true" />}
|
|
270
270
|
{bindingAction === 'bind' ? '绑定中…' : '确认绑定'}
|
|
271
271
|
</button>
|
|
272
272
|
</>
|
|
@@ -275,36 +275,36 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
275
275
|
{isEmpty ? (
|
|
276
276
|
<p className="parking-vm__empty">还没有绑定车辆</p>
|
|
277
277
|
) : (
|
|
278
|
-
<ul className="parking-vm__bound">
|
|
278
|
+
<ul className="parking-vm__bound grid list-none gap-1.5 p-0">
|
|
279
279
|
{data.bound.map((v) => {
|
|
280
280
|
const isUnbinding = unbindingRefs.has(v.vehicleRef);
|
|
281
281
|
const [prefix, rest] = plateParts(v.plateNo);
|
|
282
282
|
return (
|
|
283
|
-
<li key={v.vehicleRef} className="parking-vm__vehicle">
|
|
284
|
-
<span className="parking-vm__vehicle-icon" aria-hidden="true">
|
|
283
|
+
<li key={v.vehicleRef} className="parking-vm__vehicle flex items-center gap-1.75 rounded-md border-2 border-border bg-muted px-2.5 py-2.25">
|
|
284
|
+
<span className="parking-vm__vehicle-icon grid size-6.5 shrink-0 place-items-center rounded-md bg-primary-soft text-primary" aria-hidden="true">
|
|
285
285
|
<Car size={19} weight="fill" />
|
|
286
286
|
</span>
|
|
287
|
-
<span className="parking-vm__vehicle-copy">
|
|
288
|
-
<span className="parking-plate">
|
|
287
|
+
<span className="parking-vm__vehicle-copy flex min-w-0 flex-1 items-center gap-1.5">
|
|
288
|
+
<span className="parking-plate plate-lockup truncate text-base font-semibold">
|
|
289
289
|
<b>{prefix}</b>
|
|
290
|
-
{rest && <i className="parking-plate__sep" aria-hidden="true">·</i>}
|
|
290
|
+
{rest && <i className="parking-plate__sep mx-0.5 font-normal not-italic text-muted-foreground" aria-hidden="true">·</i>}
|
|
291
291
|
<span>{rest}</span>
|
|
292
292
|
</span>
|
|
293
293
|
{/* parked 缺省 = provider 无入场查询能力,不显示任何状态 */}
|
|
294
|
-
{v.parked === true && <em className="parking-vm__vehicle-state">已入场</em>}
|
|
294
|
+
{v.parked === true && <em className="parking-vm__vehicle-state shrink-0 rounded-full bg-success-soft px-1.5 py-0.5 text-xs font-medium not-italic leading-3.5 text-success">已入场</em>}
|
|
295
295
|
</span>
|
|
296
|
-
<div className="parking-vm__vehicle-actions">
|
|
296
|
+
<div className="parking-vm__vehicle-actions flex shrink-0 gap-1.5">
|
|
297
297
|
<button
|
|
298
298
|
type="button"
|
|
299
299
|
data-action-id="parking.unbind-vehicle"
|
|
300
300
|
disabled={isHistory || isUnbinding || !unbindToken}
|
|
301
|
-
className={isUnbinding ? 'parking-vm__btn--loading' : ''}
|
|
301
|
+
className={`inline-flex size-7 items-center justify-center rounded-full border-0 bg-card text-muted-foreground active:bg-muted active:text-primary ${isUnbinding ? 'parking-vm__btn--loading' : ''}`}
|
|
302
302
|
onClick={() => vehicleAction('parking.unbind-vehicle', v.vehicleRef, unbindToken)}
|
|
303
303
|
title="删除车辆"
|
|
304
304
|
aria-label={`删除车牌 ${v.plateNo}`}
|
|
305
305
|
>
|
|
306
306
|
{isUnbinding ? (
|
|
307
|
-
<span className="parking-vm__spinner" aria-hidden="true" />
|
|
307
|
+
<span className="parking-vm__spinner inline-flex size-5.5 shrink-0 animate-spin rounded-full border-[3px] border-white-line border-t-white" aria-hidden="true" />
|
|
308
308
|
) : (
|
|
309
309
|
<TrashSimple size={16} weight="fill" />
|
|
310
310
|
)}
|
|
@@ -317,17 +317,17 @@ export function ParkingVehicleManagementCard(props: {
|
|
|
317
317
|
)}
|
|
318
318
|
|
|
319
319
|
{showEnrollGuide && (
|
|
320
|
-
<div className="parking-vm__enroll">
|
|
321
|
-
<span className="parking-vm__enroll-icon" aria-hidden="true">
|
|
320
|
+
<div className="parking-vm__enroll flex items-center gap-1.75 rounded-lg bg-warn-surface p-2.25">
|
|
321
|
+
<span className="parking-vm__enroll-icon grid size-6 shrink-0 place-items-center rounded-full bg-warning text-white" aria-hidden="true">
|
|
322
322
|
<SealCheck size={22} weight="fill" />
|
|
323
323
|
</span>
|
|
324
|
-
<div className="parking-vm__enroll-copy">
|
|
325
|
-
<strong>入会享停车权益</strong>
|
|
326
|
-
<small>积分可抵扣停车费,会员另享折扣</small>
|
|
324
|
+
<div className="parking-vm__enroll-copy min-w-0 flex-1">
|
|
325
|
+
<strong className="block truncate text-xs font-bold leading-4.5 text-warn-ink">入会享停车权益</strong>
|
|
326
|
+
<small className="block text-xs leading-4 text-warn-ink">积分可抵扣停车费,会员另享折扣</small>
|
|
327
327
|
</div>
|
|
328
328
|
<button
|
|
329
329
|
type="button"
|
|
330
|
-
className="parking-vm__enroll-btn"
|
|
330
|
+
className="parking-vm__enroll-btn shrink-0 rounded-full border-0 bg-warning px-3 py-1.5 text-xs font-semibold text-white active:opacity-85"
|
|
331
331
|
onClick={() => sendCardAction(cardId, { type: 'sendMessage', value: '我要入会', visible: true })}
|
|
332
332
|
>
|
|
333
333
|
立即入会
|
package/src/client/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* module-parking 客户端入口(与服务端 serverModule 对称;5 卡)。
|
|
3
3
|
*/
|
|
4
|
-
import './styles/parking.css'; // 0.4.0 模块自持 CSS(副作用 import,首行保证先行加载)
|
|
5
|
-
|
|
6
4
|
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
7
5
|
import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
|
|
8
6
|
import {
|
package/tbox.module.json
CHANGED
package/tsup.config.ts
CHANGED
|
@@ -27,11 +27,6 @@ export default defineConfig({
|
|
|
27
27
|
'express',
|
|
28
28
|
'@phosphor-icons/react',
|
|
29
29
|
],
|
|
30
|
-
// 0.3.2/0.4.0 D1:模块自持 CSS 出货链。
|
|
31
|
-
// 顶层 loader 写法(实测:esbuildOptions 内设 loader 被 tsup 覆盖失效——CSS 提取断链静默丢失)。
|
|
32
|
-
loader: {
|
|
33
|
-
'.css': 'copy',
|
|
34
|
-
},
|
|
35
30
|
esbuildOptions(options) {
|
|
36
31
|
options.jsx = 'automatic';
|
|
37
32
|
},
|