@pisell/pisellos 2.3.124 → 2.3.126
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/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +19 -58
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +12 -24
- package/dist/modules/Customer/index.js +3 -6
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +151 -37
- package/dist/modules/Discount/types.d.ts +5 -36
- package/dist/modules/Order/index.d.ts +12 -7
- package/dist/modules/Order/index.js +307 -432
- package/dist/modules/Order/types.d.ts +5 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +12 -16
- package/dist/modules/Order/utils.d.ts +11 -1
- package/dist/modules/Order/utils.js +127 -122
- package/dist/modules/Payment/types.d.ts +1 -21
- package/dist/modules/Payment/types.js +0 -2
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +47 -80
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +186 -480
- package/dist/modules/Rules/types.d.ts +0 -4
- package/dist/server/modules/order/types.d.ts +0 -2
- package/dist/solution/BaseSales/index.d.ts +0 -1
- package/dist/solution/BaseSales/index.js +59 -51
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +126 -141
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -1
- package/dist/solution/BookingTicket/index.js +63 -60
- package/dist/solution/BookingTicket/types.d.ts +1 -5
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +147 -338
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +6 -19
- package/dist/solution/ShopDiscount/index.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +42 -99
- package/dist/solution/ShopDiscount/utils.d.ts +2 -4
- package/dist/solution/ShopDiscount/utils.js +23 -43
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -35
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -13
- package/lib/modules/Customer/index.js +1 -5
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +129 -23
- package/lib/modules/Discount/types.d.ts +5 -36
- package/lib/modules/Order/index.d.ts +12 -7
- package/lib/modules/Order/index.js +107 -215
- package/lib/modules/Order/types.d.ts +5 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +11 -14
- package/lib/modules/Order/utils.d.ts +11 -1
- package/lib/modules/Order/utils.js +45 -39
- package/lib/modules/Payment/types.d.ts +1 -21
- package/lib/modules/Payment/types.js +0 -1
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +9 -29
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +110 -357
- package/lib/modules/Rules/types.d.ts +0 -4
- package/lib/server/modules/order/types.d.ts +0 -2
- package/lib/solution/BaseSales/index.d.ts +0 -1
- package/lib/solution/BaseSales/index.js +12 -5
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BaseSales/utils/cartPromotion.js +4 -12
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -1
- package/lib/solution/BookingTicket/index.js +33 -36
- package/lib/solution/BookingTicket/types.d.ts +1 -5
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +42 -174
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +3 -11
- package/lib/solution/ShopDiscount/index.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +9 -55
- package/lib/solution/ShopDiscount/utils.d.ts +2 -4
- package/lib/solution/ShopDiscount/utils.js +25 -42
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/package.json +1 -1
- package/dist/modules/Discount/availability.d.ts +0 -7
- package/dist/modules/Discount/availability.js +0 -49
- package/dist/modules/Discount/entitlementPass.d.ts +0 -34
- package/dist/modules/Discount/entitlementPass.js +0 -147
- package/lib/modules/Discount/availability.d.ts +0 -7
- package/lib/modules/Discount/availability.js +0 -43
- package/lib/modules/Discount/entitlementPass.d.ts +0 -34
- package/lib/modules/Discount/entitlementPass.js +0 -141
|
@@ -14,6 +14,7 @@ exports.buildSubmitPayload = buildSubmitPayload;
|
|
|
14
14
|
exports.buildVirtualCurrencySnapshotFromList = buildVirtualCurrencySnapshotFromList;
|
|
15
15
|
exports.calculateOrderProductsDeposit = calculateOrderProductsDeposit;
|
|
16
16
|
exports.clearTempOrderHolderAssignments = clearTempOrderHolderAssignments;
|
|
17
|
+
exports.collectPointCardSnapshotCodeCandidates = collectPointCardSnapshotCodeCandidates;
|
|
17
18
|
exports.composeLinePrice = composeLinePrice;
|
|
18
19
|
exports.createDefaultOrderRulesHooks = createDefaultOrderRulesHooks;
|
|
19
20
|
exports.createDefaultTempOrder = createDefaultTempOrder;
|
|
@@ -66,6 +67,7 @@ Object.defineProperty(exports, "mergeManualProductDiscountIntoList", {
|
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
exports.mergeOrderProductDisplayFields = mergeOrderProductDisplayFields;
|
|
70
|
+
exports.mergePointCardSnapshotCodes = mergePointCardSnapshotCodes;
|
|
69
71
|
exports.mergeRelationForms = void 0;
|
|
70
72
|
exports.normalizeBookingIsAll = normalizeBookingIsAll;
|
|
71
73
|
exports.normalizeBookingSubType = normalizeBookingSubType;
|
|
@@ -127,7 +129,6 @@ Object.defineProperty(exports, "syncManualProductDiscountProductNum", {
|
|
|
127
129
|
}
|
|
128
130
|
});
|
|
129
131
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
130
|
-
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
131
132
|
var _decimal = _interopRequireDefault(require("decimal.js"));
|
|
132
133
|
var _utils = require("../Holder/utils");
|
|
133
134
|
var _utils2 = require("../../solution/ScanOrder/utils");
|
|
@@ -135,7 +136,6 @@ var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
|
135
136
|
var _salesNotes = require("./salesNotes");
|
|
136
137
|
var _manualProductDiscount = require("./utils/manualProductDiscount");
|
|
137
138
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
138
|
-
_dayjs.default.extend(_customParseFormat.default);
|
|
139
139
|
const POINT_CARD_SNAPSHOT_TAG = 'point_card';
|
|
140
140
|
const VIRTUAL_CURRENCY_SNAPSHOT_TAG = 'virtual_currency';
|
|
141
141
|
function isPlainObject(value) {
|
|
@@ -179,6 +179,46 @@ function buildPointCardSnapshotFromWalletPassList(value) {
|
|
|
179
179
|
return result;
|
|
180
180
|
}, []);
|
|
181
181
|
}
|
|
182
|
+
function collectPointCardSnapshotCodeCandidates(value) {
|
|
183
|
+
if (!Array.isArray(value)) return [];
|
|
184
|
+
const codeById = new Map();
|
|
185
|
+
value.forEach(item => {
|
|
186
|
+
if (!isPlainObject(item)) return;
|
|
187
|
+
const id = normalizeSnapshotScalar(item.id ?? item.voucher_id);
|
|
188
|
+
const code = normalizeSnapshotScalar(item.code);
|
|
189
|
+
if (id === undefined || code === undefined) return;
|
|
190
|
+
const identity = String(id).trim();
|
|
191
|
+
const normalizedCode = String(code).trim();
|
|
192
|
+
if (!identity || !normalizedCode || codeById.has(identity)) return;
|
|
193
|
+
codeById.set(identity, normalizedCode);
|
|
194
|
+
});
|
|
195
|
+
return [...codeById].map(([id, code]) => ({
|
|
196
|
+
id,
|
|
197
|
+
code
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
|
|
203
|
+
* 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
|
|
204
|
+
* 数据覆盖下单时已经冻结的卡名称和余额。
|
|
205
|
+
*/
|
|
206
|
+
function mergePointCardSnapshotCodes(snapshotsValue, walletPassesValue) {
|
|
207
|
+
const snapshots = buildPointCardSnapshotFromWalletPassList(snapshotsValue);
|
|
208
|
+
if (!snapshots.length || !Array.isArray(walletPassesValue)) return snapshots;
|
|
209
|
+
const codeById = new Map(collectPointCardSnapshotCodeCandidates(walletPassesValue).map(({
|
|
210
|
+
id,
|
|
211
|
+
code
|
|
212
|
+
}) => [id, code]));
|
|
213
|
+
return snapshots.map(snapshot => {
|
|
214
|
+
if (snapshot.code) return snapshot;
|
|
215
|
+
const code = codeById.get(String(snapshot.id).trim());
|
|
216
|
+
return code ? {
|
|
217
|
+
...snapshot,
|
|
218
|
+
code
|
|
219
|
+
} : snapshot;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
182
222
|
function normalizeSnapshotNameMap(value) {
|
|
183
223
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
184
224
|
const normalizedText = String(value).trim();
|
|
@@ -672,24 +712,6 @@ function resolveSubmitBundleMapId(bundle) {
|
|
|
672
712
|
}
|
|
673
713
|
return undefined;
|
|
674
714
|
}
|
|
675
|
-
function ensureSubmitDiscountIdentity(discount) {
|
|
676
|
-
if (!discount || typeof discount !== 'object' || Array.isArray(discount)) {
|
|
677
|
-
return discount;
|
|
678
|
-
}
|
|
679
|
-
const discountRecord = discount;
|
|
680
|
-
const metadata = discountRecord.metadata && typeof discountRecord.metadata === 'object' && !Array.isArray(discountRecord.metadata) ? discountRecord.metadata : {};
|
|
681
|
-
const uniqueIdentificationNumber = metadata.unique_identification_number;
|
|
682
|
-
if (uniqueIdentificationNumber !== undefined && uniqueIdentificationNumber !== null && String(uniqueIdentificationNumber).trim() !== '') {
|
|
683
|
-
return discount;
|
|
684
|
-
}
|
|
685
|
-
return {
|
|
686
|
-
...discountRecord,
|
|
687
|
-
metadata: {
|
|
688
|
-
...metadata,
|
|
689
|
-
unique_identification_number: (0, _orderCollectionIdentity.createUuidV4)()
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
715
|
function collectSubmitProductDiscountList(product) {
|
|
694
716
|
const submitDiscountList = Array.isArray(product?.discount_list) ? [...product.discount_list] : [];
|
|
695
717
|
for (const bundle of product?.product_bundle || []) {
|
|
@@ -711,7 +733,7 @@ function collectSubmitProductDiscountList(product) {
|
|
|
711
733
|
});
|
|
712
734
|
}
|
|
713
735
|
}
|
|
714
|
-
return normalizeOrderProductDiscountList(submitDiscountList
|
|
736
|
+
return normalizeOrderProductDiscountList(submitDiscountList);
|
|
715
737
|
}
|
|
716
738
|
|
|
717
739
|
/**
|
|
@@ -778,23 +800,7 @@ function resolveEffectivePerUnitDiscount(product) {
|
|
|
778
800
|
if (!Number.isFinite(originalPrice) || !Number.isFinite(finalPrice)) return fromList;
|
|
779
801
|
return fromList + (originalPrice - finalPrice);
|
|
780
802
|
}
|
|
781
|
-
function createDefaultOrderRulesHooks(
|
|
782
|
-
const getProductStartDate = product => {
|
|
783
|
-
const productUid = String(product.metadata?.unique_identification_number ?? product.unique_identification_number ?? '');
|
|
784
|
-
const bookingUid = String(product.booking_uid ?? product.metadata?.booking_uid ?? '');
|
|
785
|
-
// 每次读取当前 bookings,覆盖改期、订单回显以及直接调用 Rules 的选券入口。
|
|
786
|
-
const bookings = getBookings?.() || [];
|
|
787
|
-
const booking = bookings.find(item => productUid && String(item?.product_uid ?? item?.metadata?.product_uid ?? '') === productUid) || bookings.find(item => bookingUid && String(item?.metadata?.unique_identification_number ?? item?.booking_uid ?? '') === bookingUid);
|
|
788
|
-
if (booking) {
|
|
789
|
-
// 严格解析并保留 Invalid Date,让公共时间校验拒绝缺失/非法时间,避免回退到当前时间。
|
|
790
|
-
return (0, _dayjs.default)(`${booking.start_date} ${booking.start_time}`, ['YYYY-MM-DD HH:mm', 'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD H:mm', 'YYYY-MM-DD H:mm:ss'], true);
|
|
791
|
-
}
|
|
792
|
-
if (getBookings && (bookingUid || product.booking_id || product.metadata?.booking_id)) {
|
|
793
|
-
return (0, _dayjs.default)('');
|
|
794
|
-
}
|
|
795
|
-
const legacyStartDate = product.metadata?.start_date || product.metadata?.startDate;
|
|
796
|
-
return legacyStartDate ? (0, _dayjs.default)(legacyStartDate) : undefined;
|
|
797
|
-
};
|
|
803
|
+
function createDefaultOrderRulesHooks() {
|
|
798
804
|
const toUnitPriceString = (totalLike, num) => {
|
|
799
805
|
const effectiveNum = Number(num) > 0 ? Number(num) : 1;
|
|
800
806
|
return new _decimal.default(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
|
|
@@ -882,7 +888,7 @@ function createDefaultOrderRulesHooks(getBookings) {
|
|
|
882
888
|
// 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
|
|
883
889
|
isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
|
|
884
890
|
holder_id: product.metadata?.holder_id,
|
|
885
|
-
startDate:
|
|
891
|
+
startDate: product.metadata?.start_date || product.metadata?.startDate,
|
|
886
892
|
main_product_selling_price: metadataAny.main_product_selling_price !== undefined ? new _decimal.default(Number(metadataAny.main_product_selling_price) || 0).minus(optionSum).toDecimalPlaces(2).toString() : undefined,
|
|
887
893
|
inPromotion: metadataAny._promotion?.inPromotion === true,
|
|
888
894
|
_promotion: metadataAny._promotion
|
|
@@ -412,8 +412,6 @@ export interface WalletAssetsBehaviorOptions {
|
|
|
412
412
|
export interface RefreshWalletAssetsOptions {
|
|
413
413
|
/** 商品/金额变化默认保留并重验选择;客户变化由实现层强制清空。 */
|
|
414
414
|
preserveSelection?: boolean;
|
|
415
|
-
/** 客户变化时,仅保留与本次扫码匹配的搜索结果;其他搜索缓存仍会清空。 */
|
|
416
|
-
retainSearchResultCodes?: string[];
|
|
417
415
|
}
|
|
418
416
|
export interface SelectWalletAssetOptions {
|
|
419
417
|
selected: boolean;
|
|
@@ -421,8 +419,6 @@ export interface SelectWalletAssetOptions {
|
|
|
421
419
|
}
|
|
422
420
|
export interface ScanWalletAssetResult {
|
|
423
421
|
type: SearchIdentificationCodeResult['type'];
|
|
424
|
-
/** walletCode 时保留完整 Wallet Detail,供客户解析与客户选择器使用。 */
|
|
425
|
-
data?: WalletDetailSearchData;
|
|
426
422
|
asset?: any;
|
|
427
423
|
selected: boolean;
|
|
428
424
|
state: WalletAssetsState;
|
|
@@ -868,8 +864,6 @@ export interface SearchIdentificationCodeParams extends WalletDeductionRecommend
|
|
|
868
864
|
* 搜索识别码响应数据
|
|
869
865
|
*/
|
|
870
866
|
export interface SearchIdentificationCodeResponse {
|
|
871
|
-
/** 业务是否成功 */
|
|
872
|
-
status?: boolean;
|
|
873
867
|
/** 响应状态码 */
|
|
874
868
|
code?: number;
|
|
875
869
|
/** 响应消息 */
|
|
@@ -877,26 +871,12 @@ export interface SearchIdentificationCodeResponse {
|
|
|
877
871
|
/** 响应数据 */
|
|
878
872
|
data?: SearchIdentificationCodeItem[];
|
|
879
873
|
}
|
|
880
|
-
/** Wallet code 精确搜索返回的 Wallet Detail。 */
|
|
881
|
-
export interface WalletDetailSearchData {
|
|
882
|
-
id?: string | number;
|
|
883
|
-
customer_id?: string | number;
|
|
884
|
-
customer?: Record<string, any> | null;
|
|
885
|
-
is_cross_shop_wallet?: boolean | 0 | 1;
|
|
886
|
-
[key: string]: any;
|
|
887
|
-
}
|
|
888
|
-
export interface WalletDetailSearchResponse {
|
|
889
|
-
status?: boolean;
|
|
890
|
-
code?: number;
|
|
891
|
-
message?: string;
|
|
892
|
-
data?: WalletDetailSearchData | null;
|
|
893
|
-
}
|
|
894
874
|
/**
|
|
895
875
|
* 搜索识别码结果类型
|
|
896
876
|
*/
|
|
897
877
|
export type SearchIdentificationCodeResult = {
|
|
898
878
|
type: 'walletCode';
|
|
899
|
-
data:
|
|
879
|
+
data: SearchIdentificationCodeItem[];
|
|
900
880
|
} | {
|
|
901
881
|
type: 'normalCode';
|
|
902
882
|
data: SearchIdentificationCodeItem[];
|
|
@@ -96,7 +96,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
96
96
|
* 搜索识别码信息
|
|
97
97
|
* 通过识别码搜索相关的钱包通行证信息
|
|
98
98
|
* 基于 WalletDeductionRecommendParams 参数结构
|
|
99
|
-
*
|
|
99
|
+
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
100
100
|
*/
|
|
101
101
|
searchIdentificationCodeAsync(params: SearchIdentificationCodeParams, config?: {
|
|
102
102
|
noCache?: boolean;
|
|
@@ -705,7 +705,7 @@ class WalletPassPaymentImpl {
|
|
|
705
705
|
* 搜索识别码信息
|
|
706
706
|
* 通过识别码搜索相关的钱包通行证信息
|
|
707
707
|
* 基于 WalletDeductionRecommendParams 参数结构
|
|
708
|
-
*
|
|
708
|
+
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
709
709
|
*/
|
|
710
710
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
711
711
|
try {
|
|
@@ -725,7 +725,6 @@ class WalletPassPaymentImpl {
|
|
|
725
725
|
const walletDetailParams = {
|
|
726
726
|
code: code,
|
|
727
727
|
with_customer: 1,
|
|
728
|
-
with_franchisor_data: 1,
|
|
729
728
|
with: ['wallet']
|
|
730
729
|
};
|
|
731
730
|
this.paymentModule.logInfo('[WalletPass] 搜索钱包识别码', {
|
|
@@ -734,18 +733,15 @@ class WalletPassPaymentImpl {
|
|
|
734
733
|
with: walletDetailParams.with
|
|
735
734
|
});
|
|
736
735
|
const response = await this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
737
|
-
const
|
|
738
|
-
if (response?.status !== true || response?.code !== 200 || !walletDetail || typeof walletDetail !== 'object' || Array.isArray(walletDetail)) {
|
|
739
|
-
throw new Error(response?.message || 'Wallet detail search failed');
|
|
740
|
-
}
|
|
736
|
+
const searchResults = response?.data || [];
|
|
741
737
|
this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
|
|
742
738
|
code: code,
|
|
743
|
-
results_count:
|
|
739
|
+
results_count: searchResults.length,
|
|
744
740
|
type: 'walletCode'
|
|
745
741
|
});
|
|
746
742
|
return {
|
|
747
743
|
type: 'walletCode',
|
|
748
|
-
data:
|
|
744
|
+
data: searchResults
|
|
749
745
|
};
|
|
750
746
|
}
|
|
751
747
|
|
|
@@ -834,16 +830,9 @@ class WalletPassPaymentImpl {
|
|
|
834
830
|
const previousCustomerId = this.walletAssetsState.customerId;
|
|
835
831
|
const customerChanged = String(previousCustomerId ?? '') !== String(nextCustomerId ?? '');
|
|
836
832
|
const preserveSelection = options.preserveSelection !== false && !customerChanged;
|
|
837
|
-
const retainedSearchCodeKeys = new Set((options.retainSearchResultCodes || []).map(normalizeWalletAssetCode).filter(Boolean));
|
|
838
|
-
const retainedSearchResults = customerChanged && retainedSearchCodeKeys.size > 0 ? this.searchResults.filter(item => isWalletPaymentAsset(item) && getWalletAssetCodeKeys(item).some(code => retainedSearchCodeKeys.has(code))) : [];
|
|
839
833
|
if (customerChanged) {
|
|
840
834
|
this.clearSearchResults();
|
|
841
|
-
if (retainedSearchResults.length > 0) {
|
|
842
|
-
this.searchResults = mergeWalletAssets(retainedSearchResults);
|
|
843
|
-
this.queuePendingAutoSelectForAssets(retainedSearchResults);
|
|
844
|
-
}
|
|
845
835
|
}
|
|
846
|
-
const preserveSearchContext = preserveSelection || retainedSearchResults.length > 0;
|
|
847
836
|
const committedKeys = new Set(this.walletAssetsState.committedIds.map(id => String(id)));
|
|
848
837
|
const committedItems = this.walletAssetsState.items.filter(item => committedKeys.has(getWalletAssetKey(item)));
|
|
849
838
|
const selectedIds = preserveSelection ? [...this.walletAssetsState.selectedIds] : [];
|
|
@@ -912,8 +901,8 @@ class WalletPassPaymentImpl {
|
|
|
912
901
|
error: null
|
|
913
902
|
});
|
|
914
903
|
try {
|
|
915
|
-
const searchedWalletAssetCodes =
|
|
916
|
-
const useAggregateRecalculate =
|
|
904
|
+
const searchedWalletAssetCodes = preserveSelection ? this.getSearchedWalletAssetCodes() : [];
|
|
905
|
+
const useAggregateRecalculate = preserveSelection && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
|
|
917
906
|
const aggregateResult = useAggregateRecalculate ? await this.aggregateRecalculateWalletAssetsAsync(businessData, selectedIds) : null;
|
|
918
907
|
const result = aggregateResult || (await this.initializeWalletDataFromBusinessAsync(businessData));
|
|
919
908
|
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
@@ -931,7 +920,7 @@ class WalletPassPaymentImpl {
|
|
|
931
920
|
this.searchResults = this.searchResults.filter(item => !missingSelectedKeys.has(getWalletAssetKey(item)));
|
|
932
921
|
}
|
|
933
922
|
}
|
|
934
|
-
const searchedWalletAssets =
|
|
923
|
+
const searchedWalletAssets = preserveSelection ? this.syncSearchedWalletAssets([...(result.transformList || []), ...(result.noApplicableVoucher || [])]) : [];
|
|
935
924
|
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
936
925
|
return this.getWalletAssetsState();
|
|
937
926
|
}
|
|
@@ -1133,23 +1122,14 @@ class WalletPassPaymentImpl {
|
|
|
1133
1122
|
code: normalizedCode,
|
|
1134
1123
|
prepare_payments: this.formatWalletPassList2PreparePayments(this.walletAssetsState.selectedItems)
|
|
1135
1124
|
});
|
|
1136
|
-
if (result.type === 'walletCode') {
|
|
1137
|
-
return {
|
|
1138
|
-
type: 'walletCode',
|
|
1139
|
-
data: result.data,
|
|
1140
|
-
asset: result.data,
|
|
1141
|
-
selected: false,
|
|
1142
|
-
state: this.getWalletAssetsState()
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
1125
|
const paymentAssets = this.formatSearchedWalletPaymentAssets(result.data.filter(isWalletPaymentAsset));
|
|
1146
1126
|
if (paymentAssets.length > 0) {
|
|
1147
1127
|
this.searchResults = mergeWalletAssets(this.searchResults, paymentAssets);
|
|
1148
1128
|
}
|
|
1149
1129
|
const asset = paymentAssets.find(item => String(item?.code || '') === normalizedCode) || paymentAssets[0];
|
|
1150
|
-
if (!asset) {
|
|
1130
|
+
if (!asset || result.type === 'walletCode') {
|
|
1151
1131
|
return {
|
|
1152
|
-
type:
|
|
1132
|
+
type: result.type,
|
|
1153
1133
|
asset,
|
|
1154
1134
|
selected: false,
|
|
1155
1135
|
state: this.getWalletAssetsState()
|
|
@@ -16,8 +16,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
16
16
|
getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
|
|
17
17
|
private normalizeHolderRecordIds;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* 特定 form Holder 卡只授权给绑定同一 Holder Record 的商品行。
|
|
20
|
+
* required/isNeedHolder 仅控制是否强制选择 Holder,不参与优惠资格。
|
|
21
21
|
*/
|
|
22
22
|
private checkHolderMatch;
|
|
23
23
|
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
|