@pisell/private-materials 6.8.30 → 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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/components/footer/index.d.ts +1 -0
- package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/es/components/kioskSkuDetail/index.d.ts +7 -4
- package/es/components/kioskSkuDetail/index.js +182 -35
- package/es/components/kioskSkuDetail/locales.d.ts +21 -0
- package/es/components/kioskSkuDetail/locales.js +20 -0
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/lib/components/booking/components/footer/index.d.ts +1 -0
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/lib/components/kioskSkuDetail/index.d.ts +7 -4
- package/lib/components/kioskSkuDetail/index.js +178 -65
- package/lib/components/kioskSkuDetail/locales.d.ts +21 -0
- package/lib/components/kioskSkuDetail/locales.js +44 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/package.json +3 -3
- package/es/components/appointmentBooking/components/Services/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -4
- package/es/components/booking/components/actionButtons/index.d.ts +0 -31
- package/es/components/booking/components/footer/utils.d.ts +0 -67
- package/es/components/booking/components/voucher/index.d.ts +0 -3
- package/es/components/booking/info/service/Lists.d.ts +0 -3
- package/es/components/booking/info/service/serve.d.ts +0 -34
- package/es/components/booking/info/service2/utils.d.ts +0 -219
- package/es/components/booking/info2/service/addService/utils.d.ts +0 -106
- package/es/components/booking/info2/service/editService/index.d.ts +0 -8
- package/es/components/booking/info2/utilsByBooking.d.ts +0 -36
- package/es/components/booking/utils.d.ts +0 -182
- package/es/components/checkout/PaymentModal.d.ts +0 -39
- package/es/components/checkout/components/AdditionalModule/index.d.ts +0 -15
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +0 -26
- package/es/components/checkout/components/PaymentDetailModal/index.d.ts +0 -38
- package/es/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +0 -85
- package/es/components/checkout/components/SearchAndClientModule/index.d.ts +0 -14
- package/es/components/checkout/hooks/useWalletPass.d.ts +0 -40
- package/es/components/checkout/utils/PaymentResultToastUtils.d.ts +0 -32
- package/es/components/list/List.d.ts +0 -5
- package/es/components/list/hooks/useListState.d.ts +0 -45
- package/es/components/pay/toB/components/MX51/index.d.ts +0 -3
- package/es/components/pay/toB/types/index.d.ts +0 -72
- package/es/components/pisellSelectCustomerModal/RightPanel/serve.d.ts +0 -3
- package/es/components/ticketBooking/components/ProductDisplayAdapter/ProductDisplayAdapter.d.ts +0 -27
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -31
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -10
- package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -14
- package/es/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -16
- package/es/components/ticketBooking/index.d.ts +0 -15
- package/es/components/ticketBooking/serve.d.ts +0 -288
- package/es/components/ticketBooking/utils/index.d.ts +0 -101
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.d.ts +0 -4
- package/es/plus/productSelect/ProductCard/index.d.ts +0 -47
- package/es/plus/webPosLogin/WebPosLogin.d.ts +0 -11
- package/es/plus/webPosLogin/WebPosLoginCpt.d.ts +0 -9
- package/es/plus/webPosLogin/components/BrandPanel/index.d.ts +0 -9
- package/es/plus/webPosLogin/components/LoginPanel/index.d.ts +0 -21
- package/es/plus/webPosLogin/components/MediaDisplay/index.d.ts +0 -12
- package/es/plus/webPosLogin/components/MediaDisplay/type.d.ts +0 -54
- package/es/plus/webPosLogin/components/SelectDevice/index.d.ts +0 -28
- package/es/plus/webPosLogin/components/SelectStore/index.d.ts +0 -24
- package/es/plus/webPosLogin/components/UserFooter/index.d.ts +0 -28
- package/es/plus/webPosLogin/index.d.ts +0 -12
- package/es/plus/webPosLogin/locales.d.ts +0 -49
- package/es/plus/webPosLogin/service.d.ts +0 -44
- package/es/plus/webPosLogin/types.d.ts +0 -286
- package/es/pro/Login2.0/Login2.d.ts +0 -61
- package/lib/components/appointmentBooking/components/Services/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -4
- package/lib/components/booking/components/actionButtons/index.d.ts +0 -31
- package/lib/components/booking/components/footer/utils.d.ts +0 -67
- package/lib/components/booking/components/voucher/index.d.ts +0 -3
- package/lib/components/booking/info/service/Lists.d.ts +0 -3
- package/lib/components/booking/info/service/serve.d.ts +0 -34
- package/lib/components/booking/info/service2/utils.d.ts +0 -219
- package/lib/components/booking/info2/service/addService/utils.d.ts +0 -106
- package/lib/components/booking/info2/service/editService/index.d.ts +0 -8
- package/lib/components/booking/info2/utilsByBooking.d.ts +0 -36
- package/lib/components/booking/utils.d.ts +0 -182
- package/lib/components/checkout/PaymentModal.d.ts +0 -39
- package/lib/components/checkout/components/AdditionalModule/index.d.ts +0 -15
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +0 -26
- package/lib/components/checkout/components/PaymentDetailModal/index.d.ts +0 -38
- package/lib/components/checkout/components/PaymentResultToast/PaymentResultToastProvider.d.ts +0 -85
- package/lib/components/checkout/components/SearchAndClientModule/index.d.ts +0 -14
- package/lib/components/checkout/hooks/useWalletPass.d.ts +0 -40
- package/lib/components/checkout/utils/PaymentResultToastUtils.d.ts +0 -32
- package/lib/components/list/List.d.ts +0 -5
- package/lib/components/list/hooks/useListState.d.ts +0 -45
- package/lib/components/pay/toB/components/MX51/index.d.ts +0 -3
- package/lib/components/pay/toB/types/index.d.ts +0 -72
- package/lib/components/pisellSelectCustomerModal/RightPanel/serve.d.ts +0 -3
- package/lib/components/ticketBooking/components/ProductDisplayAdapter/ProductDisplayAdapter.d.ts +0 -27
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -31
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -10
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -14
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -16
- package/lib/components/ticketBooking/index.d.ts +0 -15
- package/lib/components/ticketBooking/serve.d.ts +0 -288
- package/lib/components/ticketBooking/utils/index.d.ts +0 -101
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.d.ts +0 -4
- package/lib/plus/productSelect/ProductCard/index.d.ts +0 -47
- package/lib/plus/webPosLogin/WebPosLogin.d.ts +0 -11
- package/lib/plus/webPosLogin/WebPosLoginCpt.d.ts +0 -9
- package/lib/plus/webPosLogin/components/BrandPanel/index.d.ts +0 -9
- package/lib/plus/webPosLogin/components/LoginPanel/index.d.ts +0 -21
- package/lib/plus/webPosLogin/components/MediaDisplay/index.d.ts +0 -12
- package/lib/plus/webPosLogin/components/MediaDisplay/type.d.ts +0 -54
- package/lib/plus/webPosLogin/components/SelectDevice/index.d.ts +0 -28
- package/lib/plus/webPosLogin/components/SelectStore/index.d.ts +0 -24
- package/lib/plus/webPosLogin/components/UserFooter/index.d.ts +0 -28
- package/lib/plus/webPosLogin/index.d.ts +0 -12
- package/lib/plus/webPosLogin/locales.d.ts +0 -49
- package/lib/plus/webPosLogin/service.d.ts +0 -44
- package/lib/plus/webPosLogin/types.d.ts +0 -286
- package/lib/pro/Login2.0/Login2.d.ts +0 -61
|
@@ -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
|
-
* -
|
|
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
|
|
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
|
-
* -
|
|
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
|
|
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
|
-
|
|
42
|
-
|
|
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 (
|
|
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
|
-
|
|
151
|
+
_params.schedule_date = scheduleDate;
|
|
104
152
|
_context.next = 10;
|
|
105
|
-
return getProductDetail(String(
|
|
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) ||
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
187
|
+
setErrorText('Failed to load product detail');
|
|
188
|
+
case 29:
|
|
189
|
+
_context.prev = 29;
|
|
141
190
|
if (!isCancelled) {
|
|
142
|
-
_context.next =
|
|
191
|
+
_context.next = 32;
|
|
143
192
|
break;
|
|
144
193
|
}
|
|
145
194
|
return _context.abrupt("return");
|
|
146
|
-
case
|
|
195
|
+
case 32:
|
|
147
196
|
setIsLoading(false);
|
|
148
|
-
return _context.finish(
|
|
149
|
-
case
|
|
197
|
+
return _context.finish(29);
|
|
198
|
+
case 34:
|
|
150
199
|
case "end":
|
|
151
200
|
return _context.stop();
|
|
152
201
|
}
|
|
153
|
-
}, _callee, null, [[4, 23,
|
|
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,
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
},
|
|
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 ? '
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
+
};
|
|
@@ -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
|
-
* -
|
|
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
|
|
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;
|