@pisell/private-materials 6.8.29 → 6.8.31

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.
Files changed (123) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +1 -1
  6. package/build/lowcode/view.js +1 -1
  7. package/es/components/booking/components/footer/index.d.ts +1 -0
  8. package/es/components/booking/components/footer/utils.js +2 -2
  9. package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  10. package/es/components/kioskSkuDetail/index.d.ts +7 -4
  11. package/es/components/kioskSkuDetail/index.js +182 -35
  12. package/es/components/kioskSkuDetail/locales.d.ts +21 -0
  13. package/es/components/kioskSkuDetail/locales.js +20 -0
  14. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  15. package/lib/components/booking/components/footer/index.d.ts +1 -0
  16. package/lib/components/booking/components/footer/utils.js +2 -2
  17. package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  18. package/lib/components/kioskSkuDetail/index.d.ts +7 -4
  19. package/lib/components/kioskSkuDetail/index.js +178 -65
  20. package/lib/components/kioskSkuDetail/locales.d.ts +21 -0
  21. package/lib/components/kioskSkuDetail/locales.js +44 -0
  22. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  23. package/package.json +4 -4
  24. package/es/components/appointmentBooking/components/Services/index.d.ts +0 -4
  25. package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -4
  26. package/es/components/booking/components/actionButtons/index.d.ts +0 -31
  27. package/es/components/booking/components/footer/utils.d.ts +0 -67
  28. package/es/components/booking/components/voucher/index.d.ts +0 -3
  29. package/es/components/booking/info/service/Lists.d.ts +0 -3
  30. package/es/components/booking/info/service/serve.d.ts +0 -34
  31. package/es/components/booking/info/service2/utils.d.ts +0 -219
  32. package/es/components/booking/info2/service/addService/utils.d.ts +0 -106
  33. package/es/components/booking/info2/service/editService/index.d.ts +0 -8
  34. package/es/components/booking/info2/utilsByBooking.d.ts +0 -36
  35. package/es/components/booking/utils.d.ts +0 -182
  36. package/es/components/checkout/PaymentModal.d.ts +0 -39
  37. package/es/components/checkout/components/AdditionalModule/index.d.ts +0 -15
  38. package/es/components/checkout/components/CashPaymentModule/index.d.ts +0 -26
  39. package/es/components/checkout/components/PaymentDetailModal/index.d.ts +0 -38
  40. package/es/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +0 -85
  41. package/es/components/checkout/components/SearchAndClientModule/index.d.ts +0 -14
  42. package/es/components/checkout/hooks/useWalletPass.d.ts +0 -40
  43. package/es/components/checkout/plugin.d.ts +0 -2
  44. package/es/components/checkout/utils/PaymentResultToastUtils.d.ts +0 -32
  45. package/es/components/list/List.d.ts +0 -5
  46. package/es/components/list/hooks/useListState.d.ts +0 -45
  47. package/es/components/pay/toB/components/MX51/index.d.ts +0 -3
  48. package/es/components/pay/toB/types/index.d.ts +0 -72
  49. package/es/components/pisellSelectCustomerModal/RightPanel/serve.d.ts +0 -3
  50. package/es/components/ticketBooking/components/ProductDisplayAdapter/ProductDisplayAdapter.d.ts +0 -27
  51. package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -31
  52. package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -10
  53. package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -14
  54. package/es/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -16
  55. package/es/components/ticketBooking/index.d.ts +0 -15
  56. package/es/components/ticketBooking/serve.d.ts +0 -288
  57. package/es/components/ticketBooking/utils/index.d.ts +0 -101
  58. package/es/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.d.ts +0 -4
  59. package/es/plus/productSelect/ProductCard/index.d.ts +0 -47
  60. package/es/plus/webPosLogin/WebPosLogin.d.ts +0 -11
  61. package/es/plus/webPosLogin/WebPosLoginCpt.d.ts +0 -9
  62. package/es/plus/webPosLogin/components/BrandPanel/index.d.ts +0 -9
  63. package/es/plus/webPosLogin/components/LoginPanel/index.d.ts +0 -21
  64. package/es/plus/webPosLogin/components/MediaDisplay/index.d.ts +0 -12
  65. package/es/plus/webPosLogin/components/MediaDisplay/type.d.ts +0 -54
  66. package/es/plus/webPosLogin/components/SelectDevice/index.d.ts +0 -28
  67. package/es/plus/webPosLogin/components/SelectStore/index.d.ts +0 -24
  68. package/es/plus/webPosLogin/components/UserFooter/index.d.ts +0 -28
  69. package/es/plus/webPosLogin/index.d.ts +0 -12
  70. package/es/plus/webPosLogin/locales.d.ts +0 -49
  71. package/es/plus/webPosLogin/service.d.ts +0 -44
  72. package/es/plus/webPosLogin/types.d.ts +0 -286
  73. package/es/pro/Login2.0/Login2.d.ts +0 -61
  74. package/lib/components/appointmentBooking/components/Services/index.d.ts +0 -4
  75. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -4
  76. package/lib/components/booking/components/actionButtons/index.d.ts +0 -31
  77. package/lib/components/booking/components/footer/utils.d.ts +0 -67
  78. package/lib/components/booking/components/voucher/index.d.ts +0 -3
  79. package/lib/components/booking/info/service/Lists.d.ts +0 -3
  80. package/lib/components/booking/info/service/serve.d.ts +0 -34
  81. package/lib/components/booking/info/service2/utils.d.ts +0 -219
  82. package/lib/components/booking/info2/service/addService/utils.d.ts +0 -106
  83. package/lib/components/booking/info2/service/editService/index.d.ts +0 -8
  84. package/lib/components/booking/info2/utilsByBooking.d.ts +0 -36
  85. package/lib/components/booking/utils.d.ts +0 -182
  86. package/lib/components/checkout/PaymentModal.d.ts +0 -39
  87. package/lib/components/checkout/components/AdditionalModule/index.d.ts +0 -15
  88. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +0 -26
  89. package/lib/components/checkout/components/PaymentDetailModal/index.d.ts +0 -38
  90. package/lib/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +0 -85
  91. package/lib/components/checkout/components/SearchAndClientModule/index.d.ts +0 -14
  92. package/lib/components/checkout/hooks/useWalletPass.d.ts +0 -40
  93. package/lib/components/checkout/plugin.d.ts +0 -2
  94. package/lib/components/checkout/utils/PaymentResultToastUtils.d.ts +0 -32
  95. package/lib/components/list/List.d.ts +0 -5
  96. package/lib/components/list/hooks/useListState.d.ts +0 -45
  97. package/lib/components/pay/toB/components/MX51/index.d.ts +0 -3
  98. package/lib/components/pay/toB/types/index.d.ts +0 -72
  99. package/lib/components/pisellSelectCustomerModal/RightPanel/serve.d.ts +0 -3
  100. package/lib/components/ticketBooking/components/ProductDisplayAdapter/ProductDisplayAdapter.d.ts +0 -27
  101. package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -31
  102. package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -10
  103. package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -14
  104. package/lib/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -16
  105. package/lib/components/ticketBooking/index.d.ts +0 -15
  106. package/lib/components/ticketBooking/serve.d.ts +0 -288
  107. package/lib/components/ticketBooking/utils/index.d.ts +0 -101
  108. package/lib/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.d.ts +0 -4
  109. package/lib/plus/productSelect/ProductCard/index.d.ts +0 -47
  110. package/lib/plus/webPosLogin/WebPosLogin.d.ts +0 -11
  111. package/lib/plus/webPosLogin/WebPosLoginCpt.d.ts +0 -9
  112. package/lib/plus/webPosLogin/components/BrandPanel/index.d.ts +0 -9
  113. package/lib/plus/webPosLogin/components/LoginPanel/index.d.ts +0 -21
  114. package/lib/plus/webPosLogin/components/MediaDisplay/index.d.ts +0 -12
  115. package/lib/plus/webPosLogin/components/MediaDisplay/type.d.ts +0 -54
  116. package/lib/plus/webPosLogin/components/SelectDevice/index.d.ts +0 -28
  117. package/lib/plus/webPosLogin/components/SelectStore/index.d.ts +0 -24
  118. package/lib/plus/webPosLogin/components/UserFooter/index.d.ts +0 -28
  119. package/lib/plus/webPosLogin/index.d.ts +0 -12
  120. package/lib/plus/webPosLogin/locales.d.ts +0 -49
  121. package/lib/plus/webPosLogin/service.d.ts +0 -44
  122. package/lib/plus/webPosLogin/types.d.ts +0 -286
  123. package/lib/pro/Login2.0/Login2.d.ts +0 -61
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  /**
3
4
  * @title: 底部
@@ -439,7 +439,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
439
439
  * @Date: 2024-12-07 14:21
440
440
  */
