@pisell/pisellos 2.3.39 → 2.3.41
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/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +750 -509
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +7 -3
- package/dist/solution/BookingTicket/index.js +132 -49
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +196 -86
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +7 -3
- package/lib/solution/BookingTicket/index.js +62 -9
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -33,7 +33,7 @@ __export(ScanOrder_exports, {
|
|
|
33
33
|
ScanOrderImpl: () => ScanOrderImpl
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(ScanOrder_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_BaseModule = require("../../modules/BaseModule");
|
|
37
37
|
var import_types = require("./types");
|
|
38
38
|
var import_Order = require("../../modules/Order");
|
|
39
39
|
var import_types2 = require("../../modules/Account/types");
|
|
@@ -42,12 +42,17 @@ var import_decimal = __toESM(require("decimal.js"));
|
|
|
42
42
|
var import_utils = require("./utils");
|
|
43
43
|
var import_types4 = require("../BookingByStep/types");
|
|
44
44
|
var import_ProductList = require("../../modules/ProductList");
|
|
45
|
+
var import_Schedule = require("../../modules/Schedule");
|
|
45
46
|
var import_getDateIsInSchedule = require("../../modules/Schedule/getDateIsInSchedule");
|
|
46
47
|
var import_utils2 = require("../../modules/Order/utils");
|
|
47
48
|
var import_dayjs = __toESM(require("dayjs"));
|
|
48
49
|
var import_itemRule = require("../../model/strategy/adapter/itemRule");
|
|
49
50
|
__reExport(ScanOrder_exports, require("./types"), module.exports);
|
|
50
|
-
|
|
51
|
+
function isItemRewardProductDiscount(discount) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
return (discount == null ? void 0 : discount.type) === "product" && ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
|
|
54
|
+
}
|
|
55
|
+
var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
51
56
|
constructor(name, version) {
|
|
52
57
|
super(name, version);
|
|
53
58
|
this.defaultName = "scanOrder";
|
|
@@ -299,22 +304,28 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
299
304
|
}
|
|
300
305
|
}
|
|
301
306
|
}
|
|
302
|
-
getRegisteredModuleNames() {
|
|
303
|
-
return ["scanOrderLogger", "products", "order", "salesSummary", "schedule"];
|
|
304
|
-
}
|
|
305
|
-
createSubModule(moduleName) {
|
|
306
|
-
if (moduleName === "scanOrderLogger") {
|
|
307
|
-
return (0, import_types4.createModule)("scanOrderLogger", this.name);
|
|
308
|
-
}
|
|
309
|
-
return super.createSubModule(moduleName);
|
|
310
|
-
}
|
|
311
307
|
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
312
308
|
getCacheId() {
|
|
313
309
|
return this.cacheId;
|
|
314
310
|
}
|
|
311
|
+
async destroyRegisteredChildModules() {
|
|
312
|
+
const modules = [
|
|
313
|
+
this.store.schedule,
|
|
314
|
+
this.store.salesSummary,
|
|
315
|
+
this.store.order,
|
|
316
|
+
this.store.products,
|
|
317
|
+
this.store.scanOrderLogger
|
|
318
|
+
];
|
|
319
|
+
for (const mod of modules) {
|
|
320
|
+
if (mod && typeof mod.destroy === "function")
|
|
321
|
+
await Promise.resolve(mod.destroy());
|
|
322
|
+
}
|
|
323
|
+
}
|
|
315
324
|
async initialize(core, options = {}) {
|
|
316
|
-
var _a, _b, _c, _d, _e, _f
|
|
325
|
+
var _a, _b, _c, _d, _e, _f;
|
|
317
326
|
this.logMethodStart("initialize");
|
|
327
|
+
this.core = core;
|
|
328
|
+
this.initializeOptions = options || {};
|
|
318
329
|
this.store = { ...this.store, ...options.store };
|
|
319
330
|
this.store.entryContext = ((_a = options.otherParams) == null ? void 0 : _a.entryContext) || this.store.entryContext;
|
|
320
331
|
this.store.status = "initializing";
|
|
@@ -330,26 +341,71 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
330
341
|
passed: null,
|
|
331
342
|
failures: []
|
|
332
343
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
);
|
|
338
|
-
|
|
339
|
-
|
|
344
|
+
this.window = core.getPlugin("window");
|
|
345
|
+
this.request = core.getPlugin("request");
|
|
346
|
+
if (!this.window) {
|
|
347
|
+
this.logMethodError("initialize", "window plugin missing");
|
|
348
|
+
throw new Error("scanOrder解决方案需要 window 插件支持");
|
|
349
|
+
}
|
|
350
|
+
if (!this.request) {
|
|
351
|
+
this.logMethodError("initialize", "request plugin missing");
|
|
352
|
+
throw new Error("scanOrder解决方案需要 request 插件支持");
|
|
353
|
+
}
|
|
354
|
+
const moduleArr = [
|
|
355
|
+
"scanOrderLogger",
|
|
356
|
+
"products",
|
|
357
|
+
"order",
|
|
358
|
+
"salesSummary"
|
|
359
|
+
];
|
|
360
|
+
moduleArr.forEach((step) => {
|
|
361
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
362
|
+
const targetModule = (0, import_types4.createModule)(step, this.name);
|
|
363
|
+
if (targetModule) {
|
|
364
|
+
this.store[step] = targetModule;
|
|
365
|
+
const initialState = step === "salesSummary" ? {
|
|
366
|
+
summary: ((_b2 = (_a2 = this.store.order) == null ? void 0 : _a2.getTempOrder()) == null ? void 0 : _b2.summary) || (0, import_utils.createEmptySummary)()
|
|
367
|
+
} : {};
|
|
368
|
+
const loggerProvider = ((_c2 = this.otherParams) == null ? void 0 : _c2.scanOrderLoggerProvider) || "feishu";
|
|
369
|
+
const loggerConfig = ((_d2 = this.otherParams) == null ? void 0 : _d2.scanOrderLoggerConfig) || {
|
|
340
370
|
feishu: {
|
|
341
371
|
webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed",
|
|
342
372
|
errorHook: "https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f"
|
|
343
373
|
}
|
|
344
|
-
}
|
|
345
|
-
|
|
374
|
+
};
|
|
375
|
+
this.core.registerModule(targetModule, {
|
|
376
|
+
initialState,
|
|
377
|
+
otherParams: {
|
|
378
|
+
...this.otherParams,
|
|
379
|
+
fatherModule: this.name,
|
|
380
|
+
openCache: ((_e2 = this.otherParams) == null ? void 0 : _e2.cacheId) ? true : false,
|
|
381
|
+
cacheId: (_f2 = this.otherParams) == null ? void 0 : _f2.cacheId,
|
|
382
|
+
salesSummaryModuleName: `${this.name}_salesSummary`,
|
|
383
|
+
provider: loggerProvider,
|
|
384
|
+
providerConfig: loggerConfig,
|
|
385
|
+
context: this.getScanOrderLoggerContext()
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
} else {
|
|
389
|
+
this.logMethodError("initialize", `module ${step} missing`);
|
|
390
|
+
throw new Error(`模块 ${step} 不存在`);
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
if (this.store.scanOrderLogger) {
|
|
346
394
|
this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
|
|
347
395
|
}
|
|
396
|
+
const scheduleModule = new import_Schedule.ScheduleModule(`${this.name}_schedule`);
|
|
397
|
+
this.store.schedule = scheduleModule;
|
|
398
|
+
this.core.registerModule(scheduleModule, {
|
|
399
|
+
otherParams: {
|
|
400
|
+
...this.otherParams,
|
|
401
|
+
fatherModule: this.name
|
|
402
|
+
}
|
|
403
|
+
});
|
|
348
404
|
this.registerCustomerLoginListeners();
|
|
349
405
|
console.log("[ScanOrder] 初始化开始");
|
|
350
406
|
try {
|
|
351
|
-
await ((
|
|
352
|
-
(
|
|
407
|
+
await ((_e = this.store.order) == null ? void 0 : _e.recalculateSummary({ createIfMissing: false }));
|
|
408
|
+
(_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
|
|
353
409
|
await this.loadRuntimeConfigs();
|
|
354
410
|
if (this.store.schedule) {
|
|
355
411
|
try {
|
|
@@ -381,6 +437,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
381
437
|
this.logMethodStart("destroy");
|
|
382
438
|
this.clearLoginEffectListeners();
|
|
383
439
|
await this.core.effects.emit(import_types.ScanOrderHooks.onDestroy, {});
|
|
440
|
+
await this.destroyRegisteredChildModules();
|
|
384
441
|
super.destroy();
|
|
385
442
|
console.log("[ScanOrder] 已销毁");
|
|
386
443
|
this.logMethodSuccess("destroy");
|
|
@@ -480,27 +537,18 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
480
537
|
});
|
|
481
538
|
return result;
|
|
482
539
|
}
|
|
483
|
-
updateTempOrderNote(note
|
|
540
|
+
updateTempOrderNote(note) {
|
|
484
541
|
this.logMethodStart("updateTempOrderNote", {
|
|
485
542
|
noteLength: String(note || "").length
|
|
486
543
|
});
|
|
487
544
|
try {
|
|
488
545
|
if (!this.store.order)
|
|
489
546
|
throw new Error("order 模块未初始化");
|
|
490
|
-
const result = this.store.order.updateTempOrderNote(note
|
|
491
|
-
if (result && typeof result.then === "function") {
|
|
492
|
-
return result.then((nextNote2) => {
|
|
493
|
-
this.logMethodSuccess("updateTempOrderNote", {
|
|
494
|
-
noteLength: nextNote2.length
|
|
495
|
-
});
|
|
496
|
-
return nextNote2;
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
const nextNote = result;
|
|
547
|
+
const result = this.store.order.updateTempOrderNote(note);
|
|
500
548
|
this.logMethodSuccess("updateTempOrderNote", {
|
|
501
|
-
noteLength:
|
|
549
|
+
noteLength: result.length
|
|
502
550
|
});
|
|
503
|
-
return
|
|
551
|
+
return result;
|
|
504
552
|
} catch (error) {
|
|
505
553
|
this.logMethodError("updateTempOrderNote", error);
|
|
506
554
|
throw error;
|
|
@@ -509,7 +557,6 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
509
557
|
// 存储 UI 层选择的取餐方式到 tempOrder.metadata.shop_service_data
|
|
510
558
|
// service_type 在扫码点餐场景固定为 dine_in
|
|
511
559
|
setPickupReferenceMode(mode) {
|
|
512
|
-
var _a;
|
|
513
560
|
this.logMethodStart("setPickupReferenceMode", { mode });
|
|
514
561
|
try {
|
|
515
562
|
if (!this.store.order)
|
|
@@ -519,7 +566,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
519
566
|
...tempOrder.metadata || {},
|
|
520
567
|
shop_service_data: {
|
|
521
568
|
...(tempOrder.metadata || {}).shop_service_data || {},
|
|
522
|
-
service_type:
|
|
569
|
+
service_type: "dine_in",
|
|
523
570
|
pickup_reference_mode: mode
|
|
524
571
|
}
|
|
525
572
|
};
|
|
@@ -551,7 +598,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
551
598
|
throw error;
|
|
552
599
|
}
|
|
553
600
|
}
|
|
554
|
-
|
|
601
|
+
ensureTempOrder() {
|
|
555
602
|
if (!this.store.order)
|
|
556
603
|
throw new Error("order 模块未初始化");
|
|
557
604
|
return this.store.order.ensureTempOrder();
|
|
@@ -699,6 +746,10 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
699
746
|
for (const product of tempOrder.products) {
|
|
700
747
|
if ((_c = product._origin) == null ? void 0 : _c.isManualDiscount)
|
|
701
748
|
continue;
|
|
749
|
+
if ((product.discount_list || []).some(isItemRewardProductDiscount)) {
|
|
750
|
+
product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
702
753
|
product.discount_list = (product.discount_list || []).filter((pd) => {
|
|
703
754
|
var _a2;
|
|
704
755
|
const rid = ((_a2 = pd.discount) == null ? void 0 : _a2.resource_id) ?? pd.id;
|
|
@@ -772,49 +823,6 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
772
823
|
combined_resource: isCombined ? combined : null
|
|
773
824
|
};
|
|
774
825
|
}
|
|
775
|
-
async prepareRetailAvailability(params) {
|
|
776
|
-
var _a, _b;
|
|
777
|
-
const { tempOrder, hasOrderId, resourceId, reason } = params;
|
|
778
|
-
this.enabledReservationRuleProducts = [];
|
|
779
|
-
tempOrder.bookings = [];
|
|
780
|
-
tempOrder.order_id = null;
|
|
781
|
-
delete tempOrder.relation_id;
|
|
782
|
-
delete tempOrder.table_form_id;
|
|
783
|
-
delete tempOrder.resource_id;
|
|
784
|
-
delete tempOrder.table_number;
|
|
785
|
-
tempOrder.metadata = { ...tempOrder.metadata || {} };
|
|
786
|
-
delete tempOrder.metadata.table_occupancy_duration;
|
|
787
|
-
const resourceState = {
|
|
788
|
-
mode: "idle",
|
|
789
|
-
deskmate_valid: false,
|
|
790
|
-
allowSnack: false,
|
|
791
|
-
deskmateValid: false,
|
|
792
|
-
isExclusive: false,
|
|
793
|
-
isFull: false,
|
|
794
|
-
raw: null
|
|
795
|
-
};
|
|
796
|
-
this.store.resource = resourceState;
|
|
797
|
-
(_a = this.store.order) == null ? void 0 : _a.persistTempOrder();
|
|
798
|
-
await this.addNewOrder();
|
|
799
|
-
await this.setItemRuleRuntimeConfig({
|
|
800
|
-
serviceType: (_b = this.otherParams) == null ? void 0 : _b.businessCode,
|
|
801
|
-
submissionIndex: hasOrderId ? 1 : 0,
|
|
802
|
-
historicalItems: []
|
|
803
|
-
});
|
|
804
|
-
const availabilityInfo = {
|
|
805
|
-
mode: "idle",
|
|
806
|
-
deskmate_valid: false
|
|
807
|
-
};
|
|
808
|
-
this.logMethodSuccess("checkResourceAvailable", {
|
|
809
|
-
resourceId,
|
|
810
|
-
mode: availabilityInfo.mode,
|
|
811
|
-
retailMode: true,
|
|
812
|
-
retailReason: reason,
|
|
813
|
-
relationId: resourceState.relationId,
|
|
814
|
-
persistedResourceId: resourceState.relationId
|
|
815
|
-
});
|
|
816
|
-
return availabilityInfo;
|
|
817
|
-
}
|
|
818
826
|
// ScanOrder 提交 payload enhancer:
|
|
819
827
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
820
828
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
@@ -824,33 +832,23 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
824
832
|
const ruleProduct = this.enabledReservationRuleProducts[0];
|
|
825
833
|
const resourceState = this.store.resource;
|
|
826
834
|
const resourceSelectType = resourceState == null ? void 0 : resourceState.resourceSelectType;
|
|
827
|
-
const
|
|
835
|
+
const resolveResourceCapacity = () => {
|
|
828
836
|
var _a;
|
|
829
837
|
if (resourceSelectType === "single") {
|
|
830
838
|
const raw = (_a = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _a.capacity;
|
|
831
839
|
const num = Number(raw);
|
|
832
840
|
if (Number.isFinite(num) && num > 0)
|
|
833
|
-
return
|
|
841
|
+
return num;
|
|
834
842
|
return 1;
|
|
835
843
|
}
|
|
836
844
|
return 1;
|
|
837
845
|
};
|
|
838
846
|
return (payload, { bookingUuid, tempOrder }) => {
|
|
839
847
|
var _a, _b;
|
|
840
|
-
const resourceId =
|
|
841
|
-
const hasReservationBookingContext = Boolean(
|
|
842
|
-
ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId
|
|
843
|
-
);
|
|
844
|
-
if (!hasReservationBookingContext) {
|
|
845
|
-
return {
|
|
846
|
-
...payload,
|
|
847
|
-
bookings: [],
|
|
848
|
-
products: [...payload.products || []]
|
|
849
|
-
};
|
|
850
|
-
}
|
|
848
|
+
const resourceId = tempOrder.resource_id ?? (resourceState == null ? void 0 : resourceState.relationId);
|
|
851
849
|
const rawCollectPax = (_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax;
|
|
852
|
-
const
|
|
853
|
-
const
|
|
850
|
+
const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
|
|
851
|
+
const resourceCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
|
|
854
852
|
const pickOriginal = (value) => {
|
|
855
853
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
856
854
|
const original = value.original;
|
|
@@ -866,42 +864,35 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
866
864
|
main_field: mainField,
|
|
867
865
|
form_id: resourceState.tableFormId,
|
|
868
866
|
relation_id: resourceState.relationId ?? resourceId,
|
|
869
|
-
capacity:
|
|
867
|
+
capacity: resourceCapacityValue,
|
|
870
868
|
metadata: this.buildScanOrderResourceMetadata({
|
|
871
869
|
resourceState,
|
|
872
870
|
resourceName: mainField
|
|
873
871
|
})
|
|
874
872
|
} : void 0;
|
|
875
873
|
const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
|
|
874
|
+
const bookingCapacityValue = resourceCapacityValue;
|
|
876
875
|
const bookingCapacityDimensionId = (0, import_utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
|
|
877
|
-
const nextBookings = (payload.bookings || []).map((booking, idx) => {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
}
|
|
898
|
-
]
|
|
899
|
-
} : {}
|
|
900
|
-
},
|
|
901
|
-
...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
|
|
902
|
-
...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
|
|
903
|
-
};
|
|
904
|
-
});
|
|
876
|
+
const nextBookings = (payload.bookings || []).map((booking, idx) => ({
|
|
877
|
+
...booking,
|
|
878
|
+
number: bookingCapacityValue,
|
|
879
|
+
appointment_status: "started",
|
|
880
|
+
metadata: {
|
|
881
|
+
...booking.metadata || {},
|
|
882
|
+
...resourceSelectType ? { resource_select_type: resourceSelectType } : {},
|
|
883
|
+
...resourceSelectType ? {
|
|
884
|
+
capacity: [
|
|
885
|
+
{
|
|
886
|
+
id: bookingCapacityDimensionId,
|
|
887
|
+
value: bookingCapacityValue,
|
|
888
|
+
name: ""
|
|
889
|
+
}
|
|
890
|
+
]
|
|
891
|
+
} : {}
|
|
892
|
+
},
|
|
893
|
+
...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
|
|
894
|
+
...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
|
|
895
|
+
}));
|
|
905
896
|
const nextProducts = [...payload.products || []];
|
|
906
897
|
if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
|
|
907
898
|
const sellingPrice = String(ruleProduct.price ?? "0.00");
|
|
@@ -930,58 +921,8 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
930
921
|
return { ...payload, bookings: nextBookings, products: nextProducts };
|
|
931
922
|
};
|
|
932
923
|
}
|
|
933
|
-
isScanOrderMoreMode(tempOrder) {
|
|
934
|
-
var _a, _b;
|
|
935
|
-
const mode = (_a = this.store.resource) == null ? void 0 : _a.mode;
|
|
936
|
-
return Boolean(
|
|
937
|
-
tempOrder.order_id && (mode === "additional_order" || mode === "additional_order_with_code" || ((_b = this.store.entryContext) == null ? void 0 : _b.mode) === "append")
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
async submitScanOrderMore(params) {
|
|
941
|
-
var _a, _b, _c, _d, _e;
|
|
942
|
-
if (!this.request) {
|
|
943
|
-
throw new Error("scanOrder解决方案需要 request 插件支持");
|
|
944
|
-
}
|
|
945
|
-
if (!this.store.order) {
|
|
946
|
-
throw new Error("scanOrder解决方案需要 order 模块支持");
|
|
947
|
-
}
|
|
948
|
-
const { tempOrder, enhancePayload } = params;
|
|
949
|
-
const latestSummary = await this.store.order.recalculateSummary({
|
|
950
|
-
createIfMissing: true
|
|
951
|
-
});
|
|
952
|
-
const payload = (0, import_utils2.buildSubmitPayload)({
|
|
953
|
-
tempOrder,
|
|
954
|
-
cacheId: this.cacheId,
|
|
955
|
-
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
956
|
-
businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
957
|
-
channel: (_d = this.otherParams) == null ? void 0 : _d.channel,
|
|
958
|
-
type: (_e = this.otherParams) == null ? void 0 : _e.type,
|
|
959
|
-
summary: latestSummary,
|
|
960
|
-
enhance: enhancePayload
|
|
961
|
-
});
|
|
962
|
-
const products = (0, import_utils.filterProductsForScanOrderMore)(payload.products);
|
|
963
|
-
const orderId = tempOrder.order_id;
|
|
964
|
-
const result = await this.request.put(
|
|
965
|
-
`/order/order/product/${orderId}`,
|
|
966
|
-
{
|
|
967
|
-
products,
|
|
968
|
-
request_unique_idempotency_token: payload.request_unique_idempotency_token
|
|
969
|
-
},
|
|
970
|
-
{ customToast: () => {
|
|
971
|
-
} }
|
|
972
|
-
);
|
|
973
|
-
if ((result == null ? void 0 : result.code) === 200 && !(result == null ? void 0 : result.data)) {
|
|
974
|
-
return {
|
|
975
|
-
...result,
|
|
976
|
-
data: {
|
|
977
|
-
order_id: orderId
|
|
978
|
-
}
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
return result;
|
|
982
|
-
}
|
|
983
924
|
async submitScanOrder() {
|
|
984
|
-
var _a, _b, _c;
|
|
925
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
985
926
|
this.logMethodStart("submitScanOrder");
|
|
986
927
|
try {
|
|
987
928
|
await this.validateBeforeSubmitByItemRule();
|
|
@@ -1001,15 +942,17 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1001
942
|
}
|
|
1002
943
|
this.store.order.persistTempOrder();
|
|
1003
944
|
const enhancePayload = this.buildSubmitPayloadEnhancer();
|
|
1004
|
-
const result =
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
945
|
+
const result = await this.store.order.submitTempOrder({
|
|
946
|
+
cacheId: this.cacheId,
|
|
947
|
+
platform: (_c = this.otherParams) == null ? void 0 : _c.platform,
|
|
948
|
+
businessCode: (_d = this.otherParams) == null ? void 0 : _d.businessCode,
|
|
949
|
+
channel: (_e = this.otherParams) == null ? void 0 : _e.channel,
|
|
950
|
+
type: (_f = this.otherParams) == null ? void 0 : _f.type,
|
|
1008
951
|
enhancePayload
|
|
1009
952
|
});
|
|
1010
953
|
const tempOrder = this.store.order.getTempOrder();
|
|
1011
954
|
this.logMethodSuccess("submitScanOrder", {
|
|
1012
|
-
productCount: ((
|
|
955
|
+
productCount: ((_g = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _g.length) || 0
|
|
1013
956
|
});
|
|
1014
957
|
return result;
|
|
1015
958
|
} catch (error) {
|
|
@@ -1250,7 +1193,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1250
1193
|
return [];
|
|
1251
1194
|
}
|
|
1252
1195
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1253
|
-
tempOrder: this.
|
|
1196
|
+
tempOrder: this.ensureTempOrder(),
|
|
1254
1197
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1255
1198
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1256
1199
|
});
|
|
@@ -1276,7 +1219,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1276
1219
|
if (!strategyConfigs.length)
|
|
1277
1220
|
return;
|
|
1278
1221
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1279
|
-
tempOrder: this.
|
|
1222
|
+
tempOrder: this.ensureTempOrder(),
|
|
1280
1223
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1281
1224
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1282
1225
|
});
|
|
@@ -1286,7 +1229,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1286
1229
|
return;
|
|
1287
1230
|
}
|
|
1288
1231
|
const productSourceMap = await this.buildPrefillProductSourceMap();
|
|
1289
|
-
const tempOrder = this.
|
|
1232
|
+
const tempOrder = this.ensureTempOrder();
|
|
1290
1233
|
let hasChanges = false;
|
|
1291
1234
|
for (const prefillItem of prefillItems) {
|
|
1292
1235
|
const productId = Number(prefillItem.product_id);
|
|
@@ -1386,7 +1329,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1386
1329
|
};
|
|
1387
1330
|
}
|
|
1388
1331
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1389
|
-
tempOrder: this.
|
|
1332
|
+
tempOrder: this.ensureTempOrder(),
|
|
1390
1333
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1391
1334
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1392
1335
|
});
|
|
@@ -1536,8 +1479,8 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1536
1479
|
const matched = resources.find((r) => Number(r == null ? void 0 : r.id) === numericFormId);
|
|
1537
1480
|
return matched == null ? void 0 : matched.type;
|
|
1538
1481
|
}
|
|
1539
|
-
async
|
|
1540
|
-
var _a, _b, _c;
|
|
1482
|
+
async fetchResourceOccupyDetailByResourceId(resourceId) {
|
|
1483
|
+
var _a, _b, _c, _d;
|
|
1541
1484
|
const formRecordId = Number(resourceId);
|
|
1542
1485
|
if (!Number.isFinite(formRecordId) || formRecordId <= 0) {
|
|
1543
1486
|
throw new Error(`[ScanOrder] 非法桌台 resourceId: ${resourceId}`);
|
|
@@ -1559,60 +1502,15 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1559
1502
|
if (!(response == null ? void 0 : response.status)) {
|
|
1560
1503
|
throw new Error((response == null ? void 0 : response.message) || "获取资源占用详情失败");
|
|
1561
1504
|
}
|
|
1562
|
-
return ((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details)
|
|
1563
|
-
}
|
|
1564
|
-
resolveAdditionalOrderFromOccupyDetail(detail, resourceSelectType, allowAddItems) {
|
|
1565
|
-
const currentOrderId = (0, import_utils.toPositiveString)(detail == null ? void 0 : detail.order_id);
|
|
1566
|
-
if (currentOrderId) {
|
|
1567
|
-
return {
|
|
1568
|
-
matched: true,
|
|
1569
|
-
order_id: currentOrderId
|
|
1570
|
-
};
|
|
1571
|
-
}
|
|
1572
|
-
const orderListIds = (Array.isArray(detail == null ? void 0 : detail.order_list) ? (detail == null ? void 0 : detail.order_list) || [] : []).map((order) => (0, import_utils.toPositiveString)(order == null ? void 0 : order.id)).filter(Boolean);
|
|
1573
|
-
if (resourceSelectType !== "single") {
|
|
1574
|
-
return {
|
|
1575
|
-
matched: false,
|
|
1576
|
-
reason: "no_order"
|
|
1577
|
-
};
|
|
1578
|
-
}
|
|
1579
|
-
if (!orderListIds.length) {
|
|
1580
|
-
return {
|
|
1581
|
-
matched: false,
|
|
1582
|
-
reason: "no_order"
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
if (!allowAddItems) {
|
|
1586
|
-
return {
|
|
1587
|
-
matched: false,
|
|
1588
|
-
reason: "add_items_disabled"
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
1591
|
-
if (orderListIds.length === 1) {
|
|
1592
|
-
return {
|
|
1593
|
-
matched: true,
|
|
1594
|
-
order_id: orderListIds[0]
|
|
1595
|
-
};
|
|
1596
|
-
}
|
|
1597
|
-
if (orderListIds.length > 1) {
|
|
1598
|
-
return {
|
|
1599
|
-
matched: false,
|
|
1600
|
-
reason: "multiple_orders"
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
return {
|
|
1604
|
-
matched: false,
|
|
1605
|
-
reason: "no_order"
|
|
1606
|
-
};
|
|
1505
|
+
return ((_d = (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details) == null ? void 0 : _d[0]) ?? null;
|
|
1607
1506
|
}
|
|
1608
1507
|
// 检测当前链接是否可用
|
|
1609
1508
|
// 通过 resource_id + 店铺配置
|
|
1610
1509
|
// hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
|
|
1611
|
-
async checkResourceAvailable(resourceId, hasOrderId
|
|
1612
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1613
|
-
const normalizedResourceId = String(resourceId ?? "").trim();
|
|
1510
|
+
async checkResourceAvailable(resourceId, hasOrderId) {
|
|
1511
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1614
1512
|
this.logMethodStart("checkResourceAvailable", {
|
|
1615
|
-
resourceId
|
|
1513
|
+
resourceId
|
|
1616
1514
|
});
|
|
1617
1515
|
try {
|
|
1618
1516
|
const businessCode = String(((_a = this.otherParams) == null ? void 0 : _a.businessCode) ?? "").trim();
|
|
@@ -1662,71 +1560,37 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1662
1560
|
if (outsideOperatingHours && closedBehaviorValue !== "show_menu_disabled") {
|
|
1663
1561
|
return makeShopClosed(closedMessage, closedBehaviorValue);
|
|
1664
1562
|
}
|
|
1665
|
-
const tempOrder = this.
|
|
1563
|
+
const tempOrder = this.ensureTempOrder();
|
|
1666
1564
|
const reservationLinkIds = (0, import_utils.collectLinkProductIdsFromReservationRules)(
|
|
1667
1565
|
dineInConfig["fulfillment.enabled_resource_rules"]
|
|
1668
1566
|
);
|
|
1669
|
-
if (!normalizedResourceId || reservationLinkIds.length === 0) {
|
|
1670
|
-
return await this.prepareRetailAvailability({
|
|
1671
|
-
tempOrder,
|
|
1672
|
-
hasOrderId,
|
|
1673
|
-
resourceId: normalizedResourceId,
|
|
1674
|
-
reason: !normalizedResourceId ? "missing_resource_id" : "missing_enabled_resource_rules"
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
1567
|
let pendingRequestEntryPax;
|
|
1678
1568
|
let pendingRequestPaxMin;
|
|
1679
1569
|
let pendingRequestPaxMax;
|
|
1680
|
-
|
|
1681
|
-
delete tempOrder.metadata.table_occupancy_duration;
|
|
1682
|
-
const reservationProductList = new import_ProductList.ProductList(
|
|
1683
|
-
`${this.name}_reservationEnabledRules`,
|
|
1684
|
-
this.defaultVersion
|
|
1685
|
-
);
|
|
1686
|
-
await reservationProductList.initialize(this.core, {
|
|
1687
|
-
store: { list: [], selectProducts: [] },
|
|
1688
|
-
otherParams: {
|
|
1689
|
-
...this.otherParams,
|
|
1690
|
-
fatherModule: this.name,
|
|
1691
|
-
openCache: Boolean(this.cacheId),
|
|
1692
|
-
cacheId: this.cacheId
|
|
1693
|
-
}
|
|
1694
|
-
});
|
|
1695
|
-
const scheduleDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
1696
|
-
const scheduleDatetime = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
1697
|
-
const loaded = await reservationProductList.loadProducts({
|
|
1698
|
-
product_ids: reservationLinkIds,
|
|
1699
|
-
schedule_date: scheduleDate,
|
|
1700
|
-
schedule_datetime: scheduleDatetime,
|
|
1701
|
-
cacheId: this.cacheId
|
|
1702
|
-
});
|
|
1703
|
-
if (Array.isArray(loaded)) {
|
|
1704
|
-
const matchedRuleProduct = (0, import_utils.findReservationRuleProductByResourceId)(
|
|
1705
|
-
loaded,
|
|
1706
|
-
normalizedResourceId
|
|
1707
|
-
);
|
|
1708
|
-
const ruleProductsForResource = matchedRuleProduct ? [matchedRuleProduct] : [];
|
|
1709
|
-
this.enabledReservationRuleProducts = ruleProductsForResource;
|
|
1710
|
-
const occupancyMinutes = (0, import_utils.pickFirstDurationMinutesFromProducts)(ruleProductsForResource);
|
|
1711
|
-
if (occupancyMinutes !== void 0) {
|
|
1712
|
-
tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
|
|
1713
|
-
}
|
|
1714
|
-
if ((0, import_utils.hasCustomCapacityProduct)(ruleProductsForResource)) {
|
|
1715
|
-
pendingRequestEntryPax = 1;
|
|
1716
|
-
const paxBounds = (0, import_utils.pickFirstCustomCapacityPaxBounds)(ruleProductsForResource);
|
|
1717
|
-
if ((paxBounds == null ? void 0 : paxBounds.min) !== void 0)
|
|
1718
|
-
pendingRequestPaxMin = paxBounds.min;
|
|
1719
|
-
if ((paxBounds == null ? void 0 : paxBounds.max) !== void 0)
|
|
1720
|
-
pendingRequestPaxMax = paxBounds.max;
|
|
1721
|
-
}
|
|
1722
|
-
} else {
|
|
1570
|
+
if (reservationLinkIds.length === 0) {
|
|
1723
1571
|
this.enabledReservationRuleProducts = [];
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1572
|
+
} else {
|
|
1573
|
+
tempOrder.metadata = { ...tempOrder.metadata || {} };
|
|
1574
|
+
delete tempOrder.metadata.table_occupancy_duration;
|
|
1575
|
+
const reservationProductList = new import_ProductList.ProductList(
|
|
1576
|
+
`${this.name}_reservationEnabledRules`,
|
|
1577
|
+
this.defaultVersion
|
|
1578
|
+
);
|
|
1579
|
+
await reservationProductList.initialize(this.core, {
|
|
1580
|
+
store: { list: [], selectProducts: [] },
|
|
1581
|
+
otherParams: {
|
|
1582
|
+
...this.otherParams,
|
|
1583
|
+
fatherModule: this.name,
|
|
1584
|
+
openCache: Boolean(this.cacheId),
|
|
1585
|
+
cacheId: this.cacheId
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
const scheduleDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
1589
|
+
const scheduleDatetime = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
1590
|
+
const loaded = await reservationProductList.loadProducts({
|
|
1591
|
+
product_ids: reservationLinkIds,
|
|
1592
|
+
schedule_date: scheduleDate,
|
|
1593
|
+
schedule_datetime: scheduleDatetime,
|
|
1730
1594
|
cacheId: this.cacheId
|
|
1731
1595
|
});
|
|
1732
1596
|
if (Array.isArray(loaded)) {
|
|
@@ -1745,8 +1609,8 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1745
1609
|
}
|
|
1746
1610
|
} else {
|
|
1747
1611
|
this.enabledReservationRuleProducts = [];
|
|
1748
|
-
const
|
|
1749
|
-
this.logMethodError("loadReservationRuleProducts",
|
|
1612
|
+
const error = loaded instanceof Error ? loaded : new Error("预约规则商品列表接口返回异常");
|
|
1613
|
+
this.logMethodError("loadReservationRuleProducts", error, {
|
|
1750
1614
|
resourceId,
|
|
1751
1615
|
reservationLinkIds,
|
|
1752
1616
|
scheduleDate,
|
|
@@ -1755,54 +1619,15 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1755
1619
|
});
|
|
1756
1620
|
}
|
|
1757
1621
|
}
|
|
1758
|
-
const
|
|
1759
|
-
const occupyDetail = occupyDetails[0] ?? null;
|
|
1622
|
+
const occupyDetail = await this.fetchResourceOccupyDetailByResourceId(resourceId);
|
|
1760
1623
|
const resourceSelectType = this.resolveResourceSelectType(
|
|
1761
1624
|
(0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id)
|
|
1762
1625
|
);
|
|
1763
|
-
const allowAddItems = (0, import_utils.toBoolean)(dineInConfig == null ? void 0 : dineInConfig["sale.allow_add_items"]);
|
|
1764
|
-
const additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(
|
|
1765
|
-
occupyDetail,
|
|
1766
|
-
resourceSelectType,
|
|
1767
|
-
allowAddItems
|
|
1768
|
-
);
|
|
1769
|
-
if (additionalOrderResult.reason === "multiple_orders") {
|
|
1770
|
-
const multipleOrdersState = {
|
|
1771
|
-
...this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId),
|
|
1772
|
-
mode: "multiple_orders"
|
|
1773
|
-
};
|
|
1774
|
-
this.store.resource = multipleOrdersState;
|
|
1775
|
-
const availabilityInfo2 = {
|
|
1776
|
-
mode: "multiple_orders",
|
|
1777
|
-
deskmate_valid: multipleOrdersState.deskmate_valid,
|
|
1778
|
-
relation_id: multipleOrdersState.relationId,
|
|
1779
|
-
table_form_id: multipleOrdersState.tableFormId,
|
|
1780
|
-
table_form_record: multipleOrdersState.table_form_record
|
|
1781
|
-
};
|
|
1782
|
-
this.logMethodSuccess("checkResourceAvailable", {
|
|
1783
|
-
resourceId: normalizedResourceId,
|
|
1784
|
-
mode: availabilityInfo2.mode,
|
|
1785
|
-
orderListCount: ((_e = occupyDetail == null ? void 0 : occupyDetail.order_list) == null ? void 0 : _e.length) || 0,
|
|
1786
|
-
resourceSelectType
|
|
1787
|
-
});
|
|
1788
|
-
return availabilityInfo2;
|
|
1789
|
-
}
|
|
1790
1626
|
const resourceState = this.normalizeResourceState(
|
|
1791
1627
|
occupyDetail,
|
|
1792
1628
|
resourceSelectType,
|
|
1793
1629
|
hasOrderId
|
|
1794
1630
|
);
|
|
1795
|
-
const additionalOrderId = additionalOrderResult.order_id;
|
|
1796
|
-
if (additionalOrderId) {
|
|
1797
|
-
resourceState.mode = "additional_order";
|
|
1798
|
-
resourceState.order_id = additionalOrderId;
|
|
1799
|
-
} else if (additionalOrderResult.reason === "add_items_disabled") {
|
|
1800
|
-
resourceState.mode = "resource_busy";
|
|
1801
|
-
resourceState.order_id = "0";
|
|
1802
|
-
} else if (resourceSelectType === "multiple" && resourceState.isFull) {
|
|
1803
|
-
resourceState.mode = "resource_busy";
|
|
1804
|
-
resourceState.order_id = "0";
|
|
1805
|
-
}
|
|
1806
1631
|
this.store.resource = resourceState;
|
|
1807
1632
|
if (pendingRequestEntryPax !== void 0) {
|
|
1808
1633
|
this.store.resource.requestEntryPax = pendingRequestEntryPax;
|
|
@@ -1820,22 +1645,36 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1820
1645
|
table_form_id: resourceState.tableFormId,
|
|
1821
1646
|
deskmate_valid: resourceState.deskmate_valid,
|
|
1822
1647
|
table_form_record: resourceState.table_form_record,
|
|
1823
|
-
policy: (
|
|
1824
|
-
partyroom_booking: (
|
|
1648
|
+
policy: (_e = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _e.policy,
|
|
1649
|
+
partyroom_booking: (_f = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _f.partyroom_booking,
|
|
1825
1650
|
...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
|
|
1826
1651
|
...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
|
|
1827
1652
|
...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
|
|
1828
1653
|
};
|
|
1654
|
+
tempOrder.relation_id = resourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
|
|
1655
|
+
tempOrder.table_form_id = resourceState.tableFormId;
|
|
1656
|
+
tempOrder.resource_id = resourceId;
|
|
1829
1657
|
(_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
|
|
1830
1658
|
if (availabilityInfo.mode === "idle") {
|
|
1831
1659
|
await this.addNewOrder();
|
|
1832
1660
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
tempOrder.order_id = additionalOrderId;
|
|
1661
|
+
if (availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code") {
|
|
1662
|
+
tempOrder.order_id = resourceState.lastOrderId;
|
|
1836
1663
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1664
|
+
if (tempOrder.order_id) {
|
|
1665
|
+
const res = await ((_i = this.store.order) == null ? void 0 : _i.getSalesOrderByLookup({
|
|
1666
|
+
lookup: tempOrder.order_id
|
|
1667
|
+
}));
|
|
1668
|
+
const entryPaxNumber = (_m = (_l = (_k = (_j = res == null ? void 0 : res.data) == null ? void 0 : _j.bookings) == null ? void 0 : _k.find((p) => {
|
|
1669
|
+
var _a2;
|
|
1670
|
+
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|
|
1671
|
+
})) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
|
|
1672
|
+
if (entryPaxNumber) {
|
|
1673
|
+
await this.setEntryPaxNumber(entryPaxNumber);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
const lastOrderInfo = (_o = (_n = this.store.order) == null ? void 0 : _n.getLastOrderInfo) == null ? void 0 : _o.call(_n);
|
|
1677
|
+
const historicalItems = hasOrderId && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
|
|
1839
1678
|
if (typeof (p == null ? void 0 : p.product_id) !== "number")
|
|
1840
1679
|
return acc;
|
|
1841
1680
|
acc.push({
|
|
@@ -1846,8 +1685,8 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1846
1685
|
return acc;
|
|
1847
1686
|
}, []) : [];
|
|
1848
1687
|
await this.setItemRuleRuntimeConfig({
|
|
1849
|
-
serviceType: (
|
|
1850
|
-
submissionIndex:
|
|
1688
|
+
serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
|
|
1689
|
+
submissionIndex: hasOrderId ? 1 : 0,
|
|
1851
1690
|
historicalItems
|
|
1852
1691
|
});
|
|
1853
1692
|
if (outsideOperatingHours && closedBehaviorValue === "show_menu_disabled") {
|
|
@@ -1856,13 +1695,13 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1856
1695
|
availabilityInfo.closed_behavior = closedBehaviorValue;
|
|
1857
1696
|
}
|
|
1858
1697
|
this.logMethodSuccess("checkResourceAvailable", {
|
|
1859
|
-
resourceId
|
|
1698
|
+
resourceId,
|
|
1860
1699
|
mode: availabilityInfo.mode,
|
|
1861
1700
|
orderId: availabilityInfo.order_id,
|
|
1862
1701
|
relationId: availabilityInfo.relation_id,
|
|
1863
1702
|
tableFormId: availabilityInfo.table_form_id,
|
|
1864
|
-
persistedRelationId:
|
|
1865
|
-
persistedResourceId:
|
|
1703
|
+
persistedRelationId: tempOrder.relation_id,
|
|
1704
|
+
persistedResourceId: tempOrder.resource_id,
|
|
1866
1705
|
deskmateValid: availabilityInfo.deskmate_valid,
|
|
1867
1706
|
resourceSelectType: resourceState.resourceSelectType,
|
|
1868
1707
|
isExclusive: resourceState.isExclusive,
|
|
@@ -1871,29 +1710,11 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1871
1710
|
return availabilityInfo;
|
|
1872
1711
|
} catch (error) {
|
|
1873
1712
|
this.logMethodError("checkResourceAvailable", error.message, {
|
|
1874
|
-
resourceId
|
|
1713
|
+
resourceId
|
|
1875
1714
|
});
|
|
1876
1715
|
throw error;
|
|
1877
1716
|
}
|
|
1878
1717
|
}
|
|
1879
|
-
// 恢复之前订单的数据,读取 entrypax
|
|
1880
|
-
async restorePreviousOrderData() {
|
|
1881
|
-
var _a, _b, _c, _d;
|
|
1882
|
-
const orderModule = this.store.order;
|
|
1883
|
-
if (!orderModule)
|
|
1884
|
-
return;
|
|
1885
|
-
const tempOrder = orderModule.ensureTempOrder();
|
|
1886
|
-
if (tempOrder.order_id) {
|
|
1887
|
-
const res = await orderModule.getOrderInfo(tempOrder.order_id);
|
|
1888
|
-
const entryPaxNumber = (_d = (_c = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.bookings) == null ? void 0 : _b.find((p) => {
|
|
1889
|
-
var _a2;
|
|
1890
|
-
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|
|
1891
|
-
})) == null ? void 0 : _c.metadata) == null ? void 0 : _d.collect_pax;
|
|
1892
|
-
if (entryPaxNumber) {
|
|
1893
|
-
await this.setEntryPaxNumber(entryPaxNumber);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
1718
|
// 如果是加单的情况,提供返回当前订单相关信息的能力
|
|
1898
1719
|
async getAdditionalOrderInfo() {
|
|
1899
1720
|
this.logMethodStart("getAdditionalOrderInfo");
|
|
@@ -1914,8 +1735,7 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1914
1735
|
async getProductList() {
|
|
1915
1736
|
var _a, _b;
|
|
1916
1737
|
this.logMethodStart("getProductList");
|
|
1917
|
-
const
|
|
1918
|
-
const menu_list_ids = associatedMenus.map((n) => Number(n.value)) || [];
|
|
1738
|
+
const menu_list_ids = ((_b = (_a = this.otherParams) == null ? void 0 : _a.dineInConfig) == null ? void 0 : _b["menu.associated_menus"].map((n) => Number(n.value))) || [];
|
|
1919
1739
|
try {
|
|
1920
1740
|
if (!this.store.products)
|
|
1921
1741
|
throw new Error("products 模块未初始化");
|
|
@@ -2039,85 +1859,6 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
2039
1859
|
getEntryPaxNumber() {
|
|
2040
1860
|
return this.store.entryPaxNumber;
|
|
2041
1861
|
}
|
|
2042
|
-
async syncAdditionalOrderFromResource(resourceId) {
|
|
2043
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2044
|
-
if (!this.store.order)
|
|
2045
|
-
throw new Error("order 模块未初始化");
|
|
2046
|
-
const tempOrder = this.store.order.ensureTempOrder();
|
|
2047
|
-
const normalizedResourceId = String(
|
|
2048
|
-
resourceId ?? tempOrder.resource_id ?? ((_a = this.store.resource) == null ? void 0 : _a.relationId) ?? ((_b = this.store.resource) == null ? void 0 : _b.relation_id) ?? ""
|
|
2049
|
-
).trim();
|
|
2050
|
-
this.logMethodStart("syncAdditionalOrderFromResource", {
|
|
2051
|
-
resourceId: normalizedResourceId
|
|
2052
|
-
});
|
|
2053
|
-
if (!normalizedResourceId) {
|
|
2054
|
-
const result2 = {
|
|
2055
|
-
matched: false,
|
|
2056
|
-
reason: "missing_resource_id"
|
|
2057
|
-
};
|
|
2058
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", result2);
|
|
2059
|
-
return result2;
|
|
2060
|
-
}
|
|
2061
|
-
const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
2062
|
-
const occupyDetail = occupyDetails[0] ?? null;
|
|
2063
|
-
const resourceSelectType = ((_c = this.store.resource) == null ? void 0 : _c.resourceSelectType) || this.resolveResourceSelectType((0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id));
|
|
2064
|
-
const allowAddItems = (0, import_utils.toBoolean)(
|
|
2065
|
-
(_e = (_d = this.otherParams) == null ? void 0 : _d.dineInConfig) == null ? void 0 : _e["sale.allow_add_items"]
|
|
2066
|
-
);
|
|
2067
|
-
const result = this.resolveAdditionalOrderFromOccupyDetail(
|
|
2068
|
-
occupyDetail,
|
|
2069
|
-
resourceSelectType,
|
|
2070
|
-
allowAddItems
|
|
2071
|
-
);
|
|
2072
|
-
if (!result.matched || !result.order_id) {
|
|
2073
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", {
|
|
2074
|
-
...result,
|
|
2075
|
-
resourceId: normalizedResourceId,
|
|
2076
|
-
resourceSelectType,
|
|
2077
|
-
allowAddItems
|
|
2078
|
-
});
|
|
2079
|
-
return result;
|
|
2080
|
-
}
|
|
2081
|
-
tempOrder.order_id = result.order_id;
|
|
2082
|
-
tempOrder.resource_id = normalizedResourceId;
|
|
2083
|
-
tempOrder.relation_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
2084
|
-
tempOrder.table_form_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
2085
|
-
(_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
|
|
2086
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", {
|
|
2087
|
-
...result,
|
|
2088
|
-
resourceId: normalizedResourceId,
|
|
2089
|
-
resourceSelectType,
|
|
2090
|
-
allowAddItems
|
|
2091
|
-
});
|
|
2092
|
-
return result;
|
|
2093
|
-
}
|
|
2094
|
-
// 读取预约规则商品的资源选择类型:single=单个预约,multiple=多个预约,capacity=容量型预约
|
|
2095
|
-
// 依赖 checkResourceAvailable 已根据预约规则商品与 occupy-detail 的 form_id 计算并缓存 store.resource
|
|
2096
|
-
getReservationResourceSelectType() {
|
|
2097
|
-
var _a;
|
|
2098
|
-
this.logMethodStart("getReservationResourceSelectType");
|
|
2099
|
-
const resourceSelectType = (_a = this.store.resource) == null ? void 0 : _a.resourceSelectType;
|
|
2100
|
-
const result = {
|
|
2101
|
-
...resourceSelectType ? { resourceSelectType } : {},
|
|
2102
|
-
isSingleReservation: resourceSelectType === "single",
|
|
2103
|
-
isMultipleReservation: resourceSelectType === "multiple",
|
|
2104
|
-
isCapacityReservation: resourceSelectType === "capacity"
|
|
2105
|
-
};
|
|
2106
|
-
this.logMethodSuccess("getReservationResourceSelectType", result);
|
|
2107
|
-
return result;
|
|
2108
|
-
}
|
|
2109
|
-
// 判定后台是否开启允许加餐
|
|
2110
|
-
// 依赖 checkResourceAvailable 已缓存的 dineInConfig
|
|
2111
|
-
checkAllowAddItems() {
|
|
2112
|
-
var _a;
|
|
2113
|
-
this.logMethodStart("checkAllowAddItems");
|
|
2114
|
-
const dineInConfig = ((_a = this.otherParams) == null ? void 0 : _a.dineInConfig) || {};
|
|
2115
|
-
const result = {
|
|
2116
|
-
enabled: (0, import_utils.toBoolean)(dineInConfig["sale.allow_add_items"])
|
|
2117
|
-
};
|
|
2118
|
-
this.logMethodSuccess("checkAllowAddItems", result);
|
|
2119
|
-
return result;
|
|
2120
|
-
}
|
|
2121
1862
|
// 读取取餐/送餐开关
|
|
2122
1863
|
// 依赖 checkResourceAvailable 已缓存的 dineInConfig
|
|
2123
1864
|
getFulfillmentModes() {
|