@tbox.cn/app-module-parking 0.10.8 → 0.10.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.
@@ -358,8 +358,8 @@ var BASIC = "\u7F34\u8D39\u5361\xB7\u57FA\u7840\u5F62\u6001\uFF08\u91D1\u989D /
358
358
  var MATRIX = "\u7F34\u8D39\u5361\xB7\u4F18\u60E0\u77E9\u9635\uFF08\u4F1A\u5458\u6001 \xD7 \u5238 \xD7 \u79EF\u5206 \xD7 \u4E92\u65A5\uFF09";
359
359
  var BASE = {
360
360
  plateNo: "\u6D59A12345",
361
- entryAtText: "08-14 07:12",
362
- durationText: "3 \u5C0F\u65F6 05 \u5206",
361
+ entryAtText: "08-14 07:35",
362
+ durationText: "2 \u5C0F\u65F6 42 \u5206",
363
363
  feeItems: [{ name: "\u505C\u8F66\u8D39\uFF083 \u5C0F\u65F6\uFF09", amountText: "15.00 \u5143" }],
364
364
  totalText: "15.00 \u5143",
365
365
  revision: 1,
@@ -372,7 +372,7 @@ var COUPON_STACKABLE = {
372
372
  kind: "coupon",
373
373
  autoSelected: true,
374
374
  description: "\u9650\u9996\u6B21\u505C\u8F66",
375
- discountText: "6.00 \u5143"
375
+ discountText: "10.00 \u5143"
376
376
  };
377
377
  var COUPON_EXCLUSIVE = {
378
378
  benefitRef: "c2",
@@ -391,6 +391,8 @@ var POINTS_BENEFIT = {
391
391
  description: "\u6D88\u8017 500 \u79EF\u5206",
392
392
  discountText: "5.00 \u5143"
393
393
  };
394
+ var MEMBER_APPLIED = { benefitRef: "member-discount", title: "\u4F1A\u5458 95 \u6298", discountText: "0.75 \u5143" };
395
+ var POINTS_APPLIED = { benefitRef: "p1", title: "\u79EF\u5206\u62B5 5 \u5143", discountText: "5.00 \u5143" };
394
396
  var LEVEL_APPLIED = { benefitRef: "lv1", title: "\u91D1\u5361 95 \u6298", discountText: "0.75 \u5143" };
395
397
  var LEVEL_SELECTABLE = {
396
398
  benefitRef: "lv1",
@@ -426,7 +428,7 @@ var samples = [
426
428
  revision: 1,
427
429
  entryAtText: "08-12 09:00",
428
430
  durationText: "28 \u5206",
429
- feeItems: [{ name: "\u505C\u8F66\u8D39\uFF080.5 \u5C0F\u65F6\uFF09", amountText: "0.00 \u5143" }],
431
+ feeItems: [{ name: "\u505C\u8F66\u8D39\uFF081 \u5C0F\u65F6\uFF09", amountText: "0.00 \u5143" }],
430
432
  totalText: "0.00 \u5143",
431
433
  payableText: "0.00 \u5143",
432
434
  appliedBenefits: [],
@@ -436,7 +438,7 @@ var samples = [
436
438
  },
437
439
  {
438
440
  label: "\u591A\u8D39\u9879\xB7\u8DE8\u65E5\u957F\u65F6\u957F",
439
- note: "\u4E09\u884C\u8D39\u9879 + \u56DB\u4F4D\u91D1\u989D + 26 \u5C0F\u65F6\u65F6\u957F\u2014\u2014\u68C0\u67E5\u53F3\u5BF9\u9F50\u3001\u6362\u884C\u4E0E hero meta \u5BBD\u5EA6",
441
+ note: "\u4E09\u884C\u8D39\u9879 + \u56DB\u4F4D\u91D1\u989D + 26 \u5C0F\u65F6 12 \u5206\u505C\u7559\uFF08\u8BA1\u8D39 27 \u5C0F\u65F6\uFF09\u2014\u2014\u68C0\u67E5\u53F3\u5BF9\u9F50\u3001\u6362\u884C\u4E0E hero meta \u5BBD\u5EA6",
440
442
  group: BASIC,
441
443
  data: {
442
444
  ...BASE,
@@ -446,7 +448,7 @@ var samples = [
446
448
  durationText: "26 \u5C0F\u65F6 12 \u5206",
447
449
  membership: MEMBER_ACTIVE,
448
450
  feeItems: [
449
- { name: "\u505C\u8F66\u8D39\uFF0826 \u5C0F\u65F6\uFF09", amountText: "120.00 \u5143" },
451
+ { name: "\u505C\u8F66\u8D39\uFF0827 \u5C0F\u65F6\uFF09", amountText: "120.00 \u5143" },
450
452
  { name: "\u8D85\u65F6\u5360\u7528\u9644\u52A0\u8D39", amountText: "30.00 \u5143" },
451
453
  { name: "\u591C\u95F4\u670D\u52A1\u8D39", amountText: "12.50 \u5143" }
452
454
  ],
@@ -501,7 +503,7 @@ var samples = [
501
503
  membership: MEMBER_ACTIVE,
502
504
  discountText: "5.75 \u5143",
503
505
  payableText: "9.25 \u5143",
504
- appliedBenefits: [],
506
+ appliedBenefits: [MEMBER_APPLIED, POINTS_APPLIED],
505
507
  selectableBenefits: [],
506
508
  revision: 2,
507
509
  settlement: { state: "paying", text: "\u652F\u4ED8\u5904\u7406\u4E2D\uFF0C\u7ED3\u679C\u4EE5\u56DE\u6267\u4E3A\u51C6" }
@@ -517,7 +519,7 @@ var samples = [
517
519
  membership: MEMBER_ACTIVE,
518
520
  discountText: "5.75 \u5143",
519
521
  payableText: "9.25 \u5143",
520
- appliedBenefits: [],
522
+ appliedBenefits: [MEMBER_APPLIED, POINTS_APPLIED],
521
523
  selectableBenefits: [],
522
524
  revision: 2,
523
525
  settlement: { state: "paid", text: "\u5DF2\u5B8C\u6210\u652F\u4ED8\uFF0C\u8BF7\u5728 15 \u5206\u949F\u5185\u79BB\u573A" }
@@ -559,16 +561,16 @@ var samples = [
559
561
  },
560
562
  {
561
563
  label: "\u5DF2\u5165\u4F1A\xB7\u53EA\u6709\u5238",
562
- note: "\u5238\u5DF2 autoSelected \u751F\u6548 \u2192 \u6309\u94AE\u62A5 9.00 \u5143\uFF08\u4E0E\u300C\u5F53\u524D\u5E94\u4ED8\u300D\u540C\u6E90\uFF09",
564
+ note: "\u5238\u5DF2 autoSelected \u751F\u6548 \u2192 \u6309\u94AE\u62A5 5.00 \u5143\uFF08\u4E0E\u300C\u5F53\u524D\u5E94\u4ED8\u300D\u540C\u6E90\uFF09",
563
565
  group: MATRIX,
564
566
  hidden: true,
565
567
  data: {
566
568
  ...BASE,
567
569
  quoteRef: "m_coupon",
568
570
  membership: MEMBER_ACTIVE,
569
- discountText: "6.00 \u5143",
570
- payableText: "9.00 \u5143",
571
- appliedBenefits: [{ benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "6.00 \u5143" }],
571
+ discountText: "10.00 \u5143",
572
+ payableText: "5.00 \u5143",
573
+ appliedBenefits: [{ benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "10.00 \u5143" }],
572
574
  selectableBenefits: [COUPON_STACKABLE]
573
575
  }
574
576
  },
@@ -614,9 +616,9 @@ var samples = [
614
616
  ...BASE,
615
617
  quoteRef: "m_stack",
616
618
  membership: MEMBER_ACTIVE,
617
- discountText: "6.00 \u5143",
618
- payableText: "9.00 \u5143",
619
- appliedBenefits: [{ benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "6.00 \u5143" }],
619
+ discountText: "10.00 \u5143",
620
+ payableText: "5.00 \u5143",
621
+ appliedBenefits: [{ benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "10.00 \u5143" }],
620
622
  selectableBenefits: [COUPON_STACKABLE, POINTS_BENEFIT]
621
623
  }
622
624
  },
@@ -642,11 +644,11 @@ var samples = [
642
644
  ...BASE,
643
645
  quoteRef: "m_mixed",
644
646
  membership: MEMBER_ACTIVE,
645
- discountText: "6.75 \u5143",
646
- payableText: "8.25 \u5143",
647
+ discountText: "10.75 \u5143",
648
+ payableText: "4.25 \u5143",
647
649
  appliedBenefits: [
648
650
  LEVEL_APPLIED,
649
- { benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "6.00 \u5143" }
651
+ { benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "10.00 \u5143" }
650
652
  ],
651
653
  selectableBenefits: [LEVEL_SELECTABLE, COUPON_STACKABLE, COUPON_EXCLUSIVE, POINTS_BENEFIT]
652
654
  }
@@ -691,9 +693,9 @@ var samples = [
691
693
  ...BASE,
692
694
  quoteRef: "m_ne_coupon",
693
695
  membership: { state: "not_enrolled" },
694
- discountText: "6.00 \u5143",
695
- payableText: "9.00 \u5143",
696
- appliedBenefits: [{ benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "6.00 \u5143" }],
696
+ discountText: "10.00 \u5143",
697
+ payableText: "5.00 \u5143",
698
+ appliedBenefits: [{ benefitRef: "c1", title: "2 \u5C0F\u65F6\u514D\u8D39\u5238", discountText: "10.00 \u5143" }],
697
699
  selectableBenefits: [COUPON_STACKABLE]
698
700
  }
699
701
  },
@@ -719,7 +721,7 @@ var samples = [
719
721
  data: {
720
722
  ...BASE,
721
723
  quoteRef: "m_anon",
722
- durationText: "3 \u5C0F\u65F6 05 \u5206",
724
+ durationText: "2 \u5C0F\u65F6 42 \u5206",
723
725
  entryAtText: void 0,
724
726
  membership: { state: "unauthenticated" },
725
727
  payableText: "15.00 \u5143",
@@ -752,16 +754,21 @@ var meta = {
752
754
  sampleData: {
753
755
  quoteRef: "q_demo",
754
756
  plateNo: "\u6D59A12345",
755
- entryAtText: "08-14 07:12",
756
- durationText: "3 \u5C0F\u65F6 05 \u5206",
757
+ entryAtText: "08-14 07:35",
758
+ durationText: "2 \u5C0F\u65F6 42 \u5206",
757
759
  feeItems: [{ name: "\u505C\u8F66\u8D39\uFF083 \u5C0F\u65F6\uFF09", amountText: "15.00 \u5143" }],
758
760
  totalText: "15.00 \u5143",
759
761
  discountText: "5.75 \u5143",
760
762
  payableText: "9.25 \u5143",
761
- appliedBenefits: [{ benefitRef: "member-discount", title: "\u4F1A\u5458 95 \u6298", discountText: "0.75 \u5143" }],
763
+ // 5.75 = 会员 95 折 0.75 + 积分 5.00:appliedBenefits 必须与 discountText 同源明细
764
+ appliedBenefits: [
765
+ { benefitRef: "member-discount", title: "\u4F1A\u5458 95 \u6298", discountText: "0.75 \u5143" },
766
+ { benefitRef: "points-offset", title: "\u79EF\u5206\u62B5 5 \u5143", discountText: "5.00 \u5143" }
767
+ ],
762
768
  selectableBenefits: [
763
769
  { benefitRef: "member-discount", title: "\u4F1A\u5458 95 \u6298", autoSelected: true },
764
- { benefitRef: "points-offset", title: "\u79EF\u5206\u62B5 5 \u5143", autoSelected: false }
770
+ // 已计入上方 appliedBenefits → 勾选态与已应用态一致
771
+ { benefitRef: "points-offset", title: "\u79EF\u5206\u62B5 5 \u5143", autoSelected: true }
765
772
  ],
766
773
  revision: 1,
767
774
  caveats: ["\u8D39\u7528\u4EE5\u51FA\u573A\u5B9E\u9645\u8BA1\u8D39\u4E3A\u51C6"]
@@ -791,7 +798,7 @@ var samples2 = [
791
798
  leaveNotice: "\u8BF7\u5728 15 \u5206\u949F\u5185\u79BB\u573A\uFF0C\u8D85\u65F6\u5C06\u91CD\u65B0\u8BA1\u8D39",
792
799
  details: [
793
800
  { label: "\u8F66\u724C", value: "\u6D59A12345" },
794
- { label: "\u505C\u8F66\u65F6\u957F", value: "3 \u5C0F\u65F6 08 \u5206" },
801
+ { label: "\u505C\u8F66\u65F6\u957F", value: "2 \u5C0F\u65F6 45 \u5206" },
795
802
  { label: "\u7F34\u8D39\u65F6\u95F4", value: "\u4ECA\u5929 10:20" }
796
803
  ]
797
804
  }
@@ -808,7 +815,7 @@ var samples2 = [
808
815
  message: "\u652F\u4ED8\u5DF2\u53D6\u6D88\uFF0C\u53EF\u91CD\u65B0\u53D1\u8D77\u7F34\u8D39",
809
816
  details: [
810
817
  { label: "\u8F66\u724C", value: "\u6D59A12345" },
811
- { label: "\u505C\u8F66\u65F6\u957F", value: "3 \u5C0F\u65F6 10 \u5206" },
818
+ { label: "\u505C\u8F66\u65F6\u957F", value: "2 \u5C0F\u65F6 47 \u5206" },
812
819
  { label: "\u7F34\u8D39\u65F6\u95F4", value: "\u4ECA\u5929 10:22" }
813
820
  ]
814
821
  },
@@ -827,7 +834,7 @@ var samples2 = [
827
834
  retryable: true,
828
835
  details: [
829
836
  { label: "\u8F66\u724C", value: "\u6D59A12345" },
830
- { label: "\u505C\u8F66\u65F6\u957F", value: "3 \u5C0F\u65F6 19 \u5206" },
837
+ { label: "\u505C\u8F66\u65F6\u957F", value: "2 \u5C0F\u65F6 56 \u5206" },
831
838
  { label: "\u7F34\u8D39\u65F6\u95F4", value: "\u4ECA\u5929 10:31" }
832
839
  ]
833
840
  },
@@ -973,7 +980,7 @@ var samples3 = [
973
980
  paidAtText: "08-14 10:20",
974
981
  status: "PAID",
975
982
  parkName: "\u793A\u4F8B\u5E7F\u573A\u5730\u4E0B\u505C\u8F66\u573A",
976
- entryAtText: "08-14 07:12",
983
+ entryAtText: "08-14 07:35",
977
984
  exitAtText: "08-14 10:25",
978
985
  payOrderNoMasked: "2026****8891",
979
986
  orderCompleted: true,
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  resolveParkingQueryPort,
7
7
  resolveParkingVehiclePort,
8
8
  serverModule
9
- } from "./chunk-BYN4OF6Z.js";
9
+ } from "./chunk-YVL4JFJL.js";
10
10
  import {
11
11
  cards,
12
12
  clientModule
@@ -6,7 +6,7 @@ import {
6
6
  resolveParkingQueryPort,
7
7
  resolveParkingVehiclePort,
8
8
  serverModule
9
- } from "../chunk-BYN4OF6Z.js";
9
+ } from "../chunk-YVL4JFJL.js";
10
10
  export {
11
11
  InMemoryParkingService,
12
12
  inMemoryParking,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-parking",
3
- "version": "0.10.8",
3
+ "version": "0.10.11",
4
4
  "type": "module",
5
5
  "description": "商圈停车模块:计费支付、车辆寻车、缴费记录与开票(codegen 源)。",
6
6
  "exports": {
@@ -19,9 +19,9 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tbox.cn/app-contracts": "0.13.3",
22
- "@tbox.cn/app-contracts-mall": "0.13.2",
23
- "@tbox.cn/app-agent-sdk-client": "0.2.0",
24
- "@tbox.cn/app-agent-sdk-server": "0.3.1"
22
+ "@tbox.cn/app-contracts-mall": "0.14.0",
23
+ "@tbox.cn/app-agent-sdk-client": "0.2.1",
24
+ "@tbox.cn/app-agent-sdk-server": "0.3.3"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "3.25.76",
@@ -10,16 +10,21 @@ const meta: CardMeta<typeof parkingPaymentCardDataSchema> = {
10
10
  sampleData: {
11
11
  quoteRef: 'q_demo',
12
12
  plateNo: '浙A12345',
13
- entryAtText: '08-14 07:12',
14
- durationText: '3 小时 05 分',
13
+ entryAtText: '08-14 07:35',
14
+ durationText: '2 小时 42 分',
15
15
  feeItems: [{ name: '停车费(3 小时)', amountText: '15.00 元' }],
16
16
  totalText: '15.00 元',
17
17
  discountText: '5.75 元',
18
18
  payableText: '9.25 元',
19
- appliedBenefits: [{ benefitRef: 'member-discount', title: '会员 95 折', discountText: '0.75 元' }],
19
+ // 5.75 = 会员 95 折 0.75 + 积分 5.00:appliedBenefits 必须与 discountText 同源明细
20
+ appliedBenefits: [
21
+ { benefitRef: 'member-discount', title: '会员 95 折', discountText: '0.75 元' },
22
+ { benefitRef: 'points-offset', title: '积分抵 5 元', discountText: '5.00 元' },
23
+ ],
20
24
  selectableBenefits: [
21
25
  { benefitRef: 'member-discount', title: '会员 95 折', autoSelected: true },
22
- { benefitRef: 'points-offset', title: '积分抵 5 元', autoSelected: false },
26
+ // 已计入上方 appliedBenefits → 勾选态与已应用态一致
27
+ { benefitRef: 'points-offset', title: '积分抵 5 元', autoSelected: true },
23
28
  ],
24
29
  revision: 1,
25
30
  caveats: ['费用以出场实际计费为准'],
@@ -18,13 +18,15 @@ const BASIC = '缴费卡·基础形态(金额 / 费项 / 时长 / 终态)';
18
18
  const MATRIX = '缴费卡·优惠矩阵(会员态 × 券 × 积分 × 互斥)';
19
19
 
20
20
  /**
21
- * 共用基底:同一张「3 小时 / 15.00 元」的报价单。只让被考察的维度变——
22
- * 金额各不相同的话,一眼扫过去分不清是维度差异还是数字差异。
21
+ * 共用基底:同一张「停留 2 小时 42 分 / 计费 3 小时 / 15.00 元」的报价单。
22
+ * 只让被考察的维度变——金额各不相同的话,一眼扫过去分不清是维度差异还是数字差异。
23
+ * 162 分钟同时满足运行时 durationText 的 round(2.7→3)与计费 ceil(→3),
24
+ * 保证样本与 provider-mock 的演示叙事同源;改动前先核对这两条口径。
23
25
  */
24
26
  const BASE = {
25
27
  plateNo: '浙A12345',
26
- entryAtText: '08-14 07:12',
27
- durationText: '3 小时 05 分',
28
+ entryAtText: '08-14 07:35',
29
+ durationText: '2 小时 42 分',
28
30
  feeItems: [{ name: '停车费(3 小时)', amountText: '15.00 元' }],
29
31
  totalText: '15.00 元',
30
32
  revision: 1,
@@ -38,10 +40,10 @@ type Membership = NonNullable<ParkingPaymentCardData['membership']>;
38
40
  /** 已入会且积分充足——矩阵里大部分格子的会员轴取值。 */
39
41
  const MEMBER_ACTIVE: Membership = { state: 'active', availablePoints: 860 };
40
42
 
41
- /** 券:可与积分叠加(默认规则)。 */
43
+ /** 券:可与积分叠加(默认规则)。2 小时 × 5.00 元/小时 = 10.00 元(与演示费率卡同源)。 */
42
44
  const COUPON_STACKABLE: SelectableBenefit = {
43
45
  benefitRef: 'c1', title: '2 小时免费券', kind: 'coupon', autoSelected: true,
44
- description: '限首次停车', discountText: '6.00 元',
46
+ description: '限首次停车', discountText: '10.00 元',
45
47
  };
46
48
  /** 券:厂商标记不可与积分叠加——规则写在券上,判定却是双向的。 */
47
49
  const COUPON_EXCLUSIVE: SelectableBenefit = {
@@ -53,6 +55,9 @@ const POINTS_BENEFIT: SelectableBenefit = {
53
55
  benefitRef: 'p1', title: '积分抵 5 元', kind: 'points', autoSelected: false,
54
56
  description: '消耗 500 积分', discountText: '5.00 元',
55
57
  };
58
+ /** 已应用的会员 95 折 / 积分抵扣——仅用于 discountText 已包含它们的终态样本。 */
59
+ const MEMBER_APPLIED: AppliedBenefit = { benefitRef: 'member-discount', title: '会员 95 折', discountText: '0.75 元' };
60
+ const POINTS_APPLIED: AppliedBenefit = { benefitRef: 'p1', title: '积分抵 5 元', discountText: '5.00 元' };
56
61
  /**
57
62
  * 等级权益的两种形态,判据是 autoSelected 而非 kind:
58
63
  * - discount + autoSelected:够等级就自动生效,用户没有决策权 → 剔出勾选区,只在费用明细现身
@@ -84,7 +89,7 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
84
89
  data: {
85
90
  quoteRef: 'b_free', plateNo: '浙A12345', revision: 1,
86
91
  entryAtText: '08-12 09:00', durationText: '28 分',
87
- feeItems: [{ name: '停车费(0.5 小时)', amountText: '0.00 元' }],
92
+ feeItems: [{ name: '停车费(1 小时)', amountText: '0.00 元' }],
88
93
  totalText: '0.00 元', payableText: '0.00 元',
89
94
  appliedBenefits: [], selectableBenefits: [POINTS_BENEFIT],
90
95
  caveats: ['免费时段内出场不收费', '费用以出场实际计费为准'],
@@ -92,14 +97,14 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
92
97
  },
93
98
  {
94
99
  label: '多费项·跨日长时长',
95
- note: '三行费项 + 四位金额 + 26 小时时长——检查右对齐、换行与 hero meta 宽度',
100
+ note: '三行费项 + 四位金额 + 26 小时 12 分停留(计费 27 小时)——检查右对齐、换行与 hero meta 宽度',
96
101
  group: BASIC,
97
102
  data: {
98
103
  ...BASE, quoteRef: 'b_long', plateNo: '浙AD12345',
99
104
  entryAtText: '08-13 20:30', durationText: '26 小时 12 分',
100
105
  membership: MEMBER_ACTIVE,
101
106
  feeItems: [
102
- { name: '停车费(26 小时)', amountText: '120.00 元' },
107
+ { name: '停车费(27 小时)', amountText: '120.00 元' },
103
108
  { name: '超时占用附加费', amountText: '30.00 元' },
104
109
  { name: '夜间服务费', amountText: '12.50 元' },
105
110
  ],
@@ -141,7 +146,7 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
141
146
  data: {
142
147
  ...BASE, quoteRef: 'b_paying', membership: MEMBER_ACTIVE,
143
148
  discountText: '5.75 元', payableText: '9.25 元',
144
- appliedBenefits: [], selectableBenefits: [], revision: 2,
149
+ appliedBenefits: [MEMBER_APPLIED, POINTS_APPLIED], selectableBenefits: [], revision: 2,
145
150
  settlement: { state: 'paying', text: '支付处理中,结果以回执为准' },
146
151
  },
147
152
  },
@@ -152,7 +157,7 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
152
157
  data: {
153
158
  ...BASE, quoteRef: 'b_paid', membership: MEMBER_ACTIVE,
154
159
  discountText: '5.75 元', payableText: '9.25 元',
155
- appliedBenefits: [], selectableBenefits: [], revision: 2,
160
+ appliedBenefits: [MEMBER_APPLIED, POINTS_APPLIED], selectableBenefits: [], revision: 2,
156
161
  settlement: { state: 'paid', text: '已完成支付,请在 15 分钟内离场' },
157
162
  },
158
163
  },
@@ -185,13 +190,13 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
185
190
  },
186
191
  {
187
192
  label: '已入会·只有券',
188
- note: '券已 autoSelected 生效 → 按钮报 9.00 元(与「当前应付」同源)',
193
+ note: '券已 autoSelected 生效 → 按钮报 5.00 元(与「当前应付」同源)',
189
194
  group: MATRIX,
190
195
  hidden: true,
191
196
  data: {
192
197
  ...BASE, quoteRef: 'm_coupon', membership: MEMBER_ACTIVE,
193
- discountText: '6.00 元', payableText: '9.00 元',
194
- appliedBenefits: [{ benefitRef: 'c1', title: '2 小时免费券', discountText: '6.00 元' }],
198
+ discountText: '10.00 元', payableText: '5.00 元',
199
+ appliedBenefits: [{ benefitRef: 'c1', title: '2 小时免费券', discountText: '10.00 元' }],
195
200
  selectableBenefits: [COUPON_STACKABLE],
196
201
  },
197
202
  },
@@ -227,8 +232,8 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
227
232
  hidden: true,
228
233
  data: {
229
234
  ...BASE, quoteRef: 'm_stack', membership: MEMBER_ACTIVE,
230
- discountText: '6.00 元', payableText: '9.00 元',
231
- appliedBenefits: [{ benefitRef: 'c1', title: '2 小时免费券', discountText: '6.00 元' }],
235
+ discountText: '10.00 元', payableText: '5.00 元',
236
+ appliedBenefits: [{ benefitRef: 'c1', title: '2 小时免费券', discountText: '10.00 元' }],
232
237
  selectableBenefits: [COUPON_STACKABLE, POINTS_BENEFIT],
233
238
  },
234
239
  },
@@ -249,10 +254,10 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
249
254
  group: MATRIX,
250
255
  data: {
251
256
  ...BASE, quoteRef: 'm_mixed', membership: MEMBER_ACTIVE,
252
- discountText: '6.75 元', payableText: '8.25 元',
257
+ discountText: '10.75 元', payableText: '4.25 元',
253
258
  appliedBenefits: [
254
259
  LEVEL_APPLIED,
255
- { benefitRef: 'c1', title: '2 小时免费券', discountText: '6.00 元' },
260
+ { benefitRef: 'c1', title: '2 小时免费券', discountText: '10.00 元' },
256
261
  ],
257
262
  selectableBenefits: [LEVEL_SELECTABLE, COUPON_STACKABLE, COUPON_EXCLUSIVE, POINTS_BENEFIT],
258
263
  },
@@ -290,8 +295,8 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
290
295
  data: {
291
296
  ...BASE, quoteRef: 'm_ne_coupon',
292
297
  membership: { state: 'not_enrolled' },
293
- discountText: '6.00 元', payableText: '9.00 元',
294
- appliedBenefits: [{ benefitRef: 'c1', title: '2 小时免费券', discountText: '6.00 元' }],
298
+ discountText: '10.00 元', payableText: '5.00 元',
299
+ appliedBenefits: [{ benefitRef: 'c1', title: '2 小时免费券', discountText: '10.00 元' }],
295
300
  selectableBenefits: [COUPON_STACKABLE],
296
301
  },
297
302
  },
@@ -312,7 +317,7 @@ export const samples: CardSample<ParkingPaymentCardData>[] = [
312
317
  group: MATRIX,
313
318
  hidden: true,
314
319
  data: {
315
- ...BASE, quoteRef: 'm_anon', durationText: '3 小时 05 分', entryAtText: undefined,
320
+ ...BASE, quoteRef: 'm_anon', durationText: '2 小时 42 分', entryAtText: undefined,
316
321
  membership: { state: 'unauthenticated' },
317
322
  payableText: '15.00 元', appliedBenefits: [], selectableBenefits: [],
318
323
  },
@@ -63,7 +63,7 @@ export const samples: CardSample<ParkingPaymentRecordsCardData>[] = [
63
63
  items: [{
64
64
  recordRef: 'r_1', plateNo: '浙A12345', amountText: '9.25 元', paidAtText: '08-14 10:20',
65
65
  status: 'PAID', parkName: '示例广场地下停车场',
66
- entryAtText: '08-14 07:12', exitAtText: '08-14 10:25', payOrderNoMasked: '2026****8891',
66
+ entryAtText: '08-14 07:35', exitAtText: '08-14 10:25', payOrderNoMasked: '2026****8891',
67
67
  orderCompleted: true, invoiceEligible: true, invoiceIssued: false,
68
68
  }],
69
69
  total: 1, hasMore: false, caveats: ['仅展示近 6 个月缴费记录'],
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * parking-payment-result 附加预览样本(沉淀自 mall dev-gallery 停车场景画廊)。
3
3
  * 方法论:见同目录 ../parking-payment/samples.ts 头注释。
4
- * 叙事基线:与 ../parking-payment/samples.ts BASE 同一停车叙事——入场 08-14 07:12,
5
- * 报价时已停 3 小时 05 分(10:17);三态回执 = 这张报价单的三种结局,
6
- * 停车时长 = 缴费时间 − 入场时间(07:12)逐分吻合,金额对齐缴费卡应付(tests 守卫)。
4
+ * 叙事基线:与 ../parking-payment/samples.ts BASE 同一停车叙事——入场 08-14 07:35,
5
+ * 报价时已停 2 小时 42 分(10:17,计费 3 小时);三态回执 = 这张报价单的三种结局,
6
+ * 停车时长 = 缴费时间 − 入场时间(07:35)逐分吻合,金额对齐缴费卡应付(tests 守卫)。
7
7
  */
8
8
  import type { CardSample } from '@tbox.cn/app-contracts';
9
9
  import type { ParkingPaymentResultCardData } from '@tbox.cn/app-contracts-mall';
@@ -21,7 +21,7 @@ export const samples: CardSample<ParkingPaymentResultCardData>[] = [
21
21
  leaveNotice: '请在 15 分钟内离场,超时将重新计费',
22
22
  details: [
23
23
  { label: '车牌', value: '浙A12345' },
24
- { label: '停车时长', value: '3 小时 08 分' },
24
+ { label: '停车时长', value: '2 小时 45 分' },
25
25
  { label: '缴费时间', value: '今天 10:20' },
26
26
  ],
27
27
  },
@@ -35,7 +35,7 @@ export const samples: CardSample<ParkingPaymentResultCardData>[] = [
35
35
  amountText: '9.25 元', message: '支付已取消,可重新发起缴费',
36
36
  details: [
37
37
  { label: '车牌', value: '浙A12345' },
38
- { label: '停车时长', value: '3 小时 10 分' },
38
+ { label: '停车时长', value: '2 小时 47 分' },
39
39
  { label: '缴费时间', value: '今天 10:22' },
40
40
  ],
41
41
  },
@@ -50,7 +50,7 @@ export const samples: CardSample<ParkingPaymentResultCardData>[] = [
50
50
  amountText: '15.00 元', message: '厂商对账中,请稍后再查询', retryable: true,
51
51
  details: [
52
52
  { label: '车牌', value: '浙A12345' },
53
- { label: '停车时长', value: '3 小时 19 分' },
53
+ { label: '停车时长', value: '2 小时 56 分' },
54
54
  { label: '缴费时间', value: '今天 10:31' },
55
55
  ],
56
56
  },
package/tbox.module.json CHANGED
@@ -114,9 +114,6 @@
114
114
  },
115
115
  {
116
116
  "service": "parking.vehicle"
117
- },
118
- {
119
- "service": "parking.snapshot"
120
117
  }
121
118
  ]
122
119
  }
@@ -4,7 +4,7 @@
4
4
  * - withCardEmissionHint wrap:8 出卡工具 description 含预告知句,locateVehicle 不含;
5
5
  * - note 契约:报价/支付状态 note 含主体+关键事实(车牌/金额/状态/时长)。
6
6
  */
7
- import { describe, expect, it } from 'vitest';
7
+ import { describe, expect, it, vi } from 'vitest';
8
8
  import {
9
9
  createParkingTools,
10
10
  decideParkingFeePreRun,
@@ -82,6 +82,16 @@ describe('note 契约(W7):主体+关键事实', () => {
82
82
  it('durationText:entryAt 缺省 → undefined', () => {
83
83
  expect(durationText(undefined)).toBeUndefined();
84
84
  });
85
+
86
+ it('durationText:162 分钟前入场 → 3 小时(与「停车费(3 小时)」同值)', () => {
87
+ vi.useFakeTimers();
88
+ try {
89
+ vi.setSystemTime(new Date('2026-10-27T10:17:00+08:00'));
90
+ expect(durationText(new Date(Date.now() - 162 * 60_000).toISOString())).toBe('3 小时');
91
+ } finally {
92
+ vi.useRealTimers();
93
+ }
94
+ });
85
95
  });
86
96
 
87
97
  describe('decideListVehiclesPreRun:车辆问句门控', () => {
@@ -74,8 +74,8 @@ describe('parking samples 双断言(样本即契约)', () => {
74
74
  });
75
75
 
76
76
  describe('样本叙事自洽(回执 × 缴费卡 × 缴费记录同一停车叙事)', () => {
77
- /** 基线入场时刻 08-14 07:12(真源 ../src/server/cards/parking-payment/samples.ts BASE)。 */
78
- const ENTRY_MIN = 7 * 60 + 12;
77
+ /** 基线入场时刻 08-14 07:35(真源 ../src/server/cards/parking-payment/samples.ts BASE)。 */
78
+ const ENTRY_MIN = 7 * 60 + 35;
79
79
  /** 「X 小时 Y 分」→ 分钟。 */
80
80
  const durationMinutes = (text: string) => {
81
81
  const [h = '0', m = '0'] = text.match(/\d+/g) ?? [];
@@ -87,7 +87,7 @@ describe('样本叙事自洽(回执 × 缴费卡 × 缴费记录同一停车
87
87
  return Number(hh) * 60 + Number(mm);
88
88
  };
89
89
 
90
- it('回执三态:时长 = 缴费时间 − 入场(07:12)逐分吻合,金额对齐缴费卡应付', () => {
90
+ it('回执三态:时长 = 缴费时间 − 入场(07:35)逐分吻合,金额对齐缴费卡应付', () => {
91
91
  const cases = [
92
92
  { label: '缴费成功', amountText: '9.25 元', paidAtText: '今天 10:20' },
93
93
  { label: '支付取消', amountText: '9.25 元', paidAtText: '今天 10:22' },
@@ -98,8 +98,8 @@ describe('样本叙事自洽(回执 × 缴费卡 × 缴费记录同一停车
98
98
  expect(sample?.label, expected.label).toBe(expected.label);
99
99
  expect(sample?.data.amountText, `${expected.label} 金额对齐缴费卡应付`).toBe(expected.amountText);
100
100
  const duration = sample?.data.details?.find((d) => d.label === '停车时长')?.value ?? '';
101
- expect(duration, `${expected.label} 时长须落在 3 小时档(与停车费(3 小时)同叙事)`).toMatch(
102
- /^3 小时 \d{2} 分$/,
101
+ expect(duration, `${expected.label} 时长须落在 2 小时档(计费 3 小时,与停车费(3 小时)同叙事)`).toMatch(
102
+ /^2 小时 \d{2} 分$/,
103
103
  );
104
104
  expect(durationMinutes(duration), `${expected.label} 时长 = 缴费时间 − 入场`).toBe(
105
105
  clockMinutes(expected.paidAtText) - ENTRY_MIN,
@@ -122,6 +122,73 @@ describe('样本叙事自洽(回执 × 缴费卡 × 缴费记录同一停车
122
122
  });
123
123
  });
124
124
 
125
+ describe('缴费卡计费口径自洽(费项小时数 = ceil(时长))', () => {
126
+ /** 「15.00 元」→ 1500 分。 */
127
+ const cents = (text?: string): number | undefined => {
128
+ if (!text) return undefined;
129
+ const value = Number(text.replace(/[^\d.]/g, ''));
130
+ return Number.isFinite(value) ? Math.round(value * 100) : undefined;
131
+ };
132
+ /** 「X 小时 Y 分」/「Y 分」→ 分钟。 */
133
+ const minutesOf = (text?: string): number => {
134
+ const hours = Number(text?.match(/(\d+)\s*小时/)?.[1] ?? 0);
135
+ const minutes = Number(text?.match(/(\d+)\s*分/)?.[1] ?? 0);
136
+ return hours * 60 + minutes;
137
+ };
138
+ /** 费项名「停车费(N 小时)」→ N;无小时数(附加费/服务费)→ undefined。 */
139
+ const billedHoursOf = (name: string): number | undefined => {
140
+ const match = name.match(/((\d+)\s*小时)/);
141
+ return match ? Number(match[1]) : undefined;
142
+ };
143
+
144
+ const paymentCards = [
145
+ paymentMeta.sampleData,
146
+ ...(paymentMeta.samples ?? []).map((sample) => sample.data),
147
+ ];
148
+
149
+ it('费项小时数 = max(1, ceil(已停分钟 / 60))(含初始态与全部附加样本)', () => {
150
+ for (const data of paymentCards) {
151
+ expect(data.durationText, `${data.quoteRef} 缺 durationText`).toBeTruthy();
152
+ const expectedHours = Math.max(1, Math.ceil(minutesOf(data.durationText) / 60));
153
+ for (const fee of data.feeItems) {
154
+ const billed = billedHoursOf(fee.name);
155
+ if (billed === undefined) continue;
156
+ expect(billed, `${data.quoteRef}/${fee.name} 计费小时数`).toBe(expectedHours);
157
+ }
158
+ }
159
+ });
160
+
161
+ it('金额自洽:total = Σ费项;payable = total − discount;discount = ΣappliedBenefits', () => {
162
+ for (const data of paymentCards) {
163
+ const feeSum = data.feeItems.reduce((sum, fee) => sum + (cents(fee.amountText) ?? NaN), 0);
164
+ expect(feeSum, `${data.quoteRef} 费项合计`).toBe(cents(data.totalText));
165
+ expect(
166
+ (cents(data.totalText) ?? 0) - (cents(data.discountText) ?? 0),
167
+ `${data.quoteRef} 应付 = 总额 − 减免`,
168
+ ).toBe(cents(data.payableText));
169
+ const appliedSum = data.appliedBenefits.reduce(
170
+ (sum, benefit) => sum + (cents(benefit.discountText) ?? 0),
171
+ 0,
172
+ );
173
+ expect(appliedSum, `${data.quoteRef} 减免明细合计`).toBe(cents(data.discountText) ?? 0);
174
+ }
175
+ });
176
+
177
+ it('券面小时数与演示费率匹配(N 小时免费券 = N × 5.00 元)', () => {
178
+ const HOUR_RATE_CENTS = 500; // 演示费率 5.00 元/小时(与 provider-mock / InMemory 费率卡同源)
179
+ for (const data of paymentCards) {
180
+ for (const benefit of [...data.selectableBenefits, ...data.appliedBenefits]) {
181
+ const match = benefit.title.match(/^(\d+) 小时免费券$/);
182
+ if (!match) continue;
183
+ expect(
184
+ cents(benefit.discountText),
185
+ `${data.quoteRef}/${benefit.title} 券面额`,
186
+ ).toBe(Number(match[1]) * HOUR_RATE_CENTS);
187
+ }
188
+ }
189
+ });
190
+ });
191
+
125
192
  describe('卡级 hidden 标记守卫(预览策展)', () => {
126
193
  it('支付结果卡降噪型(2026-10-19 裁决——出卡链路照常,恢复 = 删标记)', () => {
127
194
  expect(resultMeta.hidden).toBe(true);
@@ -172,6 +172,51 @@ describe('门禁边界(require 守卫之外的形态)', () => {
172
172
  });
173
173
  });
174
174
 
175
+ describe('停车费卡:运行时投影与费项同源(162 分钟 → 3 小时)', () => {
176
+ it('queryParkingFee:entryAt 162 分钟前 + 费项(3 小时)/1500 → durationText 3 小时', async () => {
177
+ vi.useFakeTimers();
178
+ try {
179
+ vi.setSystemTime(new Date('2026-10-27T10:17:00+08:00'));
180
+ const quote = {
181
+ quoteRef: 'demo:quote:浙A12345',
182
+ plateNo: '浙A12345',
183
+ mallId: 'mall-1',
184
+ entryAt: new Date(Date.now() - 162 * 60_000).toISOString(),
185
+ feeItems: [{ name: '停车费(3 小时)', amountCents: 1500 }],
186
+ totalCents: 1500,
187
+ discountCents: 0,
188
+ payableCents: 1500,
189
+ appliedBenefits: [],
190
+ revision: 1,
191
+ paymentState: 'UNPAID' as const,
192
+ };
193
+ const service = {
194
+ queryFee: async () => [quote],
195
+ listVehicles: async () => ({ bound: [] }),
196
+ };
197
+ const tools = createParkingTools({ getCtx: () => ctxWithStatus(guestStatus) as never });
198
+ mockAllSlots(service);
199
+ const result = (await tools.queryParkingFee.execute!(
200
+ {} as never,
201
+ execCtx(),
202
+ )) as {
203
+ cards?: {
204
+ cardType: string;
205
+ note: string;
206
+ data: { durationText?: string; feeItems: { name: string; amountText: string }[] };
207
+ }[];
208
+ };
209
+ const card = result.cards?.[0];
210
+ expect(card?.cardType).toBe('parking-payment');
211
+ expect(card?.data.durationText).toBe('3 小时');
212
+ expect(card?.data.feeItems).toEqual([{ name: '停车费(3 小时)', amountText: '15.00 元' }]);
213
+ expect(card?.note).toContain('已停 3 小时');
214
+ } finally {
215
+ vi.useRealTimers();
216
+ }
217
+ });
218
+ });
219
+
175
220
  describe('非绑定车牌拒查(安全防护)', () => {
176
221
  function serviceWithBound(...plates: string[]) {
177
222
  const service = new InMemoryParkingService();