441
441
  var formatProducts = function formatProducts(item, quantity) {
442
- var _item$_extend32, _getMainProductSellin, _item$_extend33, _item$_extend34, _item$_extend35, _item$_extend36;
442
+ var _item$_extend32, _getMainProductSellin, _item$_extend33, _item$_extend34, _item$_extend35, _item$_extend36, _item$_extend$tax_fee, _item$metadata11;
443
443
  if (item !== null && item !== void 0 && item.discount_list) {
444
444
  item === null || item === void 0 || item.discount_list.forEach(function (d) {
445
445
  if (d !== null && d !== void 0 && d.id) {
@@ -494,7 +494,7 @@ var formatProducts = function formatProducts(item, quantity) {
494
494
  // checkout 需求新增字段
495
495
  "calculated_original_price": formatOriginalPrice(item),
496
496
  "calculated_selling_price": formatSellingPrice(item),
497
- "tax_fee": item._extend.tax_fee,
497
+ "tax_fee": (_item$_extend$tax_fee = item._extend.tax_fee) !== null && _item$_extend$tax_fee !== void 0 ? _item$_extend$tax_fee : (_item$metadata11 = item.metadata) === null || _item$metadata11 === void 0 ? void 0 : _item$metadata11.main_product_attached_bundle_tax_fee,
498
498
  "custom_deposit_data": item.custom_deposit_data
499
499
  };
500
500
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const AddTimeModal: () => JSX.Element;
3
4
  export default AddTimeModal;
@@ -3,16 +3,19 @@ import type { SkuValue } from '../../plus/skuOptionsSelection/types';
3
3
  import './index.less';
4
4
  /**
5
5
  * @description Kiosk 商品详情(参考 Figma: Kiosk / Launchpad screen)
6
- * - 外部传入商品 id,内部通过 getProductDetail 拉取详情
6
+ * - 默认从 URL query 读取商品 id(productId / product_id / id),内部通过 getProductDetail 拉取详情
7
7
  * - 中间区域用 SKUOptionsSelection 做 SKU 选择
8
8
  * - 底部用 PisellNumberSelector 做数量编辑
9
9
  */
10
10
  declare function KioskSkuDetail(props: KioskSkuDetailProps): JSX.Element;
11
11
  export default KioskSkuDetail;
12
12
  export interface KioskSkuDetailProps {
13
- /** 商品 id */
14
- productId: number | string;
15
- /** 可选:用于商品报价的日期(预约类商品) */
13
+ /** 商品 id(可选:目前默认从 URL 读取,props 仅作为兜底以兼容老用法) */
14
+ productId?: number | string;
15
+ /**
16
+ * 可选:用于商品报价的日期(预约类商品)
17
+ * @deprecated 目前 kiosk 详情暂时固定取当天,这个参数暂不生效
18
+ */
16
19
  scheduleDate?: string;
17
20
  /** 自定义类名 */
18
21
  className?: string;
@@ -1,4 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -16,32 +17,79 @@ import React, { useEffect, useMemo, useState } from 'react';
16
17
  import Decimal from 'decimal.js';
17
18
  import classNames from 'classnames';
18
19
  import { Button } from '@pisell/materials';
20
+ import dayjs from 'dayjs';
21
+ import { locales } from '@pisell/utils';
19
22
  import SKUOptionsSelection from "../../plus/skuOptionsSelection";
20
23
  import PisellNumberSelector from "../../pro/pisellNumberSelector";
21
24
  import useEngineContext from "../../hooks/useEngineContext";
22
25
  import { getProductDetail } from "../booking/info/service/serve";
26
+ import localeTexts from "./locales";
23
27
  import "./index.less";
28
+ import { request } from "../booking/utils";
24
29
 
25
30
  /**
26
31
  * @description Kiosk 商品详情(参考 Figma: Kiosk / Launchpad screen)
27
- * - 外部传入商品 id,内部通过 getProductDetail 拉取详情
32
+ * - 默认从 URL query 读取商品 id(productId / product_id / id),内部通过 getProductDetail 拉取详情
28
33
  * - 中间区域用 SKUOptionsSelection 做 SKU 选择
29
34
  * - 底部用 PisellNumberSelector 做数量编辑
30
35
  */
31
36
  function KioskSkuDetail(props) {
32
- var _context$appHelper, _store$getState, _store$getState2;
33
- var productId = props.productId,
34
- scheduleDate = props.scheduleDate,
35
- className = props.className,
37
+ var _context$appHelper, _context$engine, _context$appHelper2, _store$getState, _store$getState2;
38
+ var className = props.className,
36
39
  style = props.style,
37
40
  onBack = props.onBack,
38
41
  onAddToCart = props.onAddToCart;
42
+
43
+ /**
44
+ * @description 从 URL 中读取 productId(兼容 search / hash query)
45
+ * - 支持 key: productId / product_id / id
46
+ */
47
+ var productIdFromUrl = useMemo(function () {
48
+ return getQueryFirstMatch({
49
+ keys: ['productId', 'product_id', 'id']
50
+ });
51
+ }, []);
52
+
53
+ /**
54
+ * @description 最终使用的商品 id
55
+ * - 以 URL 为准(方便 kiosk 场景通过路由跳转直接带参)
56
+ * - props.productId 作为兜底,兼容老用法
57
+ */
58
+ var resolvedProductId = productIdFromUrl !== null && productIdFromUrl !== void 0 ? productIdFromUrl : props.productId;
59
+
60
+ /**
61
+ * @description 目前 scheduleDate 暂时固定成“当天”
62
+ * - 按本地时区格式化为 YYYY-MM-DD
63
+ */
64
+ var scheduleDate = useMemo(function () {
65
+ return dayjs().format('YYYY-MM-DD');
66
+ }, []);
39
67
  var context = useEngineContext();
40
68
  var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
41
- store = _ref.store,
42
- getData = _ref.getData;
69
+ interaction = _ref.interaction;
70
+ locales.init(localeTexts, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en');
71
+ request.setRequest(context.appHelper.utils.request);
72
+ var _ref2 = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
73
+ store = _ref2.store,
74
+ getData = _ref2.getData;
43
75
  var state = store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : _store$getState.call(store);
44
76
  var symbol = (store === null || store === void 0 || (_store$getState2 = store.getState) === null || _store$getState2 === void 0 || (_store$getState2 = _store$getState2.call(store)) === null || _store$getState2 === void 0 || (_store$getState2 = _store$getState2.global) === null || _store$getState2 === void 0 ? void 0 : _store$getState2.symbol) || '$';
77
+ useEffect(function () {
78
+ var _interaction$utils, _interaction$utils$po;
79
+ // 通知原生初始化
80
+ interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
81
+ module: 'tickets',
82
+ key: 'page_load'
83
+ });
84
+ // 原生初始化调用-新购流程
85
+ interaction.utils.mountFunction('tickets', 'restore_buy_wallet_pass', function (data) {
86
+ console.log('重置状态', data);
87
+ });
88
+ // 原生初始化调用-购物车编辑
89
+ interaction.utils.mountFunction('tickets', 'edit_buy_wallet_pass', function (data) {
90
+ console.log('编辑状态', data);
91
+ });
92
+ }, []);
45
93
  var _useState = useState(false),
46
94
  _useState2 = _slicedToArray(_useState, 2),
47
95
  isLoading = _useState2[0],
@@ -87,7 +135,7 @@ function KioskSkuDetail(props) {
87
135
  return _regeneratorRuntime().wrap(function _callee$(_context) {
88
136
  while (1) switch (_context.prev = _context.next) {
89
137
  case 0:
90
- if (productId) {
138
+ if (resolvedProductId) {
91
139
  _context.next = 2;
92
140
  break;
93
141
  }
@@ -100,9 +148,9 @@ function KioskSkuDetail(props) {
100
148
  _params = {
101
149
  open_deposit: open_deposit
102
150
  };
103
- if (scheduleDate) _params.schedule_date = scheduleDate;
151
+ _params.schedule_date = scheduleDate;
104
152
  _context.next = 10;
105
- return getProductDetail(String(productId), _params);
153
+ return getProductDetail(String(resolvedProductId), _params);
106
154
  case 10:
107
155
  res = _context.sent;
108
156
  apiData = (res === null || res === void 0 ? void 0 : res.data) || {};
@@ -113,7 +161,7 @@ function KioskSkuDetail(props) {
113
161
  return _context.abrupt("return");
114
162
  case 14:
115
163
  setProductData(apiData);
116
- normalizedProductId = Number((apiData === null || apiData === void 0 ? void 0 : apiData.product_id) || (apiData === null || apiData === void 0 ? void 0 : apiData.id) || productId || 0);
164
+ normalizedProductId = Number((apiData === null || apiData === void 0 ? void 0 : apiData.product_id) || (apiData === null || apiData === void 0 ? void 0 : apiData.id) || resolvedProductId || 0);
117
165
  minNumUnit = Number((apiData === null || apiData === void 0 ? void 0 : apiData.min_num_unit) || 1);
118
166
  setQuantity(minNumUnit > 0 ? minNumUnit : 1);
119
167
  initialSkuValue = {
@@ -124,33 +172,34 @@ function KioskSkuDetail(props) {
124
172
  };
125
173
  setSkuValue(initialSkuValue);
126
174
  setSkuDefaultValue(initialSkuValue);
127
- _context.next = 28;
175
+ _context.next = 29;
128
176
  break;
129
177
  case 23:
130
178
  _context.prev = 23;
131
179
  _context.t0 = _context["catch"](4);
180
+ console.error(_context.t0);
132
181
  if (!isCancelled) {
133
- _context.next = 27;
182
+ _context.next = 28;
134
183
  break;
135
184
  }
136
185
  return _context.abrupt("return");
137
- case 27:
138
- setErrorText('Failed to load product detail');
139
186
  case 28:
140
- _context.prev = 28;
187
+ setErrorText('Failed to load product detail');
188
+ case 29:
189
+ _context.prev = 29;
141
190
  if (!isCancelled) {
142
- _context.next = 31;
191
+ _context.next = 32;
143
192
  break;
144
193
  }
145
194
  return _context.abrupt("return");
146
- case 31:
195
+ case 32:
147
196
  setIsLoading(false);
148
- return _context.finish(28);
149
- case 33:
197
+ return _context.finish(29);
198
+ case 34:
150
199
  case "end":
151
200
  return _context.stop();
152
201
  }
153
- }, _callee, null, [[4, 23, 28, 33]]);
202
+ }, _callee, null, [[4, 23, 29, 34]]);
154
203
  }));
155
204
  return _load.apply(this, arguments);
156
205
  }
@@ -158,7 +207,7 @@ function KioskSkuDetail(props) {
158
207
  return function () {
159
208
  isCancelled = true;
160
209
  };
161
- }, [getData, productId, scheduleDate]);
210
+ }, [getData, resolvedProductId, scheduleDate]);
162
211
  var coverUrl = useMemo(function () {
163
212
  return (productData === null || productData === void 0 ? void 0 : productData.cover) || (productData === null || productData === void 0 ? void 0 : productData.image) || '';
164
213
  }, [productData]);
@@ -201,16 +250,72 @@ function KioskSkuDetail(props) {
201
250
  var deQty = new Decimal(quantity || 0);
202
251
  return deUnit.mul(deQty).toNumber();
203
252
  }, [quantity, unitPrice]);
253
+
254
+ /**
255
+ * @description 用于展示的总价文案(参考 SkuDetailModal 的 totalText 逻辑)
256
+ * - 统一处理负数符号
257
+ * - 统一保留两位小数
258
+ */
259
+ var itemTotalText = useMemo(function () {
260
+ var deTotal = new Decimal(itemTotal || 0);
261
+ var priceSign = deTotal.toNumber() < 0 ? '-' : '';
262
+ return "".concat(priceSign).concat(symbol).concat(deTotal.abs().toNumber().toFixed(2));
263
+ }, [itemTotal, symbol]);
204
264
  var handleAddToCart = function handleAddToCart() {
205
265
  if (!productData) return;
206
- onAddToCart === null || onAddToCart === void 0 || onAddToCart({
207
- product: productData,
208
- skuValue: skuValue,
266
+ // onAddToCart?.({
267
+ // product: productData,
268
+ // skuValue,
269
+ // quantity,
270
+ // unitPrice,
271
+ // total: itemTotal,
272
+ // currencySymbol: symbol,
273
+ // bookingConfig: state?.bookingConfig,
274
+ // });
275
+ var productBundle = [];
276
+ skuValue.bundle.forEach(function (item) {
277
+ if (!item.num || item.num < 1) return;
278
+ var targetBundleData;
279
+ var bundle_group_id;
280
+ for (var i = 0; i < productData.bundle_group.length; i++) {
281
+ var _productData$bundle_g = productData.bundle_group[i],
282
+ id = _productData$bundle_g.id,
283
+ _productData$bundle_g2 = _productData$bundle_g.bundle_item,
284
+ bundle_item = _productData$bundle_g2 === void 0 ? [] : _productData$bundle_g2;
285
+ for (var j = 0; j < bundle_item.length; j++) {
286
+ if (item.id === bundle_item[j].bundle_product_id) {
287
+ bundle_group_id = id;
288
+ targetBundleData = bundle_item[j];
289
+ break;
290
+ }
291
+ }
292
+ }
293
+ productBundle.push({
294
+ bundle_group_id: bundle_group_id,
295
+ bundle_id: targetBundleData.id,
296
+ bundle_product_id: item.id,
297
+ bundle_variant_id: targetBundleData.bundle_variant_id,
298
+ num: item.num,
299
+ extension_id: targetBundleData.extension_id,
300
+ extension_type: targetBundleData.extension_type
301
+ });
302
+ });
303
+ productData.option_group = [];
304
+ productData.variant_group = [];
305
+ var obj = {
306
+ productDetail: productData,
209
307
  quantity: quantity,
210
- unitPrice: unitPrice,
211
- total: itemTotal,
212
- currencySymbol: symbol,
213
- bookingConfig: state === null || state === void 0 ? void 0 : state.bookingConfig
308
+ pricePerUnit: unitPrice,
309
+ bundlePrice: productData.price,
310
+ productBundle: productBundle
311
+ };
312
+ interaction.utils.postMessageToApp({
313
+ module: 'tickets',
314
+ key: 'buy_wallet_pass',
315
+ data: {
316
+ // 把洗好的数据放这里
317
+ productData: [obj]
318
+ }
214
319
  });
215
320
  };
216
321
  return /*#__PURE__*/React.createElement("div", {
@@ -232,7 +337,12 @@ function KioskSkuDetail(props) {
232
337
  className: "pisell-kiosk-sku-detail__title"
233
338
  }, titleText || (isLoading ? 'Loading…' : '')), !!descriptionText && /*#__PURE__*/React.createElement("div", {
234
339
  className: "pisell-kiosk-sku-detail__desc"
235
- }, descriptionText), !!priceRangeText && /*#__PURE__*/React.createElement("div", {
340
+ }, /*#__PURE__*/React.createElement("div", {
341
+ // descriptionText 为 HTML 字符串,需要按 HTML 渲染
342
+ dangerouslySetInnerHTML: {
343
+ __html: descriptionText
344
+ }
345
+ })), !!priceRangeText && /*#__PURE__*/React.createElement("div", {
236
346
  className: "pisell-kiosk-sku-detail__price-range"
237
347
  }, priceRangeText), !!errorText && /*#__PURE__*/React.createElement("div", {
238
348
  className: "pisell-kiosk-sku-detail__error"
@@ -247,17 +357,17 @@ function KioskSkuDetail(props) {
247
357
  customScrollParent: ".pisell-kiosk-sku-detail"
248
358
  }) : /*#__PURE__*/React.createElement("div", {
249
359
  className: "pisell-kiosk-sku-detail__options-loading"
250
- }, isLoading ? 'Loading options' : ''))), /*#__PURE__*/React.createElement("div", {
360
+ }, isLoading ? locales.getText('pisell2.text.kiosk.sku.detail.loading.options') : ''))), /*#__PURE__*/React.createElement("div", {
251
361
  className: "pisell-kiosk-sku-detail__footer"
252
362
  }, /*#__PURE__*/React.createElement(Button, {
253
363
  className: "pisell-kiosk-sku-detail__back-btn",
254
364
  size: "large",
255
365
  onClick: onBack
256
- }, "Back"), /*#__PURE__*/React.createElement("div", {
366
+ }, locales.getText('pisell2.text.kiosk.sku.detail.btn.back')), /*#__PURE__*/React.createElement("div", {
257
367
  className: "pisell-kiosk-sku-detail__footer-center"
258
368
  }, /*#__PURE__*/React.createElement("div", {
259
369
  className: "pisell-kiosk-sku-detail__item-total"
260
- }, "Item total: ", symbol, new Decimal(itemTotal || 0).toFixed(2)), /*#__PURE__*/React.createElement("div", {
370
+ }, locales.getText('pisell2.text.kiosk.sku.detail.item.total'), ":", ' ', itemTotalText), /*#__PURE__*/React.createElement("div", {
261
371
  className: "pisell-kiosk-sku-detail__qty"
262
372
  }, /*#__PURE__*/React.createElement(PisellNumberSelector, {
263
373
  value: quantity,
@@ -277,6 +387,43 @@ function KioskSkuDetail(props) {
277
387
  size: "large",
278
388
  onClick: handleAddToCart,
279
389
  disabled: !productData || isLoading
280
- }, "Add to cart")));
390
+ }, locales.getText('pisell2.text.kiosk.sku.detail.btn.add.to.cart'))));
281
391
  }
