@pisell/pisellos 2.1.136 → 2.1.137
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/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +110 -67
- package/dist/solution/VenueBooking/index.js +5 -2
- package/dist/solution/VenueBooking/types.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +16 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +44 -16
- package/lib/solution/VenueBooking/index.js +1 -1
- package/lib/solution/VenueBooking/types.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +13 -1
- package/package.json +1 -1
|
@@ -86,6 +86,8 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
86
86
|
onCustomerLogin(params: {
|
|
87
87
|
customerId: number;
|
|
88
88
|
}): Promise<void>;
|
|
89
|
+
private findReservationRuleResource;
|
|
90
|
+
private buildScanOrderResourceMetadata;
|
|
89
91
|
private buildSubmitPayloadEnhancer;
|
|
90
92
|
submitScanOrder<T = any>(): Promise<T>;
|
|
91
93
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
@@ -1247,7 +1247,50 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1247
1247
|
return _onCustomerLogin.apply(this, arguments);
|
|
1248
1248
|
}
|
|
1249
1249
|
return onCustomerLogin;
|
|
1250
|
-
}()
|
|
1250
|
+
}()
|
|
1251
|
+
}, {
|
|
1252
|
+
key: "findReservationRuleResource",
|
|
1253
|
+
value: function findReservationRuleResource(formId) {
|
|
1254
|
+
if (formId == null) return undefined;
|
|
1255
|
+
var numericFormId = Number(formId);
|
|
1256
|
+
if (!Number.isFinite(numericFormId) || numericFormId <= 0) return undefined;
|
|
1257
|
+
var _iterator4 = _createForOfIteratorHelper(this.enabledReservationRuleProducts),
|
|
1258
|
+
_step4;
|
|
1259
|
+
try {
|
|
1260
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1261
|
+
var _product$product_reso;
|
|
1262
|
+
var product = _step4.value;
|
|
1263
|
+
var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
|
|
1264
|
+
if (!Array.isArray(resources)) continue;
|
|
1265
|
+
var matched = resources.find(function (resource) {
|
|
1266
|
+
return Number(resource === null || resource === void 0 ? void 0 : resource.id) === numericFormId;
|
|
1267
|
+
});
|
|
1268
|
+
if (matched) return matched;
|
|
1269
|
+
}
|
|
1270
|
+
} catch (err) {
|
|
1271
|
+
_iterator4.e(err);
|
|
1272
|
+
} finally {
|
|
1273
|
+
_iterator4.f();
|
|
1274
|
+
}
|
|
1275
|
+
return undefined;
|
|
1276
|
+
}
|
|
1277
|
+
}, {
|
|
1278
|
+
key: "buildScanOrderResourceMetadata",
|
|
1279
|
+
value: function buildScanOrderResourceMetadata(params) {
|
|
1280
|
+
var _ruleResource$title;
|
|
1281
|
+
var resourceState = params.resourceState,
|
|
1282
|
+
resourceName = params.resourceName;
|
|
1283
|
+
var ruleResource = this.findReservationRuleResource(resourceState.tableFormId);
|
|
1284
|
+
var combined = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.combined_resource;
|
|
1285
|
+
var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
1286
|
+
return {
|
|
1287
|
+
form_name: (_ruleResource$title = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.title) !== null && _ruleResource$title !== void 0 ? _ruleResource$title : '',
|
|
1288
|
+
resource_name: resourceName,
|
|
1289
|
+
combined_resource: isCombined ? combined : null
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// ScanOrder 提交 payload enhancer:
|
|
1251
1294
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
1252
1295
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
1253
1296
|
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
@@ -1292,7 +1335,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1292
1335
|
form_id: resourceState.tableFormId,
|
|
1293
1336
|
relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
|
|
1294
1337
|
capacity: resolveResourceCapacity(),
|
|
1295
|
-
metadata: {
|
|
1338
|
+
metadata: _this5.buildScanOrderResourceMetadata({
|
|
1339
|
+
resourceState: resourceState,
|
|
1340
|
+
resourceName: mainField
|
|
1341
|
+
})
|
|
1296
1342
|
} : undefined;
|
|
1297
1343
|
var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
|
|
1298
1344
|
// 默认 resolveResourceCapacity(single 为桌台容量,其余多为 1);有 collect_pax 时 value 优先用人数
|
|
@@ -1776,17 +1822,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1776
1822
|
if (visited.has(value)) return;
|
|
1777
1823
|
visited.add(value);
|
|
1778
1824
|
if (Array.isArray(value)) {
|
|
1779
|
-
var
|
|
1780
|
-
|
|
1825
|
+
var _iterator5 = _createForOfIteratorHelper(value),
|
|
1826
|
+
_step5;
|
|
1781
1827
|
try {
|
|
1782
|
-
for (
|
|
1783
|
-
var item =
|
|
1828
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1829
|
+
var item = _step5.value;
|
|
1784
1830
|
collectFromValue(item);
|
|
1785
1831
|
}
|
|
1786
1832
|
} catch (err) {
|
|
1787
|
-
|
|
1833
|
+
_iterator5.e(err);
|
|
1788
1834
|
} finally {
|
|
1789
|
-
|
|
1835
|
+
_iterator5.f();
|
|
1790
1836
|
}
|
|
1791
1837
|
return;
|
|
1792
1838
|
}
|
|
@@ -1947,7 +1993,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1947
1993
|
key: "applyPrefillByItemRule",
|
|
1948
1994
|
value: function () {
|
|
1949
1995
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1950
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
1996
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
|
|
1951
1997
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1952
1998
|
while (1) switch (_context29.prev = _context29.next) {
|
|
1953
1999
|
case 0:
|
|
@@ -1992,15 +2038,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1992
2038
|
productSourceMap = _context29.sent;
|
|
1993
2039
|
tempOrder = this.ensureTempOrder();
|
|
1994
2040
|
hasChanges = false;
|
|
1995
|
-
|
|
2041
|
+
_iterator6 = _createForOfIteratorHelper(prefillItems);
|
|
1996
2042
|
_context29.prev = 20;
|
|
1997
|
-
|
|
2043
|
+
_iterator6.s();
|
|
1998
2044
|
case 22:
|
|
1999
|
-
if ((
|
|
2045
|
+
if ((_step6 = _iterator6.n()).done) {
|
|
2000
2046
|
_context29.next = 47;
|
|
2001
2047
|
break;
|
|
2002
2048
|
}
|
|
2003
|
-
prefillItem =
|
|
2049
|
+
prefillItem = _step6.value;
|
|
2004
2050
|
productId = Number(prefillItem.product_id);
|
|
2005
2051
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2006
2052
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -2071,10 +2117,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2071
2117
|
case 49:
|
|
2072
2118
|
_context29.prev = 49;
|
|
2073
2119
|
_context29.t0 = _context29["catch"](20);
|
|
2074
|
-
|
|
2120
|
+
_iterator6.e(_context29.t0);
|
|
2075
2121
|
case 52:
|
|
2076
2122
|
_context29.prev = 52;
|
|
2077
|
-
|
|
2123
|
+
_iterator6.f();
|
|
2078
2124
|
return _context29.finish(52);
|
|
2079
2125
|
case 55:
|
|
2080
2126
|
if (!hasChanges) {
|
|
@@ -2462,7 +2508,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2462
2508
|
key: "checkResourceAvailable",
|
|
2463
2509
|
value: function () {
|
|
2464
2510
|
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
|
|
2465
|
-
var _this$
|
|
2511
|
+
var _this$otherParams10, _this$otherParams10$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams11, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams12, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
|
|
2466
2512
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2467
2513
|
while (1) switch (_context36.prev = _context36.next) {
|
|
2468
2514
|
case 0:
|
|
@@ -2470,28 +2516,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2470
2516
|
resourceId: resourceId
|
|
2471
2517
|
});
|
|
2472
2518
|
_context36.prev = 1;
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2476
|
-
_context36.next = 7;
|
|
2477
|
-
return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
|
|
2519
|
+
_context36.next = 4;
|
|
2520
|
+
return (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10$g = _this$otherParams10.getOpenData) === null || _this$otherParams10$g === void 0 ? void 0 : _this$otherParams10$g.call(_this$otherParams10, {
|
|
2478
2521
|
scope: 'board',
|
|
2479
|
-
target:
|
|
2522
|
+
target: 'dine_in+scan_to_order',
|
|
2480
2523
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
2481
2524
|
});
|
|
2482
|
-
case
|
|
2525
|
+
case 4:
|
|
2483
2526
|
openData = _context36.sent;
|
|
2484
2527
|
if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
|
|
2485
|
-
_context36.next =
|
|
2528
|
+
_context36.next = 7;
|
|
2486
2529
|
break;
|
|
2487
2530
|
}
|
|
2488
2531
|
throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
|
|
2489
|
-
case
|
|
2532
|
+
case 7:
|
|
2490
2533
|
dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
|
|
2491
2534
|
this.otherParams.dineInConfig = dineInConfig;
|
|
2492
|
-
_context36.next =
|
|
2535
|
+
_context36.next = 11;
|
|
2493
2536
|
return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
|
|
2494
|
-
case
|
|
2537
|
+
case 11:
|
|
2495
2538
|
closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
|
|
2496
2539
|
closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
|
|
2497
2540
|
basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
|
|
@@ -2508,21 +2551,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2508
2551
|
};
|
|
2509
2552
|
}; // 1. 基础开关 basic.enable 关闭
|
|
2510
2553
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
|
|
2511
|
-
_context36.next =
|
|
2554
|
+
_context36.next = 18;
|
|
2512
2555
|
break;
|
|
2513
2556
|
}
|
|
2514
2557
|
return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
|
|
2515
|
-
case
|
|
2558
|
+
case 18:
|
|
2516
2559
|
if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
|
|
2517
|
-
_context36.next =
|
|
2560
|
+
_context36.next = 21;
|
|
2518
2561
|
break;
|
|
2519
2562
|
}
|
|
2520
2563
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
|
|
2521
|
-
_context36.next =
|
|
2564
|
+
_context36.next = 21;
|
|
2522
2565
|
break;
|
|
2523
2566
|
}
|
|
2524
2567
|
return _context36.abrupt("return", makeShopClosed(pauseMessage));
|
|
2525
|
-
case
|
|
2568
|
+
case 21:
|
|
2526
2569
|
// 3. 营业时间 operating_hours 闸门
|
|
2527
2570
|
operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
|
|
2528
2571
|
return Number(id);
|
|
@@ -2538,27 +2581,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2538
2581
|
}
|
|
2539
2582
|
}
|
|
2540
2583
|
if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
|
|
2541
|
-
_context36.next =
|
|
2584
|
+
_context36.next = 26;
|
|
2542
2585
|
break;
|
|
2543
2586
|
}
|
|
2544
2587
|
return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
|
|
2545
|
-
case
|
|
2588
|
+
case 26:
|
|
2546
2589
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2547
2590
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2548
2591
|
tempOrder = this.ensureTempOrder();
|
|
2549
2592
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2550
2593
|
if (!(reservationLinkIds.length === 0)) {
|
|
2551
|
-
_context36.next =
|
|
2594
|
+
_context36.next = 32;
|
|
2552
2595
|
break;
|
|
2553
2596
|
}
|
|
2554
2597
|
this.enabledReservationRuleProducts = [];
|
|
2555
|
-
_context36.next =
|
|
2598
|
+
_context36.next = 43;
|
|
2556
2599
|
break;
|
|
2557
|
-
case
|
|
2600
|
+
case 32:
|
|
2558
2601
|
tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
|
|
2559
2602
|
delete tempOrder.metadata.table_occupancy_duration;
|
|
2560
2603
|
reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
|
|
2561
|
-
_context36.next =
|
|
2604
|
+
_context36.next = 37;
|
|
2562
2605
|
return reservationProductList.initialize(this.core, {
|
|
2563
2606
|
store: {
|
|
2564
2607
|
list: [],
|
|
@@ -2570,17 +2613,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2570
2613
|
cacheId: this.cacheId
|
|
2571
2614
|
})
|
|
2572
2615
|
});
|
|
2573
|
-
case
|
|
2616
|
+
case 37:
|
|
2574
2617
|
scheduleDate = dayjs().format('YYYY-MM-DD');
|
|
2575
2618
|
scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2576
|
-
_context36.next =
|
|
2619
|
+
_context36.next = 41;
|
|
2577
2620
|
return reservationProductList.loadProducts({
|
|
2578
2621
|
product_ids: reservationLinkIds,
|
|
2579
2622
|
schedule_date: scheduleDate,
|
|
2580
2623
|
schedule_datetime: scheduleDatetime,
|
|
2581
2624
|
cacheId: this.cacheId
|
|
2582
2625
|
});
|
|
2583
|
-
case
|
|
2626
|
+
case 41:
|
|
2584
2627
|
loaded = _context36.sent;
|
|
2585
2628
|
if (Array.isArray(loaded)) {
|
|
2586
2629
|
this.enabledReservationRuleProducts = loaded;
|
|
@@ -2605,10 +2648,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2605
2648
|
}
|
|
2606
2649
|
});
|
|
2607
2650
|
}
|
|
2608
|
-
case
|
|
2609
|
-
_context36.next =
|
|
2651
|
+
case 43:
|
|
2652
|
+
_context36.next = 45;
|
|
2610
2653
|
return this.fetchResourceOccupyDetailByResourceId(resourceId);
|
|
2611
|
-
case
|
|
2654
|
+
case 45:
|
|
2612
2655
|
occupyDetail = _context36.sent;
|
|
2613
2656
|
// Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2614
2657
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
@@ -2642,30 +2685,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2642
2685
|
} : {}), this.store.resource.requestPaxMax !== undefined ? {
|
|
2643
2686
|
requestPaxMax: this.store.resource.requestPaxMax
|
|
2644
2687
|
} : {});
|
|
2645
|
-
tempOrder.relation_id = resourceId || ((_this$
|
|
2688
|
+
tempOrder.relation_id = resourceId || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.relation_id);
|
|
2646
2689
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
2647
2690
|
tempOrder.resource_id = resourceId;
|
|
2648
2691
|
(_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
|
|
2649
2692
|
|
|
2650
2693
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2651
2694
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2652
|
-
_context36.next =
|
|
2695
|
+
_context36.next = 60;
|
|
2653
2696
|
break;
|
|
2654
2697
|
}
|
|
2655
|
-
_context36.next =
|
|
2698
|
+
_context36.next = 60;
|
|
2656
2699
|
return this.addNewOrder();
|
|
2657
|
-
case
|
|
2700
|
+
case 60:
|
|
2658
2701
|
// 如果是加单模式,tempOrder 里 需要记录 lastOrderId,提交的时候走加单接口
|
|
2659
2702
|
if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
|
|
2660
2703
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
2661
2704
|
}
|
|
2662
2705
|
if (!tempOrder.order_id) {
|
|
2663
|
-
_context36.next =
|
|
2706
|
+
_context36.next = 69;
|
|
2664
2707
|
break;
|
|
2665
2708
|
}
|
|
2666
|
-
_context36.next =
|
|
2709
|
+
_context36.next = 64;
|
|
2667
2710
|
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
|
|
2668
|
-
case
|
|
2711
|
+
case 64:
|
|
2669
2712
|
res = _context36.sent;
|
|
2670
2713
|
// 找到下单的时候输入的 entryPaxNumber
|
|
2671
2714
|
entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
|
|
@@ -2673,12 +2716,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2673
2716
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
2674
2717
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
2675
2718
|
if (!entryPaxNumber) {
|
|
2676
|
-
_context36.next =
|
|
2719
|
+
_context36.next = 69;
|
|
2677
2720
|
break;
|
|
2678
2721
|
}
|
|
2679
|
-
_context36.next =
|
|
2722
|
+
_context36.next = 69;
|
|
2680
2723
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
2681
|
-
case
|
|
2724
|
+
case 69:
|
|
2682
2725
|
lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
|
|
2683
2726
|
historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
|
|
2684
2727
|
if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
|
|
@@ -2690,13 +2733,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2690
2733
|
} : {}));
|
|
2691
2734
|
return acc;
|
|
2692
2735
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2693
|
-
_context36.next =
|
|
2736
|
+
_context36.next = 73;
|
|
2694
2737
|
return this.setItemRuleRuntimeConfig({
|
|
2695
|
-
serviceType: (_this$
|
|
2738
|
+
serviceType: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
|
|
2696
2739
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
2697
2740
|
historicalItems: historicalItems
|
|
2698
2741
|
});
|
|
2699
|
-
case
|
|
2742
|
+
case 73:
|
|
2700
2743
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2701
2744
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2702
2745
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2718,18 +2761,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2718
2761
|
isFull: resourceState.isFull
|
|
2719
2762
|
});
|
|
2720
2763
|
return _context36.abrupt("return", availabilityInfo);
|
|
2721
|
-
case
|
|
2722
|
-
_context36.prev =
|
|
2764
|
+
case 78:
|
|
2765
|
+
_context36.prev = 78;
|
|
2723
2766
|
_context36.t0 = _context36["catch"](1);
|
|
2724
2767
|
this.logMethodError('checkResourceAvailable', _context36.t0.message, {
|
|
2725
2768
|
resourceId: resourceId
|
|
2726
2769
|
});
|
|
2727
2770
|
throw _context36.t0;
|
|
2728
|
-
case
|
|
2771
|
+
case 82:
|
|
2729
2772
|
case "end":
|
|
2730
2773
|
return _context36.stop();
|
|
2731
2774
|
}
|
|
2732
|
-
}, _callee36, this, [[1,
|
|
2775
|
+
}, _callee36, this, [[1, 78]]);
|
|
2733
2776
|
}));
|
|
2734
2777
|
function checkResourceAvailable(_x18, _x19) {
|
|
2735
2778
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -2772,14 +2815,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2772
2815
|
key: "getProductList",
|
|
2773
2816
|
value: function () {
|
|
2774
2817
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2775
|
-
var _this$
|
|
2818
|
+
var _this$otherParams13;
|
|
2776
2819
|
var menu_list_ids, _this$store$products, res, formattedRes;
|
|
2777
2820
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2778
2821
|
while (1) switch (_context38.prev = _context38.next) {
|
|
2779
2822
|
case 0:
|
|
2780
2823
|
this.logMethodStart('getProductList');
|
|
2781
2824
|
// 可以直接通过配置里的 menu 读取
|
|
2782
|
-
menu_list_ids = ((_this$
|
|
2825
|
+
menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
|
|
2783
2826
|
return Number(n.value);
|
|
2784
2827
|
})) || [];
|
|
2785
2828
|
_context38.prev = 2;
|
|
@@ -2982,9 +3025,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2982
3025
|
}, {
|
|
2983
3026
|
key: "getFulfillmentModes",
|
|
2984
3027
|
value: function getFulfillmentModes() {
|
|
2985
|
-
var _this$
|
|
3028
|
+
var _this$otherParams14;
|
|
2986
3029
|
this.logMethodStart('getFulfillmentModes');
|
|
2987
|
-
var dineInConfig = ((_this$
|
|
3030
|
+
var dineInConfig = ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.dineInConfig) || {};
|
|
2988
3031
|
var result = {
|
|
2989
3032
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
2990
3033
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -2998,9 +3041,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2998
3041
|
}, {
|
|
2999
3042
|
key: "checkManualPickupRef",
|
|
3000
3043
|
value: function checkManualPickupRef() {
|
|
3001
|
-
var _this$
|
|
3044
|
+
var _this$otherParams15;
|
|
3002
3045
|
this.logMethodStart('checkManualPickupRef');
|
|
3003
|
-
var dineInConfig = ((_this$
|
|
3046
|
+
var dineInConfig = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.dineInConfig) || {};
|
|
3004
3047
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3005
3048
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3006
3049
|
var enabled = refMode === 'manual_input';
|
|
@@ -44,7 +44,7 @@ import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
|
44
44
|
import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
45
45
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
46
46
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
47
|
-
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildPriceBreakdown } from "./utils/slotMerge";
|
|
47
|
+
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
|
|
48
48
|
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
49
49
|
import { OrderModule } from "../../modules/Order";
|
|
50
50
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
@@ -1627,7 +1627,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1627
1627
|
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
1628
1628
|
relation_id: resourceId,
|
|
1629
1629
|
capacity: 1,
|
|
1630
|
-
metadata: {
|
|
1630
|
+
metadata: buildVenueResourceMetadata({
|
|
1631
|
+
mapping: mapping,
|
|
1632
|
+
rawResource: rawResource
|
|
1633
|
+
})
|
|
1631
1634
|
};
|
|
1632
1635
|
if (childRawResources && childRawResources.length) {
|
|
1633
1636
|
resourceEntry.children = childRawResources.map(function (child) {
|
|
@@ -25,6 +25,10 @@ export interface BuildVenueBookingParams {
|
|
|
25
25
|
*/
|
|
26
26
|
childResources?: VenueResourceRawData[];
|
|
27
27
|
}
|
|
28
|
+
export declare function buildVenueResourceMetadata(params: {
|
|
29
|
+
mapping: ResourceProductMapping;
|
|
30
|
+
rawResource: VenueResourceRawData | undefined;
|
|
31
|
+
}): Record<string, any>;
|
|
28
32
|
export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
|
|
29
33
|
/**
|
|
30
34
|
* 从一条已合并的订单商品还原出独立的时段列表。
|
|
@@ -89,6 +89,18 @@ export function buildPriceBreakdown(params) {
|
|
|
89
89
|
}
|
|
90
90
|
return entries;
|
|
91
91
|
}
|
|
92
|
+
export function buildVenueResourceMetadata(params) {
|
|
93
|
+
var _mapping$formName, _rawResource$main_fie;
|
|
94
|
+
var mapping = params.mapping,
|
|
95
|
+
rawResource = params.rawResource;
|
|
96
|
+
var combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource;
|
|
97
|
+
var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
98
|
+
return {
|
|
99
|
+
form_name: (_mapping$formName = mapping.formName) !== null && _mapping$formName !== void 0 ? _mapping$formName : mapping.resourceName,
|
|
100
|
+
resource_name: (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName,
|
|
101
|
+
combined_resource: isCombined ? combined : null
|
|
102
|
+
};
|
|
103
|
+
}
|
|
92
104
|
export function buildVenueBookingEntry(params) {
|
|
93
105
|
var _rawResource$form_id;
|
|
94
106
|
var group = params.group,
|
|
@@ -109,7 +121,10 @@ export function buildVenueBookingEntry(params) {
|
|
|
109
121
|
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
110
122
|
relation_id: resourceId,
|
|
111
123
|
capacity: 1,
|
|
112
|
-
metadata: {
|
|
124
|
+
metadata: buildVenueResourceMetadata({
|
|
125
|
+
mapping: mapping,
|
|
126
|
+
rawResource: rawResource
|
|
127
|
+
})
|
|
113
128
|
};
|
|
114
129
|
if (childResources && childResources.length) {
|
|
115
130
|
resourceEntry.children = childResources.map(function (child) {
|
|
@@ -86,6 +86,8 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
86
86
|
onCustomerLogin(params: {
|
|
87
87
|
customerId: number;
|
|
88
88
|
}): Promise<void>;
|
|
89
|
+
private findReservationRuleResource;
|
|
90
|
+
private buildScanOrderResourceMetadata;
|
|
89
91
|
private buildSubmitPayloadEnhancer;
|
|
90
92
|
submitScanOrder<T = any>(): Promise<T>;
|
|
91
93
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
@@ -746,6 +746,34 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
746
746
|
throw error;
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
|
+
findReservationRuleResource(formId) {
|
|
750
|
+
var _a;
|
|
751
|
+
if (formId == null)
|
|
752
|
+
return void 0;
|
|
753
|
+
const numericFormId = Number(formId);
|
|
754
|
+
if (!Number.isFinite(numericFormId) || numericFormId <= 0)
|
|
755
|
+
return void 0;
|
|
756
|
+
for (const product of this.enabledReservationRuleProducts) {
|
|
757
|
+
const resources = (_a = product == null ? void 0 : product.product_resource) == null ? void 0 : _a.resources;
|
|
758
|
+
if (!Array.isArray(resources))
|
|
759
|
+
continue;
|
|
760
|
+
const matched = resources.find((resource) => Number(resource == null ? void 0 : resource.id) === numericFormId);
|
|
761
|
+
if (matched)
|
|
762
|
+
return matched;
|
|
763
|
+
}
|
|
764
|
+
return void 0;
|
|
765
|
+
}
|
|
766
|
+
buildScanOrderResourceMetadata(params) {
|
|
767
|
+
const { resourceState, resourceName } = params;
|
|
768
|
+
const ruleResource = this.findReservationRuleResource(resourceState.tableFormId);
|
|
769
|
+
const combined = ruleResource == null ? void 0 : ruleResource.combined_resource;
|
|
770
|
+
const isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
771
|
+
return {
|
|
772
|
+
form_name: (ruleResource == null ? void 0 : ruleResource.title) ?? "",
|
|
773
|
+
resource_name: resourceName,
|
|
774
|
+
combined_resource: isCombined ? combined : null
|
|
775
|
+
};
|
|
776
|
+
}
|
|
749
777
|
// ScanOrder 提交 payload enhancer:
|
|
750
778
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
751
779
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
@@ -785,7 +813,10 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
785
813
|
form_id: resourceState.tableFormId,
|
|
786
814
|
relation_id: resourceState.relationId ?? resourceId,
|
|
787
815
|
capacity: resolveResourceCapacity(),
|
|
788
|
-
metadata: {
|
|
816
|
+
metadata: this.buildScanOrderResourceMetadata({
|
|
817
|
+
resourceState,
|
|
818
|
+
resourceName: mainField
|
|
819
|
+
})
|
|
789
820
|
} : void 0;
|
|
790
821
|
const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
|
|
791
822
|
const rawCollectPax = (_b = tempOrder.metadata) == null ? void 0 : _b.collect_pax;
|
|
@@ -1426,17 +1457,14 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1426
1457
|
// 通过 resource_id + 店铺配置
|
|
1427
1458
|
// hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
|
|
1428
1459
|
async checkResourceAvailable(resourceId, hasOrderId) {
|
|
1429
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n
|
|
1460
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1430
1461
|
this.logMethodStart("checkResourceAvailable", {
|
|
1431
1462
|
resourceId
|
|
1432
1463
|
});
|
|
1433
1464
|
try {
|
|
1434
|
-
const
|
|
1435
|
-
const channel = String(((_b = this.otherParams) == null ? void 0 : _b.channel) ?? "").trim();
|
|
1436
|
-
const openDataTarget = businessCode && channel ? `${businessCode}+${channel}` : "dine_in+scan_to_order";
|
|
1437
|
-
const openData = await ((_d = (_c = this.otherParams) == null ? void 0 : _c.getOpenData) == null ? void 0 : _d.call(_c, {
|
|
1465
|
+
const openData = await ((_b = (_a = this.otherParams) == null ? void 0 : _a.getOpenData) == null ? void 0 : _b.call(_a, {
|
|
1438
1466
|
scope: "board",
|
|
1439
|
-
target:
|
|
1467
|
+
target: "dine_in+scan_to_order",
|
|
1440
1468
|
section_code: ["basic", "fulfillment", "reservation", "sale", "menu", "availability", "workflow"]
|
|
1441
1469
|
}));
|
|
1442
1470
|
if ((openData == null ? void 0 : openData.status) === false) {
|
|
@@ -1563,16 +1591,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1563
1591
|
table_form_id: resourceState.tableFormId,
|
|
1564
1592
|
deskmate_valid: resourceState.deskmate_valid,
|
|
1565
1593
|
table_form_record: resourceState.table_form_record,
|
|
1566
|
-
policy: (
|
|
1567
|
-
partyroom_booking: (
|
|
1594
|
+
policy: (_c = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _c.policy,
|
|
1595
|
+
partyroom_booking: (_d = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _d.partyroom_booking,
|
|
1568
1596
|
...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
|
|
1569
1597
|
...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
|
|
1570
1598
|
...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
|
|
1571
1599
|
};
|
|
1572
|
-
tempOrder.relation_id = resourceId || ((
|
|
1600
|
+
tempOrder.relation_id = resourceId || ((_e = this.otherParams) == null ? void 0 : _e.relation_id);
|
|
1573
1601
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
1574
1602
|
tempOrder.resource_id = resourceId;
|
|
1575
|
-
(
|
|
1603
|
+
(_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
|
|
1576
1604
|
if (availabilityInfo.mode === "idle") {
|
|
1577
1605
|
await this.addNewOrder();
|
|
1578
1606
|
}
|
|
@@ -1580,16 +1608,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1580
1608
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
1581
1609
|
}
|
|
1582
1610
|
if (tempOrder.order_id) {
|
|
1583
|
-
const res = await ((
|
|
1584
|
-
const entryPaxNumber = (
|
|
1611
|
+
const res = await ((_g = this.store.order) == null ? void 0 : _g.getOrderInfoByRemote(tempOrder.order_id));
|
|
1612
|
+
const entryPaxNumber = (_k = (_j = (_i = (_h = res == null ? void 0 : res.data) == null ? void 0 : _h.bookings) == null ? void 0 : _i.find((p) => {
|
|
1585
1613
|
var _a2;
|
|
1586
1614
|
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|
|
1587
|
-
})) == null ? void 0 :
|
|
1615
|
+
})) == null ? void 0 : _j.metadata) == null ? void 0 : _k.collect_pax;
|
|
1588
1616
|
if (entryPaxNumber) {
|
|
1589
1617
|
await this.setEntryPaxNumber(entryPaxNumber);
|
|
1590
1618
|
}
|
|
1591
1619
|
}
|
|
1592
|
-
const lastOrderInfo = (
|
|
1620
|
+
const lastOrderInfo = (_m = (_l = this.store.order) == null ? void 0 : _l.getLastOrderInfo) == null ? void 0 : _m.call(_l);
|
|
1593
1621
|
const historicalItems = hasOrderId && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
|
|
1594
1622
|
if (typeof (p == null ? void 0 : p.product_id) !== "number")
|
|
1595
1623
|
return acc;
|
|
@@ -1601,7 +1629,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1601
1629
|
return acc;
|
|
1602
1630
|
}, []) : [];
|
|
1603
1631
|
await this.setItemRuleRuntimeConfig({
|
|
1604
|
-
serviceType: (
|
|
1632
|
+
serviceType: (_n = this.otherParams) == null ? void 0 : _n.businessCode,
|
|
1605
1633
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
1606
1634
|
historicalItems
|
|
1607
1635
|
});
|
|
@@ -988,7 +988,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
988
988
|
form_id: (rawResource == null ? void 0 : rawResource.form_id) ?? mapping.formId,
|
|
989
989
|
relation_id: resourceId,
|
|
990
990
|
capacity: 1,
|
|
991
|
-
metadata: {}
|
|
991
|
+
metadata: (0, import_slotMerge.buildVenueResourceMetadata)({ mapping, rawResource })
|
|
992
992
|
};
|
|
993
993
|
if (childRawResources && childRawResources.length) {
|
|
994
994
|
resourceEntry.children = childRawResources.map((child) => ({
|
|
@@ -25,6 +25,10 @@ export interface BuildVenueBookingParams {
|
|
|
25
25
|
*/
|
|
26
26
|
childResources?: VenueResourceRawData[];
|
|
27
27
|
}
|
|
28
|
+
export declare function buildVenueResourceMetadata(params: {
|
|
29
|
+
mapping: ResourceProductMapping;
|
|
30
|
+
rawResource: VenueResourceRawData | undefined;
|
|
31
|
+
}): Record<string, any>;
|
|
28
32
|
export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
|
|
29
33
|
/**
|
|
30
34
|
* 从一条已合并的订单商品还原出独立的时段列表。
|
|
@@ -32,6 +32,7 @@ __export(slotMerge_exports, {
|
|
|
32
32
|
buildPriceBreakdown: () => buildPriceBreakdown,
|
|
33
33
|
buildVenueBookingEntry: () => buildVenueBookingEntry,
|
|
34
34
|
buildVenueIdentityKey: () => buildVenueIdentityKey,
|
|
35
|
+
buildVenueResourceMetadata: () => buildVenueResourceMetadata,
|
|
35
36
|
expandMergedSlotToIndividual: () => expandMergedSlotToIndividual,
|
|
36
37
|
mergeConsecutiveSlots: () => mergeConsecutiveSlots
|
|
37
38
|
});
|
|
@@ -106,6 +107,16 @@ function buildPriceBreakdown(params) {
|
|
|
106
107
|
}
|
|
107
108
|
return entries;
|
|
108
109
|
}
|
|
110
|
+
function buildVenueResourceMetadata(params) {
|
|
111
|
+
const { mapping, rawResource } = params;
|
|
112
|
+
const combined = rawResource == null ? void 0 : rawResource.combined_resource;
|
|
113
|
+
const isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
114
|
+
return {
|
|
115
|
+
form_name: mapping.formName ?? mapping.resourceName,
|
|
116
|
+
resource_name: (rawResource == null ? void 0 : rawResource.main_field) ?? mapping.resourceName,
|
|
117
|
+
combined_resource: isCombined ? combined : null
|
|
118
|
+
};
|
|
119
|
+
}
|
|
109
120
|
function buildVenueBookingEntry(params) {
|
|
110
121
|
const { group, resourceId, mapping, rawResource, bookingUuid, productUid, childResources } = params;
|
|
111
122
|
const startMoment = (0, import_dayjs.default)(group.startTime, "YYYY-MM-DD HH:mm");
|
|
@@ -119,7 +130,7 @@ function buildVenueBookingEntry(params) {
|
|
|
119
130
|
form_id: (rawResource == null ? void 0 : rawResource.form_id) ?? mapping.formId,
|
|
120
131
|
relation_id: resourceId,
|
|
121
132
|
capacity: 1,
|
|
122
|
-
metadata: {}
|
|
133
|
+
metadata: buildVenueResourceMetadata({ mapping, rawResource })
|
|
123
134
|
};
|
|
124
135
|
if (childResources && childResources.length) {
|
|
125
136
|
resourceEntry.children = childResources.map((child) => ({
|
|
@@ -220,6 +231,7 @@ function expandMergedSlotToIndividual(product, slotDurationMinutes) {
|
|
|
220
231
|
buildPriceBreakdown,
|
|
221
232
|
buildVenueBookingEntry,
|
|
222
233
|
buildVenueIdentityKey,
|
|
234
|
+
buildVenueResourceMetadata,
|
|
223
235
|
expandMergedSlotToIndividual,
|
|
224
236
|
mergeConsecutiveSlots
|
|
225
237
|
});
|