@pisell/pisellos 2.1.159 → 2.1.161
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/Order/index.d.ts +0 -1
- package/dist/modules/Order/index.js +1 -18
- package/dist/modules/Order/types.d.ts +0 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Product/types.d.ts +0 -7
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.d.ts +0 -15
- package/dist/solution/BookingByStep/index.js +204 -276
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/ScanOrder/types.d.ts +0 -1
- package/dist/solution/VenueBooking/index.d.ts +0 -19
- package/dist/solution/VenueBooking/index.js +733 -963
- package/dist/solution/VenueBooking/types.d.ts +0 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/modules/Order/index.d.ts +0 -1
- package/lib/modules/Order/index.js +0 -14
- package/lib/modules/Order/types.d.ts +0 -2
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Product/types.d.ts +0 -7
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.d.ts +0 -15
- package/lib/solution/BookingByStep/index.js +0 -39
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/ScanOrder/types.d.ts +0 -1
- package/lib/solution/VenueBooking/index.d.ts +0 -19
- package/lib/solution/VenueBooking/index.js +16 -134
- package/lib/solution/VenueBooking/types.d.ts +0 -2
- package/lib/types/index.d.ts +0 -1
- package/package.json +2 -2
- 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/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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
|
|
2
2
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
|
-
import { HolderModule } from '../../modules/Holder';
|
|
4
3
|
export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
|
|
5
4
|
export declare enum VenueBookingHooks {
|
|
6
5
|
onInited = "venueBooking:onInited",
|
|
@@ -146,7 +145,6 @@ export interface VenueBookingState {
|
|
|
146
145
|
passed: boolean | null;
|
|
147
146
|
failures: QuantityCheckResult[];
|
|
148
147
|
};
|
|
149
|
-
holder?: HolderModule;
|
|
150
148
|
}
|
|
151
149
|
export interface VenueBookingLoggerRuntimeConfig {
|
|
152
150
|
provider?: ScanOrderLoggerProviderType;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
57
57
|
private getTempOrderStorageKey;
|
|
58
58
|
private restoreTempOrderFromStorage;
|
|
59
59
|
persistTempOrder(): void;
|
|
60
|
-
notifyTempOrderChanged(): void;
|
|
61
60
|
private createDefaultTempOrderInstance;
|
|
62
61
|
ensureTempOrder(): ScanOrderTempOrder;
|
|
63
62
|
restoreOrder(): ScanOrderTempOrder;
|
|
@@ -325,16 +325,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
325
325
|
return;
|
|
326
326
|
this.window.localStorage.setItem(key, JSON.stringify(this.store.tempOrder));
|
|
327
327
|
}
|
|
328
|
-
notifyTempOrderChanged() {
|
|
329
|
-
if (!this.store.tempOrder)
|
|
330
|
-
return;
|
|
331
|
-
this.store.tempOrder = {
|
|
332
|
-
...this.store.tempOrder,
|
|
333
|
-
products: [...this.store.tempOrder.products],
|
|
334
|
-
bookings: this.store.tempOrder.bookings ? [...this.store.tempOrder.bookings] : []
|
|
335
|
-
};
|
|
336
|
-
this.persistTempOrder();
|
|
337
|
-
}
|
|
338
328
|
// ─── TempOrder: 创建 & 获取 ───
|
|
339
329
|
createDefaultTempOrderInstance() {
|
|
340
330
|
return (0, import_utils.createDefaultTempOrder)({
|
|
@@ -605,7 +595,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
605
595
|
let is_deposit = 0;
|
|
606
596
|
if (params.cartItems.length > 0) {
|
|
607
597
|
params.cartItems.forEach((item) => {
|
|
608
|
-
var _a2;
|
|
609
598
|
if (!item._origin.duration) {
|
|
610
599
|
const { duration, durationType } = (0, import_utils.generateDuration)(item);
|
|
611
600
|
item._origin.duration = duration;
|
|
@@ -613,9 +602,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
613
602
|
}
|
|
614
603
|
const discountList = (0, import_utils.getAllDiscountList)(item);
|
|
615
604
|
item._origin.product.discount_list = discountList;
|
|
616
|
-
if ((_a2 = params == null ? void 0 : params.extraData) == null ? void 0 : _a2.is_add_holder_info) {
|
|
617
|
-
(0, import_utils.ensureCartItemOriginHolder)(item, this.window);
|
|
618
|
-
}
|
|
619
605
|
if ((0, import_utils2.isNormalProduct)(item._origin)) {
|
|
620
606
|
order.relation_products.push(item._origin.product);
|
|
621
607
|
const relationForms = item._origin.relation_forms || [];
|
|
@@ -235,8 +235,6 @@ export interface OrderModuleAPI {
|
|
|
235
235
|
updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
|
|
236
236
|
removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
|
|
237
237
|
persistTempOrder: () => void;
|
|
238
|
-
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
239
|
-
notifyTempOrderChanged: () => void;
|
|
240
238
|
submitTempOrder: <T = any>(params?: {
|
|
241
239
|
cacheId?: string;
|
|
242
240
|
platform?: string;
|
|
@@ -2,7 +2,6 @@ import Decimal from 'decimal.js';
|
|
|
2
2
|
import { CartItem } from "../Cart";
|
|
3
3
|
import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
|
-
import type { WindowPlugin } from '../../plugins';
|
|
6
5
|
/**
|
|
7
6
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
8
7
|
*
|
|
@@ -87,15 +86,6 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
87
86
|
form_id: number;
|
|
88
87
|
form_record_ids: number[];
|
|
89
88
|
}[];
|
|
90
|
-
export interface CartOrderHolder {
|
|
91
|
-
customer_id?: number;
|
|
92
|
-
form_id: number | string;
|
|
93
|
-
form_record: (number | string)[] | null;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
97
|
-
*/
|
|
98
|
-
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
99
89
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
100
90
|
export declare function createUuidV4(): string;
|
|
101
91
|
export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
|
|
@@ -33,9 +33,8 @@ __export(utils_exports, {
|
|
|
33
33
|
composeLinePrice: () => composeLinePrice,
|
|
34
34
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
35
35
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
36
|
-
createEmptySummary: () =>
|
|
36
|
+
createEmptySummary: () => import_utils2.createEmptySummary,
|
|
37
37
|
createUuidV4: () => createUuidV4,
|
|
38
|
-
ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
|
|
39
38
|
filterProductsForScanOrderMore: () => filterProductsForScanOrderMore,
|
|
40
39
|
formatDateTime: () => formatDateTime,
|
|
41
40
|
formatV1Product: () => formatV1Product,
|
|
@@ -51,9 +50,8 @@ __export(utils_exports, {
|
|
|
51
50
|
module.exports = __toCommonJS(utils_exports);
|
|
52
51
|
var import_dayjs = __toESM(require("dayjs"));
|
|
53
52
|
var import_decimal = __toESM(require("decimal.js"));
|
|
54
|
-
var import_utils = require("
|
|
53
|
+
var import_utils = require("../../solution/ScanOrder/utils");
|
|
55
54
|
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
56
|
-
var import_utils3 = require("../../solution/ScanOrder/utils");
|
|
57
55
|
function composeLinePrice(params) {
|
|
58
56
|
const { mainPrice, bundle, useOriginalBundle } = params;
|
|
59
57
|
let total = new import_decimal.default(Number(mainPrice) || 0);
|
|
@@ -115,7 +113,7 @@ function createDefaultOrderRulesHooks() {
|
|
|
115
113
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
116
114
|
// 不透明 identity 契约下,normalizeOrderProduct / restoreTempOrderFromStorage 已保证 identity_key 必存在;
|
|
117
115
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
118
|
-
_id: product.identity_key ? `${product.product_id}_${product.product_variant_id}_${product.identity_key}` : `${product.product_id}_${product.product_variant_id}_${(0,
|
|
116
|
+
_id: product.identity_key ? `${product.product_id}_${product.product_variant_id}_${product.identity_key}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils.buildProductLineFingerprint)(
|
|
119
117
|
product.product_option_item,
|
|
120
118
|
product.product_bundle
|
|
121
119
|
)}`,
|
|
@@ -198,34 +196,6 @@ var mergeRelationForms = (relationForms) => {
|
|
|
198
196
|
}, {})
|
|
199
197
|
).filter((item) => item.form_record_ids.length > 0);
|
|
200
198
|
};
|
|
201
|
-
function getCustomerIdFromStorage(window) {
|
|
202
|
-
var _a;
|
|
203
|
-
try {
|
|
204
|
-
const customer = JSON.parse(((_a = window == null ? void 0 : window.getLocalStorage) == null ? void 0 : _a.call(window, "customer")) || "{}");
|
|
205
|
-
const customerId = Number(customer == null ? void 0 : customer.id);
|
|
206
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId : void 0;
|
|
207
|
-
} catch {
|
|
208
|
-
return void 0;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
function ensureCartItemOriginHolder(cartItem, window) {
|
|
212
|
-
var _a;
|
|
213
|
-
if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
const holderConfig = (0, import_utils.getProductHolderConfig)(
|
|
217
|
-
(cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
|
|
218
|
-
);
|
|
219
|
-
const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
|
|
220
|
-
if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
cartItem._origin.holder = {
|
|
224
|
-
customer_id: getCustomerIdFromStorage(window),
|
|
225
|
-
form_id: holderConfig.resource_id,
|
|
226
|
-
form_record: [formRecordId]
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
199
|
var getAllDiscountList = (cartItem) => {
|
|
230
200
|
var _a, _b, _c, _d;
|
|
231
201
|
let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
|
|
@@ -408,7 +378,7 @@ function resolveSubmitCollectPax(tempOrder) {
|
|
|
408
378
|
return normalizeSubmitCollectPaxValue((_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax);
|
|
409
379
|
}
|
|
410
380
|
function createDefaultTempOrder(params) {
|
|
411
|
-
const summary = params.summary || (0,
|
|
381
|
+
const summary = params.summary || (0, import_utils.createEmptySummary)();
|
|
412
382
|
return {
|
|
413
383
|
order_id: null,
|
|
414
384
|
relation_id: void 0,
|
|
@@ -467,7 +437,7 @@ function buildSubmitPayload(params) {
|
|
|
467
437
|
enhance
|
|
468
438
|
} = params;
|
|
469
439
|
const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
470
|
-
const summary = tempOrder.summary || (0,
|
|
440
|
+
const summary = tempOrder.summary || (0, import_utils.createEmptySummary)();
|
|
471
441
|
const relationId = tempOrder.relation_id;
|
|
472
442
|
const tableFormId = tempOrder.table_form_id;
|
|
473
443
|
const bookingUuid = createUuidV4();
|
|
@@ -570,7 +540,6 @@ function formatV1Product(products) {
|
|
|
570
540
|
createDefaultTempOrder,
|
|
571
541
|
createEmptySummary,
|
|
572
542
|
createUuidV4,
|
|
573
|
-
ensureCartItemOriginHolder,
|
|
574
543
|
filterProductsForScanOrderMore,
|
|
575
544
|
formatDateTime,
|
|
576
545
|
formatV1Product,
|
|
@@ -189,13 +189,6 @@ export interface ProductData {
|
|
|
189
189
|
};
|
|
190
190
|
/** 购物车行键,用于唯一标识购物车中的商品,用于相同 SKU商品合并 */
|
|
191
191
|
rowKey?: string;
|
|
192
|
-
/** holder 表单配置 */
|
|
193
|
-
holder_config?: {
|
|
194
|
-
required?: number;
|
|
195
|
-
resource_id?: number;
|
|
196
|
-
status?: string;
|
|
197
|
-
[key: string]: any;
|
|
198
|
-
};
|
|
199
192
|
}
|
|
200
193
|
/**
|
|
201
194
|
* 商品媒体信息接口
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -34,7 +34,6 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
34
34
|
__reExport(modules_exports, require("./Quotation"), module.exports);
|
|
35
35
|
__reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
|
|
36
36
|
__reExport(modules_exports, require("./OpenData"), module.exports);
|
|
37
|
-
__reExport(modules_exports, require("./Holder"), module.exports);
|
|
38
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
38
|
0 && (module.exports = {
|
|
40
39
|
...require("./Product"),
|
|
@@ -54,6 +53,5 @@ __reExport(modules_exports, require("./Holder"), module.exports);
|
|
|
54
53
|
...require("./Schedule"),
|
|
55
54
|
...require("./Quotation"),
|
|
56
55
|
...require("./ScanOrderLogger"),
|
|
57
|
-
...require("./OpenData")
|
|
58
|
-
...require("./Holder")
|
|
56
|
+
...require("./OpenData")
|
|
59
57
|
});
|
package/lib/plugins/window.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
-
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
14
13
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
15
14
|
protected defaultName: string;
|
|
16
15
|
protected defaultVersion: string;
|
|
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
127
126
|
* @param params
|
|
128
127
|
*/
|
|
129
128
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* 获取 holder 表单 map
|
|
132
|
-
*/
|
|
133
|
-
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
-
/**
|
|
135
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
-
*/
|
|
137
|
-
refreshAllHolderFormRecords(params?: {
|
|
138
|
-
customer_id?: number;
|
|
139
|
-
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
-
/**
|
|
141
|
-
* 添加表单记录
|
|
142
|
-
*/
|
|
143
|
-
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
144
129
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
145
130
|
clearDateRange(): void;
|
|
146
131
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -89,7 +89,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
89
89
|
}
|
|
90
90
|
const moduleArr = [
|
|
91
91
|
"accountList",
|
|
92
|
-
"holder",
|
|
93
92
|
"cart",
|
|
94
93
|
"schedule",
|
|
95
94
|
"summary",
|
|
@@ -380,27 +379,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
380
379
|
}
|
|
381
380
|
return this.store.accountList.fetchHolderAccounts(params);
|
|
382
381
|
}
|
|
383
|
-
/**
|
|
384
|
-
* 获取 holder 表单 map
|
|
385
|
-
*/
|
|
386
|
-
getHolderFormMap() {
|
|
387
|
-
return this.store.holder.getHolderFormMap();
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
391
|
-
*/
|
|
392
|
-
async refreshAllHolderFormRecords(params) {
|
|
393
|
-
return this.store.holder.refreshAllFormRecords({
|
|
394
|
-
customer_id: params == null ? void 0 : params.customer_id,
|
|
395
|
-
useCache: false
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* 添加表单记录
|
|
400
|
-
*/
|
|
401
|
-
appendFormRecord(params) {
|
|
402
|
-
return this.store.holder.appendFormRecord(params);
|
|
403
|
-
}
|
|
404
382
|
// 设置日期范围,注入到日期模块中
|
|
405
383
|
async setDateRange(dateRange) {
|
|
406
384
|
this.store.date.setDateRange(dateRange);
|
|
@@ -508,14 +486,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
508
486
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
509
487
|
}
|
|
510
488
|
this.updateQuotationPriceAndCart(date);
|
|
511
|
-
try {
|
|
512
|
-
const customerId = Number(accountInfo.id);
|
|
513
|
-
await this.refreshAllHolderFormRecords({
|
|
514
|
-
customer_id: customerId
|
|
515
|
-
});
|
|
516
|
-
} catch (error) {
|
|
517
|
-
console.error("[BookingByStep] 登录后刷新 holder 表单失败", error);
|
|
518
|
-
}
|
|
519
489
|
}
|
|
520
490
|
} else {
|
|
521
491
|
throw new Error(`没有找到${accountId}账户`);
|
|
@@ -661,15 +631,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
661
631
|
account = activeAccount;
|
|
662
632
|
}
|
|
663
633
|
}
|
|
664
|
-
try {
|
|
665
|
-
this.store.holder.ensureFormByProduct({
|
|
666
|
-
product: productData,
|
|
667
|
-
shop_id: (productData == null ? void 0 : productData.shop_id) || "",
|
|
668
|
-
useCache: true
|
|
669
|
-
});
|
|
670
|
-
} catch (error) {
|
|
671
|
-
console.error("[BookingByStep] 加载 holder 表单失败", error);
|
|
672
|
-
}
|
|
673
634
|
const flag = this.store.cart.mergeCartItemByRowKey({
|
|
674
635
|
rowKey,
|
|
675
636
|
quantity,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -16,7 +16,6 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
-
holder: HolderModule;
|
|
20
19
|
}
|
|
21
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
22
21
|
export declare enum BookingByStepHooks {
|
|
@@ -81,11 +81,6 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
81
81
|
`${solutionName}_${name || moduleName}`,
|
|
82
82
|
version
|
|
83
83
|
);
|
|
84
|
-
case "holder":
|
|
85
|
-
return new import_modules.HolderModule(
|
|
86
|
-
`${solutionName}_${name || moduleName}`,
|
|
87
|
-
version
|
|
88
|
-
);
|
|
89
84
|
default:
|
|
90
85
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
91
86
|
}
|
|
@@ -34,7 +34,6 @@ export interface ScanOrderOrderProductIdentity {
|
|
|
34
34
|
/** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
|
|
35
35
|
product_option_item?: any[];
|
|
36
36
|
product_bundle?: any[];
|
|
37
|
-
shop_id?: number | string;
|
|
38
37
|
}
|
|
39
38
|
export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
40
39
|
order_detail_id: number | null;
|
|
@@ -7,7 +7,6 @@ import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
|
7
7
|
import type { ProductData } from '../../modules/Product/types';
|
|
8
8
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
9
9
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
10
|
-
import type { IAppendFormRecordParams, IRefreshAllFormRecordsParams } from '../../modules/Holder/types';
|
|
11
10
|
export * from './types';
|
|
12
11
|
interface VenueBookingItemRuleRuntimeConfig {
|
|
13
12
|
strategyConfigs?: StrategyConfig[];
|
|
@@ -53,12 +52,6 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
53
52
|
constructor(name?: string, version?: string);
|
|
54
53
|
private normalizeCustomerId;
|
|
55
54
|
private resolveCustomerIdFromLoginPayload;
|
|
56
|
-
private resolveHolderCustomerId;
|
|
57
|
-
/**
|
|
58
|
-
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
59
|
-
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
60
|
-
*/
|
|
61
|
-
private preloadHolderForms;
|
|
62
55
|
private clearLoginEffectListeners;
|
|
63
56
|
private registerLoginEffect;
|
|
64
57
|
private registerCustomerLoginListeners;
|
|
@@ -201,18 +194,6 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
201
194
|
getUIState<T = any>(key: string): T | undefined;
|
|
202
195
|
deleteUIState(key: string): void;
|
|
203
196
|
setBookingHolder(bookingUid: string, holder: any): void;
|
|
204
|
-
/**
|
|
205
|
-
* 获取 holder 表单 map
|
|
206
|
-
*/
|
|
207
|
-
getHolderFormMap(): import("../../modules/Holder").HolderFormMap;
|
|
208
|
-
/**
|
|
209
|
-
* UI 层触发:按当前 holderMap 批量刷新所有表单的 records
|
|
210
|
-
*/
|
|
211
|
-
refreshAllHolderFormRecords(params?: Pick<IRefreshAllFormRecordsParams, 'customer_id' | 'useCache' | 'recordsUrl' | 'num' | 'skip'>): Promise<import("../../modules/Holder").HolderFormMap>;
|
|
212
|
-
/**
|
|
213
|
-
* 添加表单记录
|
|
214
|
-
*/
|
|
215
|
-
appendFormRecord(params: IAppendFormRecordParams): import("../../modules/Holder").IFormRecord;
|
|
216
197
|
checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
|
|
217
198
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
218
199
|
cover?: boolean;
|
|
@@ -54,8 +54,6 @@ 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");
|
|
59
57
|
__reExport(VenueBooking_exports, require("./types"), module.exports);
|
|
60
58
|
var OPEN_DATA_SECTION_CODES = [
|
|
61
59
|
"basic",
|
|
@@ -255,42 +253,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
255
253
|
}
|
|
256
254
|
return null;
|
|
257
255
|
}
|
|
258
|
-
resolveHolderCustomerId() {
|
|
259
|
-
var _a, _b;
|
|
260
|
-
const customer = JSON.parse(((_b = (_a = this.window) == null ? void 0 : _a.getLocalStorage) == null ? void 0 : _b.call(_a, "customer")) || "{}");
|
|
261
|
-
if (customer == null ? void 0 : customer.id)
|
|
262
|
-
return Number(customer.id);
|
|
263
|
-
return void 0;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
267
|
-
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
268
|
-
*/
|
|
269
|
-
async preloadHolderForms(products) {
|
|
270
|
-
var _a, _b, _c, _d;
|
|
271
|
-
if (!this.store.holder || !products.length)
|
|
272
|
-
return;
|
|
273
|
-
const seenFormIds = /* @__PURE__ */ new Set();
|
|
274
|
-
for (const item of products) {
|
|
275
|
-
const holderConfig = (0, import_utils4.getProductHolderConfig)((_a = item == null ? void 0 : item._origin) == null ? void 0 : _a.product);
|
|
276
|
-
if (!holderConfig)
|
|
277
|
-
continue;
|
|
278
|
-
const formId = (0, import_utils4.getFormIdFromHolderConfig)(holderConfig);
|
|
279
|
-
if (seenFormIds.has(formId))
|
|
280
|
-
continue;
|
|
281
|
-
seenFormIds.add(formId);
|
|
282
|
-
try {
|
|
283
|
-
await this.store.holder.ensureFormByProduct({
|
|
284
|
-
product: ((_b = item == null ? void 0 : item._origin) == null ? void 0 : _b.product) || {},
|
|
285
|
-
customer_id: this.resolveHolderCustomerId(),
|
|
286
|
-
shop_id: (_d = (_c = item == null ? void 0 : item._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.shop_id,
|
|
287
|
-
useCache: true
|
|
288
|
-
});
|
|
289
|
-
} catch (error) {
|
|
290
|
-
console.error("[VenueBooking] 预加载 holder 表单失败", { formId, error });
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
256
|
clearLoginEffectListeners() {
|
|
295
257
|
for (const dispose of this.loginEffectDisposers) {
|
|
296
258
|
dispose();
|
|
@@ -337,12 +299,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
337
299
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
338
300
|
const refreshTask = (async () => {
|
|
339
301
|
var _a;
|
|
340
|
-
if (this.store.holder) {
|
|
341
|
-
await this.store.holder.refreshAllFormRecords({
|
|
342
|
-
customer_id: params.customerId,
|
|
343
|
-
useCache: false
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
302
|
if (this.store.quotation) {
|
|
347
303
|
await this.store.quotation.loadQuotations({
|
|
348
304
|
channel: (_a = this.otherParams) == null ? void 0 : _a.channel
|
|
@@ -370,7 +326,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
370
326
|
}
|
|
371
327
|
}
|
|
372
328
|
async initialize(core, options = {}) {
|
|
373
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
329
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
374
330
|
this.logMethodStart("initialize");
|
|
375
331
|
this.core = core;
|
|
376
332
|
this.initializeOptions = options || {};
|
|
@@ -495,42 +451,20 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
495
451
|
cacheId: (_g = this.otherParams) == null ? void 0 : _g.cacheId
|
|
496
452
|
}
|
|
497
453
|
});
|
|
498
|
-
let holderCacheState;
|
|
499
|
-
if ((_h = this.otherParams) == null ? void 0 : _h.cacheId) {
|
|
500
|
-
const sessionData = this.window.sessionStorage.getItem(this.name);
|
|
501
|
-
if (sessionData) {
|
|
502
|
-
try {
|
|
503
|
-
const data = JSON.parse(sessionData);
|
|
504
|
-
holderCacheState = (_i = data[this.otherParams.cacheId]) == null ? void 0 : _i[`${this.name}_holder`];
|
|
505
|
-
} catch {
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
const holderModule = new import_Holder.HolderModule(`${this.name}_holder`);
|
|
510
|
-
this.store.holder = holderModule;
|
|
511
|
-
this.core.registerModule(holderModule, {
|
|
512
|
-
initialState: holderCacheState,
|
|
513
|
-
otherParams: {
|
|
514
|
-
...this.otherParams,
|
|
515
|
-
fatherModule: this.name,
|
|
516
|
-
openCache: !!((_j = this.otherParams) == null ? void 0 : _j.cacheId),
|
|
517
|
-
cacheId: (_k = this.otherParams) == null ? void 0 : _k.cacheId
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
454
|
if (this.store.scanOrderLogger) {
|
|
521
455
|
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
522
456
|
}
|
|
523
457
|
this.registerCustomerLoginListeners();
|
|
524
458
|
console.log("[VenueBooking] 初始化开始");
|
|
525
459
|
try {
|
|
526
|
-
await ((
|
|
527
|
-
(
|
|
460
|
+
await ((_h = this.store.order) == null ? void 0 : _h.recalculateSummary({ createIfMissing: false }));
|
|
461
|
+
(_i = this.store.order) == null ? void 0 : _i.persistTempOrder();
|
|
528
462
|
await this.loadRuntimeConfigs();
|
|
529
463
|
if (this.store.schedule) {
|
|
530
464
|
await this.store.schedule.loadAllSchedule();
|
|
531
465
|
this.injectScheduleResolverToQuotation();
|
|
532
|
-
(
|
|
533
|
-
channel: (
|
|
466
|
+
(_k = this.store.quotation) == null ? void 0 : _k.loadQuotations({
|
|
467
|
+
channel: (_j = this.otherParams) == null ? void 0 : _j.channel
|
|
534
468
|
});
|
|
535
469
|
}
|
|
536
470
|
await this.refreshItemRuleQuantityLimits();
|
|
@@ -617,7 +551,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
617
551
|
return this.loadAllProductsInFlight;
|
|
618
552
|
}
|
|
619
553
|
async _doLoadAllProducts() {
|
|
620
|
-
var _a, _b, _c
|
|
554
|
+
var _a, _b, _c;
|
|
621
555
|
this.logMethodStart("loadAllProducts");
|
|
622
556
|
try {
|
|
623
557
|
if (!this.store.venueProducts)
|
|
@@ -646,10 +580,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
646
580
|
}
|
|
647
581
|
this.store.addonProducts.addProduct(addonList);
|
|
648
582
|
this.resourceProductMap = (0, import_resource.buildResourceProductMap)(venueList);
|
|
649
|
-
if (this.store.order) {
|
|
650
|
-
const products = ((_e = (_d = this.store.order) == null ? void 0 : _d.getOrderProducts) == null ? void 0 : _e.call(_d)) || [];
|
|
651
|
-
await this.preloadHolderForms(products);
|
|
652
|
-
}
|
|
653
583
|
this.productsLoaded = true;
|
|
654
584
|
this.logMethodSuccess("loadAllProducts", {
|
|
655
585
|
total: list.length,
|
|
@@ -1042,7 +972,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1042
972
|
* 同一场地下不同商品互不干扰,各自单独 reconcile。
|
|
1043
973
|
*/
|
|
1044
974
|
async reconcileOrderForResourceProduct(resourceId, productId, slots) {
|
|
1045
|
-
var _a, _b;
|
|
1046
975
|
const mappings = this.resourceProductMap.get(resourceId);
|
|
1047
976
|
if (!mappings || !mappings.length || !this.store.order)
|
|
1048
977
|
return;
|
|
@@ -1056,10 +985,10 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1056
985
|
);
|
|
1057
986
|
tempOrder.bookings = (tempOrder.bookings || []).filter(
|
|
1058
987
|
(b) => {
|
|
1059
|
-
var
|
|
1060
|
-
if (!((
|
|
988
|
+
var _a, _b, _c, _d;
|
|
989
|
+
if (!((_a = b.metadata) == null ? void 0 : _a.venue_booking))
|
|
1061
990
|
return true;
|
|
1062
|
-
if (String((
|
|
991
|
+
if (String((_b = b.metadata) == null ? void 0 : _b.resource_id) !== String(resourceId))
|
|
1063
992
|
return true;
|
|
1064
993
|
const bookingProductId = ((_c = b.metadata) == null ? void 0 : _c.product_id) ?? ((_d = b == null ? void 0 : b.product) == null ? void 0 : _d.product_id);
|
|
1065
994
|
if (bookingProductId == null)
|
|
@@ -1151,10 +1080,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1151
1080
|
product_option_item: [],
|
|
1152
1081
|
discount_list: [],
|
|
1153
1082
|
custom_deposit_data: customDepositData,
|
|
1154
|
-
metadata: {}
|
|
1155
|
-
holder_config: venueProduct == null ? void 0 : venueProduct.holder_config,
|
|
1156
|
-
bookingUuid,
|
|
1157
|
-
shop_id: (venueProduct == null ? void 0 : venueProduct.shop_id) || 0
|
|
1083
|
+
metadata: {}
|
|
1158
1084
|
},
|
|
1159
1085
|
sub_type: "minutes",
|
|
1160
1086
|
duration,
|
|
@@ -1185,8 +1111,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1185
1111
|
});
|
|
1186
1112
|
tempOrder.bookings.push(booking);
|
|
1187
1113
|
}
|
|
1188
|
-
const products = ((_b = (_a = this.store.order) == null ? void 0 : _a.getOrderProducts) == null ? void 0 : _b.call(_a)) || [];
|
|
1189
|
-
await this.preloadHolderForms(products);
|
|
1190
1114
|
this.store.order.applyDiscount();
|
|
1191
1115
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
1192
1116
|
this.store.order.persistTempOrder();
|
|
@@ -1973,57 +1897,15 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1973
1897
|
}
|
|
1974
1898
|
}
|
|
1975
1899
|
setBookingHolder(bookingUid, holder) {
|
|
1976
|
-
var _a
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
var _a2;
|
|
1983
|
-
return ((_a2 = b.metadata) == null ? void 0 : _a2.unique_identification_number) === bookingUid;
|
|
1984
|
-
}
|
|
1985
|
-
);
|
|
1900
|
+
var _a;
|
|
1901
|
+
const order = this.getTempOrder();
|
|
1902
|
+
const booking = (_a = order == null ? void 0 : order.bookings) == null ? void 0 : _a.find((b) => {
|
|
1903
|
+
var _a2;
|
|
1904
|
+
return ((_a2 = b.metadata) == null ? void 0 : _a2.unique_identification_number) === bookingUid;
|
|
1905
|
+
});
|
|
1986
1906
|
if (booking) {
|
|
1987
1907
|
booking.holder = holder;
|
|
1988
1908
|
}
|
|
1989
|
-
for (const product of tempOrder.products) {
|
|
1990
|
-
const productBookingUid = ((_b = product.metadata) == null ? void 0 : _b.booking_uid) ?? ((_d = (_c = product._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.bookingUuid);
|
|
1991
|
-
if (String(productBookingUid) !== String(bookingUid))
|
|
1992
|
-
continue;
|
|
1993
|
-
const origin = product._origin && typeof product._origin === "object" ? product._origin : {};
|
|
1994
|
-
origin.holder = holder;
|
|
1995
|
-
product._origin = origin;
|
|
1996
|
-
}
|
|
1997
|
-
this.store.order.notifyTempOrderChanged();
|
|
1998
|
-
}
|
|
1999
|
-
/**
|
|
2000
|
-
* 获取 holder 表单 map
|
|
2001
|
-
*/
|
|
2002
|
-
getHolderFormMap() {
|
|
2003
|
-
if (!this.store.holder)
|
|
2004
|
-
throw new Error("[VenueBooking] holder 模块未初始化");
|
|
2005
|
-
return this.store.holder.getHolderFormMap();
|
|
2006
|
-
}
|
|
2007
|
-
/**
|
|
2008
|
-
* UI 层触发:按当前 holderMap 批量刷新所有表单的 records
|
|
2009
|
-
*/
|
|
2010
|
-
async refreshAllHolderFormRecords(params) {
|
|
2011
|
-
if (!this.store.holder)
|
|
2012
|
-
throw new Error("[VenueBooking] holder 模块未初始化");
|
|
2013
|
-
const customer_id = (params == null ? void 0 : params.customer_id) ?? this.resolveHolderCustomerId();
|
|
2014
|
-
return this.store.holder.refreshAllFormRecords({
|
|
2015
|
-
...params,
|
|
2016
|
-
customer_id,
|
|
2017
|
-
useCache: (params == null ? void 0 : params.useCache) ?? false
|
|
2018
|
-
});
|
|
2019
|
-
}
|
|
2020
|
-
/**
|
|
2021
|
-
* 添加表单记录
|
|
2022
|
-
*/
|
|
2023
|
-
appendFormRecord(params) {
|
|
2024
|
-
if (!this.store.holder)
|
|
2025
|
-
throw new Error("[VenueBooking] holder 模块未初始化");
|
|
2026
|
-
return this.store.holder.appendFormRecord(params);
|
|
2027
1909
|
}
|
|
2028
1910
|
// ─── OpenData 可用性 ───
|
|
2029
1911
|
async checkOpenDataAvailability() {
|