@pisell/pisellos 2.3.122 → 2.3.124
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/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/Order/index.d.ts +6 -0
- package/dist/modules/Order/index.js +437 -229
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +105 -60
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/utils/small-ticket.js +25 -15
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +5 -2
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingTicket/index.d.ts +1 -2
- package/dist/solution/BookingTicket/index.js +60 -63
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/Order/index.d.ts +6 -0
- package/lib/modules/Order/index.js +213 -40
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +43 -3
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/utils/small-ticket.js +25 -14
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +5 -2
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingTicket/index.d.ts +1 -2
- package/lib/solution/BookingTicket/index.js +36 -33
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/package.json +1 -1
|
@@ -29,6 +29,10 @@ export interface RulesCalcDiscountOptions {
|
|
|
29
29
|
discountId?: number;
|
|
30
30
|
selectedList?: SetDiscountSelectedParams[];
|
|
31
31
|
scan?: boolean;
|
|
32
|
+
/** 本次扫码优先使用的次卡实例;普通重算不传,继续保留商品行当前选择。 */
|
|
33
|
+
preferredEntitlementPassIds?: number[];
|
|
34
|
+
/** 普通重算保留商品行已应用的次卡;最优选择传 false 恢复自动排序。 */
|
|
35
|
+
preserveEntitlementSelection?: boolean;
|
|
32
36
|
/** Change time 重报价目标行:允许已选编辑态折扣卡重新应用到这些 booking 商品。 */
|
|
33
37
|
reapplyBookingDiscountProductUids?: string[];
|
|
34
38
|
}
|
|
@@ -36,6 +36,8 @@ export type OrderSurchargeType = string;
|
|
|
36
36
|
export interface OrderProductDiscountMetadata {
|
|
37
37
|
/** 设备端本地唯一标识,用于与服务端记录对齐 */
|
|
38
38
|
unique_identification_number?: string;
|
|
39
|
+
/** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
|
|
40
|
+
balance?: number | null;
|
|
39
41
|
[key: string]: unknown;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
@@ -452,6 +454,7 @@ export interface OrderData {
|
|
|
452
454
|
id: number | string;
|
|
453
455
|
tag: 'point_card';
|
|
454
456
|
product_id?: number | string;
|
|
457
|
+
code?: string;
|
|
455
458
|
product_name: string;
|
|
456
459
|
par_value: string;
|
|
457
460
|
used_par_value: string;
|
|
@@ -803,7 +803,9 @@ function normalizeExistingCombinations(combinations, locale, currencySymbol) {
|
|
|
803
803
|
options: rawOptions
|
|
804
804
|
});
|
|
805
805
|
var nestedCombinations = Array.isArray(combination.combinations) ? normalizeExistingCombinations(combination.combinations, locale, currencySymbol) : [];
|
|
806
|
+
var productTitle = getBundleProductTitleSource(combination, locale);
|
|
806
807
|
var snapshot = _objectSpread({}, combination);
|
|
808
|
+
delete snapshot.product_title;
|
|
807
809
|
delete snapshot.product_note;
|
|
808
810
|
delete snapshot.note;
|
|
809
811
|
delete snapshot.combinations;
|
|
@@ -823,7 +825,9 @@ function normalizeExistingCombinations(combinations, locale, currencySymbol) {
|
|
|
823
825
|
originalPrice: unitPrice
|
|
824
826
|
});
|
|
825
827
|
var shouldIncludeBasePrice = normalizedOptions.length > 0 || nestedCombinations.length > 0 || hasProductDiscount(combination, extensionList);
|
|
826
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, snapshot),
|
|
828
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, snapshot), productTitle ? {
|
|
829
|
+
product_title: productTitle
|
|
830
|
+
} : {}), {}, {
|
|
827
831
|
product_quantity: quantity,
|
|
828
832
|
total_selling_price: formatCalculatedMoney(new Decimal(toMoneyNumber(unitPrice)).mul(quantity), currencySymbol)
|
|
829
833
|
}, shouldIncludeBasePrice ? {
|
|
@@ -896,18 +900,18 @@ function resolveBundleProductTitle(params) {
|
|
|
896
900
|
productMap = params.productMap,
|
|
897
901
|
locale = params.locale,
|
|
898
902
|
parentProduct = params.parentProduct;
|
|
899
|
-
var ownTitle =
|
|
903
|
+
var ownTitle = getBundleProductTitleSource(bundle, locale);
|
|
900
904
|
if (ownTitle) return ownTitle;
|
|
901
905
|
var parentBundleItem = resolveBundleItemFromParentProduct({
|
|
902
906
|
bundle: bundle,
|
|
903
907
|
parentProduct: parentProduct
|
|
904
908
|
});
|
|
905
|
-
var parentBundleTitle = parentBundleItem ?
|
|
909
|
+
var parentBundleTitle = parentBundleItem ? getBundleProductTitleSource(parentBundleItem, locale) : '';
|
|
906
910
|
if (parentBundleTitle) return parentBundleTitle;
|
|
907
911
|
var productId = (_ref31 = (_ref32 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref32 !== void 0 ? _ref32 : bundle.product_id) !== null && _ref31 !== void 0 ? _ref31 : bundle.id;
|
|
908
912
|
var fallbackProduct = resolveProductFromMap(productId, productMap);
|
|
909
913
|
if (!fallbackProduct) return '';
|
|
910
|
-
return
|
|
914
|
+
return getBundleProductTitleSource(fallbackProduct, locale);
|
|
911
915
|
}
|
|
912
916
|
function resolveProductFromMap(productId, productMap) {
|
|
913
917
|
if (productId === undefined || productId === null || productId === '') return null;
|
|
@@ -990,7 +994,11 @@ function resolveVariantItem(group, itemPositionId) {
|
|
|
990
994
|
}
|
|
991
995
|
function getProductTitleSource(source, locale) {
|
|
992
996
|
if (!source || _typeof(source) !== 'object') return '';
|
|
993
|
-
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
997
|
+
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
998
|
+
}
|
|
999
|
+
function getBundleProductTitleSource(source, locale) {
|
|
1000
|
+
if (!source || _typeof(source) !== 'object') return '';
|
|
1001
|
+
return resolveTitleValue(source.bundle_title, locale) || resolveTitleValue(source.trans_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
994
1002
|
}
|
|
995
1003
|
function resolveTitleValue(value, locale) {
|
|
996
1004
|
var _ref35, _ref36, _ref37, _ref38, _value$locale;
|
|
@@ -1894,7 +1902,7 @@ function buildPointCardSnapshotAssets(params) {
|
|
|
1894
1902
|
codes: []
|
|
1895
1903
|
})) return [];
|
|
1896
1904
|
var rows = [{
|
|
1897
|
-
item: stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'),
|
|
1905
|
+
item: appendMaskedCardCode(stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'), pointCard.code),
|
|
1898
1906
|
value: ''
|
|
1899
1907
|
}];
|
|
1900
1908
|
var remainingPoints = getPointCardSnapshotRemainingPoints(pointCard);
|
|
@@ -2394,9 +2402,14 @@ function isPointCardPayment(payment) {
|
|
|
2394
2402
|
return code === 'POINTCARD' || type === 'point_card';
|
|
2395
2403
|
}
|
|
2396
2404
|
function maskMachineCode(code) {
|
|
2397
|
-
var text = stringify(code);
|
|
2398
|
-
if (text
|
|
2399
|
-
|
|
2405
|
+
var text = stringify(code).trim();
|
|
2406
|
+
if (!text) return '';
|
|
2407
|
+
if (text.length <= 6) return '*'.repeat(text.length);
|
|
2408
|
+
return "".concat(text.slice(0, 2), "****").concat(text.slice(-4));
|
|
2409
|
+
}
|
|
2410
|
+
function appendMaskedCardCode(name, code) {
|
|
2411
|
+
var maskedCode = maskMachineCode(code);
|
|
2412
|
+
return maskedCode ? "".concat(name, "(").concat(maskedCode, ")") : name;
|
|
2400
2413
|
}
|
|
2401
2414
|
function trimDecimal(value) {
|
|
2402
2415
|
return value.toDecimalPlaces(2).toFixed(2).replace(/\.?0+$/, '');
|
|
@@ -2405,16 +2418,13 @@ function getFundRecordPaymentName(payment, locale) {
|
|
|
2405
2418
|
var fundRecord = getFundRecord(payment);
|
|
2406
2419
|
if (!fundRecord) return '';
|
|
2407
2420
|
var name = getLocalizedValue(fundRecord.wallet_pass_name, locale);
|
|
2408
|
-
|
|
2409
|
-
if (!name && !code) return '';
|
|
2410
|
-
if (!code) return name;
|
|
2421
|
+
if (!name && !maskMachineCode(fundRecord.code)) return '';
|
|
2411
2422
|
var fallbackName = getLocalizedValue(payment.name || payment.title || payment.payment_method_name || payment.method_name || payment.code, locale);
|
|
2412
|
-
return
|
|
2423
|
+
return appendMaskedCardCode(name || fallbackName, fundRecord.code);
|
|
2413
2424
|
}
|
|
2414
2425
|
function appendMachineCodeToName(name, payment) {
|
|
2415
2426
|
var fundRecord = getFundRecord(payment);
|
|
2416
|
-
|
|
2417
|
-
return "".concat(name, "(").concat(maskMachineCode(fundRecord.code), ")");
|
|
2427
|
+
return appendMaskedCardCode(name, fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.code);
|
|
2418
2428
|
}
|
|
2419
2429
|
function paymentMethodName(payment, locale) {
|
|
2420
2430
|
var fundRecordName = getFundRecordPaymentName(payment, locale);
|
|
@@ -415,6 +415,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
415
415
|
refreshWalletAssets(params?: {
|
|
416
416
|
order_wait_pay_amount?: number;
|
|
417
417
|
preserveSelection?: boolean;
|
|
418
|
+
retainSearchResultCodes?: string[];
|
|
418
419
|
}): Promise<WalletAssetsState>;
|
|
419
420
|
/** 选择或取消单张钱包资产,并立即同步 pending wallet payments。 */
|
|
420
421
|
selectWalletAsset(params: {
|
|
@@ -2815,7 +2815,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2815
2815
|
(item.discount_list || []).forEach(function (discount) {
|
|
2816
2816
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
2817
2817
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
2818
|
-
if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
|
|
2818
|
+
if (!discountId || !['entitlement_pass', 'good_pass', 'discount_card'].includes(discount.type)) return;
|
|
2819
2819
|
var quantity = item.quantity || item.num || item.product_quantity || 1;
|
|
2820
2820
|
var savedAmount = new Decimal(discount.amount || 0).times(quantity).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
|
|
2821
2821
|
var index = historyDiscountList.findIndex(function (n) {
|
|
@@ -3380,6 +3380,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3380
3380
|
return resolveIsFormSubject(tempOrder, product);
|
|
3381
3381
|
},
|
|
3382
3382
|
orderTotalAmount: orderTotalAmount
|
|
3383
|
+
}, {
|
|
3384
|
+
preserveEntitlementSelection: false
|
|
3383
3385
|
}) || result;
|
|
3384
3386
|
if (result.productList) {
|
|
3385
3387
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
@@ -5203,7 +5205,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5203
5205
|
return this.publishWalletAssetsState(clearedState);
|
|
5204
5206
|
case 20:
|
|
5205
5207
|
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
5206
|
-
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
5208
|
+
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
|
|
5209
|
+
retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
|
|
5207
5210
|
});
|
|
5208
5211
|
_context47.next = 23;
|
|
5209
5212
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
@@ -441,10 +441,10 @@ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
|
|
|
441
441
|
/** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
|
|
442
442
|
export interface BaseSalesScanCodeResult {
|
|
443
443
|
isAvailable: boolean;
|
|
444
|
-
/** 卡券已加入 Promotion
|
|
444
|
+
/** 卡券已加入 Promotion;可能因次数、时间或当前订单条件而暂时无法应用。 */
|
|
445
445
|
isAccepted?: boolean;
|
|
446
446
|
type?: 'server' | string;
|
|
447
447
|
unavailableReason?: 'time_limit' | string;
|
|
448
|
-
/**
|
|
448
|
+
/** 扫码卡券资料及最新可用状态,供 Holder 补全等流程使用。 */
|
|
449
449
|
scannedDiscountList?: Discount[];
|
|
450
450
|
}
|