@pisell/pisellos 0.0.500 → 0.0.502
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/dist/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +52 -8
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +15 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +68 -1
- package/dist/model/strategy/adapter/itemRule/index.d.ts +1 -1
- package/dist/model/strategy/adapter/itemRule/index.js +1 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +20 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +10 -0
- package/dist/modules/Order/index.js +64 -40
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils.d.ts +36 -1
- package/dist/modules/Order/utils.js +120 -24
- package/dist/modules/ProductList/index.js +2 -2
- package/dist/modules/Quotation/index.js +6 -3
- package/dist/modules/SalesSummary/types.d.ts +2 -1
- package/dist/modules/SalesSummary/utils.js +10 -10
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/index.d.ts +22 -0
- package/dist/solution/ScanOrder/index.js +863 -369
- package/dist/solution/ScanOrder/types.d.ts +31 -8
- package/dist/solution/ScanOrder/utils.d.ts +26 -0
- package/dist/solution/ScanOrder/utils.js +191 -44
- package/dist/solution/VenueBooking/index.d.ts +42 -5
- package/dist/solution/VenueBooking/index.js +692 -280
- package/dist/solution/VenueBooking/types.d.ts +23 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -1
- package/dist/solution/VenueBooking/utils/dateSummary.js +7 -5
- package/dist/solution/VenueBooking/utils/resource.d.ts +11 -1
- package/dist/solution/VenueBooking/utils/resource.js +57 -21
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +5 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +33 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -1
- package/dist/solution/VenueBooking/utils/timeSlot.js +259 -62
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +41 -2
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +15 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +47 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +1 -1
- package/lib/model/strategy/adapter/itemRule/index.js +2 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +20 -1
- package/lib/modules/Order/index.d.ts +10 -0
- package/lib/modules/Order/index.js +40 -43
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils.d.ts +36 -1
- package/lib/modules/Order/utils.js +100 -21
- package/lib/modules/ProductList/index.js +3 -2
- package/lib/modules/Quotation/index.js +3 -0
- package/lib/modules/SalesSummary/types.d.ts +2 -1
- package/lib/modules/SalesSummary/utils.js +2 -2
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/index.d.ts +22 -0
- package/lib/solution/ScanOrder/index.js +376 -21
- package/lib/solution/ScanOrder/types.d.ts +31 -8
- package/lib/solution/ScanOrder/utils.d.ts +26 -0
- package/lib/solution/ScanOrder/utils.js +128 -19
- package/lib/solution/VenueBooking/index.d.ts +42 -5
- package/lib/solution/VenueBooking/index.js +356 -84
- package/lib/solution/VenueBooking/types.d.ts +23 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -1
- package/lib/solution/VenueBooking/utils/dateSummary.js +14 -5
- package/lib/solution/VenueBooking/utils/resource.d.ts +11 -1
- package/lib/solution/VenueBooking/utils/resource.js +15 -4
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +5 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +29 -12
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -1
- package/lib/solution/VenueBooking/utils/timeSlot.js +182 -43
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary, ScanOrderTempOrder } from './types';
|
|
2
2
|
import type { CartItemSummary, ItemRuleBusinessData, PaxInfo, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
3
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
4
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
4
5
|
/**
|
|
5
6
|
* 构建金额全为 0 的空 summary。
|
|
6
7
|
* 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
|
|
@@ -58,8 +59,15 @@ export declare function resolveSkuMatchedQuantityLimits(params: {
|
|
|
58
59
|
export declare function aggregateItemRuleLimit(matchedLimits: QuantityLimitResult[]): {
|
|
59
60
|
min: number | undefined;
|
|
60
61
|
max: number | undefined;
|
|
62
|
+
remainingMax: number | undefined;
|
|
61
63
|
exact: number | undefined;
|
|
62
64
|
mustInclude: boolean;
|
|
65
|
+
validationMessage: string | undefined;
|
|
66
|
+
rawValidationMessage: string | Record<string, string> | undefined;
|
|
67
|
+
maxValidationMessage: string | undefined;
|
|
68
|
+
rawMaxValidationMessage: string | Record<string, string> | undefined;
|
|
69
|
+
minValidationMessage: string | undefined;
|
|
70
|
+
rawMinValidationMessage: string | Record<string, string> | undefined;
|
|
63
71
|
} | null;
|
|
64
72
|
export declare function buildItemRuleBusinessData(params: {
|
|
65
73
|
tempOrder: ScanOrderTempOrder;
|
|
@@ -91,3 +99,21 @@ export declare function getProductIdentityIndex(products: ScanOrderOrderProduct[
|
|
|
91
99
|
* - 保留 _origin 供后续业务流程(如促销规则)使用
|
|
92
100
|
*/
|
|
93
101
|
export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): ScanOrderOrderProduct;
|
|
102
|
+
/**
|
|
103
|
+
* 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
|
|
104
|
+
*/
|
|
105
|
+
export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
|
|
106
|
+
/**
|
|
107
|
+
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
108
|
+
*/
|
|
109
|
+
export declare function pickFirstDurationMinutesFromProducts(products: ProductData[]): number | undefined;
|
|
110
|
+
/** 是否存在 capacity.type === 'custom' 的商品 */
|
|
111
|
+
export declare function hasCustomCapacityProduct(products: ProductData[]): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 在商品列表中找到第一个 `capacity.type === 'custom'` 的商品,取其 `custom` 数组第一项的 min/max。
|
|
114
|
+
* 仅返回有限数字字段;若均无法解析则返回 `undefined`。
|
|
115
|
+
*/
|
|
116
|
+
export declare function pickFirstCustomCapacityPaxBounds(products: ProductData[]): {
|
|
117
|
+
min?: number;
|
|
118
|
+
max?: number;
|
|
119
|
+
} | undefined;
|
|
@@ -24,16 +24,20 @@ __export(utils_exports, {
|
|
|
24
24
|
buildItemRuleBusinessData: () => buildItemRuleBusinessData,
|
|
25
25
|
buildProductKey: () => buildProductKey,
|
|
26
26
|
buildQuantityLimitIndex: () => buildQuantityLimitIndex,
|
|
27
|
+
collectLinkProductIdsFromReservationRules: () => collectLinkProductIdsFromReservationRules,
|
|
27
28
|
createEmptySummary: () => createEmptySummary,
|
|
28
29
|
extractStrategyModelIdsFromTableConfig: () => extractStrategyModelIdsFromTableConfig,
|
|
29
30
|
getProductIdentityIndex: () => getProductIdentityIndex,
|
|
30
31
|
getSafeProductNum: () => getSafeProductNum,
|
|
31
32
|
getTopLevelProductId: () => getTopLevelProductId,
|
|
32
33
|
getTopLevelVariantId: () => getTopLevelVariantId,
|
|
34
|
+
hasCustomCapacityProduct: () => hasCustomCapacityProduct,
|
|
33
35
|
isIdentityMatch: () => isIdentityMatch,
|
|
34
36
|
normalizeEnabledItemRuleIds: () => normalizeEnabledItemRuleIds,
|
|
35
37
|
normalizeItemRuleStrategies: () => normalizeItemRuleStrategies,
|
|
36
38
|
normalizeOrderProduct: () => normalizeOrderProduct,
|
|
39
|
+
pickFirstCustomCapacityPaxBounds: () => pickFirstCustomCapacityPaxBounds,
|
|
40
|
+
pickFirstDurationMinutesFromProducts: () => pickFirstDurationMinutesFromProducts,
|
|
37
41
|
resolveSkuMatchedQuantityLimits: () => resolveSkuMatchedQuantityLimits,
|
|
38
42
|
toBoolean: () => toBoolean,
|
|
39
43
|
toNonNegativeInt: () => toNonNegativeInt,
|
|
@@ -160,18 +164,20 @@ function buildQuantityLimitIndex(limits) {
|
|
|
160
164
|
const exactLimitMap = /* @__PURE__ */ new Map();
|
|
161
165
|
const productLimitMap = /* @__PURE__ */ new Map();
|
|
162
166
|
for (const limit of limits) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
const targets = limit.targets || [];
|
|
168
|
+
if (targets.length !== 1)
|
|
169
|
+
continue;
|
|
170
|
+
const target = targets[0];
|
|
171
|
+
const productId = Number(target.product_id);
|
|
172
|
+
if (!Number.isFinite(productId) || productId <= 0)
|
|
173
|
+
continue;
|
|
174
|
+
const variantId = Number(target.product_variant_id);
|
|
175
|
+
const hasVariant = Number.isFinite(variantId) && variantId > 0;
|
|
176
|
+
if (hasVariant) {
|
|
177
|
+
const exactKey = buildProductKey(productId, variantId);
|
|
178
|
+
const existed = exactLimitMap.get(exactKey) || [];
|
|
179
|
+
exactLimitMap.set(exactKey, [...existed, limit]);
|
|
180
|
+
} else {
|
|
175
181
|
const existed = productLimitMap.get(productId) || [];
|
|
176
182
|
productLimitMap.set(productId, [...existed, limit]);
|
|
177
183
|
}
|
|
@@ -192,29 +198,66 @@ function aggregateItemRuleLimit(matchedLimits) {
|
|
|
192
198
|
return null;
|
|
193
199
|
let min;
|
|
194
200
|
let max;
|
|
201
|
+
let remainingMax;
|
|
195
202
|
let exact;
|
|
196
203
|
let mustInclude = false;
|
|
204
|
+
let maxSourceLimit;
|
|
205
|
+
let remainingMaxSourceLimit;
|
|
206
|
+
let exactSourceLimit;
|
|
207
|
+
let minSourceLimit;
|
|
208
|
+
let firstMessagedLimit;
|
|
197
209
|
for (const limit of matchedLimits) {
|
|
198
210
|
if (typeof limit.requiredMin === "number" && Number.isFinite(limit.requiredMin)) {
|
|
199
|
-
|
|
211
|
+
if (min === void 0 || limit.requiredMin > min) {
|
|
212
|
+
min = limit.requiredMin;
|
|
213
|
+
minSourceLimit = limit;
|
|
214
|
+
}
|
|
200
215
|
}
|
|
201
216
|
if (typeof limit.requiredMax === "number" && Number.isFinite(limit.requiredMax)) {
|
|
202
|
-
|
|
217
|
+
if (max === void 0 || limit.requiredMax < max) {
|
|
218
|
+
max = limit.requiredMax;
|
|
219
|
+
maxSourceLimit = limit;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (typeof limit.remainingMax === "number" && Number.isFinite(limit.remainingMax)) {
|
|
223
|
+
if (remainingMax === void 0 || limit.remainingMax < remainingMax) {
|
|
224
|
+
remainingMax = limit.remainingMax;
|
|
225
|
+
remainingMaxSourceLimit = limit;
|
|
226
|
+
}
|
|
203
227
|
}
|
|
204
228
|
if (typeof limit.requiredExact === "number" && Number.isFinite(limit.requiredExact)) {
|
|
205
229
|
exact = limit.requiredExact;
|
|
230
|
+
exactSourceLimit = limit;
|
|
206
231
|
}
|
|
207
232
|
mustInclude = mustInclude || Boolean(limit.mustInclude);
|
|
233
|
+
if (!firstMessagedLimit && limit.validationMessage) {
|
|
234
|
+
firstMessagedLimit = limit;
|
|
235
|
+
}
|
|
208
236
|
}
|
|
209
237
|
if (typeof exact === "number" && Number.isFinite(exact)) {
|
|
210
238
|
min = exact;
|
|
211
239
|
max = exact;
|
|
212
240
|
}
|
|
241
|
+
const maxMessageSource = maxSourceLimit || remainingMaxSourceLimit || exactSourceLimit || firstMessagedLimit;
|
|
242
|
+
const minMessageSource = minSourceLimit || exactSourceLimit || firstMessagedLimit;
|
|
243
|
+
const maxValidationMessage = maxMessageSource == null ? void 0 : maxMessageSource.validationMessage;
|
|
244
|
+
const rawMaxValidationMessage = maxMessageSource == null ? void 0 : maxMessageSource.rawValidationMessage;
|
|
245
|
+
const minValidationMessage = minMessageSource == null ? void 0 : minMessageSource.validationMessage;
|
|
246
|
+
const rawMinValidationMessage = minMessageSource == null ? void 0 : minMessageSource.rawValidationMessage;
|
|
247
|
+
const validationMessage = maxValidationMessage ?? minValidationMessage;
|
|
248
|
+
const rawValidationMessage = rawMaxValidationMessage ?? rawMinValidationMessage;
|
|
213
249
|
return {
|
|
214
250
|
min,
|
|
215
251
|
max,
|
|
252
|
+
remainingMax,
|
|
216
253
|
exact,
|
|
217
|
-
mustInclude
|
|
254
|
+
mustInclude,
|
|
255
|
+
validationMessage,
|
|
256
|
+
rawValidationMessage,
|
|
257
|
+
maxValidationMessage,
|
|
258
|
+
rawMaxValidationMessage,
|
|
259
|
+
minValidationMessage,
|
|
260
|
+
rawMinValidationMessage
|
|
218
261
|
};
|
|
219
262
|
}
|
|
220
263
|
function buildItemRuleBusinessData(params) {
|
|
@@ -294,13 +337,13 @@ function getProductIdentityIndex(products, identity) {
|
|
|
294
337
|
return products.findIndex((item) => isIdentityMatch(item, identity));
|
|
295
338
|
}
|
|
296
339
|
function normalizeOrderProduct(product) {
|
|
297
|
-
var _a;
|
|
340
|
+
var _a, _b;
|
|
298
341
|
const metadata = { ...product.metadata || {} };
|
|
299
342
|
if (product.identity_key && !metadata.unique_identification_number) {
|
|
300
343
|
metadata.unique_identification_number = product.identity_key;
|
|
301
344
|
}
|
|
302
|
-
const resolvedOriginalPrice = product.original_price || "0.00";
|
|
303
345
|
const resolvedSellingPrice = product.selling_price || "0.00";
|
|
346
|
+
const resolvedOriginalPrice = product.original_price || resolvedSellingPrice;
|
|
304
347
|
if (metadata.main_product_original_price === void 0) {
|
|
305
348
|
metadata.main_product_original_price = resolvedOriginalPrice;
|
|
306
349
|
}
|
|
@@ -308,7 +351,7 @@ function normalizeOrderProduct(product) {
|
|
|
308
351
|
metadata.main_product_selling_price = resolvedSellingPrice;
|
|
309
352
|
}
|
|
310
353
|
if (metadata.source_product_price === void 0) {
|
|
311
|
-
metadata.source_product_price = ((_a = product._origin) == null ? void 0 : _a.
|
|
354
|
+
metadata.source_product_price = ((_a = product._origin) == null ? void 0 : _a.price) ?? ((_b = product._origin) == null ? void 0 : _b.base_price) ?? resolvedSellingPrice;
|
|
312
355
|
}
|
|
313
356
|
const normalizedBundle = (product.product_bundle || []).map((item) => ({
|
|
314
357
|
...item,
|
|
@@ -324,7 +367,6 @@ function normalizeOrderProduct(product) {
|
|
|
324
367
|
product_option_item: product.product_option_item || [],
|
|
325
368
|
selling_price: resolvedSellingPrice,
|
|
326
369
|
original_price: resolvedOriginalPrice,
|
|
327
|
-
payment_price: product.payment_price || "0.00",
|
|
328
370
|
tax_fee: product.tax_fee || "0.00",
|
|
329
371
|
is_charge_tax: product.is_charge_tax ?? 0,
|
|
330
372
|
discount_list: product.discount_list || [],
|
|
@@ -333,6 +375,69 @@ function normalizeOrderProduct(product) {
|
|
|
333
375
|
_origin: product._origin
|
|
334
376
|
};
|
|
335
377
|
}
|
|
378
|
+
function collectLinkProductIdsFromReservationRules(rules) {
|
|
379
|
+
if (!Array.isArray(rules))
|
|
380
|
+
return [];
|
|
381
|
+
const ids = [];
|
|
382
|
+
for (const entry of rules) {
|
|
383
|
+
if (!entry || typeof entry !== "object")
|
|
384
|
+
continue;
|
|
385
|
+
const rec = entry;
|
|
386
|
+
if (rec.type !== "link")
|
|
387
|
+
continue;
|
|
388
|
+
if (!Array.isArray(rec.value))
|
|
389
|
+
continue;
|
|
390
|
+
for (const v of rec.value) {
|
|
391
|
+
const n = Number(v);
|
|
392
|
+
if (Number.isFinite(n) && n > 0)
|
|
393
|
+
ids.push(Math.floor(n));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return [...new Set(ids)];
|
|
397
|
+
}
|
|
398
|
+
function pickFirstDurationMinutesFromProducts(products) {
|
|
399
|
+
var _a;
|
|
400
|
+
for (const product of products) {
|
|
401
|
+
const value = (_a = product == null ? void 0 : product.duration) == null ? void 0 : _a.value;
|
|
402
|
+
const n = Number(value);
|
|
403
|
+
if (Number.isFinite(n) && n > 0)
|
|
404
|
+
return Math.floor(n);
|
|
405
|
+
}
|
|
406
|
+
return void 0;
|
|
407
|
+
}
|
|
408
|
+
function hasCustomCapacityProduct(products) {
|
|
409
|
+
return products.some((p) => {
|
|
410
|
+
var _a;
|
|
411
|
+
return ((_a = p == null ? void 0 : p.capacity) == null ? void 0 : _a.type) === "custom";
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function pickFirstCustomCapacityPaxBounds(products) {
|
|
415
|
+
for (const p of products) {
|
|
416
|
+
const cap = p == null ? void 0 : p.capacity;
|
|
417
|
+
if (!cap || cap.type !== "custom")
|
|
418
|
+
continue;
|
|
419
|
+
if (!Array.isArray(cap.custom) || cap.custom.length === 0)
|
|
420
|
+
continue;
|
|
421
|
+
const row = cap.custom[0];
|
|
422
|
+
if (!row || typeof row !== "object")
|
|
423
|
+
continue;
|
|
424
|
+
const raw = row;
|
|
425
|
+
const out = {};
|
|
426
|
+
if (raw.min !== null && raw.min !== void 0 && raw.min !== "") {
|
|
427
|
+
const min = Number(raw.min);
|
|
428
|
+
if (Number.isFinite(min))
|
|
429
|
+
out.min = min;
|
|
430
|
+
}
|
|
431
|
+
if (raw.max !== null && raw.max !== void 0 && raw.max !== "") {
|
|
432
|
+
const max = Number(raw.max);
|
|
433
|
+
if (Number.isFinite(max))
|
|
434
|
+
out.max = max;
|
|
435
|
+
}
|
|
436
|
+
if (out.min !== void 0 || out.max !== void 0)
|
|
437
|
+
return out;
|
|
438
|
+
}
|
|
439
|
+
return void 0;
|
|
440
|
+
}
|
|
336
441
|
// Annotate the CommonJS export names for ESM import in node:
|
|
337
442
|
0 && (module.exports = {
|
|
338
443
|
aggregateItemRuleLimit,
|
|
@@ -340,16 +445,20 @@ function normalizeOrderProduct(product) {
|
|
|
340
445
|
buildItemRuleBusinessData,
|
|
341
446
|
buildProductKey,
|
|
342
447
|
buildQuantityLimitIndex,
|
|
448
|
+
collectLinkProductIdsFromReservationRules,
|
|
343
449
|
createEmptySummary,
|
|
344
450
|
extractStrategyModelIdsFromTableConfig,
|
|
345
451
|
getProductIdentityIndex,
|
|
346
452
|
getSafeProductNum,
|
|
347
453
|
getTopLevelProductId,
|
|
348
454
|
getTopLevelVariantId,
|
|
455
|
+
hasCustomCapacityProduct,
|
|
349
456
|
isIdentityMatch,
|
|
350
457
|
normalizeEnabledItemRuleIds,
|
|
351
458
|
normalizeItemRuleStrategies,
|
|
352
459
|
normalizeOrderProduct,
|
|
460
|
+
pickFirstCustomCapacityPaxBounds,
|
|
461
|
+
pickFirstDurationMinutesFromProducts,
|
|
353
462
|
resolveSkuMatchedQuantityLimits,
|
|
354
463
|
toBoolean,
|
|
355
464
|
toNonNegativeInt,
|
|
@@ -25,6 +25,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
25
25
|
private cacheId;
|
|
26
26
|
private window;
|
|
27
27
|
private request;
|
|
28
|
+
private baseSlotConfig;
|
|
28
29
|
private itemRuleEvaluator;
|
|
29
30
|
private itemRuleConfigs;
|
|
30
31
|
private itemRuleConfigsPromise;
|
|
@@ -80,6 +81,9 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
80
81
|
startDate: string;
|
|
81
82
|
endDate: string;
|
|
82
83
|
}): Promise<void>;
|
|
84
|
+
private getOperatingHoursScheduleIds;
|
|
85
|
+
private resolveSlotConfigForDate;
|
|
86
|
+
private syncOperatingHoursToSlotConfig;
|
|
83
87
|
getDateRangeSummary(params: {
|
|
84
88
|
startDate: string;
|
|
85
89
|
endDate: string;
|
|
@@ -88,25 +92,48 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
88
92
|
/**
|
|
89
93
|
* 切换单个时段的选中状态(选中/取消)。
|
|
90
94
|
* 内部自动处理连续时段的合并与拆分,订单是唯一真相源。
|
|
95
|
+
*
|
|
96
|
+
* slot.productId 指定当前操作针对的是该 resourceId 下的哪一个商品。
|
|
97
|
+
* 同一资源下不同 productId 之间互相隔离,不会相互合并。
|
|
91
98
|
*/
|
|
92
99
|
toggleSlot(slot: VenueSlotSelection): Promise<ScanOrderOrderProduct[]>;
|
|
93
100
|
/**
|
|
94
101
|
* 获取某资源当前选中的所有独立时段(从订单中解析)。
|
|
102
|
+
* 不传 productId 时返回该资源下所有商品的选中时段;传了则精确匹配。
|
|
95
103
|
*/
|
|
96
|
-
getSelectedSlotsForResource(resourceId: number | string): VenueSlotSelection[];
|
|
104
|
+
getSelectedSlotsForResource(resourceId: number | string, productId?: number): VenueSlotSelection[];
|
|
105
|
+
/** getSelectedSlotsForResource 的 (resourceId, productId) 精确版,内部使用。 */
|
|
106
|
+
private getSelectedSlotsForResourceProduct;
|
|
97
107
|
/**
|
|
98
108
|
* 判断某个时段是否已选中。
|
|
109
|
+
* 不传 productId 时:只要该资源下任一商品在 startTime 被选中即返回 true;传了则精确匹配。
|
|
99
110
|
*/
|
|
100
|
-
isSlotSelected(resourceId: number | string, startTime: string): boolean;
|
|
111
|
+
isSlotSelected(resourceId: number | string, startTime: string, productId?: number): boolean;
|
|
101
112
|
/**
|
|
102
|
-
*
|
|
113
|
+
* 判断指定 (resourceId, productId, startTime) 格子是否应因其它已选项而被禁用。
|
|
114
|
+
* 规则:
|
|
115
|
+
* 1) 同一 resourceId 下若已选了另一个 productId 的同 startTime → 禁用
|
|
116
|
+
* 2) 当前 resource 是组合资源:若其任一 child resource 在 startTime 被选中 → 禁用
|
|
117
|
+
* 3) 当前 resource 是某些组合资源的 child:若该组合资源在 startTime 被选中 → 禁用
|
|
118
|
+
* 4) 两个组合资源的 child 集合有交集,且对方在该 startTime 被选中 → 禁用
|
|
119
|
+
*/
|
|
120
|
+
isSlotDisabledBySelection(params: {
|
|
121
|
+
resourceId: number | string;
|
|
122
|
+
productId: number;
|
|
123
|
+
startTime: string;
|
|
124
|
+
}): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* 获取所有已选时段(按资源分组)。每个 slot 上带 productId,便于 UI 做 per-product 判定。
|
|
103
127
|
*/
|
|
104
128
|
getAllSelectedSlots(): Map<number | string, VenueSlotSelection[]>;
|
|
105
129
|
/**
|
|
106
|
-
*
|
|
130
|
+
* 对指定 (resourceId, productId) 的订单商品进行 reconcile:
|
|
107
131
|
* 清除旧商品 → 合并连续时段 → 重新写入。
|
|
132
|
+
* 同一场地下不同商品互不干扰,各自单独 reconcile。
|
|
108
133
|
*/
|
|
109
|
-
private
|
|
134
|
+
private reconcileOrderForResourceProduct;
|
|
135
|
+
/** 给定一个父 rawResource,返回其 combined_resource.resource_ids 对应的子 rawResource 列表。 */
|
|
136
|
+
private getCombinedChildRawResources;
|
|
110
137
|
setSlotConfig(config: Partial<VenueBookingSlotConfig>): void;
|
|
111
138
|
getSlotConfig(): VenueBookingSlotConfig;
|
|
112
139
|
loadSchedules(): Promise<void>;
|
|
@@ -159,5 +186,15 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
159
186
|
private refreshCartValidationPassed;
|
|
160
187
|
setItemRuleRuntimeConfig(config?: VenueBookingItemRuleRuntimeConfig): Promise<void>;
|
|
161
188
|
getOtherParams(): Record<string, any>;
|
|
189
|
+
private static readonly UI_STATE_KEY_PREFIX;
|
|
190
|
+
private getUIStateBucketKey;
|
|
191
|
+
private readUIStateBucket;
|
|
192
|
+
private writeUIStateBucket;
|
|
193
|
+
setUIState(key: string, value: any): void;
|
|
194
|
+
getUIState<T = any>(key: string): T | undefined;
|
|
195
|
+
deleteUIState(key: string): void;
|
|
162
196
|
checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
|
|
197
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
198
|
+
cover?: boolean;
|
|
199
|
+
}): Promise<void>;
|
|
163
200
|
}
|