@pisell/pisellos 2.2.210 → 2.2.212
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/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.d.ts +13 -2
- package/dist/modules/BookingContext/index.js +198 -68
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
- package/dist/modules/Order/index.d.ts +36 -0
- package/dist/modules/Order/index.js +312 -127
- package/dist/modules/Order/types.d.ts +4 -1
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +12 -7
- package/dist/modules/Quotation/index.js +2 -1
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +29 -15
- package/dist/modules/SurchargeList/index.d.ts +16 -0
- package/dist/modules/SurchargeList/index.js +162 -0
- package/dist/modules/SurchargeList/types.d.ts +11 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +1075 -915
- package/dist/server/modules/order/index.d.ts +9 -0
- package/dist/server/modules/order/index.js +557 -411
- package/dist/server/modules/order/utils/filterBookings.js +25 -2
- package/dist/server/modules/order/utils/filterOrders.js +3 -2
- package/dist/server/test.json +713 -0
- package/dist/server/utils/small-ticket.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +22 -20
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/index.d.ts +13 -2
- package/lib/modules/BookingContext/index.js +99 -28
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
- package/lib/modules/Order/index.d.ts +36 -0
- package/lib/modules/Order/index.js +123 -1
- package/lib/modules/Order/types.d.ts +4 -1
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +12 -4
- package/lib/modules/Quotation/index.js +1 -1
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +11 -1
- package/lib/modules/SurchargeList/index.d.ts +16 -0
- package/lib/modules/SurchargeList/index.js +89 -0
- package/lib/modules/SurchargeList/types.d.ts +11 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/server/index.d.ts +8 -0
- package/lib/server/index.js +134 -19
- package/lib/server/modules/order/index.d.ts +9 -0
- package/lib/server/modules/order/index.js +107 -19
- package/lib/server/modules/order/utils/filterBookings.js +17 -2
- package/lib/server/modules/order/utils/filterOrders.js +3 -2
- package/lib/server/test.json +713 -0
- package/lib/server/utils/small-ticket.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -35
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +12 -7
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -3,6 +3,13 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { BookingContextConfig, BookingContextDateInput, BookingContextModuleAPI, BookingContextResource, BookingContextResourceMap, BookingContextState, InitBookingContextParams, LoadBookingConfigParams, LoadBookingResourcesParams } from './types';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export * from './utils';
|
|
6
|
+
/**
|
|
7
|
+
* 清理跨实例共享缓存,仅供单元测试隔离使用。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* __clearBookingContextSharedCacheForTest();
|
|
11
|
+
*/
|
|
12
|
+
export declare function __clearBookingContextSharedCacheForTest(): void;
|
|
6
13
|
/** 稳定序列化 config 查询参数,用于判断是否与上次 loadBookingConfig 一致。 */
|
|
7
14
|
export declare function buildBookingConfigQueryKey(params?: LoadBookingConfigParams): string;
|
|
8
15
|
/** 稳定序列化资源列表查询(date + bookingIds),用于跳过重复 loadResources。 */
|
|
@@ -18,8 +25,12 @@ export declare class BookingContextModule extends BaseModule implements Module,
|
|
|
18
25
|
private lastResourcesQueryKey;
|
|
19
26
|
constructor(name?: string, version?: string);
|
|
20
27
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
21
|
-
loadBookingConfig(params?: LoadBookingConfigParams
|
|
22
|
-
|
|
28
|
+
loadBookingConfig(params?: LoadBookingConfigParams, options?: {
|
|
29
|
+
forceRefresh?: boolean;
|
|
30
|
+
}): Promise<BookingContextConfig | null>;
|
|
31
|
+
loadResources(params?: LoadBookingResourcesParams, options?: {
|
|
32
|
+
forceRefresh?: boolean;
|
|
33
|
+
}): Promise<BookingContextResource[]>;
|
|
23
34
|
/**
|
|
24
35
|
* store 内是否已具备与本次 init 入参等价的 config / resources(不再打接口)。
|
|
25
36
|
*/
|
|
@@ -55,6 +55,50 @@ var RESOURCE_LIST_CACHE = {
|
|
|
55
55
|
type: 'memory'
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
+
var requestScopeIds = new WeakMap();
|
|
59
|
+
var nextRequestScopeId = 1;
|
|
60
|
+
var sharedBookingConfigCache = new Map();
|
|
61
|
+
var sharedBookingConfigPending = new Map();
|
|
62
|
+
var sharedResourcesCache = new Map();
|
|
63
|
+
var sharedResourcesPending = new Map();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 为 request 插件生成稳定作用域,避免不同 request 客户端之间共享缓存数据。
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const scopedKey = buildSharedCacheKey(requestPlugin, '{"sub_type":"ticket"}');
|
|
70
|
+
*/
|
|
71
|
+
function getRequestScopeId(request) {
|
|
72
|
+
var key = request;
|
|
73
|
+
var existed = requestScopeIds.get(key);
|
|
74
|
+
if (existed) return existed;
|
|
75
|
+
var id = nextRequestScopeId++;
|
|
76
|
+
requestScopeIds.set(key, id);
|
|
77
|
+
return id;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 共享缓存 key = request 作用域 + 已稳定序列化的业务参数。
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* const cacheKey = buildSharedCacheKey(requestPlugin, '2026-06-10|1,2');
|
|
85
|
+
*/
|
|
86
|
+
function buildSharedCacheKey(request, queryKey) {
|
|
87
|
+
return "".concat(getRequestScopeId(request), ":").concat(queryKey);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 清理跨实例共享缓存,仅供单元测试隔离使用。
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* __clearBookingContextSharedCacheForTest();
|
|
95
|
+
*/
|
|
96
|
+
export function __clearBookingContextSharedCacheForTest() {
|
|
97
|
+
sharedBookingConfigCache.clear();
|
|
98
|
+
sharedBookingConfigPending.clear();
|
|
99
|
+
sharedResourcesCache.clear();
|
|
100
|
+
sharedResourcesPending.clear();
|
|
101
|
+
}
|
|
58
102
|
|
|
59
103
|
/**
|
|
60
104
|
* 把多形态 date 入参 normalize 成字符串。
|
|
@@ -188,40 +232,82 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
188
232
|
}, {
|
|
189
233
|
key: "loadBookingConfig",
|
|
190
234
|
value: function () {
|
|
191
|
-
var _loadBookingConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
192
|
-
var
|
|
235
|
+
var _loadBookingConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
236
|
+
var _this2 = this;
|
|
193
237
|
var params,
|
|
238
|
+
options,
|
|
194
239
|
configKey,
|
|
195
240
|
query,
|
|
196
|
-
|
|
241
|
+
sharedKey,
|
|
242
|
+
_sharedBookingConfigC,
|
|
243
|
+
cached,
|
|
244
|
+
pending,
|
|
245
|
+
requestPromise,
|
|
197
246
|
config,
|
|
198
|
-
|
|
199
|
-
return _regeneratorRuntime().wrap(function
|
|
200
|
-
while (1) switch (
|
|
247
|
+
_args3 = arguments;
|
|
248
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
249
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
201
250
|
case 0:
|
|
202
|
-
params =
|
|
251
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
252
|
+
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
203
253
|
configKey = buildBookingConfigQueryKey(params);
|
|
204
|
-
if (!(this.store.bookingConfig != null && this.lastConfigQueryKey === configKey)) {
|
|
205
|
-
|
|
254
|
+
if (!(!options.forceRefresh && this.store.bookingConfig != null && this.lastConfigQueryKey === configKey)) {
|
|
255
|
+
_context3.next = 5;
|
|
206
256
|
break;
|
|
207
257
|
}
|
|
208
|
-
return
|
|
209
|
-
case
|
|
258
|
+
return _context3.abrupt("return", this.store.bookingConfig);
|
|
259
|
+
case 5:
|
|
210
260
|
query = _objectSpread(_objectSpread({}, DEFAULT_BOOKING_CONFIG_PARAMS), params);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
261
|
+
sharedKey = buildSharedCacheKey(this.request, configKey);
|
|
262
|
+
if (!(!options.forceRefresh && sharedBookingConfigCache.has(sharedKey))) {
|
|
263
|
+
_context3.next = 12;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
cached = (_sharedBookingConfigC = sharedBookingConfigCache.get(sharedKey)) !== null && _sharedBookingConfigC !== void 0 ? _sharedBookingConfigC : null;
|
|
267
|
+
this.setBookingConfig(cached);
|
|
268
|
+
this.lastConfigQueryKey = configKey;
|
|
269
|
+
return _context3.abrupt("return", cached);
|
|
270
|
+
case 12:
|
|
271
|
+
pending = !options.forceRefresh ? sharedBookingConfigPending.get(sharedKey) : undefined;
|
|
272
|
+
if (!pending) {
|
|
273
|
+
requestPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
274
|
+
var _res$data, res, _config;
|
|
275
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
276
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
277
|
+
case 0:
|
|
278
|
+
_context2.prev = 0;
|
|
279
|
+
_context2.next = 3;
|
|
280
|
+
return _this2.request.get('/core/board/management/config', query, BOARD_CONFIG_CACHE);
|
|
281
|
+
case 3:
|
|
282
|
+
res = _context2.sent;
|
|
283
|
+
_config = (_res$data = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data !== void 0 ? _res$data : null;
|
|
284
|
+
sharedBookingConfigCache.set(sharedKey, _config);
|
|
285
|
+
return _context2.abrupt("return", _config);
|
|
286
|
+
case 7:
|
|
287
|
+
_context2.prev = 7;
|
|
288
|
+
sharedBookingConfigPending.delete(sharedKey);
|
|
289
|
+
return _context2.finish(7);
|
|
290
|
+
case 10:
|
|
291
|
+
case "end":
|
|
292
|
+
return _context2.stop();
|
|
293
|
+
}
|
|
294
|
+
}, _callee2, null, [[0,, 7, 10]]);
|
|
295
|
+
}))();
|
|
296
|
+
pending = requestPromise;
|
|
297
|
+
sharedBookingConfigPending.set(sharedKey, requestPromise);
|
|
298
|
+
}
|
|
299
|
+
_context3.next = 16;
|
|
300
|
+
return pending;
|
|
301
|
+
case 16:
|
|
302
|
+
config = _context3.sent;
|
|
217
303
|
this.setBookingConfig(config);
|
|
218
|
-
this.lastConfigQueryKey =
|
|
219
|
-
return
|
|
220
|
-
case
|
|
304
|
+
this.lastConfigQueryKey = configKey;
|
|
305
|
+
return _context3.abrupt("return", config);
|
|
306
|
+
case 20:
|
|
221
307
|
case "end":
|
|
222
|
-
return
|
|
308
|
+
return _context3.stop();
|
|
223
309
|
}
|
|
224
|
-
},
|
|
310
|
+
}, _callee3, this);
|
|
225
311
|
}));
|
|
226
312
|
function loadBookingConfig() {
|
|
227
313
|
return _loadBookingConfig.apply(this, arguments);
|
|
@@ -231,48 +317,88 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
231
317
|
}, {
|
|
232
318
|
key: "loadResources",
|
|
233
319
|
value: function () {
|
|
234
|
-
var _loadResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
235
|
-
var _params$date
|
|
320
|
+
var _loadResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
321
|
+
var _params$date,
|
|
322
|
+
_this3 = this;
|
|
236
323
|
var params,
|
|
324
|
+
options,
|
|
237
325
|
date,
|
|
238
326
|
resourcesKey,
|
|
239
|
-
|
|
240
|
-
|
|
327
|
+
sharedKey,
|
|
328
|
+
_sharedResourcesCache,
|
|
329
|
+
cached,
|
|
330
|
+
pending,
|
|
331
|
+
requestPromise,
|
|
241
332
|
list,
|
|
242
|
-
|
|
243
|
-
return _regeneratorRuntime().wrap(function
|
|
244
|
-
while (1) switch (
|
|
333
|
+
_args5 = arguments;
|
|
334
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
335
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
245
336
|
case 0:
|
|
246
|
-
params =
|
|
337
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
338
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
247
339
|
date = toScheduleQueryDate((_params$date = params.date) !== null && _params$date !== void 0 ? _params$date : this.store.date);
|
|
248
340
|
resourcesKey = buildBookingResourcesQueryKey({
|
|
249
341
|
date: date,
|
|
250
342
|
bookingIds: params.bookingIds
|
|
251
343
|
});
|
|
252
|
-
if (!(this.lastResourcesQueryKey === resourcesKey)) {
|
|
253
|
-
|
|
344
|
+
if (!(!options.forceRefresh && this.lastResourcesQueryKey === resourcesKey)) {
|
|
345
|
+
_context5.next = 6;
|
|
254
346
|
break;
|
|
255
347
|
}
|
|
256
|
-
return
|
|
257
|
-
case
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.
|
|
266
|
-
this.
|
|
267
|
-
date: date,
|
|
268
|
-
bookingIds: params.bookingIds
|
|
269
|
-
});
|
|
270
|
-
return _context3.abrupt("return", list);
|
|
348
|
+
return _context5.abrupt("return", this.getResourcesOrigin());
|
|
349
|
+
case 6:
|
|
350
|
+
sharedKey = buildSharedCacheKey(this.request, resourcesKey);
|
|
351
|
+
if (!(!options.forceRefresh && sharedResourcesCache.has(sharedKey))) {
|
|
352
|
+
_context5.next = 12;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
cached = (_sharedResourcesCache = sharedResourcesCache.get(sharedKey)) !== null && _sharedResourcesCache !== void 0 ? _sharedResourcesCache : [];
|
|
356
|
+
this.setResources(cached);
|
|
357
|
+
this.lastResourcesQueryKey = resourcesKey;
|
|
358
|
+
return _context5.abrupt("return", this.getResourcesOrigin());
|
|
271
359
|
case 12:
|
|
360
|
+
pending = !options.forceRefresh ? sharedResourcesPending.get(sharedKey) : undefined;
|
|
361
|
+
if (!pending) {
|
|
362
|
+
requestPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
363
|
+
var res, _formatResourceListAn, _list;
|
|
364
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
365
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
366
|
+
case 0:
|
|
367
|
+
_context4.prev = 0;
|
|
368
|
+
_context4.next = 3;
|
|
369
|
+
return _this3.request.get('/schedule/resource/list', {
|
|
370
|
+
date: date
|
|
371
|
+
}, RESOURCE_LIST_CACHE);
|
|
372
|
+
case 3:
|
|
373
|
+
res = _context4.sent;
|
|
374
|
+
_formatResourceListAn = formatResourceListAndMap(res === null || res === void 0 ? void 0 : res.data, params.bookingIds || []), _list = _formatResourceListAn.list;
|
|
375
|
+
sharedResourcesCache.set(sharedKey, _list);
|
|
376
|
+
return _context4.abrupt("return", _list);
|
|
377
|
+
case 7:
|
|
378
|
+
_context4.prev = 7;
|
|
379
|
+
sharedResourcesPending.delete(sharedKey);
|
|
380
|
+
return _context4.finish(7);
|
|
381
|
+
case 10:
|
|
382
|
+
case "end":
|
|
383
|
+
return _context4.stop();
|
|
384
|
+
}
|
|
385
|
+
}, _callee4, null, [[0,, 7, 10]]);
|
|
386
|
+
}))();
|
|
387
|
+
pending = requestPromise;
|
|
388
|
+
sharedResourcesPending.set(sharedKey, requestPromise);
|
|
389
|
+
}
|
|
390
|
+
_context5.next = 16;
|
|
391
|
+
return pending;
|
|
392
|
+
case 16:
|
|
393
|
+
list = _context5.sent;
|
|
394
|
+
this.setResources(list);
|
|
395
|
+
this.lastResourcesQueryKey = resourcesKey;
|
|
396
|
+
return _context5.abrupt("return", this.getResourcesOrigin());
|
|
397
|
+
case 20:
|
|
272
398
|
case "end":
|
|
273
|
-
return
|
|
399
|
+
return _context5.stop();
|
|
274
400
|
}
|
|
275
|
-
},
|
|
401
|
+
}, _callee5, this);
|
|
276
402
|
}));
|
|
277
403
|
function loadResources() {
|
|
278
404
|
return _loadResources.apply(this, arguments);
|
|
@@ -285,10 +411,10 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
285
411
|
}, {
|
|
286
412
|
key: "isBookingContextReady",
|
|
287
413
|
value: function isBookingContextReady() {
|
|
288
|
-
var
|
|
414
|
+
var _ref3, _params$date2;
|
|
289
415
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
290
416
|
var configKey = buildBookingConfigQueryKey(params.bookingConfigParams);
|
|
291
|
-
var dateInput = (
|
|
417
|
+
var dateInput = (_ref3 = (_params$date2 = params.date) !== null && _params$date2 !== void 0 ? _params$date2 : this.store.date) !== null && _ref3 !== void 0 ? _ref3 : dayjs();
|
|
292
418
|
var queryDate = toScheduleQueryDate(dateInput);
|
|
293
419
|
var resourcesKey = buildBookingResourcesQueryKey({
|
|
294
420
|
date: queryDate,
|
|
@@ -301,8 +427,8 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
301
427
|
}, {
|
|
302
428
|
key: "initBookingContext",
|
|
303
429
|
value: function () {
|
|
304
|
-
var _initBookingContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
305
|
-
var
|
|
430
|
+
var _initBookingContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
431
|
+
var _ref4, _params$date3;
|
|
306
432
|
var params,
|
|
307
433
|
dateInput,
|
|
308
434
|
queryDate,
|
|
@@ -310,19 +436,19 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
310
436
|
resourcesKey,
|
|
311
437
|
needConfig,
|
|
312
438
|
needResources,
|
|
313
|
-
|
|
314
|
-
return _regeneratorRuntime().wrap(function
|
|
315
|
-
while (1) switch (
|
|
439
|
+
_args6 = arguments;
|
|
440
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
441
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
316
442
|
case 0:
|
|
317
|
-
params =
|
|
318
|
-
dateInput = (
|
|
443
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
444
|
+
dateInput = (_ref4 = (_params$date3 = params.date) !== null && _params$date3 !== void 0 ? _params$date3 : this.store.date) !== null && _ref4 !== void 0 ? _ref4 : dayjs();
|
|
319
445
|
queryDate = toScheduleQueryDate(dateInput);
|
|
320
446
|
this.setDate(dateInput);
|
|
321
447
|
if (!(!params.forceRefresh && this.isBookingContextReady(params))) {
|
|
322
|
-
|
|
448
|
+
_context6.next = 6;
|
|
323
449
|
break;
|
|
324
450
|
}
|
|
325
|
-
return
|
|
451
|
+
return _context6.abrupt("return", this.getState());
|
|
326
452
|
case 6:
|
|
327
453
|
configKey = buildBookingConfigQueryKey(params.bookingConfigParams);
|
|
328
454
|
resourcesKey = buildBookingResourcesQueryKey({
|
|
@@ -332,28 +458,32 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
332
458
|
needConfig = params.forceRefresh || this.store.bookingConfig == null || this.lastConfigQueryKey !== configKey;
|
|
333
459
|
needResources = params.loadResources !== false && (params.forceRefresh || this.lastResourcesQueryKey !== resourcesKey);
|
|
334
460
|
if (!needConfig) {
|
|
335
|
-
|
|
461
|
+
_context6.next = 13;
|
|
336
462
|
break;
|
|
337
463
|
}
|
|
338
|
-
|
|
339
|
-
return this.loadBookingConfig(params.bookingConfigParams
|
|
464
|
+
_context6.next = 13;
|
|
465
|
+
return this.loadBookingConfig(params.bookingConfigParams, {
|
|
466
|
+
forceRefresh: params.forceRefresh
|
|
467
|
+
});
|
|
340
468
|
case 13:
|
|
341
469
|
if (!needResources) {
|
|
342
|
-
|
|
470
|
+
_context6.next = 16;
|
|
343
471
|
break;
|
|
344
472
|
}
|
|
345
|
-
|
|
473
|
+
_context6.next = 16;
|
|
346
474
|
return this.loadResources({
|
|
347
475
|
date: queryDate,
|
|
348
476
|
bookingIds: params.bookingIds
|
|
477
|
+
}, {
|
|
478
|
+
forceRefresh: params.forceRefresh
|
|
349
479
|
});
|
|
350
480
|
case 16:
|
|
351
|
-
return
|
|
481
|
+
return _context6.abrupt("return", this.getState());
|
|
352
482
|
case 17:
|
|
353
483
|
case "end":
|
|
354
|
-
return
|
|
484
|
+
return _context6.stop();
|
|
355
485
|
}
|
|
356
|
-
},
|
|
486
|
+
}, _callee6, this);
|
|
357
487
|
}));
|
|
358
488
|
function initBookingContext() {
|
|
359
489
|
return _initBookingContext.apply(this, arguments);
|
|
@@ -193,6 +193,9 @@ export function cacheItemToBookingInput(cacheItem, options) {
|
|
|
193
193
|
if (ext.holder_id !== undefined && ext.holder_id !== null) {
|
|
194
194
|
metadata.holder_id = ext.holder_id;
|
|
195
195
|
}
|
|
196
|
+
if (ext.holder !== undefined) {
|
|
197
|
+
metadata.holder = ext.holder;
|
|
198
|
+
}
|
|
196
199
|
if (ext.collect_pax !== undefined) metadata.collect_pax = ext.collect_pax;
|
|
197
200
|
// 与 info2 formatMetaData 一致:优先写入完整人数维度数组,供编辑回显 / 详情回灌。
|
|
198
201
|
var extendCapacity = normalizeExtendCapacityForMetadata(ext.capacity);
|
|
@@ -186,6 +186,41 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
186
186
|
private ensureExtend;
|
|
187
187
|
private captureProductRuntime;
|
|
188
188
|
private createLinkedProductAndBooking;
|
|
189
|
+
/**
|
|
190
|
+
* booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* this.syncBookingMetadataHolder(booking, metadata);
|
|
194
|
+
*/
|
|
195
|
+
private syncBookingMetadataHolder;
|
|
196
|
+
/**
|
|
197
|
+
* 从单条 booking 的 holder / metadata 中收集 holder form_record。
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* const ids = this.collectBookingHolderRecords(booking);
|
|
201
|
+
*/
|
|
202
|
+
private collectBookingHolderRecords;
|
|
203
|
+
/**
|
|
204
|
+
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const names = this.collectBookingHolderNames(booking);
|
|
208
|
+
*/
|
|
209
|
+
private collectBookingHolderNames;
|
|
210
|
+
/**
|
|
211
|
+
* 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* const holder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
215
|
+
*/
|
|
216
|
+
private buildTempOrderHolderFromBookings;
|
|
217
|
+
/**
|
|
218
|
+
* 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* this.syncTempOrderHolderFromBookings(tempOrder);
|
|
222
|
+
*/
|
|
223
|
+
private syncTempOrderHolderFromBookings;
|
|
189
224
|
private getBookingUniqueIdentificationNumber;
|
|
190
225
|
private findBookingIndexByUniqueIdentificationNumber;
|
|
191
226
|
private removeLinkedBookingsForProduct;
|
|
@@ -328,6 +363,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
328
363
|
}): Promise<T>;
|
|
329
364
|
private markLocalOrderSynced;
|
|
330
365
|
private isSubmitResponseRejected;
|
|
366
|
+
private isLocalPendingSubmitResult;
|
|
331
367
|
private isSubmitErrorResponse;
|
|
332
368
|
private extractSubmitErrorResponse;
|
|
333
369
|
private logSubmitBackendRejected;
|