@pisell/pisellos 2.1.153 → 2.1.155
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/solution/ScanOrder/index.d.ts +6 -2
- package/dist/solution/ScanOrder/index.js +259 -62
- package/dist/solution/ScanOrder/types.d.ts +20 -1
- package/dist/solution/ScanOrder/utils.d.ts +5 -0
- package/dist/solution/ScanOrder/utils.js +55 -23
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +13 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/solution/ScanOrder/index.d.ts +6 -2
- package/lib/solution/ScanOrder/index.js +221 -51
- package/lib/solution/ScanOrder/types.d.ts +20 -1
- package/lib/solution/ScanOrder/utils.d.ts +5 -0
- package/lib/solution/ScanOrder/utils.js +23 -0
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +11 -0
- package/package.json +1 -1
|
@@ -185,7 +185,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
|
|
|
185
185
|
}>;
|
|
186
186
|
products: ScanOrderSubmitProduct[];
|
|
187
187
|
}
|
|
188
|
-
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
188
|
+
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'multiple_orders' | 'additional_order_with_code' | 'additional_order';
|
|
189
189
|
export interface ScanOrderTableFormRecord {
|
|
190
190
|
policy?: string | null;
|
|
191
191
|
partyroom_booking?: string | null;
|
|
@@ -228,6 +228,10 @@ export interface ScanOrderResourceOccupyDetail {
|
|
|
228
228
|
form_id?: number | string | null;
|
|
229
229
|
order_id?: number | string | null;
|
|
230
230
|
last_order_id?: number | string | null;
|
|
231
|
+
order_list?: Array<{
|
|
232
|
+
id?: number | string | null;
|
|
233
|
+
[key: string]: any;
|
|
234
|
+
}> | null;
|
|
231
235
|
resource_capacity?: ScanOrderResourceCapacity[] | null;
|
|
232
236
|
form_record?: ScanOrderTableFormRecord | null;
|
|
233
237
|
[key: string]: any;
|
|
@@ -241,6 +245,21 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
|
|
|
241
245
|
} | null;
|
|
242
246
|
}
|
|
243
247
|
export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
|
|
248
|
+
export interface ScanOrderReservationResourceSelectInfo {
|
|
249
|
+
resourceSelectType?: ScanOrderResourceSelectType;
|
|
250
|
+
isSingleReservation: boolean;
|
|
251
|
+
isMultipleReservation: boolean;
|
|
252
|
+
isCapacityReservation: boolean;
|
|
253
|
+
}
|
|
254
|
+
export interface ScanOrderAllowAddItemsInfo {
|
|
255
|
+
enabled: boolean;
|
|
256
|
+
}
|
|
257
|
+
export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'add_items_disabled' | 'invalid_order_id';
|
|
258
|
+
export interface ScanOrderSyncAdditionalOrderResult {
|
|
259
|
+
matched: boolean;
|
|
260
|
+
order_id?: string;
|
|
261
|
+
reason?: ScanOrderSyncAdditionalOrderReason;
|
|
262
|
+
}
|
|
244
263
|
export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
|
|
245
264
|
relationId?: string;
|
|
246
265
|
tableFormId?: string;
|
|
@@ -134,6 +134,11 @@ export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderPro
|
|
|
134
134
|
* 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
|
|
135
135
|
*/
|
|
136
136
|
export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
|
|
137
|
+
/**
|
|
138
|
+
* 找到第一个归属指定桌台的预约规则商品。
|
|
139
|
+
* 归属判断基于商品资源中的 default_resource / optional_resource。
|
|
140
|
+
*/
|
|
141
|
+
export declare function findReservationRuleProductByResourceId(products: ProductData[], resourceId: string | number | null | undefined): ProductData | undefined;
|
|
137
142
|
/**
|
|
138
143
|
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
139
144
|
*/
|
|
@@ -39,6 +39,7 @@ __export(utils_exports, {
|
|
|
39
39
|
computeResourceIsFull: () => computeResourceIsFull,
|
|
40
40
|
createEmptySummary: () => createEmptySummary,
|
|
41
41
|
extractStrategyModelIdsFromTableConfig: () => extractStrategyModelIdsFromTableConfig,
|
|
42
|
+
findReservationRuleProductByResourceId: () => findReservationRuleProductByResourceId,
|
|
42
43
|
getProductIdentityIndex: () => getProductIdentityIndex,
|
|
43
44
|
getSafeProductNum: () => getSafeProductNum,
|
|
44
45
|
getTopLevelProductId: () => getTopLevelProductId,
|
|
@@ -510,6 +511,27 @@ function collectLinkProductIdsFromReservationRules(rules) {
|
|
|
510
511
|
}
|
|
511
512
|
return [...new Set(ids)];
|
|
512
513
|
}
|
|
514
|
+
function findReservationRuleProductByResourceId(products, resourceId) {
|
|
515
|
+
var _a;
|
|
516
|
+
const numericResourceId = Number(resourceId);
|
|
517
|
+
if (!Number.isFinite(numericResourceId) || numericResourceId <= 0)
|
|
518
|
+
return void 0;
|
|
519
|
+
for (const product of products) {
|
|
520
|
+
const resources = (_a = product == null ? void 0 : product.product_resource) == null ? void 0 : _a.resources;
|
|
521
|
+
if (!Array.isArray(resources))
|
|
522
|
+
continue;
|
|
523
|
+
const hasMatchedResource = resources.some((resource) => {
|
|
524
|
+
const defaultResources = Array.isArray(resource == null ? void 0 : resource.default_resource) ? resource.default_resource : [];
|
|
525
|
+
const optionalResources = Array.isArray(resource == null ? void 0 : resource.optional_resource) ? resource.optional_resource : [];
|
|
526
|
+
return [...defaultResources, ...optionalResources].some(
|
|
527
|
+
(id) => Number(id) === numericResourceId
|
|
528
|
+
);
|
|
529
|
+
});
|
|
530
|
+
if (hasMatchedResource)
|
|
531
|
+
return product;
|
|
532
|
+
}
|
|
533
|
+
return void 0;
|
|
534
|
+
}
|
|
513
535
|
function pickFirstDurationMinutesFromProducts(products) {
|
|
514
536
|
var _a;
|
|
515
537
|
for (const product of products) {
|
|
@@ -613,6 +635,7 @@ function pickFirstCustomCapacityDimensionId(products) {
|
|
|
613
635
|
computeResourceIsFull,
|
|
614
636
|
createEmptySummary,
|
|
615
637
|
extractStrategyModelIdsFromTableConfig,
|
|
638
|
+
findReservationRuleProductByResourceId,
|
|
616
639
|
getProductIdentityIndex,
|
|
617
640
|
getSafeProductNum,
|
|
618
641
|
getTopLevelProductId,
|
|
@@ -193,6 +193,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
193
193
|
setUIState(key: string, value: any): void;
|
|
194
194
|
getUIState<T = any>(key: string): T | undefined;
|
|
195
195
|
deleteUIState(key: string): void;
|
|
196
|
+
setBookingHolder(bookingUid: string, holder: any): void;
|
|
196
197
|
checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
|
|
197
198
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
198
199
|
cover?: boolean;
|
|
@@ -1896,6 +1896,17 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1896
1896
|
this.writeUIStateBucket(bucket);
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
+
setBookingHolder(bookingUid, holder) {
|
|
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
|
+
});
|
|
1906
|
+
if (booking) {
|
|
1907
|
+
booking.holder = holder;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1899
1910
|
// ─── OpenData 可用性 ───
|
|
1900
1911
|
async checkOpenDataAvailability() {
|
|
1901
1912
|
if (!this.store.openData)
|