@pisell/pisellos 2.2.259 → 2.2.260
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/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +152 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +755 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +282 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +146 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +13 -17
- package/dist/modules/Order/index.d.ts +1 -32
- package/dist/modules/Order/index.js +288 -615
- package/dist/modules/Order/types.d.ts +2 -20
- package/dist/modules/Order/utils.d.ts +0 -4
- package/dist/modules/Order/utils.js +28 -114
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +22 -0
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -2
- package/dist/modules/ProductList/types.d.ts +2 -0
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +3 -8
- package/dist/modules/Rules/types.d.ts +1 -2
- package/dist/modules/SalesSummary/index.d.ts +3 -7
- package/dist/modules/SalesSummary/index.js +39 -67
- package/dist/modules/SalesSummary/types.d.ts +0 -1
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/SurchargeList/index.d.ts +4 -6
- package/dist/modules/SurchargeList/index.js +39 -62
- package/dist/modules/SurchargeList/types.d.ts +2 -6
- package/dist/server/index.d.ts +50 -3
- package/dist/server/index.js +1040 -1075
- package/dist/server/modules/order/index.d.ts +3 -22
- package/dist/server/modules/order/index.js +316 -398
- package/dist/server/modules/products/index.d.ts +26 -7
- package/dist/server/modules/products/index.js +166 -76
- package/dist/server/modules/products/types.d.ts +14 -0
- package/dist/solution/BaseSales/index.d.ts +2 -22
- package/dist/solution/BaseSales/index.js +701 -995
- package/dist/solution/BaseSales/types.d.ts +0 -1
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -6
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -8
- package/dist/solution/BookingTicket/index.js +6 -153
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +139 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +564 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +295 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +146 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -11
- package/lib/modules/Order/index.d.ts +1 -32
- package/lib/modules/Order/index.js +64 -402
- package/lib/modules/Order/types.d.ts +2 -20
- package/lib/modules/Order/utils.d.ts +0 -4
- package/lib/modules/Order/utils.js +2 -84
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +22 -0
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -2
- package/lib/modules/ProductList/types.d.ts +2 -0
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +3 -4
- package/lib/modules/Rules/types.d.ts +1 -2
- package/lib/modules/SalesSummary/index.d.ts +3 -7
- package/lib/modules/SalesSummary/index.js +11 -28
- package/lib/modules/SalesSummary/types.d.ts +0 -1
- package/lib/modules/SalesSummary/utils.js +0 -2
- package/lib/modules/SurchargeList/index.d.ts +4 -6
- package/lib/modules/SurchargeList/index.js +21 -41
- package/lib/modules/SurchargeList/types.d.ts +2 -6
- package/lib/server/index.d.ts +50 -3
- package/lib/server/index.js +215 -244
- package/lib/server/modules/order/index.d.ts +3 -22
- package/lib/server/modules/order/index.js +53 -103
- package/lib/server/modules/products/index.d.ts +26 -7
- package/lib/server/modules/products/index.js +113 -35
- package/lib/server/modules/products/types.d.ts +14 -0
- package/lib/solution/BaseSales/index.d.ts +2 -22
- package/lib/solution/BaseSales/index.js +60 -246
- package/lib/solution/BaseSales/types.d.ts +0 -1
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +0 -8
- package/lib/solution/BookingTicket/index.js +0 -101
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
- package/dist/modules/Order/utils/bundleDiscountHydration.js +0 -144
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
- package/lib/modules/Order/utils/bundleDiscountHydration.js +0 -139
|
@@ -491,7 +491,7 @@ export interface OrderPaymentData {
|
|
|
491
491
|
voucher_id?: string | number;
|
|
492
492
|
origin_amount?: string;
|
|
493
493
|
service_fee?: string;
|
|
494
|
-
status?: 'active' | '
|
|
494
|
+
status?: 'active' | 'voided' | string;
|
|
495
495
|
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
496
496
|
payment_time?: string;
|
|
497
497
|
wallet_pass_usage_unit?: unknown;
|
|
@@ -537,15 +537,9 @@ export interface SyncPaymentsToOrderParams {
|
|
|
537
537
|
smallTicketDataFlag?: number;
|
|
538
538
|
businessCode?: string;
|
|
539
539
|
channel?: string;
|
|
540
|
-
confirmPendingVoucherPayments?: boolean;
|
|
541
540
|
}
|
|
542
541
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
543
542
|
isFullyPaid: boolean;
|
|
544
|
-
isOrderFullyPaid: boolean;
|
|
545
|
-
isDepositFullyPaid: boolean;
|
|
546
|
-
paymentStage: 'deposit' | 'normal';
|
|
547
|
-
depositAmount: string;
|
|
548
|
-
orderExpectedAmount: string;
|
|
549
543
|
submitResult?: T;
|
|
550
544
|
}
|
|
551
545
|
export interface OrderIdentitySnapshot {
|
|
@@ -697,7 +691,6 @@ export interface OrderModuleAPI {
|
|
|
697
691
|
payments?: OrderPaymentSource[];
|
|
698
692
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
699
693
|
smallTicketDataFlag?: number;
|
|
700
|
-
confirmPendingVoucherPayments?: boolean;
|
|
701
694
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
702
695
|
}) => Promise<T>;
|
|
703
696
|
submitTempOrderAsync: <T = any>(params?: {
|
|
@@ -709,7 +702,6 @@ export interface OrderModuleAPI {
|
|
|
709
702
|
payments?: OrderPaymentSource[];
|
|
710
703
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
711
704
|
smallTicketDataFlag?: number;
|
|
712
|
-
confirmPendingVoucherPayments?: boolean;
|
|
713
705
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
714
706
|
}) => Promise<T>;
|
|
715
707
|
getOrderPayments: () => OrderPaymentData[];
|
|
@@ -717,17 +709,7 @@ export interface OrderModuleAPI {
|
|
|
717
709
|
addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
|
|
718
710
|
updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
|
|
719
711
|
deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
|
|
720
|
-
updateVoucherOrderPayments: (payments: OrderPaymentSource[]
|
|
721
|
-
status?: 'paid' | 'payment_pending';
|
|
722
|
-
}) => OrderPaymentData[];
|
|
723
|
-
confirmPendingVoucherPayments: (options?: {
|
|
724
|
-
persist?: boolean;
|
|
725
|
-
recalculateSummary?: boolean;
|
|
726
|
-
}) => OrderPaymentData[];
|
|
727
|
-
discardPendingVoucherPayments: (options?: {
|
|
728
|
-
persist?: boolean;
|
|
729
|
-
recalculateSummary?: boolean;
|
|
730
|
-
}) => OrderPaymentData[];
|
|
712
|
+
updateVoucherOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
731
713
|
sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
|
|
732
714
|
saveDraft: () => Promise<void>;
|
|
733
715
|
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
|
|
@@ -254,10 +254,6 @@ export declare function clearTempOrderHolderAssignments(tempOrder: OrderTempOrde
|
|
|
254
254
|
* getOrderProductLineUid({ metadata: { unique_identification_number: 'line-1' } }); // 'line-1'
|
|
255
255
|
*/
|
|
256
256
|
export declare function getOrderProductLineUid(product: Record<string, any> | null | undefined): string | null;
|
|
257
|
-
export declare function getRuntimeProductOrigin(tempOrder: OrderTempOrder | null | undefined, product: any): Record<string, any> | null;
|
|
258
|
-
export declare function isHolderConfigRequired(holderConfig: any): boolean;
|
|
259
|
-
export declare function productRequiresFormSubject(tempOrder: OrderTempOrder | null | undefined, product: any): boolean;
|
|
260
|
-
export declare function resolveIsFormSubject(tempOrder: OrderTempOrder | null | undefined, product?: any): boolean;
|
|
261
257
|
/**
|
|
262
258
|
* 判断展示字段是否为空(含 i18n 对象全空)。
|
|
263
259
|
*
|
|
@@ -49,11 +49,9 @@ __export(utils_exports, {
|
|
|
49
49
|
getBundleSignedUnit: () => getBundleSignedUnit,
|
|
50
50
|
getOrderProductLineUid: () => getOrderProductLineUid,
|
|
51
51
|
getProductSkuOptions: () => getProductSkuOptions,
|
|
52
|
-
getRuntimeProductOrigin: () => getRuntimeProductOrigin,
|
|
53
52
|
hasAssignedHolderId: () => hasAssignedHolderId,
|
|
54
53
|
indexOrderProductsByUid: () => indexOrderProductsByUid,
|
|
55
54
|
isEmptyOrderProductDisplayValue: () => isEmptyOrderProductDisplayValue,
|
|
56
|
-
isHolderConfigRequired: () => isHolderConfigRequired,
|
|
57
55
|
isMarkdownBundle: () => isMarkdownBundle,
|
|
58
56
|
isTempOrder: () => isTempOrder,
|
|
59
57
|
mapPaymentItemToOrderPayment: () => mapPaymentItemToOrderPayment,
|
|
@@ -67,9 +65,7 @@ __export(utils_exports, {
|
|
|
67
65
|
normalizeProductSkuOptions: () => normalizeProductSkuOptions,
|
|
68
66
|
normalizeSubmitBooking: () => normalizeSubmitBooking,
|
|
69
67
|
normalizeSubmitCollectPaxValue: () => normalizeSubmitCollectPaxValue,
|
|
70
|
-
productRequiresFormSubject: () => productRequiresFormSubject,
|
|
71
68
|
resolveEffectivePerUnitDiscount: () => resolveEffectivePerUnitDiscount,
|
|
72
|
-
resolveIsFormSubject: () => resolveIsFormSubject,
|
|
73
69
|
resolveManualDiscountMessage: () => import_manualProductDiscount.resolveManualDiscountMessage,
|
|
74
70
|
resolveManualDiscountOriginTotal: () => import_manualProductDiscount.resolveManualDiscountOriginTotal,
|
|
75
71
|
resolveManualDiscountReasonFromSources: () => import_manualProductDiscount.resolveManualDiscountReasonFromSources,
|
|
@@ -380,42 +376,6 @@ function normalizeOrderProductDiscountList(discountList) {
|
|
|
380
376
|
return normalized;
|
|
381
377
|
});
|
|
382
378
|
}
|
|
383
|
-
function resolveSubmitBundleMapId(bundle) {
|
|
384
|
-
var _a;
|
|
385
|
-
const metadataMapId = (_a = bundle.metadata) == null ? void 0 : _a.custom_product_bundle_map_id;
|
|
386
|
-
if (metadataMapId !== void 0 && metadataMapId !== null && metadataMapId !== "") {
|
|
387
|
-
return metadataMapId;
|
|
388
|
-
}
|
|
389
|
-
if (bundle._id !== void 0 && bundle._id !== null && bundle._id !== "") {
|
|
390
|
-
return bundle._id;
|
|
391
|
-
}
|
|
392
|
-
return void 0;
|
|
393
|
-
}
|
|
394
|
-
function collectSubmitProductDiscountList(product) {
|
|
395
|
-
const submitDiscountList = Array.isArray(product == null ? void 0 : product.discount_list) ? [...product.discount_list] : [];
|
|
396
|
-
for (const bundle of (product == null ? void 0 : product.product_bundle) || []) {
|
|
397
|
-
if (!bundle || typeof bundle !== "object")
|
|
398
|
-
continue;
|
|
399
|
-
const bundleMapId = resolveSubmitBundleMapId(bundle);
|
|
400
|
-
const bundleDiscountList = Array.isArray(bundle.discount_list) ? bundle.discount_list : [];
|
|
401
|
-
for (const discount of bundleDiscountList) {
|
|
402
|
-
if (!discount || typeof discount !== "object")
|
|
403
|
-
continue;
|
|
404
|
-
const discountMetadata = discount.metadata && typeof discount.metadata === "object" ? discount.metadata : {};
|
|
405
|
-
const discountMapId = discountMetadata.custom_product_bundle_map_id !== void 0 && discountMetadata.custom_product_bundle_map_id !== null && discountMetadata.custom_product_bundle_map_id !== "" ? discountMetadata.custom_product_bundle_map_id : bundleMapId;
|
|
406
|
-
submitDiscountList.push({
|
|
407
|
-
...discount,
|
|
408
|
-
...discountMapId !== void 0 ? {
|
|
409
|
-
metadata: {
|
|
410
|
-
...discountMetadata,
|
|
411
|
-
custom_product_bundle_map_id: discountMapId
|
|
412
|
-
}
|
|
413
|
-
} : {}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return normalizeOrderProductDiscountList(submitDiscountList);
|
|
418
|
-
}
|
|
419
379
|
function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
|
|
420
380
|
var _a, _b;
|
|
421
381
|
const metadata = params.metadata || {};
|
|
@@ -711,10 +671,6 @@ function formatSubmitBundleItems(bundle) {
|
|
|
711
671
|
return bundle.map((b) => {
|
|
712
672
|
const rawBundle = b && typeof b === "object" ? b : {};
|
|
713
673
|
const existedMetadata = rawBundle.metadata && typeof rawBundle.metadata === "object" ? rawBundle.metadata : {};
|
|
714
|
-
const {
|
|
715
|
-
custom_product_bundle_map_id: _customProductBundleMapId,
|
|
716
|
-
...submitMetadata
|
|
717
|
-
} = existedMetadata;
|
|
718
674
|
const sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
|
|
719
675
|
const paymentPrice = rawBundle.bundle_payment_price !== void 0 && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== "" ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
|
|
720
676
|
const priceValue = rawBundle.price ?? rawBundle.custom_price ?? rawBundle.bundle_selling_price;
|
|
@@ -727,8 +683,6 @@ function formatSubmitBundleItems(bundle) {
|
|
|
727
683
|
0
|
|
728
684
|
);
|
|
729
685
|
const num = toBundleNumber(rawBundle.num ?? rawBundle.quantity, 1);
|
|
730
|
-
const bundleMapId = resolveSubmitBundleMapId(rawBundle);
|
|
731
|
-
const hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
|
|
732
686
|
return {
|
|
733
687
|
is_charge_tax: rawBundle.is_charge_tax ?? 0,
|
|
734
688
|
bundle_variant_id: rawBundle.bundle_variant_id ?? 0,
|
|
@@ -746,8 +700,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
746
700
|
bundle_id: (rawBundle == null ? void 0 : rawBundle.bundle_id) ?? (rawBundle == null ? void 0 : rawBundle.id),
|
|
747
701
|
bundle_product_id: (rawBundle == null ? void 0 : rawBundle.bundle_product_id) ?? (rawBundle == null ? void 0 : rawBundle._bundle_product_id),
|
|
748
702
|
metadata: {
|
|
749
|
-
...
|
|
750
|
-
...hasSubmitBundleDiscounts && bundleMapId !== void 0 ? { custom_product_bundle_map_id: bundleMapId } : {},
|
|
703
|
+
...existedMetadata,
|
|
751
704
|
surcharge_fee: surchargeFee,
|
|
752
705
|
relation_surcharge_ids: relationSurchargeIds,
|
|
753
706
|
product_discount_difference: productDiscountDifference
|
|
@@ -812,7 +765,7 @@ function normalizeSubmitProduct(product) {
|
|
|
812
765
|
...bookingUid ? { booking_uid: bookingUid } : {},
|
|
813
766
|
product_quantity: toBundleNumber(num ?? submitProduct.product_quantity, 1),
|
|
814
767
|
product_sku: productSku,
|
|
815
|
-
discount_list:
|
|
768
|
+
discount_list: normalizeOrderProductDiscountList(submitProduct.discount_list),
|
|
816
769
|
product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
|
|
817
770
|
metadata: cleanMetadata,
|
|
818
771
|
// 出站兼容:后端消费 payment_price 字段(行 composite 已减整单折扣均摊)。
|
|
@@ -1141,37 +1094,6 @@ function getOrderProductLineUid(product) {
|
|
|
1141
1094
|
return null;
|
|
1142
1095
|
return String(uid);
|
|
1143
1096
|
}
|
|
1144
|
-
function getRuntimeProductOrigin(tempOrder, product) {
|
|
1145
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1146
|
-
const uid = getOrderProductLineUid(product);
|
|
1147
|
-
if (uid && ((_c = (_b = (_a = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _a.productsByUid) == null ? void 0 : _b[uid]) == null ? void 0 : _c.origin)) {
|
|
1148
|
-
return tempOrder._extend.productsByUid[uid].origin;
|
|
1149
|
-
}
|
|
1150
|
-
const matchedProduct = ((tempOrder == null ? void 0 : tempOrder.products) || []).find((item) => item === product || getOrderProductLineUid(item) === uid || String((item == null ? void 0 : item.product_id) ?? (item == null ? void 0 : item.id) ?? "") === String((product == null ? void 0 : product.product_id) ?? (product == null ? void 0 : product.id) ?? ""));
|
|
1151
|
-
const matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : "";
|
|
1152
|
-
return matchedUid ? ((_f = (_e = (_d = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _d.productsByUid) == null ? void 0 : _e[matchedUid]) == null ? void 0 : _f.origin) || null : null;
|
|
1153
|
-
}
|
|
1154
|
-
function isHolderConfigRequired(holderConfig) {
|
|
1155
|
-
if (!holderConfig || typeof holderConfig !== "object")
|
|
1156
|
-
return false;
|
|
1157
|
-
if (holderConfig.status === "disable")
|
|
1158
|
-
return false;
|
|
1159
|
-
return Number(holderConfig.required) === 1;
|
|
1160
|
-
}
|
|
1161
|
-
function productRequiresFormSubject(tempOrder, product) {
|
|
1162
|
-
const runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
|
|
1163
|
-
return isHolderConfigRequired(product == null ? void 0 : product.holder_config) || isHolderConfigRequired(runtimeOrigin == null ? void 0 : runtimeOrigin.holder_config);
|
|
1164
|
-
}
|
|
1165
|
-
function resolveIsFormSubject(tempOrder, product) {
|
|
1166
|
-
var _a;
|
|
1167
|
-
if (((_a = tempOrder == null ? void 0 : tempOrder.holder) == null ? void 0 : _a.type) === "form")
|
|
1168
|
-
return true;
|
|
1169
|
-
if (product)
|
|
1170
|
-
return productRequiresFormSubject(tempOrder, product);
|
|
1171
|
-
return ((tempOrder == null ? void 0 : tempOrder.products) || []).some(
|
|
1172
|
-
(item) => productRequiresFormSubject(tempOrder, item)
|
|
1173
|
-
);
|
|
1174
|
-
}
|
|
1175
1097
|
function isEmptyOrderProductDisplayValue(value) {
|
|
1176
1098
|
if (value === void 0 || value === null)
|
|
1177
1099
|
return true;
|
|
@@ -1252,11 +1174,9 @@ function indexOrderProductsByUid(products) {
|
|
|
1252
1174
|
getBundleSignedUnit,
|
|
1253
1175
|
getOrderProductLineUid,
|
|
1254
1176
|
getProductSkuOptions,
|
|
1255
|
-
getRuntimeProductOrigin,
|
|
1256
1177
|
hasAssignedHolderId,
|
|
1257
1178
|
indexOrderProductsByUid,
|
|
1258
1179
|
isEmptyOrderProductDisplayValue,
|
|
1259
|
-
isHolderConfigRequired,
|
|
1260
1180
|
isMarkdownBundle,
|
|
1261
1181
|
isTempOrder,
|
|
1262
1182
|
mapPaymentItemToOrderPayment,
|
|
@@ -1270,9 +1190,7 @@ function indexOrderProductsByUid(products) {
|
|
|
1270
1190
|
normalizeProductSkuOptions,
|
|
1271
1191
|
normalizeSubmitBooking,
|
|
1272
1192
|
normalizeSubmitCollectPaxValue,
|
|
1273
|
-
productRequiresFormSubject,
|
|
1274
1193
|
resolveEffectivePerUnitDiscount,
|
|
1275
|
-
resolveIsFormSubject,
|
|
1276
1194
|
resolveManualDiscountMessage,
|
|
1277
1195
|
resolveManualDiscountOriginTotal,
|
|
1278
1196
|
resolveManualDiscountReasonFromSources,
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -9,6 +9,26 @@ export interface ProductCollection {
|
|
|
9
9
|
/** 商品集合封面 */
|
|
10
10
|
cover: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
|
|
14
|
+
*/
|
|
15
|
+
export interface ProductDataVariant {
|
|
16
|
+
/** 变体记录 id */
|
|
17
|
+
id: number;
|
|
18
|
+
/** 店铺 id */
|
|
19
|
+
shop_id: number;
|
|
20
|
+
/** 所属模块,商品场景固定为 product */
|
|
21
|
+
module: string;
|
|
22
|
+
/** 模块数据 id,商品场景对应 product.id */
|
|
23
|
+
module_data_id: number;
|
|
24
|
+
/** 关联 data_variant_rule.id */
|
|
25
|
+
data_variant_rule_id: number;
|
|
26
|
+
/** 命中策略后覆盖到商品上的字段 */
|
|
27
|
+
data: Record<string, any>;
|
|
28
|
+
created_at: string | null;
|
|
29
|
+
updated_at: string | null;
|
|
30
|
+
deleted_at: string | null;
|
|
31
|
+
}
|
|
12
32
|
/**
|
|
13
33
|
* 商品基本信息接口
|
|
14
34
|
*/
|
|
@@ -214,6 +234,8 @@ export interface ProductData {
|
|
|
214
234
|
bundle_group_count: number;
|
|
215
235
|
/** 选项组数量 */
|
|
216
236
|
option_group_count: number;
|
|
237
|
+
/** 智能定价变体列表,/product/query with dataVariants 返回 */
|
|
238
|
+
data_variants?: ProductDataVariant[];
|
|
217
239
|
/** 服务时长 */
|
|
218
240
|
service_times?: any;
|
|
219
241
|
}
|
|
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
26
26
|
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
27
27
|
*/
|
|
28
28
|
getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
|
|
29
|
-
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, }?: ProductListLoadProductsParams, options?: {
|
|
29
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, strategy_context, }?: ProductListLoadProductsParams, options?: {
|
|
30
30
|
callback?: (result: any) => void;
|
|
31
31
|
subscriberId?: string;
|
|
32
32
|
}): Promise<any>;
|
|
@@ -95,7 +95,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
95
95
|
cacheId,
|
|
96
96
|
with_schedule,
|
|
97
97
|
extension_type,
|
|
98
|
-
status = "published"
|
|
98
|
+
status = "published",
|
|
99
|
+
strategy_context
|
|
99
100
|
} = {}, options) {
|
|
100
101
|
var _a, _b;
|
|
101
102
|
let userPlugin = this.core.getPlugin("user");
|
|
@@ -135,7 +136,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
135
136
|
is_eject: 1,
|
|
136
137
|
with_schedule,
|
|
137
138
|
schedule_datetime,
|
|
138
|
-
extension_type
|
|
139
|
+
extension_type,
|
|
140
|
+
strategy_context
|
|
139
141
|
},
|
|
140
142
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
141
143
|
} }
|
|
@@ -12,6 +12,8 @@ export interface ProductListLoadProductsParams {
|
|
|
12
12
|
with_schedule?: number;
|
|
13
13
|
extension_type?: string[];
|
|
14
14
|
status?: string;
|
|
15
|
+
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
+
strategy_context?: Record<string, any>;
|
|
15
17
|
}
|
|
16
18
|
export interface ProductListData {
|
|
17
19
|
list: ProductData[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Rules, RulesModuleAPI, DiscountResult,
|
|
3
|
+
import { Rules, RulesModuleAPI, DiscountResult, UnavailableReason } from './types';
|
|
4
4
|
import { Discount } from '../Discount/types';
|
|
5
5
|
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
6
6
|
import { WindowPlugin } from '../../plugins';
|
|
@@ -24,7 +24,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
24
24
|
holders: {
|
|
25
25
|
form_record_id: number;
|
|
26
26
|
}[];
|
|
27
|
-
isFormSubject:
|
|
27
|
+
isFormSubject: boolean;
|
|
28
28
|
}): {
|
|
29
29
|
isAvailable: boolean;
|
|
30
30
|
discountList: Discount[];
|
|
@@ -43,7 +43,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
43
43
|
holders: {
|
|
44
44
|
form_record_id: number;
|
|
45
45
|
}[];
|
|
46
|
-
isFormSubject:
|
|
46
|
+
isFormSubject: boolean;
|
|
47
47
|
orderTotalAmount: number;
|
|
48
48
|
}, options?: {
|
|
49
49
|
isSelected?: boolean;
|
|
@@ -70,7 +70,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
70
70
|
var _a;
|
|
71
71
|
if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form")
|
|
72
72
|
return true;
|
|
73
|
-
const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id
|
|
73
|
+
const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : void 0;
|
|
74
74
|
const productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
|
|
75
75
|
if (!product.isNeedHolder)
|
|
76
76
|
return true;
|
|
@@ -207,7 +207,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
207
207
|
orderTotalAmount
|
|
208
208
|
}, options) {
|
|
209
209
|
var _a;
|
|
210
|
-
const resolveIsFormSubject = (product) => typeof isFormSubject === "function" ? Boolean(isFormSubject(product)) : Boolean(isFormSubject);
|
|
211
210
|
const isEditModeAddNewProduct = productList.find((n) => n.booking_id) && productList.find((n) => !n.booking_id);
|
|
212
211
|
const editModeDiscount = [];
|
|
213
212
|
const addModeDiscount = [];
|
|
@@ -597,7 +596,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
597
596
|
const isHolderMatch = this.checkHolderMatch(
|
|
598
597
|
discount,
|
|
599
598
|
{
|
|
600
|
-
isNeedHolder:
|
|
599
|
+
isNeedHolder: isFormSubject && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
|
|
601
600
|
holder_id: (_tempVar == null ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
602
601
|
},
|
|
603
602
|
holders
|
|
@@ -768,7 +767,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
768
767
|
const isHolderMatch = this.checkHolderMatch(
|
|
769
768
|
discount,
|
|
770
769
|
{
|
|
771
|
-
isNeedHolder:
|
|
770
|
+
isNeedHolder: isFormSubject && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
|
|
772
771
|
holder_id: (_tempVar == null ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
773
772
|
},
|
|
774
773
|
holders
|
|
@@ -22,7 +22,6 @@ export interface DiscountResult {
|
|
|
22
22
|
productList: any[];
|
|
23
23
|
discountList: any[];
|
|
24
24
|
}
|
|
25
|
-
export type RulesFormSubject = boolean | ((product: any) => boolean);
|
|
26
25
|
export interface RulesModuleAPI {
|
|
27
26
|
setRulesList: (rulesList: Rules[]) => Promise<void>;
|
|
28
27
|
clear: () => Promise<void>;
|
|
@@ -32,7 +31,7 @@ export interface RulesModuleAPI {
|
|
|
32
31
|
holders: {
|
|
33
32
|
form_record_id: number;
|
|
34
33
|
}[];
|
|
35
|
-
isFormSubject:
|
|
34
|
+
isFormSubject: boolean;
|
|
36
35
|
orderTotalAmount: number;
|
|
37
36
|
}) => DiscountResult;
|
|
38
37
|
}
|
|
@@ -9,19 +9,16 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
9
9
|
private store;
|
|
10
10
|
private request;
|
|
11
11
|
private surchargeListModuleName;
|
|
12
|
-
private otherParams;
|
|
13
|
-
private surchargeListChannel;
|
|
14
12
|
constructor(name?: string, version?: string);
|
|
15
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
14
|
/**
|
|
17
|
-
* 更新父级解决方案透传的运行态参数,并在 surcharge
|
|
15
|
+
* 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
|
|
18
16
|
*
|
|
19
17
|
* @example
|
|
20
|
-
* await salesSummaryModule.updateOtherParams({
|
|
18
|
+
* await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
|
|
21
19
|
*/
|
|
22
20
|
updateOtherParams(params: Record<string, any>): Promise<void>;
|
|
23
|
-
|
|
24
|
-
getSurchargeList(channel?: string): Promise<void>;
|
|
21
|
+
getSurchargeList(): Promise<void>;
|
|
25
22
|
private getAppData;
|
|
26
23
|
private getTaxConfig;
|
|
27
24
|
getSummary(params: {
|
|
@@ -29,7 +26,6 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
29
26
|
isPriceIncludeTax?: number;
|
|
30
27
|
taxRate?: number;
|
|
31
28
|
shopDiscount?: string | number;
|
|
32
|
-
channel?: string;
|
|
33
29
|
}): Promise<{
|
|
34
30
|
tax_title: string;
|
|
35
31
|
tax_rate: number | undefined;
|
|
@@ -33,15 +33,12 @@ var salesSummaryDataKeys = {
|
|
|
33
33
|
taxTitle: "tax_title",
|
|
34
34
|
taxCountryCode: "tax_country_code"
|
|
35
35
|
};
|
|
36
|
-
var DEFAULT_SURCHARGE_CHANNEL = "online-store";
|
|
37
36
|
var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
38
37
|
constructor(name, version) {
|
|
39
38
|
super(name, version);
|
|
40
39
|
this.defaultName = "salesSummary";
|
|
41
40
|
this.defaultVersion = "1.0.0";
|
|
42
41
|
this.surchargeListModuleName = "surchargeList";
|
|
43
|
-
this.otherParams = {};
|
|
44
|
-
this.surchargeListChannel = DEFAULT_SURCHARGE_CHANNEL;
|
|
45
42
|
}
|
|
46
43
|
async initialize(core, options) {
|
|
47
44
|
var _a, _b, _c;
|
|
@@ -49,10 +46,9 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
49
46
|
this.store = options.store;
|
|
50
47
|
this.appPlugin = this.core.getPlugin("app");
|
|
51
48
|
this.request = this.core.getPlugin("request");
|
|
52
|
-
this.otherParams = options.otherParams || {};
|
|
53
49
|
this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
|
|
54
50
|
this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
|
|
55
|
-
this.surchargeListModuleName = ((_c =
|
|
51
|
+
this.surchargeListModuleName = ((_c = options.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
|
|
56
52
|
if (!this.appPlugin) {
|
|
57
53
|
throw new Error("SalesSummaryModule 需要 app 插件支持");
|
|
58
54
|
}
|
|
@@ -62,50 +58,41 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
62
58
|
await this.getSurchargeList();
|
|
63
59
|
}
|
|
64
60
|
/**
|
|
65
|
-
* 更新父级解决方案透传的运行态参数,并在 surcharge
|
|
61
|
+
* 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
|
|
66
62
|
*
|
|
67
63
|
* @example
|
|
68
|
-
* await salesSummaryModule.updateOtherParams({
|
|
64
|
+
* await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
|
|
69
65
|
*/
|
|
70
66
|
async updateOtherParams(params) {
|
|
71
|
-
const previousChannel = this.resolveChannel();
|
|
72
67
|
const nextSurchargeListModuleName = (params == null ? void 0 : params.surchargeListModuleName) || "surchargeList";
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.otherParams = params || {};
|
|
68
|
+
if (nextSurchargeListModuleName === this.surchargeListModuleName)
|
|
69
|
+
return;
|
|
76
70
|
this.surchargeListModuleName = nextSurchargeListModuleName;
|
|
77
|
-
|
|
78
|
-
await this.getSurchargeList(nextChannel);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
resolveChannel(params = this.otherParams) {
|
|
82
|
-
return (params == null ? void 0 : params.channel) || DEFAULT_SURCHARGE_CHANNEL;
|
|
71
|
+
await this.getSurchargeList();
|
|
83
72
|
}
|
|
84
|
-
async getSurchargeList(
|
|
73
|
+
async getSurchargeList() {
|
|
85
74
|
try {
|
|
86
75
|
const surchargeListModule = this.core.getModule(
|
|
87
76
|
this.surchargeListModuleName
|
|
88
77
|
);
|
|
89
78
|
if (surchargeListModule == null ? void 0 : surchargeListModule.getSurchargeList) {
|
|
90
|
-
this.store.surchargeList = await surchargeListModule.getSurchargeList(
|
|
91
|
-
this.surchargeListChannel = channel;
|
|
79
|
+
this.store.surchargeList = await surchargeListModule.getSurchargeList();
|
|
92
80
|
return;
|
|
93
81
|
}
|
|
94
82
|
const surchargeList = await this.request.get(
|
|
95
83
|
"/order/custom-surcharge/available/v2",
|
|
96
84
|
{
|
|
97
|
-
|
|
85
|
+
// TODO 真实的渠道
|
|
86
|
+
channel: "online-store",
|
|
98
87
|
is_assemble_product_data: 1,
|
|
99
88
|
is_assemble_schedule_data: 1,
|
|
100
89
|
with: ["relationSchedule"]
|
|
101
90
|
}
|
|
102
91
|
);
|
|
103
92
|
this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
|
|
104
|
-
this.surchargeListChannel = channel;
|
|
105
93
|
} catch (error) {
|
|
106
94
|
console.warn("[SalesSummaryModule] 加载附加费配置失败", error);
|
|
107
95
|
this.store.surchargeList = [];
|
|
108
|
-
this.surchargeListChannel = channel;
|
|
109
96
|
}
|
|
110
97
|
}
|
|
111
98
|
getAppData(key) {
|
|
@@ -127,11 +114,7 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
127
114
|
}
|
|
128
115
|
async getSummary(params) {
|
|
129
116
|
var _a, _b;
|
|
130
|
-
const { products = [], isPriceIncludeTax, taxRate, shopDiscount
|
|
131
|
-
const summaryChannel = channel || this.resolveChannel();
|
|
132
|
-
if (summaryChannel !== this.surchargeListChannel) {
|
|
133
|
-
await this.getSurchargeList(summaryChannel);
|
|
134
|
-
}
|
|
117
|
+
const { products = [], isPriceIncludeTax, taxRate, shopDiscount } = params;
|
|
135
118
|
const taxConfig = this.getTaxConfig();
|
|
136
119
|
const summarySchedule = this.core.getModule(
|
|
137
120
|
`${this.name.split("_")[0]}_schedule`
|
|
@@ -308,8 +308,6 @@ function getFallbackAllProductSurchargeIds(surchargeList) {
|
|
|
308
308
|
return ids;
|
|
309
309
|
if (Number(config.is_all ?? 0) !== 1)
|
|
310
310
|
return ids;
|
|
311
|
-
if (Number(config.open_schedule ?? 0) === 1 && config.schedule_type !== "all")
|
|
312
|
-
return ids;
|
|
313
311
|
ids.push(id);
|
|
314
312
|
return ids;
|
|
315
313
|
}, []);
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { SurchargeListItem, SurchargeListModuleAPI
|
|
3
|
+
import { SurchargeListItem, SurchargeListModuleAPI } from './types';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export declare class SurchargeListModule extends BaseModule implements Module, SurchargeListModuleAPI {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
8
8
|
private request;
|
|
9
9
|
private store;
|
|
10
|
-
private
|
|
11
|
-
private requestVersion;
|
|
10
|
+
private loadingPromise;
|
|
12
11
|
constructor(name?: string, version?: string);
|
|
13
12
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
13
|
+
getSurchargeList(): Promise<SurchargeListItem[]>;
|
|
14
|
+
refreshSurchargeList(): Promise<SurchargeListItem[]>;
|
|
17
15
|
private loadSurchargeList;
|
|
18
16
|
}
|