@pisell/private-materials 6.12.407 → 6.12.409
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 +4 -4
- package/build/lowcode/view.js +4 -4
- package/es/components/bigSale/components/ProductList/index.js +179 -26
- package/es/components/bigSale/components/ProductListSettingsModal/index.js +5 -3
- package/es/components/bigSale/utils/productListPreferences.js +5 -2
- package/es/components/venueBookingSales/BookingComposer.js +44 -8
- package/es/components/venueBookingSales/VenueBookingShared.js +1 -1
- package/es/components/venueBookingSales/availability/BookingSelectionPanel.js +12 -1
- package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -1
- package/es/plus/pisellReservation/PisellReservation.js +1 -0
- package/es/plus/pisellReservation/components/ReservationNewReservationModal.js +29 -1
- package/es/pro/bookingProductDetailModal/index.js +7 -7
- package/lib/components/bigSale/components/ProductList/index.js +179 -26
- package/lib/components/bigSale/components/ProductListSettingsModal/index.js +5 -3
- package/lib/components/bigSale/utils/productListPreferences.js +5 -2
- package/lib/components/venueBookingSales/BookingComposer.js +43 -7
- package/lib/components/venueBookingSales/VenueBookingShared.js +1 -1
- package/lib/components/venueBookingSales/availability/BookingSelectionPanel.js +12 -1
- package/lib/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -1
- package/lib/plus/pisellReservation/PisellReservation.js +1 -0
- package/lib/plus/pisellReservation/components/ReservationNewReservationModal.js +29 -1
- package/lib/pro/bookingProductDetailModal/index.js +7 -7
- package/package.json +3 -3
|
@@ -52,6 +52,42 @@ function getCurrentRoutePath() {
|
|
|
52
52
|
const { pathname, search, hash } = window.location;
|
|
53
53
|
return `${pathname}${search}${hash}`;
|
|
54
54
|
}
|
|
55
|
+
function getOperatorMetadata(user) {
|
|
56
|
+
var _user$id, _user$email, _user$pos_id;
|
|
57
|
+
if (!user || typeof user !== "object") return null;
|
|
58
|
+
const name = [user.staff_first_name, user.staff_last_name].filter(Boolean).join(" ").trim() || [user.first_name, user.last_name].filter(Boolean).join(" ").trim() || null;
|
|
59
|
+
const operator = {
|
|
60
|
+
id: (_user$id = user.id) !== null && _user$id !== void 0 ? _user$id : null,
|
|
61
|
+
name,
|
|
62
|
+
email: (_user$email = user.email) !== null && _user$email !== void 0 ? _user$email : null,
|
|
63
|
+
posId: (_user$pos_id = user.pos_id) !== null && _user$pos_id !== void 0 ? _user$pos_id : null
|
|
64
|
+
};
|
|
65
|
+
return Object.values(operator).some(Boolean) ? operator : null;
|
|
66
|
+
}
|
|
67
|
+
function getCurrentOperatorMetadata(engineContext) {
|
|
68
|
+
var _engineContext$appHel;
|
|
69
|
+
const utils = engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils;
|
|
70
|
+
const candidates = [];
|
|
71
|
+
if (typeof (utils === null || utils === void 0 ? void 0 : utils.getData) === "function") try {
|
|
72
|
+
candidates.push(utils.getData("account"), utils.getData("customer"));
|
|
73
|
+
} catch (_unused) {}
|
|
74
|
+
let appStorage;
|
|
75
|
+
if (typeof (utils === null || utils === void 0 ? void 0 : utils.getApp) === "function") try {
|
|
76
|
+
var _utils$getApp;
|
|
77
|
+
appStorage = (_utils$getApp = utils.getApp()) === null || _utils$getApp === void 0 ? void 0 : _utils$getApp.storage;
|
|
78
|
+
} catch (_unused2) {}
|
|
79
|
+
[utils === null || utils === void 0 ? void 0 : utils.storage, appStorage].forEach((storage) => {
|
|
80
|
+
if (typeof (storage === null || storage === void 0 ? void 0 : storage.get) !== "function") return;
|
|
81
|
+
try {
|
|
82
|
+
candidates.push(storage.get("account"), storage.get("customer"));
|
|
83
|
+
} catch (_unused3) {}
|
|
84
|
+
});
|
|
85
|
+
for (const candidate of candidates) try {
|
|
86
|
+
const operator = getOperatorMetadata(typeof candidate === "string" ? JSON.parse(candidate) : candidate);
|
|
87
|
+
if (operator) return operator;
|
|
88
|
+
} catch (_unused4) {}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
55
91
|
function resolvePhoneCartEntryQuantity(value) {
|
|
56
92
|
var _value$_extend$displa, _value$_extend;
|
|
57
93
|
const quantity = Number((_value$_extend$displa = value === null || value === void 0 || (_value$_extend = value._extend) === null || _value$_extend === void 0 ? void 0 : _value$_extend.displayQuantity) !== null && _value$_extend$displa !== void 0 ? _value$_extend$displa : value === null || value === void 0 ? void 0 : value.num);
|
|
@@ -140,7 +176,7 @@ function shouldHideSingleKioskCategoryNavigation(navigation, items) {
|
|
|
140
176
|
* 商品列表只做“加载商品 + 触发加购”,加购决策交给 salesSdk。
|
|
141
177
|
*/
|
|
142
178
|
const BigSaleProductListInner = ({ renderContent, className, renderProductCard, catalog, quantityByProductId, onSelectProduct, onQuantityChange, getProductPresentation, isActive = true, catalogPreparation, osKey, productListPreferencesChannel, mode, context, businessCode, productLoadParams, productDisplayConfig, productCatalogSessionKey, requiredOrderId, categoryResetKey, revealProductRequest, productListPreferences: controlledProductListPreferences, productListPreferencesOverride: controlledProductListPreferencesOverride, defaultProductListPreferences: controlledDefaultProductListPreferences, onProductListPreferencesChange, onProductListPreferencesReset, variant, categoryNavigation = "tabbar", defaultCategorySelection = "first", allCategoryLabel, hideSingleCategoryNavigation = false, categoryDisplayMode = "switch", persistentSearch = false, onScrollActivityChange, showActiveCategoryTitle = false, productListHeaderSlot, productSelectionTrigger = "pointerUp", productCardVersion = "v1", addToCartToastIcon, addToCartToastOptions, showSettings = true }) => {
|
|
143
|
-
var _engineContext$
|
|
179
|
+
var _engineContext$appHel2, _catalog$products, _sales$bookingTicket$, _sales$bookingTicket, _sales$bookingTicket$2, _productLoadParams$me, _sales$defaultProduct, _sales$tempOrder3;
|
|
144
180
|
const isControlledCatalog = catalog !== void 0;
|
|
145
181
|
const hasControlledActions = isControlledCatalog || quantityByProductId !== void 0 || !!onSelectProduct || !!onQuantityChange;
|
|
146
182
|
const scopeKey = catalog === null || catalog === void 0 ? void 0 : catalog.scopeKey;
|
|
@@ -151,7 +187,8 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
151
187
|
const usesV2ProductCard = variant === "phone" && productCardVersion === "v2";
|
|
152
188
|
const Toast = (0, _pisell_materials.useToast)();
|
|
153
189
|
const engineContext = require_useEngineContext.default();
|
|
154
|
-
const getEngineData = engineContext === null || engineContext === void 0 || (_engineContext$
|
|
190
|
+
const getEngineData = engineContext === null || engineContext === void 0 || (_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.utils) === null || _engineContext$appHel2 === void 0 ? void 0 : _engineContext$appHel2.getData;
|
|
191
|
+
const operator = getCurrentOperatorMetadata(engineContext);
|
|
155
192
|
const addToCartToastApi = (0, react.useMemo)(() => addToCartToastIcon ? { success: (content) => {
|
|
156
193
|
Toast.show({
|
|
157
194
|
content,
|
|
@@ -242,8 +279,60 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
242
279
|
const [uncontrolledProductListPreferences, setUncontrolledProductListPreferences] = (0, react.useState)(() => require_productListPreferences.readBigSaleProductListPreferences(preferencesKey, defaultProductListPreferences));
|
|
243
280
|
const [uncontrolledProductListPreferencesKey, setUncontrolledProductListPreferencesKey] = (0, react.useState)(preferencesKey);
|
|
244
281
|
const [uncontrolledProductListPreferencesOverride, setUncontrolledProductListPreferencesOverride] = (0, react.useState)(() => Boolean(require_productListPreferences.readStoredBigSaleProductListPreferences(preferencesKey, defaultProductListPreferences)));
|
|
282
|
+
const productListPreferenceStorageLogRef = (0, react.useRef)();
|
|
283
|
+
const productListEntryLogRef = (0, react.useRef)();
|
|
245
284
|
const productListPreferences = controlledProductListPreferences || (uncontrolledProductListPreferencesKey === preferencesKey ? uncontrolledProductListPreferences : defaultProductListPreferences);
|
|
246
285
|
const productListPreferencesOverride = controlledProductListPreferences !== void 0 ? controlledProductListPreferencesOverride !== false : uncontrolledProductListPreferencesOverride;
|
|
286
|
+
(0, react.useEffect)(() => {
|
|
287
|
+
const metadata = {
|
|
288
|
+
eventVersion: 1,
|
|
289
|
+
action: "enter-sales-page",
|
|
290
|
+
mode,
|
|
291
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
292
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
293
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
294
|
+
scopeKey: scopeKey !== null && scopeKey !== void 0 ? scopeKey : null,
|
|
295
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
296
|
+
pathname: getCurrentRoutePath(),
|
|
297
|
+
operator,
|
|
298
|
+
storageKey: preferencesKey,
|
|
299
|
+
productListPreferencesSource: controlledProductListPreferences ? "controlled" : productListPreferencesOverride ? "local-storage" : "auto",
|
|
300
|
+
productListPreferences,
|
|
301
|
+
catalogProductCount: currentProducts.length
|
|
302
|
+
};
|
|
303
|
+
const entrySignature = JSON.stringify({
|
|
304
|
+
mode,
|
|
305
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
306
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
307
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
308
|
+
scopeKey: scopeKey !== null && scopeKey !== void 0 ? scopeKey : null,
|
|
309
|
+
pathname: metadata.pathname
|
|
310
|
+
});
|
|
311
|
+
if (productListEntryLogRef.current === entrySignature) return;
|
|
312
|
+
productListEntryLogRef.current = entrySignature;
|
|
313
|
+
try {
|
|
314
|
+
var _logger$addLog;
|
|
315
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
316
|
+
type: "info",
|
|
317
|
+
title: "[BigSaleProductList] 商品列表进入销售页",
|
|
318
|
+
metadata
|
|
319
|
+
});
|
|
320
|
+
} catch (_unused5) {}
|
|
321
|
+
}, [
|
|
322
|
+
businessCode,
|
|
323
|
+
controlledProductListPreferences,
|
|
324
|
+
currentProducts.length,
|
|
325
|
+
logger,
|
|
326
|
+
mode,
|
|
327
|
+
operator,
|
|
328
|
+
osKey,
|
|
329
|
+
preferencesKey,
|
|
330
|
+
productListPreferences,
|
|
331
|
+
productListPreferencesChannel,
|
|
332
|
+
productListPreferencesOverride,
|
|
333
|
+
scopeKey,
|
|
334
|
+
variant
|
|
335
|
+
]);
|
|
247
336
|
const productListConfig = require_useBigSaleProductListConfig.useBigSaleProductListConfig({
|
|
248
337
|
products: currentProducts,
|
|
249
338
|
scopeKey,
|
|
@@ -287,11 +376,44 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
287
376
|
setUncontrolledProductListPreferences(storedPreferences || defaultProductListPreferences);
|
|
288
377
|
setUncontrolledProductListPreferencesKey(preferencesKey);
|
|
289
378
|
setUncontrolledProductListPreferencesOverride(Boolean(storedPreferences));
|
|
379
|
+
const metadata = {
|
|
380
|
+
eventVersion: 1,
|
|
381
|
+
mode,
|
|
382
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
383
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
384
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
385
|
+
operator,
|
|
386
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
387
|
+
pathname: getCurrentRoutePath(),
|
|
388
|
+
storageKey: preferencesKey,
|
|
389
|
+
cacheHit: Boolean(storedPreferences),
|
|
390
|
+
storedPreferences: storedPreferences !== null && storedPreferences !== void 0 ? storedPreferences : null,
|
|
391
|
+
fallbackPreferences: defaultProductListPreferences
|
|
392
|
+
};
|
|
393
|
+
const signature = JSON.stringify(metadata);
|
|
394
|
+
if (productListPreferenceStorageLogRef.current !== signature) {
|
|
395
|
+
productListPreferenceStorageLogRef.current = signature;
|
|
396
|
+
try {
|
|
397
|
+
var _logger$addLog2;
|
|
398
|
+
logger === null || logger === void 0 || (_logger$addLog2 = logger.addLog) === null || _logger$addLog2 === void 0 || _logger$addLog2.call(logger, {
|
|
399
|
+
type: "info",
|
|
400
|
+
title: "[BigSaleProductList] 商品卡配置本地缓存读取",
|
|
401
|
+
metadata
|
|
402
|
+
});
|
|
403
|
+
} catch (_unused6) {}
|
|
404
|
+
}
|
|
290
405
|
}
|
|
291
406
|
}, [
|
|
407
|
+
businessCode,
|
|
292
408
|
controlledProductListPreferences,
|
|
293
409
|
defaultProductListPreferences,
|
|
294
|
-
|
|
410
|
+
logger,
|
|
411
|
+
mode,
|
|
412
|
+
osKey,
|
|
413
|
+
operator,
|
|
414
|
+
preferencesKey,
|
|
415
|
+
productListPreferencesChannel,
|
|
416
|
+
variant
|
|
295
417
|
]);
|
|
296
418
|
const productListLayoutLogRef = (0, react.useRef)();
|
|
297
419
|
(0, react.useEffect)(() => {
|
|
@@ -313,13 +435,13 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
313
435
|
if (productListLayoutLogRef.current === signature) return;
|
|
314
436
|
productListLayoutLogRef.current = signature;
|
|
315
437
|
try {
|
|
316
|
-
var _logger$
|
|
317
|
-
logger === null || logger === void 0 || (_logger$
|
|
438
|
+
var _logger$addLog3;
|
|
439
|
+
logger === null || logger === void 0 || (_logger$addLog3 = logger.addLog) === null || _logger$addLog3 === void 0 || _logger$addLog3.call(logger, {
|
|
318
440
|
type: "info",
|
|
319
441
|
title: "[BigSaleProductList] 商品列表布局已解析",
|
|
320
442
|
metadata
|
|
321
443
|
});
|
|
322
|
-
} catch (
|
|
444
|
+
} catch (_unused7) {}
|
|
323
445
|
}, [
|
|
324
446
|
businessCode,
|
|
325
447
|
controlledProductListPreferences,
|
|
@@ -505,13 +627,13 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
505
627
|
const productId = String((_ref6 = (_product$id = product === null || product === void 0 ? void 0 : product.id) !== null && _product$id !== void 0 ? _product$id : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref6 !== void 0 ? _ref6 : "");
|
|
506
628
|
const baselineQuantity = phoneCartProductEntries.filter((entry) => resolvePhoneCartProductId(entry.value) === productId).reduce((total, entry) => total + entry.quantity, 0);
|
|
507
629
|
try {
|
|
508
|
-
var _sales$tempOrder4, _logger$
|
|
630
|
+
var _sales$tempOrder4, _logger$addLog4, _cart$items$length, _cart$items, _cart$bookings$length, _cart$bookings, _ref7, _sales$tempOrder$orde, _sales$tempOrder5;
|
|
509
631
|
if (!(yield businessAvailability.ensureCanShop())) return;
|
|
510
632
|
if (!sales.isReady) return;
|
|
511
633
|
if (requiredOrderId !== void 0 && Number((_sales$tempOrder4 = sales.tempOrder) === null || _sales$tempOrder4 === void 0 ? void 0 : _sales$tempOrder4.order_id) !== Number(requiredOrderId)) return;
|
|
512
634
|
const latestProduct = currentProducts.find((currentProduct) => currentProduct.id === product.id);
|
|
513
635
|
latestProduct && require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, product), {}, { cartDetailValue: latestProduct.cartDetailValue });
|
|
514
|
-
logger === null || logger === void 0 || (_logger$
|
|
636
|
+
logger === null || logger === void 0 || (_logger$addLog4 = logger.addLog) === null || _logger$addLog4 === void 0 || _logger$addLog4.call(logger, {
|
|
515
637
|
type: "info",
|
|
516
638
|
title: "[BigSaleProductList] 用户点击商品卡片加入购物车",
|
|
517
639
|
metadata: {
|
|
@@ -1025,39 +1147,68 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1025
1147
|
setSettingsOpen(false);
|
|
1026
1148
|
});
|
|
1027
1149
|
const handleSaveSettings = (0, ahooks.useMemoizedFn)((preferences) => {
|
|
1028
|
-
require_productListPreferences.writeBigSaleProductListPreferences(preferencesKey, preferences);
|
|
1150
|
+
const cacheWriteSucceeded = require_productListPreferences.writeBigSaleProductListPreferences(preferencesKey, preferences);
|
|
1151
|
+
const persistedPreferences = cacheWriteSucceeded ? require_productListPreferences.readStoredBigSaleProductListPreferences(preferencesKey, defaultProductListPreferences) : void 0;
|
|
1029
1152
|
setUncontrolledProductListPreferences(preferences);
|
|
1030
1153
|
setUncontrolledProductListPreferencesKey(preferencesKey);
|
|
1031
1154
|
setUncontrolledProductListPreferencesOverride(true);
|
|
1155
|
+
const metadata = {
|
|
1156
|
+
eventVersion: 1,
|
|
1157
|
+
action: "save-completed",
|
|
1158
|
+
mode,
|
|
1159
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
1160
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
1161
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
1162
|
+
operator,
|
|
1163
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
1164
|
+
pathname: getCurrentRoutePath(),
|
|
1165
|
+
storageKey: preferencesKey,
|
|
1166
|
+
cacheWriteSucceeded,
|
|
1167
|
+
persistedPreferences: persistedPreferences !== null && persistedPreferences !== void 0 ? persistedPreferences : null,
|
|
1168
|
+
preferences
|
|
1169
|
+
};
|
|
1032
1170
|
try {
|
|
1033
|
-
var _logger$
|
|
1034
|
-
logger === null || logger === void 0 || (_logger$
|
|
1171
|
+
var _logger$addLog5;
|
|
1172
|
+
logger === null || logger === void 0 || (_logger$addLog5 = logger.addLog) === null || _logger$addLog5 === void 0 || _logger$addLog5.call(logger, {
|
|
1035
1173
|
type: "info",
|
|
1036
1174
|
title: "[BigSaleProductList] 商品列表布局设置已保存",
|
|
1037
|
-
metadata
|
|
1038
|
-
mode,
|
|
1039
|
-
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
1040
|
-
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
1041
|
-
pathname: getCurrentRoutePath(),
|
|
1042
|
-
columns: preferences.columns,
|
|
1043
|
-
cardLayoutDirection: preferences.layoutDirection,
|
|
1044
|
-
showImage: preferences.showImage,
|
|
1045
|
-
imageWidth: preferences.imageWidth,
|
|
1046
|
-
imageHeight: preferences.imageHeight
|
|
1047
|
-
}
|
|
1175
|
+
metadata
|
|
1048
1176
|
});
|
|
1049
|
-
} catch (
|
|
1177
|
+
} catch (_unused8) {}
|
|
1050
1178
|
onProductListPreferencesChange === null || onProductListPreferencesChange === void 0 || onProductListPreferencesChange(preferences);
|
|
1051
1179
|
setSettingsOpen(false);
|
|
1052
1180
|
});
|
|
1181
|
+
const handleSettingsSaveAttempt = (0, ahooks.useMemoizedFn)((preferences) => {
|
|
1182
|
+
const metadata = {
|
|
1183
|
+
eventVersion: 1,
|
|
1184
|
+
action: "save-clicked",
|
|
1185
|
+
mode,
|
|
1186
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
1187
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
1188
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
1189
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
1190
|
+
pathname: getCurrentRoutePath(),
|
|
1191
|
+
storageKey: preferencesKey,
|
|
1192
|
+
operator,
|
|
1193
|
+
preferences
|
|
1194
|
+
};
|
|
1195
|
+
try {
|
|
1196
|
+
var _logger$addLog6;
|
|
1197
|
+
logger === null || logger === void 0 || (_logger$addLog6 = logger.addLog) === null || _logger$addLog6 === void 0 || _logger$addLog6.call(logger, {
|
|
1198
|
+
type: "info",
|
|
1199
|
+
title: "[BigSaleProductList] 商品卡配置弹窗点击保存",
|
|
1200
|
+
metadata
|
|
1201
|
+
});
|
|
1202
|
+
} catch (_unused9) {}
|
|
1203
|
+
});
|
|
1053
1204
|
const handleResetSettings = (0, ahooks.useMemoizedFn)(() => {
|
|
1054
1205
|
require_productListPreferences.removeBigSaleProductListPreferences(preferencesKey);
|
|
1055
1206
|
setUncontrolledProductListPreferences(defaultProductListPreferences);
|
|
1056
1207
|
setUncontrolledProductListPreferencesKey(preferencesKey);
|
|
1057
1208
|
setUncontrolledProductListPreferencesOverride(false);
|
|
1058
1209
|
try {
|
|
1059
|
-
var _logger$
|
|
1060
|
-
logger === null || logger === void 0 || (_logger$
|
|
1210
|
+
var _logger$addLog7;
|
|
1211
|
+
logger === null || logger === void 0 || (_logger$addLog7 = logger.addLog) === null || _logger$addLog7 === void 0 || _logger$addLog7.call(logger, {
|
|
1061
1212
|
type: "info",
|
|
1062
1213
|
title: "[BigSaleProductList] 商品列表布局设置已重置",
|
|
1063
1214
|
metadata: {
|
|
@@ -1069,7 +1220,7 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1069
1220
|
cardLayoutDirection: defaultProductListPreferences.layoutDirection
|
|
1070
1221
|
}
|
|
1071
1222
|
});
|
|
1072
|
-
} catch (
|
|
1223
|
+
} catch (_unused10) {}
|
|
1073
1224
|
onProductListPreferencesReset === null || onProductListPreferencesReset === void 0 || onProductListPreferencesReset(defaultProductListPreferences);
|
|
1074
1225
|
setSettingsOpen(false);
|
|
1075
1226
|
});
|
|
@@ -1279,6 +1430,7 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1279
1430
|
variant,
|
|
1280
1431
|
fullWidthActions: categoryNavigation === "sidebar",
|
|
1281
1432
|
onCancel: handleCloseSettings,
|
|
1433
|
+
onSaveAttempt: handleSettingsSaveAttempt,
|
|
1282
1434
|
onSave: handleSaveSettings,
|
|
1283
1435
|
onSaveAuto: handleResetSettings
|
|
1284
1436
|
}) : null), [
|
|
@@ -1296,6 +1448,7 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1296
1448
|
handleOpenSettings,
|
|
1297
1449
|
handleResetSettings,
|
|
1298
1450
|
handleSaveSettings,
|
|
1451
|
+
handleSettingsSaveAttempt,
|
|
1299
1452
|
defaultProductListPreferences,
|
|
1300
1453
|
purchaseDisabled,
|
|
1301
1454
|
listData,
|
|
@@ -17,7 +17,7 @@ function getPlatformByVariant(variant) {
|
|
|
17
17
|
/**
|
|
18
18
|
* Big Sale 商品卡片设置弹窗,只负责编辑当前页面本地偏好。
|
|
19
19
|
*/
|
|
20
|
-
const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, isAutoMode, variant, fullWidthActions = false, onCancel, onSave, onSaveAuto }) => {
|
|
20
|
+
const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, isAutoMode, variant, fullWidthActions = false, onCancel, onSaveAttempt, onSave, onSaveAuto }) => {
|
|
21
21
|
const [form] = antd.Form.useForm();
|
|
22
22
|
const isPhoneVariant = variant === "phone";
|
|
23
23
|
const [preferenceMode, setPreferenceMode] = (0, react.useState)(isAutoMode ? "auto" : "custom");
|
|
@@ -46,7 +46,7 @@ const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, i
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const values = yield form.validateFields();
|
|
49
|
-
|
|
49
|
+
const nextPreferences = {
|
|
50
50
|
columns: values.columns,
|
|
51
51
|
layoutDirection: values.layoutDirection,
|
|
52
52
|
showImage: values.showImage,
|
|
@@ -58,7 +58,9 @@ const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, i
|
|
|
58
58
|
imageHeight: values.imageHeight,
|
|
59
59
|
imageObjectFit: values.imageObjectFit,
|
|
60
60
|
saleDetailWidth: values.saleDetailWidth
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
|
+
onSaveAttempt === null || onSaveAttempt === void 0 || onSaveAttempt(nextPreferences);
|
|
63
|
+
onSave(nextPreferences);
|
|
62
64
|
});
|
|
63
65
|
return function handleSave() {
|
|
64
66
|
return _ref.apply(this, arguments);
|
|
@@ -266,11 +266,14 @@ function readBigSaleProductListPreferences(key, defaultPreferences = DEFAULT_BIG
|
|
|
266
266
|
return readStoredBigSaleProductListPreferences(key, normalizedDefault) || normalizedDefault;
|
|
267
267
|
}
|
|
268
268
|
function writeBigSaleProductListPreferences(key, preferences) {
|
|
269
|
-
if (typeof localStorage === "undefined") return;
|
|
269
|
+
if (typeof localStorage === "undefined") return false;
|
|
270
270
|
const normalized = normalizePreferences(preferences, void 0, true);
|
|
271
271
|
try {
|
|
272
272
|
localStorage.setItem(key, JSON.stringify(normalized || DEFAULT_BIG_SALE_PRODUCT_LIST_PREFERENCES));
|
|
273
|
-
|
|
273
|
+
return true;
|
|
274
|
+
} catch (_unused2) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
274
277
|
}
|
|
275
278
|
function removeBigSaleProductListPreferences(key) {
|
|
276
279
|
if (typeof localStorage === "undefined") return;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_skuSemantics = require("../../plus/skuOptionsSelection/utils/skuSemantics.js");
|
|
4
|
+
const require_prepare = require("../../pro/bookingProductDetailModal/prepare.js");
|
|
3
5
|
const require_index = require("../../pro/NumericStepper/index.js");
|
|
4
6
|
const require_index$1 = require("../../plus/multiCurrencySettlement/index.js");
|
|
7
|
+
const require_context = require("../../plus/venueBookingDesign/context.js");
|
|
5
8
|
const require_Controls = require("../../plus/venueBookingDesign/shared/Controls.js");
|
|
6
9
|
const require_presentation = require("./presentation.js");
|
|
7
10
|
const require_index$2 = require("../../pro/bookingProductDetailModal/index.js");
|
|
8
11
|
const require_BookingSelectionPanel = require("./availability/BookingSelectionPanel.js");
|
|
9
12
|
const require_useBookingComposer = require("./useBookingComposer.js");
|
|
10
13
|
const require_VenueProductIntro = require("./VenueProductIntro.js");
|
|
14
|
+
const require_usePartyConfigurationPrice = require("./usePartyConfigurationPrice.js");
|
|
11
15
|
let react = require("react");
|
|
12
16
|
react = require_runtime.__toESM(react);
|
|
13
17
|
let antd = require("antd");
|
|
@@ -16,11 +20,35 @@ decimal_js = require_runtime.__toESM(decimal_js);
|
|
|
16
20
|
//#region src/components/venueBookingSales/BookingComposer.tsx
|
|
17
21
|
/** Existing reservation view; page compositions can consume the same model independently. */
|
|
18
22
|
function BookingComposer(props) {
|
|
19
|
-
var _props$skuOptions;
|
|
23
|
+
var _draft$plan, _props$skuOptions$con, _props$skuOptions, _draft$plan2, _props$skuOptions2;
|
|
20
24
|
const { mode, draft, locale } = props;
|
|
21
25
|
const text = (en, zh) => locale === "zh" ? zh : en;
|
|
22
26
|
const model = require_useBookingComposer.useBookingComposer(props);
|
|
27
|
+
const bookingUI = require_context.useOptionalBookingUI();
|
|
23
28
|
const { configuration, setConfiguration, quantity, setQuantity, quote, error, working, revision, commit } = model;
|
|
29
|
+
const configurationDetail = mode === "tickets" && ((_draft$plan = draft.plan) === null || _draft$plan === void 0 ? void 0 : _draft$plan.hasConfiguration) ? draft.plan.productDetail : void 0;
|
|
30
|
+
const overSold = require_skuSemantics.isSkuFlagSet((_props$skuOptions$con = (_props$skuOptions = props.skuOptions) === null || _props$skuOptions === void 0 || (_props$skuOptions = _props$skuOptions.config) === null || _props$skuOptions === void 0 ? void 0 : _props$skuOptions.overSold) !== null && _props$skuOptions$con !== void 0 ? _props$skuOptions$con : draft.detail.over_sold);
|
|
31
|
+
const configurationComplete = (0, react.useMemo)(() => Boolean(configurationDetail && require_prepare.validateBookingProductConfiguration(configurationDetail, configuration.skuValue, {
|
|
32
|
+
requiredOptionValidation: props.requiredOptionValidation,
|
|
33
|
+
overSold
|
|
34
|
+
})), [
|
|
35
|
+
configurationDetail,
|
|
36
|
+
configuration.skuValue,
|
|
37
|
+
props.requiredOptionValidation,
|
|
38
|
+
overSold
|
|
39
|
+
]);
|
|
40
|
+
const configurationEstimate = require_usePartyConfigurationPrice.usePartyConfigurationPrice({
|
|
41
|
+
enabled: configurationComplete,
|
|
42
|
+
openId: (_draft$plan2 = draft.plan) === null || _draft$plan2 === void 0 ? void 0 : _draft$plan2.openId,
|
|
43
|
+
scopeKey: props.scopeKey,
|
|
44
|
+
productDetail: configurationDetail,
|
|
45
|
+
skuValue: configuration.skuValue,
|
|
46
|
+
quantity,
|
|
47
|
+
overSold,
|
|
48
|
+
timeZone: bookingUI === null || bookingUI === void 0 ? void 0 : bookingUI.timeZone,
|
|
49
|
+
customerId: props.customerId,
|
|
50
|
+
os: props.priceSource
|
|
51
|
+
});
|
|
24
52
|
const formatAmount = props.formatAmount || ((value) => {
|
|
25
53
|
var _props$context$sales$, _props$context$sales$2, _props$context$sales$3;
|
|
26
54
|
return require_index$1.formatTempOrderSettlementAmount((_props$context$sales$ = (_props$context$sales$2 = props.context.sales.bookingTicket) === null || _props$context$sales$2 === void 0 || (_props$context$sales$3 = _props$context$sales$2.getTempOrder) === null || _props$context$sales$3 === void 0 ? void 0 : _props$context$sales$3.call(_props$context$sales$2)) !== null && _props$context$sales$ !== void 0 ? _props$context$sales$ : props.context.cart.tempOrder, value);
|
|
@@ -28,6 +56,7 @@ function BookingComposer(props) {
|
|
|
28
56
|
const catalogAmount = draft.catalogStartingAmount;
|
|
29
57
|
const startingAmount = mode === "tickets" && catalogAmount !== void 0 && catalogAmount !== null && String(catalogAmount).trim() !== "" && Number.isFinite(Number(catalogAmount)) ? formatAmount(new decimal_js.default(catalogAmount).times(quantity).toString()) : void 0;
|
|
30
58
|
const quoteAmount = quote ? formatAmount(quote.compositeLineTotal) : startingAmount !== void 0 ? draft.catalogPriceQualifier === "from" ? locale === "zh" ? `${startingAmount} 起` : `From ${startingAmount}` : startingAmount : "—";
|
|
59
|
+
const configurationAmount = configurationComplete && configurationEstimate.status === "ready" ? formatAmount(configurationEstimate.subtotal) : startingAmount !== void 0 ? locale === "zh" ? `${startingAmount} 起` : `From ${startingAmount}` : "—";
|
|
31
60
|
const booking = (scrollContainer) => /* @__PURE__ */ react.default.createElement(require_BookingSelectionPanel.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ ref: model.panelRef }, model.bookingProps), {}, {
|
|
32
61
|
scrollContainer,
|
|
33
62
|
renderDatePicker: props.renderDatePicker,
|
|
@@ -36,22 +65,22 @@ function BookingComposer(props) {
|
|
|
36
65
|
return (scrollContainer === null || scrollContainer === void 0 || (_scrollContainer$clos = scrollContainer.closest("[role=\"dialog\"]")) === null || _scrollContainer$clos === void 0 ? void 0 : _scrollContainer$clos.querySelector(".booking-config-actions .booking-primary-action")) || null;
|
|
37
66
|
}
|
|
38
67
|
}));
|
|
39
|
-
const quantityControl = mode === "tickets" && !draft.lineUid ? /* @__PURE__ */ react.default.createElement("div", { className: "reservation-quantity" }, /* @__PURE__ */ react.default.createElement("span", null, text("Number", "数量")), /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
68
|
+
const quantityControl = (busy = false) => mode === "tickets" && !draft.lineUid ? /* @__PURE__ */ react.default.createElement("div", { className: "reservation-quantity" }, /* @__PURE__ */ react.default.createElement("span", null, text("Number", "数量")), /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
40
69
|
className: "booking-ticket-quantity",
|
|
41
70
|
variant: "capsule",
|
|
42
71
|
min: 1,
|
|
43
72
|
step: 1,
|
|
44
73
|
value: quantity,
|
|
45
|
-
disabled: working || props.disabled,
|
|
74
|
+
disabled: busy || working || props.disabled,
|
|
46
75
|
commitInputOnClose: false,
|
|
47
76
|
selectAllInputOnOpen: true,
|
|
48
77
|
clearSelectedInputOnDelete: true,
|
|
49
78
|
ignoreEmptyInputConfirm: true,
|
|
50
79
|
onChange: (value) => {
|
|
51
|
-
if (!working && !props.disabled && Number.isSafeInteger(value) && value >= 1) setQuantity(value);
|
|
80
|
+
if (!busy && !working && !props.disabled && Number.isSafeInteger(value) && value >= 1) setQuantity(value);
|
|
52
81
|
}
|
|
53
82
|
})) : null;
|
|
54
|
-
const footer = /* @__PURE__ */ react.default.createElement("div", { className: "venue-booking-sales__booking-footer" }, quantityControl, /* @__PURE__ */ react.default.createElement("div", {
|
|
83
|
+
const footer = /* @__PURE__ */ react.default.createElement("div", { className: "venue-booking-sales__booking-footer" }, quantityControl(), /* @__PURE__ */ react.default.createElement("div", {
|
|
55
84
|
className: mode === "tickets" ? "reservation-subtotal" : "party-total",
|
|
56
85
|
"aria-live": "polite"
|
|
57
86
|
}, /* @__PURE__ */ react.default.createElement("span", null, text("Subtotal", "小计")), /* @__PURE__ */ react.default.createElement("strong", null, quoteAmount)));
|
|
@@ -68,7 +97,7 @@ function BookingComposer(props) {
|
|
|
68
97
|
}),
|
|
69
98
|
configuration,
|
|
70
99
|
onConfigurationChange: setConfiguration,
|
|
71
|
-
skuOptions: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props.skuOptions), {}, { priceFormatter: ((_props$
|
|
100
|
+
skuOptions: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props.skuOptions), {}, { priceFormatter: ((_props$skuOptions2 = props.skuOptions) === null || _props$skuOptions2 === void 0 ? void 0 : _props$skuOptions2.priceFormatter) || ((value) => String(formatAmount(value))) }),
|
|
72
101
|
requiredOptionValidation: props.requiredOptionValidation,
|
|
73
102
|
onCancel: model.cancel,
|
|
74
103
|
locale,
|
|
@@ -76,7 +105,14 @@ function BookingComposer(props) {
|
|
|
76
105
|
selectionRevision: revision,
|
|
77
106
|
error,
|
|
78
107
|
renderBooking: ({ scrollContainer }) => booking(scrollContainer),
|
|
79
|
-
footerContent: ({
|
|
108
|
+
footerContent: ({ busy }) => quantityControl(busy),
|
|
109
|
+
configurationFooter: {
|
|
110
|
+
label: text("Estimated subtotal", "预计小计"),
|
|
111
|
+
amount: /* @__PURE__ */ react.default.createElement("span", {
|
|
112
|
+
role: "status",
|
|
113
|
+
"aria-live": "polite"
|
|
114
|
+
}, configurationAmount)
|
|
115
|
+
},
|
|
80
116
|
bookingActionAmount: quoteAmount,
|
|
81
117
|
bookingReady: model.bookingReady,
|
|
82
118
|
onConfirm: commit
|
|
@@ -16,10 +16,10 @@ const require_index$2 = require("../../pro/bookingProductDetailModal/index.js");
|
|
|
16
16
|
const require_labels = require("./availability/labels.js");
|
|
17
17
|
const require_prepareProduct = require("./availability/prepareProduct.js");
|
|
18
18
|
const require_VenueProductIntro = require("./VenueProductIntro.js");
|
|
19
|
+
const require_usePartyConfigurationPrice = require("./usePartyConfigurationPrice.js");
|
|
19
20
|
const require_extraCatalogAvailability = require("./extraCatalogAvailability.js");
|
|
20
21
|
const require_holder = require("./extras/holder.js");
|
|
21
22
|
const require_orderBindings = require("./orderBindings.js");
|
|
22
|
-
const require_usePartyConfigurationPrice = require("./usePartyConfigurationPrice.js");
|
|
23
23
|
const require_VenueExtraDetailModal = require("./extras/VenueExtraDetailModal.js");
|
|
24
24
|
const require_catalogPresentation = require("./catalogPresentation.js");
|
|
25
25
|
const require_orderDisplayGroups = require("./orderDisplayGroups.js");
|
|
@@ -33,6 +33,7 @@ const BookingSelectionPanel = (0, react.forwardRef)((props, ref) => {
|
|
|
33
33
|
const [dateError, setDateError] = (0, react.useState)(false);
|
|
34
34
|
const rootRef = (0, react.useRef)(null);
|
|
35
35
|
const resourcesRef = (0, react.useRef)(null);
|
|
36
|
+
const resolvedResourceTimeRef = (0, react.useRef)();
|
|
36
37
|
const timeRef = (0, react.useRef)(null);
|
|
37
38
|
const dateDetailsRef = (0, react.useRef)(null);
|
|
38
39
|
const mounted = (0, react.useRef)(true);
|
|
@@ -127,6 +128,16 @@ const BookingSelectionPanel = (0, react.forwardRef)((props, ref) => {
|
|
|
127
128
|
const timeGroups = require_queries.groupBookingTimes(state.times, (state.partySize || 0) * state.bookingCount);
|
|
128
129
|
const currentTime = state.times.find((candidate) => require_queries.sameBookingTime(candidate, state.candidate));
|
|
129
130
|
const selectedTime = currentTime && require_queries.selectable(currentTime, (state.partySize || 0) * state.bookingCount) ? state.candidate : void 0;
|
|
131
|
+
const resourceTimeKey = selectedTime ? `${state.contextId || ""}:${require_queries.bookingTimeIntervalKey(selectedTime)}` : void 0;
|
|
132
|
+
const resourcesResolved = !!resourceTimeKey && !dateChanging && (state.status === "selecting" || state.status === "ready" || resolvedResourceTimeRef.current === resourceTimeKey);
|
|
133
|
+
(0, react.useEffect)(() => {
|
|
134
|
+
if (!resourceTimeKey || dateChanging) resolvedResourceTimeRef.current = void 0;
|
|
135
|
+
else if (state.status === "selecting" || state.status === "ready") resolvedResourceTimeRef.current = resourceTimeKey;
|
|
136
|
+
}, [
|
|
137
|
+
resourceTimeKey,
|
|
138
|
+
state.status,
|
|
139
|
+
dateChanging
|
|
140
|
+
]);
|
|
130
141
|
const timeValue = state.status === "loading" || dateChanging ? t("timeLoading") : state.status === "error" ? t("timeLoadFailed") : selectedTime ? `${candidateClock(selectedTime.bookingStartAt || selectedTime.startAt, selectedTime.startTime)}–${candidateClock(selectedTime.bookingEndAt || selectedTime.endAt, selectedTime.endTime)}` : t(timeGroups.some(({ candidate }) => require_queries.selectable(candidate, (state.partySize || 0) * state.bookingCount)) ? "timeNotSelected" : "timeUnavailable");
|
|
131
142
|
const localTimePending = props.mode === "party" && !state.times.length && (state.status === "idle" || state.status === "loading" || dateChanging);
|
|
132
143
|
const localTimeFailure = props.mode === "party" && !state.times.length && state.status === "error" && !state.requiresOrderReconciliation;
|
|
@@ -268,7 +279,7 @@ const BookingSelectionPanel = (0, react.forwardRef)((props, ref) => {
|
|
|
268
279
|
].includes(code));
|
|
269
280
|
const showFailure = !busy && (state.status === "error" || state.status === "blocked" || state.requiresOrderReconciliation || failureCodes.length > 0);
|
|
270
281
|
const reasonLabels = showFailure ? Array.from(new Set(failureCodes.map(reason))) : [];
|
|
271
|
-
const showResources = props.mode === "party" || visibleGroups(state).length > 0 || !state.resourceGroups.length && Object.keys(configured).length > 0;
|
|
282
|
+
const showResources = props.mode === "party" || resourcesResolved && (visibleGroups(state).length > 0 || !state.resourceGroups.length && Object.keys(configured).length > 0);
|
|
272
283
|
const statusPanel = /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, (showFailure || dateError) && /* @__PURE__ */ react.default.createElement("div", {
|
|
273
284
|
className: "venue-booking-availability__status",
|
|
274
285
|
role: "alert"
|
|
@@ -10,9 +10,9 @@ const require_index$2 = require("../../../plus/skuOptionsSelection/index.js");
|
|
|
10
10
|
const require_index$3 = require("../../../pro/skuDetailModal/appearances/immersive/index.js");
|
|
11
11
|
const require_productHolderConfig = require("../../../plus/salesSdk/utils/productHolderConfig.js");
|
|
12
12
|
const require_presentation = require("../presentation.js");
|
|
13
|
+
const require_usePartyConfigurationPrice = require("../usePartyConfigurationPrice.js");
|
|
13
14
|
const require_holder = require("./holder.js");
|
|
14
15
|
const require_errorMessage = require("../checkout/errorMessage.js");
|
|
15
|
-
const require_usePartyConfigurationPrice = require("../usePartyConfigurationPrice.js");
|
|
16
16
|
const require_VenueExtraHolderField = require("./VenueExtraHolderField.js");
|
|
17
17
|
let react = require("react");
|
|
18
18
|
react = require_runtime.__toESM(react);
|
|
@@ -862,6 +862,7 @@ const PisellReservationCore = (props) => {
|
|
|
862
862
|
}), /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellRecordBoard.ShellFrame, null, /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellRecordBoard.GridLayout, null), /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellRecordBoard.FloorMap, null), /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellRecordBoard.Calendar, countryAwareCalendarSlotProps), /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellRecordBoard.ResourceWall, null))), /* @__PURE__ */ react.default.createElement(require_ReservationNewReservationModal.ReservationNewReservationModal, {
|
|
863
863
|
ref: newReservationModalRef,
|
|
864
864
|
router,
|
|
865
|
+
businessCode: BIZ,
|
|
865
866
|
app
|
|
866
867
|
}), /* @__PURE__ */ react.default.createElement(require_ReservationBookingDetailModal.ReservationBookingDetailModal, {
|
|
867
868
|
open: bookingDetailOpen,
|
|
@@ -11,9 +11,32 @@ let ahooks = require("ahooks");
|
|
|
11
11
|
* 新建预约:引擎路由多选弹窗;仅单条路由时直接 history.push。
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
+
* 解析当前业务的 Sales2 新建页。
|
|
15
|
+
*
|
|
16
|
+
* 路由配置优先,支持 `/sales2/biz/:business_code` 这类动态段;旧店铺未下发
|
|
17
|
+
* sales2 路由时使用 POS 既有的规范地址作为兼容回退。
|
|
18
|
+
*/
|
|
19
|
+
function resolveBusinessSalesRoute(router, businessCode) {
|
|
20
|
+
const biz = typeof businessCode === "string" ? businessCode.trim() : "";
|
|
21
|
+
if (!biz) return void 0;
|
|
22
|
+
const encodedBiz = encodeURIComponent(biz);
|
|
23
|
+
const configuredRoute = (router && typeof router === "object" ? Object.values(router) : []).find((item) => {
|
|
24
|
+
if (!item || typeof item !== "object") return false;
|
|
25
|
+
const route = item;
|
|
26
|
+
return route.page_type === "proCode" && route.proCodeId === "sales2" && typeof route.router === "string" && route.router.trim() !== "";
|
|
27
|
+
});
|
|
28
|
+
const configuredPath = typeof (configuredRoute === null || configuredRoute === void 0 ? void 0 : configuredRoute.router) === "string" ? configuredRoute.router.trim() : "";
|
|
29
|
+
const [pathAndQuery, hash = ""] = (/:business_code\b/.test(configuredPath) ? configuredPath : `/sales2/biz/${encodedBiz}`).replace(/:business_code\b/g, encodedBiz).split("#", 2);
|
|
30
|
+
const [path, query = ""] = pathAndQuery.split("?", 2);
|
|
31
|
+
const params = new URLSearchParams(query);
|
|
32
|
+
const salesType = biz === "dine_in" ? "food" : biz === "party" ? "ticket" : biz;
|
|
33
|
+
params.set("type", salesType);
|
|
34
|
+
return `${path}?${params.toString()}${hash ? `#${hash}` : ""}`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
14
37
|
* 受控弹窗内容在内部;通过 ref 暴露 `requestOpen` 供顶栏「新建」等调用。
|
|
15
38
|
*/
|
|
16
|
-
const ReservationNewReservationModal = (0, react.forwardRef)(function ReservationNewReservationModal({ router, app }, ref) {
|
|
39
|
+
const ReservationNewReservationModal = (0, react.forwardRef)(function ReservationNewReservationModal({ router, businessCode, app }, ref) {
|
|
17
40
|
const newReservationRoutes = require_useNewReservationRoutesFromEngine.useNewReservationRoutesFromEngine(router);
|
|
18
41
|
const [open, setOpen] = (0, react.useState)(false);
|
|
19
42
|
const handleRouteJump = (0, ahooks.useMemoizedFn)((routePath) => {
|
|
@@ -23,6 +46,11 @@ const ReservationNewReservationModal = (0, react.forwardRef)(function Reservatio
|
|
|
23
46
|
app === null || app === void 0 || (_app$history = app.history) === null || _app$history === void 0 || (_app$history$push = _app$history.push) === null || _app$history$push === void 0 || _app$history$push.call(_app$history, routePath);
|
|
24
47
|
});
|
|
25
48
|
const requestOpen = (0, ahooks.useMemoizedFn)(() => {
|
|
49
|
+
const businessSalesRoute = resolveBusinessSalesRoute(router, businessCode);
|
|
50
|
+
if (businessSalesRoute) {
|
|
51
|
+
handleRouteJump(businessSalesRoute);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
26
54
|
if (newReservationRoutes.length === 1) {
|
|
27
55
|
handleRouteJump(newReservationRoutes[0].router);
|
|
28
56
|
return;
|