282
- export default KioskSkuDetail;
392
+ export default KioskSkuDetail;
393
+
394
+ /**
395
+ * @description 从当前页面 URL 中读取 query 参数(兼容 hash router)
396
+ * - search: ?a=b
397
+ * - hash: #/path?a=b
398
+ */
399
+ function getQueryFirstMatch(params) {
400
+ var _params$keys;
401
+ if (typeof window === 'undefined') return null;
402
+ if (!(params !== null && params !== void 0 && (_params$keys = params.keys) !== null && _params$keys !== void 0 && _params$keys.length)) return null;
403
+ var keys = params.keys;
404
+ var tryRead = function tryRead(raw) {
405
+ if (!raw) return null;
406
+ var normalized = raw.startsWith('?') ? raw.slice(1) : raw;
407
+ var searchParams = new URLSearchParams(normalized);
408
+ var _iterator = _createForOfIteratorHelper(keys),
409
+ _step;
410
+ try {
411
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
412
+ var key = _step.value;
413
+ var value = searchParams.get(key);
414
+ if (value) return value;
415
+ }
416
+ } catch (err) {
417
+ _iterator.e(err);
418
+ } finally {
419
+ _iterator.f();
420
+ }
421
+ return null;
422
+ };
423
+ var fromSearch = tryRead(window.location.search || '');
424
+ if (fromSearch) return fromSearch;
425
+ var hash = window.location.hash || '';
426
+ var queryIndex = hash.indexOf('?');
427
+ if (queryIndex === -1) return null;
428
+ return tryRead(hash.slice(queryIndex + 1));
429
+ }
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'pisell2.text.kiosk.sku.detail.btn.back': string;
4
+ 'pisell2.text.kiosk.sku.detail.item.total': string;
5
+ 'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
6
+ 'pisell2.text.kiosk.sku.detail.loading.options': string;
7
+ };
8
+ 'zh-CN': {
9
+ 'pisell2.text.kiosk.sku.detail.btn.back': string;
10
+ 'pisell2.text.kiosk.sku.detail.item.total': string;
11
+ 'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
12
+ 'pisell2.text.kiosk.sku.detail.loading.options': string;
13
+ };
14
+ 'zh-TW': {
15
+ 'pisell2.text.kiosk.sku.detail.btn.back': string;
16
+ 'pisell2.text.kiosk.sku.detail.item.total': string;
17
+ 'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
18
+ 'pisell2.text.kiosk.sku.detail.loading.options': string;
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,20 @@
1
+ export default {
2
+ en: {
3
+ 'pisell2.text.kiosk.sku.detail.btn.back': 'Back',
4
+ 'pisell2.text.kiosk.sku.detail.item.total': 'Item total',
5
+ 'pisell2.text.kiosk.sku.detail.btn.add.to.cart': 'Add to cart',
6
+ 'pisell2.text.kiosk.sku.detail.loading.options': 'Loading options…'
7
+ },
8
+ 'zh-CN': {
9
+ 'pisell2.text.kiosk.sku.detail.btn.back': '返回',
10
+ 'pisell2.text.kiosk.sku.detail.item.total': '小计',
11
+ 'pisell2.text.kiosk.sku.detail.btn.add.to.cart': '加入购物车',
12
+ 'pisell2.text.kiosk.sku.detail.loading.options': '正在加载选项…'
13
+ },
14
+ 'zh-TW': {
15
+ 'pisell2.text.kiosk.sku.detail.btn.back': '返回',
16
+ 'pisell2.text.kiosk.sku.detail.item.total': '小計',
17
+ 'pisell2.text.kiosk.sku.detail.btn.add.to.cart': '加入購物車',
18
+ 'pisell2.text.kiosk.sku.detail.loading.options': '正在載入選項…'
19
+ }
20
+ };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  import { ProductDisplayConfig, ProductDisplayPresetKey } from '../ProductDisplayAdapter/types';
3
4
  export declare const _formatBookingDetail: (data: any, modalState: any) => any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  /**
3
4
  * @title: 底部
@@ -341,7 +341,7 @@ var getMainProductSellingPrice = (item) => {
341
341
  return new import_decimal.default((_f = item._extend) == null ? void 0 : _f.main_product_selling_price).add(optionPrice).toNumber();
342
342
  };
343
343
  var formatProducts = (item, quantity) => {
344
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
344
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
345
345
  if (item == null ? void 0 : item.discount_list) {
346
346
  item == null ? void 0 : item.discount_list.forEach((d) => {
347
347
  if (d == null ? void 0 : d.id) {
@@ -393,7 +393,7 @@ var formatProducts = (item, quantity) => {
393
393
  // checkout 需求新增字段
394
394
  "calculated_original_price": formatOriginalPrice(item),
395
395
  "calculated_selling_price": formatSellingPrice(item),
396
- "tax_fee": item._extend.tax_fee,
396
+ "tax_fee": item._extend.tax_fee ?? ((_j = item.metadata) == null ? void 0 : _j.main_product_attached_bundle_tax_fee),
397
397
  "custom_deposit_data": item.custom_deposit_data
398
398
  };
399
399
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const AddTimeModal: () => JSX.Element;
3
4
  export default AddTimeModal;
@@ -3,16 +3,19 @@ import type { SkuValue } from '../../plus/skuOptionsSelection/types';
3
3
  import './index.less';
4
4
  /**
5
5
  * @description Kiosk 商品详情(参考 Figma: Kiosk / Launchpad screen)
6
- * - 外部传入商品 id,内部通过 getProductDetail 拉取详情
6
+ * - 默认从 URL query 读取商品 id(productId / product_id / id),内部通过 getProductDetail 拉取详情
7
7
  * - 中间区域用 SKUOptionsSelection 做 SKU 选择
8
8
  * - 底部用 PisellNumberSelector 做数量编辑
9
9
  */
10
10
  declare function KioskSkuDetail(props: KioskSkuDetailProps): JSX.Element;
11
11
  export default KioskSkuDetail;
12
12
  export interface KioskSkuDetailProps {
13
- /** 商品 id */
14
- productId: number | string;
15
- /** 可选:用于商品报价的日期(预约类商品) */
13
+ /** 商品 id(可选:目前默认从 URL 读取,props 仅作为兜底以兼容老用法) */
14
+ productId?: number | string;
15
+ /**
16
+ * 可选:用于商品报价的日期(预约类商品)
17
+ * @deprecated 目前 kiosk 详情暂时固定取当天,这个参数暂不生效
18
+ */
16
19
  scheduleDate?: string;
17
20
  /** 自定义类名 */
18
21
  className?: string;