@pisell/pisellos 2.3.37 → 2.3.39
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/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +513 -747
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +40 -11
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +49 -78
- package/dist/modules/Payment/types.d.ts +24 -26
- package/dist/modules/Payment/types.js +0 -2
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +48 -15
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1162 -1943
- package/dist/server/modules/order/index.d.ts +4 -49
- package/dist/server/modules/order/index.js +695 -1574
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +10 -33
- package/dist/solution/BaseSales/index.js +385 -676
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.js +1 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1140 -737
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1177 -850
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +83 -187
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -10
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +12 -33
- package/lib/modules/Payment/types.d.ts +24 -26
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +34 -18
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +88 -678
- package/lib/server/modules/order/index.d.ts +4 -49
- package/lib/server/modules/order/index.js +66 -657
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +10 -33
- package/lib/solution/BaseSales/index.js +33 -201
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.js +1 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -115
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -33,7 +33,7 @@ __export(VenueBooking_exports, {
|
|
|
33
33
|
VenueBookingImpl: () => VenueBookingImpl
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(VenueBooking_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_BaseSales = require("../BaseSales");
|
|
37
37
|
var import_types = require("./types");
|
|
38
38
|
var import_utils = require("./utils");
|
|
39
39
|
var import_types2 = require("../BookingByStep/types");
|
|
@@ -54,6 +54,8 @@ var import_utils3 = require("../../modules/Order/utils");
|
|
|
54
54
|
var import_Order = require("../../modules/Order");
|
|
55
55
|
var import_types4 = require("../RegisterAndLogin/types");
|
|
56
56
|
var import_decimal = __toESM(require("decimal.js"));
|
|
57
|
+
var import_Holder = require("../../modules/Holder");
|
|
58
|
+
var import_utils4 = require("../../modules/Holder/utils");
|
|
57
59
|
__reExport(VenueBooking_exports, require("./types"), module.exports);
|
|
58
60
|
var OPEN_DATA_SECTION_CODES = [
|
|
59
61
|
"basic",
|
|
@@ -75,7 +77,7 @@ function cloneCustomDepositData(customDepositData) {
|
|
|
75
77
|
deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? [...customDepositData.deposit_policy_data] : []
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
|
-
var _VenueBookingImpl = class extends
|
|
80
|
+
var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
79
81
|
constructor(name, version) {
|
|
80
82
|
super(name, version);
|
|
81
83
|
this.defaultName = "venueBooking";
|
|
@@ -225,6 +227,79 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
225
227
|
}
|
|
226
228
|
});
|
|
227
229
|
}
|
|
230
|
+
getRegisteredModuleNames() {
|
|
231
|
+
return [
|
|
232
|
+
"scanOrderLogger",
|
|
233
|
+
"products",
|
|
234
|
+
"order",
|
|
235
|
+
"salesSummary",
|
|
236
|
+
"venueProducts",
|
|
237
|
+
"addonProducts",
|
|
238
|
+
"date",
|
|
239
|
+
"schedule",
|
|
240
|
+
"quotation",
|
|
241
|
+
"openData"
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
createSubModule(moduleName) {
|
|
245
|
+
switch (moduleName) {
|
|
246
|
+
case "scanOrderLogger":
|
|
247
|
+
return (0, import_types2.createModule)("scanOrderLogger", this.name);
|
|
248
|
+
case "venueProducts":
|
|
249
|
+
return new import_ProductList.ProductList(`${this.name}_venueProducts`);
|
|
250
|
+
case "addonProducts":
|
|
251
|
+
return new import_ProductList.ProductList(`${this.name}_addonProducts`);
|
|
252
|
+
case "date":
|
|
253
|
+
return new import_Date.DateModule(`${this.name}_date`);
|
|
254
|
+
case "openData":
|
|
255
|
+
return new import_OpenData.OpenDataModule(`${this.name}_openData`);
|
|
256
|
+
default:
|
|
257
|
+
return super.createSubModule(moduleName);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
attachProductOriginToTempOrder(tempOrder, productUid, origin) {
|
|
261
|
+
var _a, _b, _c;
|
|
262
|
+
if (!productUid || !origin)
|
|
263
|
+
return;
|
|
264
|
+
tempOrder._extend = {
|
|
265
|
+
...tempOrder._extend || {},
|
|
266
|
+
productsByUid: {
|
|
267
|
+
...((_a = tempOrder._extend) == null ? void 0 : _a.productsByUid) || {},
|
|
268
|
+
[productUid]: {
|
|
269
|
+
...((_c = (_b = tempOrder._extend) == null ? void 0 : _b.productsByUid) == null ? void 0 : _c[productUid]) || {},
|
|
270
|
+
origin
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
readProductOriginFromTempOrder(tempOrder, product) {
|
|
276
|
+
var _a, _b, _c, _d;
|
|
277
|
+
const uid = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) || product.identity_key;
|
|
278
|
+
if (uid && ((_d = (_c = (_b = tempOrder._extend) == null ? void 0 : _b.productsByUid) == null ? void 0 : _c[uid]) == null ? void 0 : _d.origin)) {
|
|
279
|
+
return tempOrder._extend.productsByUid[uid].origin;
|
|
280
|
+
}
|
|
281
|
+
return product._origin;
|
|
282
|
+
}
|
|
283
|
+
normalizeVenueProductTitle(value) {
|
|
284
|
+
if (typeof value === "string") {
|
|
285
|
+
const text = value.trim();
|
|
286
|
+
return text ? { auto: text } : void 0;
|
|
287
|
+
}
|
|
288
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
289
|
+
return void 0;
|
|
290
|
+
const source = value;
|
|
291
|
+
const normalized = {};
|
|
292
|
+
Object.entries(source).forEach(([key, text]) => {
|
|
293
|
+
if (typeof text === "string")
|
|
294
|
+
normalized[key] = text;
|
|
295
|
+
});
|
|
296
|
+
if (!normalized.auto) {
|
|
297
|
+
const fallback = normalized.original || normalized.en || normalized["zh-CN"] || normalized["zh-HK"];
|
|
298
|
+
if (fallback)
|
|
299
|
+
normalized.auto = fallback;
|
|
300
|
+
}
|
|
301
|
+
return Object.values(normalized).some((text) => String(text || "").trim()) ? normalized : void 0;
|
|
302
|
+
}
|
|
228
303
|
normalizeCustomerId(value) {
|
|
229
304
|
const customerId = Number(value);
|
|
230
305
|
if (!Number.isFinite(customerId) || customerId <= 0)
|
|
@@ -253,6 +328,42 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
253
328
|
}
|
|
254
329
|
return null;
|
|
255
330
|
}
|
|
331
|
+
resolveHolderCustomerId() {
|
|
332
|
+
var _a, _b;
|
|
333
|
+
const customer = JSON.parse(((_b = (_a = this.window) == null ? void 0 : _a.getLocalStorage) == null ? void 0 : _b.call(_a, "customer")) || "{}");
|
|
334
|
+
if (customer == null ? void 0 : customer.id)
|
|
335
|
+
return Number(customer.id);
|
|
336
|
+
return void 0;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
340
|
+
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
341
|
+
*/
|
|
342
|
+
async preloadHolderForms(products) {
|
|
343
|
+
var _a, _b, _c, _d;
|
|
344
|
+
if (!this.store.holder || !products.length)
|
|
345
|
+
return;
|
|
346
|
+
const seenFormIds = /* @__PURE__ */ new Set();
|
|
347
|
+
for (const item of products) {
|
|
348
|
+
const holderConfig = (0, import_utils4.getProductHolderConfig)((_a = item == null ? void 0 : item._origin) == null ? void 0 : _a.product);
|
|
349
|
+
if (!holderConfig)
|
|
350
|
+
continue;
|
|
351
|
+
const formId = (0, import_utils4.getFormIdFromHolderConfig)(holderConfig);
|
|
352
|
+
if (seenFormIds.has(formId))
|
|
353
|
+
continue;
|
|
354
|
+
seenFormIds.add(formId);
|
|
355
|
+
try {
|
|
356
|
+
await this.store.holder.ensureFormByProduct({
|
|
357
|
+
product: ((_b = item == null ? void 0 : item._origin) == null ? void 0 : _b.product) || {},
|
|
358
|
+
customer_id: this.resolveHolderCustomerId(),
|
|
359
|
+
shop_id: (_d = (_c = item == null ? void 0 : item._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.shop_id,
|
|
360
|
+
useCache: true
|
|
361
|
+
});
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error("[VenueBooking] 预加载 holder 表单失败", { formId, error });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
256
367
|
clearLoginEffectListeners() {
|
|
257
368
|
for (const dispose of this.loginEffectDisposers) {
|
|
258
369
|
dispose();
|
|
@@ -299,6 +410,12 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
299
410
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
300
411
|
const refreshTask = (async () => {
|
|
301
412
|
var _a;
|
|
413
|
+
if (this.store.holder) {
|
|
414
|
+
await this.store.holder.refreshAllFormRecords({
|
|
415
|
+
customer_id: params.customerId,
|
|
416
|
+
useCache: false
|
|
417
|
+
});
|
|
418
|
+
}
|
|
302
419
|
if (this.store.quotation) {
|
|
303
420
|
await this.store.quotation.loadQuotations({
|
|
304
421
|
channel: (_a = this.otherParams) == null ? void 0 : _a.channel
|
|
@@ -326,10 +443,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
326
443
|
}
|
|
327
444
|
}
|
|
328
445
|
async initialize(core, options = {}) {
|
|
329
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
446
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
330
447
|
this.logMethodStart("initialize");
|
|
331
|
-
this.core = core;
|
|
332
|
-
this.initializeOptions = options || {};
|
|
333
448
|
this.store = { ...this.store, ...options.store };
|
|
334
449
|
this.store.entryContext = ((_a = options.otherParams) == null ? void 0 : _a.entryContext) || this.store.entryContext;
|
|
335
450
|
this.store.status = "initializing";
|
|
@@ -351,15 +466,20 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
351
466
|
passed: null,
|
|
352
467
|
failures: []
|
|
353
468
|
};
|
|
354
|
-
|
|
355
|
-
this.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
469
|
+
await super.initialize(core, options);
|
|
470
|
+
if (this.store.scanOrderLogger) {
|
|
471
|
+
this.store.scanOrderLogger.setProvider(
|
|
472
|
+
((_f = this.otherParams) == null ? void 0 : _f.loggerProvider) || "feishu"
|
|
473
|
+
);
|
|
474
|
+
this.store.scanOrderLogger.setProviderConfig(
|
|
475
|
+
((_g = this.otherParams) == null ? void 0 : _g.loggerConfig) || {
|
|
476
|
+
feishu: {
|
|
477
|
+
webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8",
|
|
478
|
+
errorHook: "https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
363
483
|
}
|
|
364
484
|
const baseModules = [
|
|
365
485
|
"scanOrderLogger",
|
|
@@ -377,10 +497,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
377
497
|
} : {};
|
|
378
498
|
const loggerProvider = ((_c2 = this.otherParams) == null ? void 0 : _c2.loggerProvider) || "feishu";
|
|
379
499
|
const loggerConfig = ((_d2 = this.otherParams) == null ? void 0 : _d2.loggerConfig) || {
|
|
380
|
-
feishu: {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
500
|
+
// feishu: {
|
|
501
|
+
// webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
502
|
+
// errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
|
|
503
|
+
// },
|
|
384
504
|
};
|
|
385
505
|
this.core.registerModule(targetModule, {
|
|
386
506
|
initialState,
|
|
@@ -447,24 +567,43 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
447
567
|
otherParams: {
|
|
448
568
|
...this.otherParams,
|
|
449
569
|
fatherModule: this.name,
|
|
450
|
-
openCache: !!((
|
|
451
|
-
cacheId: (
|
|
570
|
+
openCache: !!((_h = this.otherParams) == null ? void 0 : _h.cacheId),
|
|
571
|
+
cacheId: (_i = this.otherParams) == null ? void 0 : _i.cacheId
|
|
452
572
|
}
|
|
453
573
|
});
|
|
454
|
-
|
|
455
|
-
|
|
574
|
+
let holderCacheState;
|
|
575
|
+
if ((_j = this.otherParams) == null ? void 0 : _j.cacheId) {
|
|
576
|
+
const sessionData = this.window.sessionStorage.getItem(this.name);
|
|
577
|
+
if (sessionData) {
|
|
578
|
+
try {
|
|
579
|
+
const data = JSON.parse(sessionData);
|
|
580
|
+
holderCacheState = (_k = data[this.otherParams.cacheId]) == null ? void 0 : _k[`${this.name}_holder`];
|
|
581
|
+
} catch {
|
|
582
|
+
}
|
|
583
|
+
}
|
|
456
584
|
}
|
|
585
|
+
const holderModule = new import_Holder.HolderModule(`${this.name}_holder`);
|
|
586
|
+
this.store.holder = holderModule;
|
|
587
|
+
this.core.registerModule(holderModule, {
|
|
588
|
+
initialState: holderCacheState,
|
|
589
|
+
otherParams: {
|
|
590
|
+
...this.otherParams,
|
|
591
|
+
fatherModule: this.name,
|
|
592
|
+
openCache: !!((_l = this.otherParams) == null ? void 0 : _l.cacheId),
|
|
593
|
+
cacheId: (_m = this.otherParams) == null ? void 0 : _m.cacheId
|
|
594
|
+
}
|
|
595
|
+
});
|
|
457
596
|
this.registerCustomerLoginListeners();
|
|
458
597
|
console.log("[VenueBooking] 初始化开始");
|
|
459
598
|
try {
|
|
460
|
-
await ((
|
|
461
|
-
(
|
|
599
|
+
await ((_n = this.store.order) == null ? void 0 : _n.recalculateSummary({ createIfMissing: false }));
|
|
600
|
+
(_o = this.store.order) == null ? void 0 : _o.persistTempOrder();
|
|
462
601
|
await this.loadRuntimeConfigs();
|
|
463
602
|
if (this.store.schedule) {
|
|
464
603
|
await this.store.schedule.loadAllSchedule();
|
|
465
604
|
this.injectScheduleResolverToQuotation();
|
|
466
|
-
(
|
|
467
|
-
channel: (
|
|
605
|
+
(_q = this.store.quotation) == null ? void 0 : _q.loadQuotations({
|
|
606
|
+
channel: (_p = this.otherParams) == null ? void 0 : _p.channel
|
|
468
607
|
});
|
|
469
608
|
}
|
|
470
609
|
await this.refreshItemRuleQuantityLimits();
|
|
@@ -551,7 +690,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
551
690
|
return this.loadAllProductsInFlight;
|
|
552
691
|
}
|
|
553
692
|
async _doLoadAllProducts() {
|
|
554
|
-
var _a, _b, _c;
|
|
693
|
+
var _a, _b, _c, _d, _e;
|
|
555
694
|
this.logMethodStart("loadAllProducts");
|
|
556
695
|
try {
|
|
557
696
|
if (!this.store.venueProducts)
|
|
@@ -580,6 +719,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
580
719
|
}
|
|
581
720
|
this.store.addonProducts.addProduct(addonList);
|
|
582
721
|
this.resourceProductMap = (0, import_resource.buildResourceProductMap)(venueList);
|
|
722
|
+
if (this.store.order) {
|
|
723
|
+
const products = ((_e = (_d = this.store.order) == null ? void 0 : _d.getOrderProducts) == null ? void 0 : _e.call(_d)) || [];
|
|
724
|
+
await this.preloadHolderForms(products);
|
|
725
|
+
}
|
|
583
726
|
this.productsLoaded = true;
|
|
584
727
|
this.logMethodSuccess("loadAllProducts", {
|
|
585
728
|
total: list.length,
|
|
@@ -972,6 +1115,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
972
1115
|
* 同一场地下不同商品互不干扰,各自单独 reconcile。
|
|
973
1116
|
*/
|
|
974
1117
|
async reconcileOrderForResourceProduct(resourceId, productId, slots) {
|
|
1118
|
+
var _a, _b;
|
|
975
1119
|
const mappings = this.resourceProductMap.get(resourceId);
|
|
976
1120
|
if (!mappings || !mappings.length || !this.store.order)
|
|
977
1121
|
return;
|
|
@@ -985,10 +1129,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
985
1129
|
);
|
|
986
1130
|
tempOrder.bookings = (tempOrder.bookings || []).filter(
|
|
987
1131
|
(b) => {
|
|
988
|
-
var
|
|
989
|
-
if (!((
|
|
1132
|
+
var _a2, _b2, _c, _d;
|
|
1133
|
+
if (!((_a2 = b.metadata) == null ? void 0 : _a2.venue_booking))
|
|
990
1134
|
return true;
|
|
991
|
-
if (String((
|
|
1135
|
+
if (String((_b2 = b.metadata) == null ? void 0 : _b2.resource_id) !== String(resourceId))
|
|
992
1136
|
return true;
|
|
993
1137
|
const bookingProductId = ((_c = b.metadata) == null ? void 0 : _c.product_id) ?? ((_d = b == null ? void 0 : b.product) == null ? void 0 : _d.product_id);
|
|
994
1138
|
if (bookingProductId == null)
|
|
@@ -1017,6 +1161,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1017
1161
|
const endMoment = (0, import_dayjs.default)(group.endTime, "YYYY-MM-DD HH:mm");
|
|
1018
1162
|
const duration = endMoment.diff(startMoment, "minute");
|
|
1019
1163
|
const customDepositData = cloneCustomDepositData(venueProduct == null ? void 0 : venueProduct.custom_deposit_data);
|
|
1164
|
+
const productTitle = this.normalizeVenueProductTitle(venueProduct == null ? void 0 : venueProduct.product_title) || this.normalizeVenueProductTitle(venueProduct == null ? void 0 : venueProduct.title) || this.normalizeVenueProductTitle(mapping.productTitle);
|
|
1020
1165
|
const resourceEntry = {
|
|
1021
1166
|
relation_type: "form",
|
|
1022
1167
|
like_status: "common",
|
|
@@ -1039,67 +1184,71 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1039
1184
|
metadata: {}
|
|
1040
1185
|
}));
|
|
1041
1186
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1187
|
+
const venueProductOrigin = {
|
|
1188
|
+
name: mapping.productTitle,
|
|
1189
|
+
product_title: productTitle,
|
|
1190
|
+
cover: (venueProduct == null ? void 0 : venueProduct.cover) || "",
|
|
1191
|
+
custom_deposit_data: customDepositData,
|
|
1192
|
+
id: 0,
|
|
1193
|
+
number: 1,
|
|
1194
|
+
registration_type: "all",
|
|
1195
|
+
relation_products: [],
|
|
1196
|
+
is_all: false,
|
|
1197
|
+
product: {
|
|
1044
1198
|
product_id: mapping.productId,
|
|
1045
1199
|
product_variant_id: 0,
|
|
1046
|
-
identity_key: identityKey,
|
|
1047
1200
|
num: 1,
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
holder: null
|
|
1100
|
-
}
|
|
1101
|
-
})
|
|
1102
|
-
);
|
|
1201
|
+
product_bundle: [],
|
|
1202
|
+
product_sku: { option: [] },
|
|
1203
|
+
discount_list: [],
|
|
1204
|
+
custom_deposit_data: customDepositData,
|
|
1205
|
+
metadata: {}
|
|
1206
|
+
},
|
|
1207
|
+
sub_type: "minutes",
|
|
1208
|
+
duration,
|
|
1209
|
+
like_status: "common",
|
|
1210
|
+
resources: [resourceEntry],
|
|
1211
|
+
schedule_id: 0,
|
|
1212
|
+
select_date: startMoment.format("YYYY-MM-DD"),
|
|
1213
|
+
start_date: startMoment.format("YYYY-MM-DD"),
|
|
1214
|
+
start_time: startMoment.format("HH:mm"),
|
|
1215
|
+
end_date: endMoment.format("YYYY-MM-DD"),
|
|
1216
|
+
end_time: endMoment.format("HH:mm"),
|
|
1217
|
+
metadata: {
|
|
1218
|
+
venue_booking: true,
|
|
1219
|
+
slot_count: group.slotCount
|
|
1220
|
+
},
|
|
1221
|
+
holder: null
|
|
1222
|
+
};
|
|
1223
|
+
const normalizedVenueOrderProduct = (0, import_utils.normalizeOrderProduct)({
|
|
1224
|
+
product_id: mapping.productId,
|
|
1225
|
+
product_variant_id: 0,
|
|
1226
|
+
identity_key: identityKey,
|
|
1227
|
+
num: 1,
|
|
1228
|
+
selling_price: group.totalPrice,
|
|
1229
|
+
original_price: group.totalPrice,
|
|
1230
|
+
is_charge_tax: (venueProduct == null ? void 0 : venueProduct.is_charge_tax) ?? 0,
|
|
1231
|
+
metadata: {
|
|
1232
|
+
venue_booking: true,
|
|
1233
|
+
...productTitle ? { product_title: productTitle } : {},
|
|
1234
|
+
resource_id: resourceId,
|
|
1235
|
+
resource_form_id: mapping.formId,
|
|
1236
|
+
resource_name: mapping.resourceName,
|
|
1237
|
+
start_time: group.startTime,
|
|
1238
|
+
end_time: group.endTime,
|
|
1239
|
+
slot_count: group.slotCount,
|
|
1240
|
+
booking_uid: bookingUuid,
|
|
1241
|
+
price_breakdown: (0, import_slotMerge.buildPriceBreakdown)({
|
|
1242
|
+
group,
|
|
1243
|
+
productId: mapping.productId,
|
|
1244
|
+
quotation: this.store.quotation
|
|
1245
|
+
})
|
|
1246
|
+
},
|
|
1247
|
+
_origin: venueProductOrigin
|
|
1248
|
+
});
|
|
1249
|
+
const venueOrderProduct = productTitle ? { ...normalizedVenueOrderProduct, product_title: productTitle } : normalizedVenueOrderProduct;
|
|
1250
|
+
this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
|
|
1251
|
+
tempOrder.products.push(venueOrderProduct);
|
|
1103
1252
|
const booking = (0, import_slotMerge.buildVenueBookingEntry)({
|
|
1104
1253
|
group,
|
|
1105
1254
|
resourceId,
|
|
@@ -1111,6 +1260,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1111
1260
|
});
|
|
1112
1261
|
tempOrder.bookings.push(booking);
|
|
1113
1262
|
}
|
|
1263
|
+
const products = ((_b = (_a = this.store.order) == null ? void 0 : _a.getOrderProducts) == null ? void 0 : _b.call(_a)) || [];
|
|
1264
|
+
await this.preloadHolderForms(products);
|
|
1114
1265
|
this.store.order.applyDiscount();
|
|
1115
1266
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
1116
1267
|
this.store.order.persistTempOrder();
|
|
@@ -1178,17 +1329,17 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1178
1329
|
const result = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) || null;
|
|
1179
1330
|
return result;
|
|
1180
1331
|
}
|
|
1181
|
-
updateTempOrderNote(note) {
|
|
1332
|
+
updateTempOrderNote(note, sync = false) {
|
|
1182
1333
|
if (!this.store.order)
|
|
1183
1334
|
throw new Error("order 模块未初始化");
|
|
1184
|
-
return this.store.order.updateTempOrderNote(note);
|
|
1335
|
+
return this.store.order.updateTempOrderNote(note, sync);
|
|
1185
1336
|
}
|
|
1186
1337
|
updateTempOrderContactsInfo(contactsInfo) {
|
|
1187
1338
|
if (!this.store.order)
|
|
1188
1339
|
throw new Error("order 模块未初始化");
|
|
1189
1340
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
1190
1341
|
}
|
|
1191
|
-
|
|
1342
|
+
ensureVenueTempOrder() {
|
|
1192
1343
|
if (!this.store.order)
|
|
1193
1344
|
throw new Error("order 模块未初始化");
|
|
1194
1345
|
return this.store.order.ensureTempOrder();
|
|
@@ -1281,7 +1432,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1281
1432
|
}
|
|
1282
1433
|
/** 勾选/取消勾选某张折扣券,重新计算折扣并持久化 */
|
|
1283
1434
|
async setDiscountSelected(params) {
|
|
1284
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1435
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1285
1436
|
this.logMethodStart("setDiscountSelected", params);
|
|
1286
1437
|
try {
|
|
1287
1438
|
if (!this.store.order)
|
|
@@ -1337,7 +1488,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1337
1488
|
nextDiscountList.filter((d) => d.isSelected).map((d) => d.id)
|
|
1338
1489
|
);
|
|
1339
1490
|
for (const product of tempOrder.products) {
|
|
1340
|
-
|
|
1491
|
+
const origin = this.readProductOriginFromTempOrder(tempOrder, product);
|
|
1492
|
+
if (origin == null ? void 0 : origin.isManualDiscount)
|
|
1341
1493
|
continue;
|
|
1342
1494
|
product.discount_list = (product.discount_list || []).filter((pd) => {
|
|
1343
1495
|
var _a2;
|
|
@@ -1349,7 +1501,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1349
1501
|
0
|
|
1350
1502
|
);
|
|
1351
1503
|
const optionSum = (0, import_utils3.sumOptionUnitPrice)((0, import_utils3.getProductSkuOptions)(product));
|
|
1352
|
-
const sourcePrice = ((
|
|
1504
|
+
const sourcePrice = ((_c = product.metadata) == null ? void 0 : _c.source_product_price) ?? (((_d = product.metadata) == null ? void 0 : _d.main_product_original_price) != null ? new import_decimal.default(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : product.original_price ?? "0");
|
|
1353
1505
|
const newSourceSellingPrice = new import_decimal.default(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1354
1506
|
const newMainSellingPrice = new import_decimal.default(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1355
1507
|
if (product.metadata) {
|
|
@@ -1367,8 +1519,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1367
1519
|
const afterApplyTarget = this.store.order.getDiscountList().find((d) => d.id === params.discountId) || null;
|
|
1368
1520
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
1369
1521
|
this.store.order.persistTempOrder();
|
|
1370
|
-
const finalSummary = ((
|
|
1371
|
-
const finalProduct = ((
|
|
1522
|
+
const finalSummary = ((_e = this.store.order.getTempOrder()) == null ? void 0 : _e.summary) || null;
|
|
1523
|
+
const finalProduct = ((_g = (_f = this.store.order.getTempOrder()) == null ? void 0 : _f.products) == null ? void 0 : _g[0]) || null;
|
|
1372
1524
|
this.logMethodSuccess("setDiscountSelected", params);
|
|
1373
1525
|
const finalTarget = this.store.order.getDiscountList().find((d) => d.id === params.discountId) || null;
|
|
1374
1526
|
return this.store.order.getDiscountList();
|
|
@@ -1683,7 +1835,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1683
1835
|
return [];
|
|
1684
1836
|
}
|
|
1685
1837
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1686
|
-
tempOrder: this.
|
|
1838
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
1687
1839
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1688
1840
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1689
1841
|
});
|
|
@@ -1698,7 +1850,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1698
1850
|
}
|
|
1699
1851
|
}
|
|
1700
1852
|
async applyPrefillByItemRule() {
|
|
1701
|
-
var _a;
|
|
1853
|
+
var _a, _b;
|
|
1702
1854
|
if (this.itemRulePrefillApplied)
|
|
1703
1855
|
return;
|
|
1704
1856
|
if (!this.store.order)
|
|
@@ -1707,7 +1859,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1707
1859
|
if (!strategyConfigs.length)
|
|
1708
1860
|
return;
|
|
1709
1861
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1710
|
-
tempOrder: this.
|
|
1862
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
1711
1863
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1712
1864
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1713
1865
|
});
|
|
@@ -1717,7 +1869,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1717
1869
|
return;
|
|
1718
1870
|
}
|
|
1719
1871
|
const productSourceMap = await this.buildPrefillProductSourceMap();
|
|
1720
|
-
const tempOrder = this.
|
|
1872
|
+
const tempOrder = this.ensureVenueTempOrder();
|
|
1721
1873
|
let hasChanges = false;
|
|
1722
1874
|
for (const prefillItem of prefillItems) {
|
|
1723
1875
|
const productId = Number(prefillItem.product_id);
|
|
@@ -1734,32 +1886,39 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1734
1886
|
});
|
|
1735
1887
|
if (productIndex === -1) {
|
|
1736
1888
|
const sellingPrice = (0, import_utils.toPriceString)((sourceItem == null ? void 0 : sourceItem.price) ?? (sourceItem == null ? void 0 : sourceItem.selling_price), "0.00");
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
);
|
|
1889
|
+
const origin = { ...sourceItem || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId };
|
|
1890
|
+
const product = (0, import_utils.normalizeOrderProduct)({
|
|
1891
|
+
product_id: productId,
|
|
1892
|
+
product_variant_id: productVariantId,
|
|
1893
|
+
num: targetQuantity,
|
|
1894
|
+
selling_price: sellingPrice,
|
|
1895
|
+
original_price: sellingPrice,
|
|
1896
|
+
metadata: { item_rule_prefill: true, item_rule_id: prefillItem.ruleId },
|
|
1897
|
+
_origin: origin
|
|
1898
|
+
});
|
|
1899
|
+
const productUid = String(((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) || "");
|
|
1900
|
+
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
1901
|
+
tempOrder.products.push(product);
|
|
1748
1902
|
hasChanges = true;
|
|
1749
1903
|
continue;
|
|
1750
1904
|
}
|
|
1751
1905
|
const targetProduct = tempOrder.products[productIndex];
|
|
1906
|
+
const previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
1907
|
+
const nextOrigin = sourceItem ? { ...previousOrigin || {}, ...sourceItem } : previousOrigin;
|
|
1752
1908
|
const existedQuantity = (0, import_utils.toNonNegativeInt)(targetProduct.num);
|
|
1753
1909
|
const delta = targetQuantity - existedQuantity;
|
|
1754
1910
|
const nextProduct = {
|
|
1755
1911
|
...targetProduct,
|
|
1756
1912
|
...delta > 0 ? { num: (0, import_utils.getSafeProductNum)(existedQuantity + delta) } : {},
|
|
1757
|
-
metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
|
|
1758
|
-
_origin: sourceItem ? { ...targetProduct._origin || {}, ...sourceItem } : targetProduct._origin
|
|
1913
|
+
metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
|
|
1759
1914
|
};
|
|
1760
1915
|
if (delta > 0 || Boolean(
|
|
1761
|
-
sourceItem && (!
|
|
1916
|
+
sourceItem && (!previousOrigin || (previousOrigin == null ? void 0 : previousOrigin.price) !== (sourceItem == null ? void 0 : sourceItem.price))
|
|
1762
1917
|
)) {
|
|
1918
|
+
const productUid = String(
|
|
1919
|
+
((_b = nextProduct.metadata) == null ? void 0 : _b.unique_identification_number) || ""
|
|
1920
|
+
);
|
|
1921
|
+
this.attachProductOriginToTempOrder(tempOrder, productUid, nextOrigin);
|
|
1763
1922
|
tempOrder.products[productIndex] = nextProduct;
|
|
1764
1923
|
hasChanges = true;
|
|
1765
1924
|
}
|
|
@@ -1787,7 +1946,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1787
1946
|
if (!strategyConfigs.length)
|
|
1788
1947
|
return { passed: true, failures: [] };
|
|
1789
1948
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1790
|
-
tempOrder: this.
|
|
1949
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
1791
1950
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1792
1951
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1793
1952
|
});
|
|
@@ -1899,6 +2058,60 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1899
2058
|
this.writeUIStateBucket(bucket);
|
|
1900
2059
|
}
|
|
1901
2060
|
}
|
|
2061
|
+
setBookingHolder(bookingUid, holder) {
|
|
2062
|
+
var _a, _b, _c, _d;
|
|
2063
|
+
if (!this.store.order)
|
|
2064
|
+
return;
|
|
2065
|
+
const tempOrder = this.store.order.ensureTempOrder();
|
|
2066
|
+
const booking = (_a = tempOrder.bookings) == null ? void 0 : _a.find(
|
|
2067
|
+
(b) => {
|
|
2068
|
+
var _a2;
|
|
2069
|
+
return ((_a2 = b.metadata) == null ? void 0 : _a2.unique_identification_number) === bookingUid;
|
|
2070
|
+
}
|
|
2071
|
+
);
|
|
2072
|
+
if (booking) {
|
|
2073
|
+
booking.holder = holder;
|
|
2074
|
+
}
|
|
2075
|
+
for (const product of tempOrder.products) {
|
|
2076
|
+
const runtimeProduct = product;
|
|
2077
|
+
const productBookingUid = ((_b = runtimeProduct.metadata) == null ? void 0 : _b.booking_uid) ?? ((_d = (_c = runtimeProduct._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.bookingUuid);
|
|
2078
|
+
if (String(productBookingUid) !== String(bookingUid))
|
|
2079
|
+
continue;
|
|
2080
|
+
const origin = runtimeProduct._origin && typeof runtimeProduct._origin === "object" ? runtimeProduct._origin : {};
|
|
2081
|
+
origin.holder = holder;
|
|
2082
|
+
runtimeProduct._origin = origin;
|
|
2083
|
+
}
|
|
2084
|
+
this.store.order.notifyTempOrderChanged();
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* 获取 holder 表单 map
|
|
2088
|
+
*/
|
|
2089
|
+
getHolderFormMap() {
|
|
2090
|
+
if (!this.store.holder)
|
|
2091
|
+
throw new Error("[VenueBooking] holder 模块未初始化");
|
|
2092
|
+
return this.store.holder.getHolderFormMap();
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* UI 层触发:按当前 holderMap 批量刷新所有表单的 records
|
|
2096
|
+
*/
|
|
2097
|
+
async refreshAllHolderFormRecords(params) {
|
|
2098
|
+
if (!this.store.holder)
|
|
2099
|
+
throw new Error("[VenueBooking] holder 模块未初始化");
|
|
2100
|
+
const customer_id = (params == null ? void 0 : params.customer_id) ?? this.resolveHolderCustomerId();
|
|
2101
|
+
return this.store.holder.refreshAllFormRecords({
|
|
2102
|
+
...params,
|
|
2103
|
+
customer_id,
|
|
2104
|
+
useCache: (params == null ? void 0 : params.useCache) ?? false
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* 添加表单记录
|
|
2109
|
+
*/
|
|
2110
|
+
appendFormRecord(params) {
|
|
2111
|
+
if (!this.store.holder)
|
|
2112
|
+
throw new Error("[VenueBooking] holder 模块未初始化");
|
|
2113
|
+
return this.store.holder.appendFormRecord(params);
|
|
2114
|
+
}
|
|
1902
2115
|
// ─── OpenData 可用性 ───
|
|
1903
2116
|
async checkOpenDataAvailability() {
|
|
1904
2117
|
if (!this.store.openData)
|