@pisell/pisellos 2.1.160 → 2.1.162
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/types.d.ts +2 -0
- 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/Rules/index.js +13 -0
- package/dist/modules/Summary/utils.js +42 -21
- 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/index.js +1 -1
- 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/Discount/types.d.ts +2 -0
- 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/Rules/index.js +8 -0
- package/lib/modules/Summary/utils.js +23 -3
- 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/index.js +1 -1
- 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
|
@@ -33,6 +33,8 @@ interface Limitedrelationproductdata {
|
|
|
33
33
|
product_ids: number[];
|
|
34
34
|
product_collection_id: number[];
|
|
35
35
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
36
|
+
exclude_product_ids?: number[];
|
|
37
|
+
filter?: 0 | 1;
|
|
36
38
|
}
|
|
37
39
|
interface ApplicableProductDetails {
|
|
38
40
|
amount: string;
|
|
@@ -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
|
* 商品媒体信息接口
|
|
@@ -362,6 +362,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
362
362
|
}
|
|
363
363
|
return priceB.minus(priceA).toNumber();
|
|
364
364
|
});
|
|
365
|
+
const isProductIncludedByLimitedData = (limitedData, productId) => {
|
|
366
|
+
const excludedIds = (limitedData == null ? void 0 : limitedData.exclude_product_ids) || [];
|
|
367
|
+
const isExcluded = (limitedData == null ? void 0 : limitedData.filter) === 1 && excludedIds.some((id) => String(id) === String(productId));
|
|
368
|
+
return !isExcluded;
|
|
369
|
+
};
|
|
365
370
|
const usedDiscounts = /* @__PURE__ */ new Map();
|
|
366
371
|
const discountApplicability = /* @__PURE__ */ new Map();
|
|
367
372
|
const discountApplicableProducts = /* @__PURE__ */ new Map();
|
|
@@ -632,6 +637,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
632
637
|
return false;
|
|
633
638
|
}
|
|
634
639
|
if (limitedData.type === "product_all") {
|
|
640
|
+
if (!isProductIncludedByLimitedData(limitedData, product.id)) {
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
635
643
|
if (!this.checkPackageSubItemUsageRules(discount, flatItem)) {
|
|
636
644
|
return false;
|
|
637
645
|
}
|
|
@@ -373,6 +373,26 @@ var calculateTaxFee = (shopInfo, items) => {
|
|
|
373
373
|
}, new import_decimal.default(0));
|
|
374
374
|
return totalTaxFee;
|
|
375
375
|
};
|
|
376
|
+
var getCartItemDepositData = (item) => {
|
|
377
|
+
var _a, _b, _c, _d;
|
|
378
|
+
const target = item;
|
|
379
|
+
return ((_a = target == null ? void 0 : target._productOrigin) == null ? void 0 : _a.custom_deposit_data) || ((_b = target == null ? void 0 : target._origin) == null ? void 0 : _b.custom_deposit_data) || ((_d = (_c = target == null ? void 0 : target._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.custom_deposit_data);
|
|
380
|
+
};
|
|
381
|
+
var getCartItemQuantity = (item) => {
|
|
382
|
+
return new import_decimal.default((item == null ? void 0 : item.num) || 1);
|
|
383
|
+
};
|
|
384
|
+
var calculateCartItemDepositTotal = (item) => {
|
|
385
|
+
var _a;
|
|
386
|
+
const depositData = getCartItemDepositData(item);
|
|
387
|
+
if ((depositData == null ? void 0 : depositData.has_deposit) == 1 && typeof (depositData == null ? void 0 : depositData.deposit_fixed) === "string" && typeof (depositData == null ? void 0 : depositData.deposit_percentage) === "string") {
|
|
388
|
+
const lineTotal = new import_decimal.default(item.summaryTotal ?? item.total ?? 0);
|
|
389
|
+
const quantity = getCartItemQuantity(item);
|
|
390
|
+
const fixedTotal = new import_decimal.default(depositData.deposit_fixed || 0).times(quantity);
|
|
391
|
+
const percentageTotal = new import_decimal.default(depositData.deposit_percentage || 0).times(lineTotal);
|
|
392
|
+
return fixedTotal.plus(percentageTotal);
|
|
393
|
+
}
|
|
394
|
+
return new import_decimal.default(((_a = item == null ? void 0 : item.deposit) == null ? void 0 : _a.total) || 0);
|
|
395
|
+
};
|
|
376
396
|
var calculateDeposit = (items) => {
|
|
377
397
|
if (!(items == null ? void 0 : items.length)) {
|
|
378
398
|
return void 0;
|
|
@@ -380,11 +400,11 @@ var calculateDeposit = (items) => {
|
|
|
380
400
|
const protocols = [];
|
|
381
401
|
let hasDeposit = false;
|
|
382
402
|
const total = items.reduce((sum, item) => {
|
|
383
|
-
var _a, _b
|
|
403
|
+
var _a, _b;
|
|
384
404
|
if (item == null ? void 0 : item.deposit) {
|
|
385
405
|
hasDeposit = true;
|
|
386
|
-
const cartItemTotalPrice =
|
|
387
|
-
(
|
|
406
|
+
const cartItemTotalPrice = calculateCartItemDepositTotal(item);
|
|
407
|
+
(_b = (_a = item == null ? void 0 : item.deposit) == null ? void 0 : _a.protocols) == null ? void 0 : _b.forEach((protocol) => {
|
|
388
408
|
if (protocols.findIndex((p) => p.id === protocol.id) === -1) {
|
|
389
409
|
protocols.push(protocol);
|
|
390
410
|
}
|
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
|
}
|
|
@@ -563,7 +563,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
563
563
|
...tempOrder.metadata || {},
|
|
564
564
|
shop_service_data: {
|
|
565
565
|
...(tempOrder.metadata || {}).shop_service_data || {},
|
|
566
|
-
service_type: ((_a = this.otherParams) == null ? void 0 : _a.businessCode) === "dine_in" ? "dine_in" : "",
|
|
566
|
+
service_type: ((_a = this.otherParams) == null ? void 0 : _a.businessCode) === "dine_in" ? "dine_in" : "take_away",
|
|
567
567
|
pickup_reference_mode: mode
|
|
568
568
|
}
|
|
569
569
|
};
|
|
@@ -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;
|