@pisell/pisellos 2.3.39 → 2.3.41
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 +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +750 -509
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +7 -3
- package/dist/solution/BookingTicket/index.js +132 -49
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +196 -86
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +7 -3
- package/lib/solution/BookingTicket/index.js +62 -9
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- 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/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- 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
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -35,7 +35,6 @@ export interface ScanOrderOrderProductIdentity {
|
|
|
35
35
|
/** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
|
|
36
36
|
product_sku?: ScanOrderProductSku;
|
|
37
37
|
product_bundle?: any[];
|
|
38
|
-
shop_id?: number | string;
|
|
39
38
|
}
|
|
40
39
|
export interface ScanOrderProductSku {
|
|
41
40
|
option: any[];
|
|
@@ -208,7 +207,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
|
|
|
208
207
|
}>;
|
|
209
208
|
products: ScanOrderSubmitProduct[];
|
|
210
209
|
}
|
|
211
|
-
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | '
|
|
210
|
+
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
212
211
|
export interface ScanOrderTableFormRecord {
|
|
213
212
|
policy?: string | null;
|
|
214
213
|
partyroom_booking?: string | null;
|
|
@@ -251,10 +250,6 @@ export interface ScanOrderResourceOccupyDetail {
|
|
|
251
250
|
form_id?: number | string | null;
|
|
252
251
|
order_id?: number | string | null;
|
|
253
252
|
last_order_id?: number | string | null;
|
|
254
|
-
order_list?: Array<{
|
|
255
|
-
id?: number | string | null;
|
|
256
|
-
[key: string]: any;
|
|
257
|
-
}> | null;
|
|
258
253
|
resource_capacity?: ScanOrderResourceCapacity[] | null;
|
|
259
254
|
form_record?: ScanOrderTableFormRecord | null;
|
|
260
255
|
[key: string]: any;
|
|
@@ -268,21 +263,6 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
|
|
|
268
263
|
} | null;
|
|
269
264
|
}
|
|
270
265
|
export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
|
|
271
|
-
export interface ScanOrderReservationResourceSelectInfo {
|
|
272
|
-
resourceSelectType?: ScanOrderResourceSelectType;
|
|
273
|
-
isSingleReservation: boolean;
|
|
274
|
-
isMultipleReservation: boolean;
|
|
275
|
-
isCapacityReservation: boolean;
|
|
276
|
-
}
|
|
277
|
-
export interface ScanOrderAllowAddItemsInfo {
|
|
278
|
-
enabled: boolean;
|
|
279
|
-
}
|
|
280
|
-
export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'add_items_disabled' | 'invalid_order_id';
|
|
281
|
-
export interface ScanOrderSyncAdditionalOrderResult {
|
|
282
|
-
matched: boolean;
|
|
283
|
-
order_id?: string;
|
|
284
|
-
reason?: ScanOrderSyncAdditionalOrderReason;
|
|
285
|
-
}
|
|
286
266
|
export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
|
|
287
267
|
relationId?: string;
|
|
288
268
|
tableFormId?: string;
|
|
@@ -2,7 +2,6 @@ import { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderResource
|
|
|
2
2
|
import type { CartItemSummary, ItemRuleBusinessData, PaxInfo, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
3
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
4
4
|
import type { ProductData } from '../../modules/Product/types';
|
|
5
|
-
import type { OrderSubmitProduct } from '../../modules/Order/types';
|
|
6
5
|
/**
|
|
7
6
|
* 构建金额全为 0 的空 summary。
|
|
8
7
|
* 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
|
|
@@ -43,8 +42,6 @@ export declare function toNonNegativeNumber(value: unknown): number;
|
|
|
43
42
|
export declare function toNonNegativeInt(value: unknown): number;
|
|
44
43
|
export declare function toPriceString(value: unknown, fallback?: string): string;
|
|
45
44
|
export declare function buildProductKey(productId: number, productVariantId: number): string;
|
|
46
|
-
/** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
|
|
47
|
-
export declare function filterProductsForScanOrderMore<T extends OrderSubmitProduct>(products?: T[]): T[];
|
|
48
45
|
export declare function getTopLevelProductId(product: Record<string, any>): number | null;
|
|
49
46
|
export declare function getTopLevelVariantId(product: Record<string, any>): number | null;
|
|
50
47
|
export declare function buildQuantityLimitIndex(limits: QuantityLimitResult[]): {
|
|
@@ -137,11 +134,6 @@ export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderPro
|
|
|
137
134
|
* 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
|
|
138
135
|
*/
|
|
139
136
|
export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
|
|
140
|
-
/**
|
|
141
|
-
* 找到第一个归属指定桌台的预约规则商品。
|
|
142
|
-
* 归属判断基于商品资源中的 default_resource / optional_resource。
|
|
143
|
-
*/
|
|
144
|
-
export declare function findReservationRuleProductByResourceId(products: ProductData[], resourceId: string | number | null | undefined): ProductData | undefined;
|
|
145
137
|
/**
|
|
146
138
|
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
147
139
|
*/
|
|
@@ -154,15 +154,6 @@ export function toPriceString(value) {
|
|
|
154
154
|
export function buildProductKey(productId, productVariantId) {
|
|
155
155
|
return "".concat(productId, "_").concat(productVariantId);
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
/** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
|
|
159
|
-
export function filterProductsForScanOrderMore() {
|
|
160
|
-
var products = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
161
|
-
return products.filter(function (product) {
|
|
162
|
-
var _product$metadata;
|
|
163
|
-
return ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_rule) !== true;
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
157
|
export function getTopLevelProductId(product) {
|
|
167
158
|
var _product$product_id;
|
|
168
159
|
var rawProductId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id;
|
|
@@ -491,11 +482,11 @@ export function getProductIdentityIndex(products, identity) {
|
|
|
491
482
|
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
492
483
|
*/
|
|
493
484
|
export function normalizeOrderProduct(product) {
|
|
494
|
-
var _product$
|
|
485
|
+
var _product$metadata, _metadata$origin, _product$product_sku, _metadata$origin2, _variantList$find, _product$is_charge_ta;
|
|
495
486
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
496
487
|
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
497
488
|
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
498
|
-
var resolvedIdentityKey = (_product$
|
|
489
|
+
var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
499
490
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
500
491
|
var priceOverride = metadata.price_override;
|
|
501
492
|
var originOtherBundle = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin._extend) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin.other) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.bundle;
|
|
@@ -704,55 +695,23 @@ export function collectLinkProductIdsFromReservationRules(rules) {
|
|
|
704
695
|
}
|
|
705
696
|
|
|
706
697
|
/**
|
|
707
|
-
*
|
|
708
|
-
* 归属判断基于商品资源中的 default_resource / optional_resource。
|
|
698
|
+
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
709
699
|
*/
|
|
710
|
-
export function
|
|
711
|
-
var numericResourceId = Number(resourceId);
|
|
712
|
-
if (!Number.isFinite(numericResourceId) || numericResourceId <= 0) return undefined;
|
|
700
|
+
export function pickFirstDurationMinutesFromProducts(products) {
|
|
713
701
|
var _iterator7 = _createForOfIteratorHelper(products),
|
|
714
702
|
_step7;
|
|
715
703
|
try {
|
|
716
704
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
717
|
-
var _product$product_reso;
|
|
718
|
-
var product = _step7.value;
|
|
719
|
-
var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
|
|
720
|
-
if (!Array.isArray(resources)) continue;
|
|
721
|
-
var hasMatchedResource = resources.some(function (resource) {
|
|
722
|
-
var defaultResources = Array.isArray(resource === null || resource === void 0 ? void 0 : resource.default_resource) ? resource.default_resource : [];
|
|
723
|
-
var optionalResources = Array.isArray(resource === null || resource === void 0 ? void 0 : resource.optional_resource) ? resource.optional_resource : [];
|
|
724
|
-
return [].concat(_toConsumableArray(defaultResources), _toConsumableArray(optionalResources)).some(function (id) {
|
|
725
|
-
return Number(id) === numericResourceId;
|
|
726
|
-
});
|
|
727
|
-
});
|
|
728
|
-
if (hasMatchedResource) return product;
|
|
729
|
-
}
|
|
730
|
-
} catch (err) {
|
|
731
|
-
_iterator7.e(err);
|
|
732
|
-
} finally {
|
|
733
|
-
_iterator7.f();
|
|
734
|
-
}
|
|
735
|
-
return undefined;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
740
|
-
*/
|
|
741
|
-
export function pickFirstDurationMinutesFromProducts(products) {
|
|
742
|
-
var _iterator8 = _createForOfIteratorHelper(products),
|
|
743
|
-
_step8;
|
|
744
|
-
try {
|
|
745
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
746
705
|
var _product$duration;
|
|
747
|
-
var product =
|
|
706
|
+
var product = _step7.value;
|
|
748
707
|
var value = product === null || product === void 0 || (_product$duration = product.duration) === null || _product$duration === void 0 ? void 0 : _product$duration.value;
|
|
749
708
|
var n = Number(value);
|
|
750
709
|
if (Number.isFinite(n) && n > 0) return Math.floor(n);
|
|
751
710
|
}
|
|
752
711
|
} catch (err) {
|
|
753
|
-
|
|
712
|
+
_iterator7.e(err);
|
|
754
713
|
} finally {
|
|
755
|
-
|
|
714
|
+
_iterator7.f();
|
|
756
715
|
}
|
|
757
716
|
return undefined;
|
|
758
717
|
}
|
|
@@ -782,11 +741,11 @@ export function computeResourceIsFull(params) {
|
|
|
782
741
|
if (!Number.isFinite(totalCapacity) || totalCapacity <= 0) return false;
|
|
783
742
|
var now = dayjs();
|
|
784
743
|
var occupied = 0;
|
|
785
|
-
var
|
|
786
|
-
|
|
744
|
+
var _iterator8 = _createForOfIteratorHelper(capacityList || []),
|
|
745
|
+
_step8;
|
|
787
746
|
try {
|
|
788
|
-
for (
|
|
789
|
-
var slot =
|
|
747
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
748
|
+
var slot = _step8.value;
|
|
790
749
|
var start = dayjs(slot === null || slot === void 0 ? void 0 : slot.start_at);
|
|
791
750
|
var end = dayjs(slot === null || slot === void 0 ? void 0 : slot.end_at);
|
|
792
751
|
if (!start.isValid() || !end.isValid()) continue;
|
|
@@ -796,9 +755,9 @@ export function computeResourceIsFull(params) {
|
|
|
796
755
|
}
|
|
797
756
|
}
|
|
798
757
|
} catch (err) {
|
|
799
|
-
|
|
758
|
+
_iterator8.e(err);
|
|
800
759
|
} finally {
|
|
801
|
-
|
|
760
|
+
_iterator8.f();
|
|
802
761
|
}
|
|
803
762
|
return occupied >= totalCapacity;
|
|
804
763
|
}
|
|
@@ -808,11 +767,11 @@ export function computeResourceIsFull(params) {
|
|
|
808
767
|
* 仅返回有限数字字段;若均无法解析则返回 `undefined`。
|
|
809
768
|
*/
|
|
810
769
|
export function pickFirstCustomCapacityPaxBounds(products) {
|
|
811
|
-
var
|
|
812
|
-
|
|
770
|
+
var _iterator9 = _createForOfIteratorHelper(products),
|
|
771
|
+
_step9;
|
|
813
772
|
try {
|
|
814
|
-
for (
|
|
815
|
-
var p =
|
|
773
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
774
|
+
var p = _step9.value;
|
|
816
775
|
var cap = p === null || p === void 0 ? void 0 : p.capacity;
|
|
817
776
|
if (!cap || cap.type !== 'custom') continue;
|
|
818
777
|
if (!Array.isArray(cap.custom) || cap.custom.length === 0) continue;
|
|
@@ -831,9 +790,9 @@ export function pickFirstCustomCapacityPaxBounds(products) {
|
|
|
831
790
|
if (out.min !== undefined || out.max !== undefined) return out;
|
|
832
791
|
}
|
|
833
792
|
} catch (err) {
|
|
834
|
-
|
|
793
|
+
_iterator9.e(err);
|
|
835
794
|
} finally {
|
|
836
|
-
|
|
795
|
+
_iterator9.f();
|
|
837
796
|
}
|
|
838
797
|
return undefined;
|
|
839
798
|
}
|
|
@@ -843,11 +802,11 @@ export function pickFirstCustomCapacityPaxBounds(products) {
|
|
|
843
802
|
* 无匹配时返回 `undefined`,调用方应回退为 `0`。
|
|
844
803
|
*/
|
|
845
804
|
export function pickFirstCustomCapacityDimensionId(products) {
|
|
846
|
-
var
|
|
847
|
-
|
|
805
|
+
var _iterator10 = _createForOfIteratorHelper(products),
|
|
806
|
+
_step10;
|
|
848
807
|
try {
|
|
849
|
-
for (
|
|
850
|
-
var p =
|
|
808
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
809
|
+
var p = _step10.value;
|
|
851
810
|
var cap = p === null || p === void 0 ? void 0 : p.capacity;
|
|
852
811
|
if (!cap || cap.type !== 'custom') continue;
|
|
853
812
|
if (!Array.isArray(cap.custom) || cap.custom.length === 0) continue;
|
|
@@ -863,9 +822,9 @@ export function pickFirstCustomCapacityDimensionId(products) {
|
|
|
863
822
|
}
|
|
864
823
|
}
|
|
865
824
|
} catch (err) {
|
|
866
|
-
|
|
825
|
+
_iterator10.e(err);
|
|
867
826
|
} finally {
|
|
868
|
-
|
|
827
|
+
_iterator10.f();
|
|
869
828
|
}
|
|
870
829
|
return undefined;
|
|
871
830
|
}
|
|
@@ -40,7 +40,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
40
40
|
discountList: Discount[];
|
|
41
41
|
};
|
|
42
42
|
setProductList(productList: Record<string, any>[]): void;
|
|
43
|
-
batchSearchByProductIds(productIds: number[]): Promise<Discount[]>;
|
|
44
43
|
scanCode(code: string, customerId?: number): Promise<{
|
|
45
44
|
isAvailable: boolean;
|
|
46
45
|
productList: Record<string, any>[];
|