@pisell/pisellos 2.3.38 → 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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- 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.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- 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 +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- 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.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- 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 +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- 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 +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- 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.d.ts +3 -7
- package/dist/solution/BookingTicket/index.js +49 -132
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- 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 +1148 -756
- 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 +1176 -860
- 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 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- 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.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- 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 +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- 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.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- 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 +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- 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.d.ts +3 -7
- package/lib/solution/BookingTicket/index.js +9 -62
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- 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 -190
- 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 -123
- 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 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- 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/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- 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",
|
|
@@ -65,10 +67,6 @@ var OPEN_DATA_SECTION_CODES = [
|
|
|
65
67
|
"workflow",
|
|
66
68
|
"checkout"
|
|
67
69
|
];
|
|
68
|
-
function isItemRewardProductDiscount(discount) {
|
|
69
|
-
var _a, _b;
|
|
70
|
-
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";
|
|
71
|
-
}
|
|
72
70
|
function cloneCustomDepositData(customDepositData) {
|
|
73
71
|
if (!customDepositData || typeof customDepositData !== "object")
|
|
74
72
|
return void 0;
|
|
@@ -79,7 +77,7 @@ function cloneCustomDepositData(customDepositData) {
|
|
|
79
77
|
deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? [...customDepositData.deposit_policy_data] : []
|
|
80
78
|
};
|
|
81
79
|
}
|
|
82
|
-
var _VenueBookingImpl = class extends
|
|
80
|
+
var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
83
81
|
constructor(name, version) {
|
|
84
82
|
super(name, version);
|
|
85
83
|
this.defaultName = "venueBooking";
|
|
@@ -229,6 +227,79 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
229
227
|
}
|
|
230
228
|
});
|
|
231
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
|
+
}
|
|
232
303
|
normalizeCustomerId(value) {
|
|
233
304
|
const customerId = Number(value);
|
|
234
305
|
if (!Number.isFinite(customerId) || customerId <= 0)
|
|
@@ -257,6 +328,42 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
257
328
|
}
|
|
258
329
|
return null;
|
|
259
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
|
+
}
|
|
260
367
|
clearLoginEffectListeners() {
|
|
261
368
|
for (const dispose of this.loginEffectDisposers) {
|
|
262
369
|
dispose();
|
|
@@ -303,6 +410,12 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
303
410
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
304
411
|
const refreshTask = (async () => {
|
|
305
412
|
var _a;
|
|
413
|
+
if (this.store.holder) {
|
|
414
|
+
await this.store.holder.refreshAllFormRecords({
|
|
415
|
+
customer_id: params.customerId,
|
|
416
|
+
useCache: false
|
|
417
|
+
});
|
|
418
|
+
}
|
|
306
419
|
if (this.store.quotation) {
|
|
307
420
|
await this.store.quotation.loadQuotations({
|
|
308
421
|
channel: (_a = this.otherParams) == null ? void 0 : _a.channel
|
|
@@ -330,10 +443,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
330
443
|
}
|
|
331
444
|
}
|
|
332
445
|
async initialize(core, options = {}) {
|
|
333
|
-
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;
|
|
334
447
|
this.logMethodStart("initialize");
|
|
335
|
-
this.core = core;
|
|
336
|
-
this.initializeOptions = options || {};
|
|
337
448
|
this.store = { ...this.store, ...options.store };
|
|
338
449
|
this.store.entryContext = ((_a = options.otherParams) == null ? void 0 : _a.entryContext) || this.store.entryContext;
|
|
339
450
|
this.store.status = "initializing";
|
|
@@ -355,15 +466,20 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
355
466
|
passed: null,
|
|
356
467
|
failures: []
|
|
357
468
|
};
|
|
358
|
-
|
|
359
|
-
this.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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());
|
|
367
483
|
}
|
|
368
484
|
const baseModules = [
|
|
369
485
|
"scanOrderLogger",
|
|
@@ -381,10 +497,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
381
497
|
} : {};
|
|
382
498
|
const loggerProvider = ((_c2 = this.otherParams) == null ? void 0 : _c2.loggerProvider) || "feishu";
|
|
383
499
|
const loggerConfig = ((_d2 = this.otherParams) == null ? void 0 : _d2.loggerConfig) || {
|
|
384
|
-
feishu: {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
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
|
+
// },
|
|
388
504
|
};
|
|
389
505
|
this.core.registerModule(targetModule, {
|
|
390
506
|
initialState,
|
|
@@ -451,24 +567,43 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
451
567
|
otherParams: {
|
|
452
568
|
...this.otherParams,
|
|
453
569
|
fatherModule: this.name,
|
|
454
|
-
openCache: !!((
|
|
455
|
-
cacheId: (
|
|
570
|
+
openCache: !!((_h = this.otherParams) == null ? void 0 : _h.cacheId),
|
|
571
|
+
cacheId: (_i = this.otherParams) == null ? void 0 : _i.cacheId
|
|
456
572
|
}
|
|
457
573
|
});
|
|
458
|
-
|
|
459
|
-
|
|
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
|
+
}
|
|
460
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
|
+
});
|
|
461
596
|
this.registerCustomerLoginListeners();
|
|
462
597
|
console.log("[VenueBooking] 初始化开始");
|
|
463
598
|
try {
|
|
464
|
-
await ((
|
|
465
|
-
(
|
|
599
|
+
await ((_n = this.store.order) == null ? void 0 : _n.recalculateSummary({ createIfMissing: false }));
|
|
600
|
+
(_o = this.store.order) == null ? void 0 : _o.persistTempOrder();
|
|
466
601
|
await this.loadRuntimeConfigs();
|
|
467
602
|
if (this.store.schedule) {
|
|
468
603
|
await this.store.schedule.loadAllSchedule();
|
|
469
604
|
this.injectScheduleResolverToQuotation();
|
|
470
|
-
(
|
|
471
|
-
channel: (
|
|
605
|
+
(_q = this.store.quotation) == null ? void 0 : _q.loadQuotations({
|
|
606
|
+
channel: (_p = this.otherParams) == null ? void 0 : _p.channel
|
|
472
607
|
});
|
|
473
608
|
}
|
|
474
609
|
await this.refreshItemRuleQuantityLimits();
|
|
@@ -555,7 +690,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
555
690
|
return this.loadAllProductsInFlight;
|
|
556
691
|
}
|
|
557
692
|
async _doLoadAllProducts() {
|
|
558
|
-
var _a, _b, _c;
|
|
693
|
+
var _a, _b, _c, _d, _e;
|
|
559
694
|
this.logMethodStart("loadAllProducts");
|
|
560
695
|
try {
|
|
561
696
|
if (!this.store.venueProducts)
|
|
@@ -584,6 +719,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
584
719
|
}
|
|
585
720
|
this.store.addonProducts.addProduct(addonList);
|
|
586
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
|
+
}
|
|
587
726
|
this.productsLoaded = true;
|
|
588
727
|
this.logMethodSuccess("loadAllProducts", {
|
|
589
728
|
total: list.length,
|
|
@@ -976,6 +1115,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
976
1115
|
* 同一场地下不同商品互不干扰,各自单独 reconcile。
|
|
977
1116
|
*/
|
|
978
1117
|
async reconcileOrderForResourceProduct(resourceId, productId, slots) {
|
|
1118
|
+
var _a, _b;
|
|
979
1119
|
const mappings = this.resourceProductMap.get(resourceId);
|
|
980
1120
|
if (!mappings || !mappings.length || !this.store.order)
|
|
981
1121
|
return;
|
|
@@ -989,10 +1129,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
989
1129
|
);
|
|
990
1130
|
tempOrder.bookings = (tempOrder.bookings || []).filter(
|
|
991
1131
|
(b) => {
|
|
992
|
-
var
|
|
993
|
-
if (!((
|
|
1132
|
+
var _a2, _b2, _c, _d;
|
|
1133
|
+
if (!((_a2 = b.metadata) == null ? void 0 : _a2.venue_booking))
|
|
994
1134
|
return true;
|
|
995
|
-
if (String((
|
|
1135
|
+
if (String((_b2 = b.metadata) == null ? void 0 : _b2.resource_id) !== String(resourceId))
|
|
996
1136
|
return true;
|
|
997
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);
|
|
998
1138
|
if (bookingProductId == null)
|
|
@@ -1021,6 +1161,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1021
1161
|
const endMoment = (0, import_dayjs.default)(group.endTime, "YYYY-MM-DD HH:mm");
|
|
1022
1162
|
const duration = endMoment.diff(startMoment, "minute");
|
|
1023
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);
|
|
1024
1165
|
const resourceEntry = {
|
|
1025
1166
|
relation_type: "form",
|
|
1026
1167
|
like_status: "common",
|
|
@@ -1043,67 +1184,71 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1043
1184
|
metadata: {}
|
|
1044
1185
|
}));
|
|
1045
1186
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
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: {
|
|
1048
1198
|
product_id: mapping.productId,
|
|
1049
1199
|
product_variant_id: 0,
|
|
1050
|
-
identity_key: identityKey,
|
|
1051
1200
|
num: 1,
|
|
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
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
holder: null
|
|
1104
|
-
}
|
|
1105
|
-
})
|
|
1106
|
-
);
|
|
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);
|
|
1107
1252
|
const booking = (0, import_slotMerge.buildVenueBookingEntry)({
|
|
1108
1253
|
group,
|
|
1109
1254
|
resourceId,
|
|
@@ -1115,6 +1260,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1115
1260
|
});
|
|
1116
1261
|
tempOrder.bookings.push(booking);
|
|
1117
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);
|
|
1118
1265
|
this.store.order.applyDiscount();
|
|
1119
1266
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
1120
1267
|
this.store.order.persistTempOrder();
|
|
@@ -1182,17 +1329,17 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1182
1329
|
const result = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) || null;
|
|
1183
1330
|
return result;
|
|
1184
1331
|
}
|
|
1185
|
-
updateTempOrderNote(note) {
|
|
1332
|
+
updateTempOrderNote(note, sync = false) {
|
|
1186
1333
|
if (!this.store.order)
|
|
1187
1334
|
throw new Error("order 模块未初始化");
|
|
1188
|
-
return this.store.order.updateTempOrderNote(note);
|
|
1335
|
+
return this.store.order.updateTempOrderNote(note, sync);
|
|
1189
1336
|
}
|
|
1190
1337
|
updateTempOrderContactsInfo(contactsInfo) {
|
|
1191
1338
|
if (!this.store.order)
|
|
1192
1339
|
throw new Error("order 模块未初始化");
|
|
1193
1340
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
1194
1341
|
}
|
|
1195
|
-
|
|
1342
|
+
ensureVenueTempOrder() {
|
|
1196
1343
|
if (!this.store.order)
|
|
1197
1344
|
throw new Error("order 模块未初始化");
|
|
1198
1345
|
return this.store.order.ensureTempOrder();
|
|
@@ -1285,7 +1432,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1285
1432
|
}
|
|
1286
1433
|
/** 勾选/取消勾选某张折扣券,重新计算折扣并持久化 */
|
|
1287
1434
|
async setDiscountSelected(params) {
|
|
1288
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1435
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1289
1436
|
this.logMethodStart("setDiscountSelected", params);
|
|
1290
1437
|
try {
|
|
1291
1438
|
if (!this.store.order)
|
|
@@ -1341,12 +1488,9 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1341
1488
|
nextDiscountList.filter((d) => d.isSelected).map((d) => d.id)
|
|
1342
1489
|
);
|
|
1343
1490
|
for (const product of tempOrder.products) {
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
if ((product.discount_list || []).some(isItemRewardProductDiscount)) {
|
|
1347
|
-
product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
|
|
1491
|
+
const origin = this.readProductOriginFromTempOrder(tempOrder, product);
|
|
1492
|
+
if (origin == null ? void 0 : origin.isManualDiscount)
|
|
1348
1493
|
continue;
|
|
1349
|
-
}
|
|
1350
1494
|
product.discount_list = (product.discount_list || []).filter((pd) => {
|
|
1351
1495
|
var _a2;
|
|
1352
1496
|
const rid = ((_a2 = pd.discount) == null ? void 0 : _a2.resource_id) ?? pd.id;
|
|
@@ -1357,7 +1501,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1357
1501
|
0
|
|
1358
1502
|
);
|
|
1359
1503
|
const optionSum = (0, import_utils3.sumOptionUnitPrice)((0, import_utils3.getProductSkuOptions)(product));
|
|
1360
|
-
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");
|
|
1361
1505
|
const newSourceSellingPrice = new import_decimal.default(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1362
1506
|
const newMainSellingPrice = new import_decimal.default(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1363
1507
|
if (product.metadata) {
|
|
@@ -1375,8 +1519,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1375
1519
|
const afterApplyTarget = this.store.order.getDiscountList().find((d) => d.id === params.discountId) || null;
|
|
1376
1520
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
1377
1521
|
this.store.order.persistTempOrder();
|
|
1378
|
-
const finalSummary = ((
|
|
1379
|
-
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;
|
|
1380
1524
|
this.logMethodSuccess("setDiscountSelected", params);
|
|
1381
1525
|
const finalTarget = this.store.order.getDiscountList().find((d) => d.id === params.discountId) || null;
|
|
1382
1526
|
return this.store.order.getDiscountList();
|
|
@@ -1691,7 +1835,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1691
1835
|
return [];
|
|
1692
1836
|
}
|
|
1693
1837
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1694
|
-
tempOrder: this.
|
|
1838
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
1695
1839
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1696
1840
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1697
1841
|
});
|
|
@@ -1706,7 +1850,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1706
1850
|
}
|
|
1707
1851
|
}
|
|
1708
1852
|
async applyPrefillByItemRule() {
|
|
1709
|
-
var _a;
|
|
1853
|
+
var _a, _b;
|
|
1710
1854
|
if (this.itemRulePrefillApplied)
|
|
1711
1855
|
return;
|
|
1712
1856
|
if (!this.store.order)
|
|
@@ -1715,7 +1859,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1715
1859
|
if (!strategyConfigs.length)
|
|
1716
1860
|
return;
|
|
1717
1861
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1718
|
-
tempOrder: this.
|
|
1862
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
1719
1863
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1720
1864
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1721
1865
|
});
|
|
@@ -1725,7 +1869,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1725
1869
|
return;
|
|
1726
1870
|
}
|
|
1727
1871
|
const productSourceMap = await this.buildPrefillProductSourceMap();
|
|
1728
|
-
const tempOrder = this.
|
|
1872
|
+
const tempOrder = this.ensureVenueTempOrder();
|
|
1729
1873
|
let hasChanges = false;
|
|
1730
1874
|
for (const prefillItem of prefillItems) {
|
|
1731
1875
|
const productId = Number(prefillItem.product_id);
|
|
@@ -1742,32 +1886,39 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1742
1886
|
});
|
|
1743
1887
|
if (productIndex === -1) {
|
|
1744
1888
|
const sellingPrice = (0, import_utils.toPriceString)((sourceItem == null ? void 0 : sourceItem.price) ?? (sourceItem == null ? void 0 : sourceItem.selling_price), "0.00");
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
);
|
|
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);
|
|
1756
1902
|
hasChanges = true;
|
|
1757
1903
|
continue;
|
|
1758
1904
|
}
|
|
1759
1905
|
const targetProduct = tempOrder.products[productIndex];
|
|
1906
|
+
const previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
1907
|
+
const nextOrigin = sourceItem ? { ...previousOrigin || {}, ...sourceItem } : previousOrigin;
|
|
1760
1908
|
const existedQuantity = (0, import_utils.toNonNegativeInt)(targetProduct.num);
|
|
1761
1909
|
const delta = targetQuantity - existedQuantity;
|
|
1762
1910
|
const nextProduct = {
|
|
1763
1911
|
...targetProduct,
|
|
1764
1912
|
...delta > 0 ? { num: (0, import_utils.getSafeProductNum)(existedQuantity + delta) } : {},
|
|
1765
|
-
metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
|
|
1766
|
-
_origin: sourceItem ? { ...targetProduct._origin || {}, ...sourceItem } : targetProduct._origin
|
|
1913
|
+
metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
|
|
1767
1914
|
};
|
|
1768
1915
|
if (delta > 0 || Boolean(
|
|
1769
|
-
sourceItem && (!
|
|
1916
|
+
sourceItem && (!previousOrigin || (previousOrigin == null ? void 0 : previousOrigin.price) !== (sourceItem == null ? void 0 : sourceItem.price))
|
|
1770
1917
|
)) {
|
|
1918
|
+
const productUid = String(
|
|
1919
|
+
((_b = nextProduct.metadata) == null ? void 0 : _b.unique_identification_number) || ""
|
|
1920
|
+
);
|
|
1921
|
+
this.attachProductOriginToTempOrder(tempOrder, productUid, nextOrigin);
|
|
1771
1922
|
tempOrder.products[productIndex] = nextProduct;
|
|
1772
1923
|
hasChanges = true;
|
|
1773
1924
|
}
|
|
@@ -1795,7 +1946,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1795
1946
|
if (!strategyConfigs.length)
|
|
1796
1947
|
return { passed: true, failures: [] };
|
|
1797
1948
|
const businessData = (0, import_utils.buildItemRuleBusinessData)({
|
|
1798
|
-
tempOrder: this.
|
|
1949
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
1799
1950
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
1800
1951
|
itemRuleConfigs: this.itemRuleConfigs
|
|
1801
1952
|
});
|
|
@@ -1907,6 +2058,60 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1907
2058
|
this.writeUIStateBucket(bucket);
|
|
1908
2059
|
}
|
|
1909
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
|
+
}
|
|
1910
2115
|
// ─── OpenData 可用性 ───
|
|
1911
2116
|
async checkOpenDataAvailability() {
|
|
1912
2117
|
if (!this.store.openData)
|