@pisell/pisellos 2.3.43 → 2.3.45
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/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.js +2 -2
- package/dist/modules/Order/index.d.ts +2 -3
- package/dist/modules/Order/index.js +98 -82
- package/dist/modules/Order/types.d.ts +2 -9
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Payment/walletpass.d.ts +10 -3
- package/dist/modules/Payment/walletpass.js +425 -282
- 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 +2 -0
- package/dist/modules/Rules/index.js +72 -102
- 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 +0 -14
- package/dist/server/index.js +657 -772
- package/dist/solution/BaseSales/index.d.ts +0 -7
- package/dist/solution/BaseSales/index.js +48 -67
- package/dist/solution/BaseSales/types.d.ts +3 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- 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 +1 -13
- package/dist/solution/BookingTicket/index.js +8 -5
- package/dist/solution/BookingTicket/types.d.ts +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- 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 +12 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- 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 +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- 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.js +1 -1
- package/lib/modules/Order/index.d.ts +2 -3
- package/lib/modules/Order/index.js +56 -33
- package/lib/modules/Order/types.d.ts +2 -9
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Payment/walletpass.d.ts +10 -3
- package/lib/modules/Payment/walletpass.js +218 -56
- 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 +2 -0
- package/lib/modules/Rules/index.js +24 -36
- 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 +0 -14
- package/lib/server/index.js +5 -65
- package/lib/solution/BaseSales/index.d.ts +0 -7
- package/lib/solution/BaseSales/index.js +9 -24
- package/lib/solution/BaseSales/types.d.ts +3 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- 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 +1 -13
- package/lib/solution/BookingTicket/index.js +3 -10
- package/lib/solution/BookingTicket/types.d.ts +1 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -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 +12 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- 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 +0 -1
- 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 -1891
- 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 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -41,6 +41,11 @@ function getWalletAssetKey(assetOrId) {
|
|
|
41
41
|
const id = assetOrId && typeof assetOrId === "object" ? getWalletAssetId(assetOrId) : assetOrId;
|
|
42
42
|
return id === void 0 || id === null ? "" : String(id);
|
|
43
43
|
}
|
|
44
|
+
function matchesWalletAssetCode(asset, normalizedCode) {
|
|
45
|
+
return [asset == null ? void 0 : asset.code, asset == null ? void 0 : asset.encoded].some(
|
|
46
|
+
(identifier) => String(identifier ?? "").trim() === normalizedCode
|
|
47
|
+
);
|
|
48
|
+
}
|
|
44
49
|
function isWalletAssetAvailable(asset) {
|
|
45
50
|
if (!asset)
|
|
46
51
|
return false;
|
|
@@ -150,12 +155,10 @@ var WalletPassPaymentImpl = class {
|
|
|
150
155
|
const committedKeys = new Set(
|
|
151
156
|
this.walletAssetsState.committedIds.map((id) => String(id))
|
|
152
157
|
);
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
);
|
|
156
|
-
const requested = items.filter(
|
|
157
|
-
(item) => requestedKeys.has(getWalletAssetKey(item)) && isWalletAssetAvailable(item)
|
|
158
|
+
const itemsByKey = new Map(
|
|
159
|
+
items.map((item) => [getWalletAssetKey(item), item])
|
|
158
160
|
);
|
|
161
|
+
const requested = requestedIds.map((id) => String(id)).filter((id) => !committedKeys.has(id)).map((id) => itemsByKey.get(id)).filter((item) => item && isWalletAssetAvailable(item));
|
|
159
162
|
let nextItems = items;
|
|
160
163
|
let selectedItems = requested;
|
|
161
164
|
const evaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
@@ -201,57 +204,40 @@ var WalletPassPaymentImpl = class {
|
|
|
201
204
|
error: null
|
|
202
205
|
});
|
|
203
206
|
}
|
|
207
|
+
/** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
|
|
208
|
+
getSearchedWalletAssetCodes() {
|
|
209
|
+
const cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
210
|
+
const seenCodes = /* @__PURE__ */ new Set();
|
|
211
|
+
return cachedAssets.map((item) => String((item == null ? void 0 : item.code) || "").trim()).filter((code) => {
|
|
212
|
+
const normalizedCode = code.toUpperCase();
|
|
213
|
+
if (!normalizedCode || seenCodes.has(normalizedCode))
|
|
214
|
+
return false;
|
|
215
|
+
seenCodes.add(normalizedCode);
|
|
216
|
+
return true;
|
|
217
|
+
});
|
|
218
|
+
}
|
|
204
219
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
220
|
+
* 用订单重算接口返回的数据更新扫码 Wallet 缓存。
|
|
221
|
+
* 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
|
|
207
222
|
*/
|
|
208
|
-
|
|
223
|
+
syncSearchedWalletAssets(refreshedCandidates) {
|
|
209
224
|
const cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
cachedAssets.map((item) => String((item == null ? void 0 : item.code) || "").trim()).filter(Boolean)
|
|
213
|
-
)
|
|
214
|
-
];
|
|
215
|
-
if (searchCodes.length === 0)
|
|
216
|
-
return cachedAssets;
|
|
217
|
-
const preparePayments = this.formatWalletPassList2PreparePayments(
|
|
218
|
-
this.walletAssetsState.selectedItems
|
|
219
|
-
);
|
|
220
|
-
const refreshedGroups = await Promise.all(
|
|
221
|
-
searchCodes.map(async (searchCode) => {
|
|
222
|
-
try {
|
|
223
|
-
const result = await this.searchIdentificationCodeAsync(
|
|
224
|
-
{
|
|
225
|
-
...this.walletParams || {},
|
|
226
|
-
code: searchCode,
|
|
227
|
-
prepare_payments: preparePayments
|
|
228
|
-
},
|
|
229
|
-
{ noCache: true }
|
|
230
|
-
);
|
|
231
|
-
return {
|
|
232
|
-
searchCode,
|
|
233
|
-
items: result.type === "normalCode" ? result.data.filter(isWalletPaymentAsset) : []
|
|
234
|
-
};
|
|
235
|
-
} catch (error) {
|
|
236
|
-
this.paymentModule.logWarning(
|
|
237
|
-
"[WalletPass] 重验扫码 Wallet 资产失败,保留旧结果",
|
|
238
|
-
{
|
|
239
|
-
code: searchCode,
|
|
240
|
-
error: error instanceof Error ? error.message : String(error)
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
return { searchCode, items: [] };
|
|
244
|
-
}
|
|
245
|
-
})
|
|
225
|
+
const searchedCodeKeys = new Set(
|
|
226
|
+
this.getSearchedWalletAssetCodes().map((code) => code.toUpperCase())
|
|
246
227
|
);
|
|
247
|
-
if (
|
|
228
|
+
if (searchedCodeKeys.size === 0)
|
|
248
229
|
return cachedAssets;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
230
|
+
const refreshedAssets = refreshedCandidates.filter(
|
|
231
|
+
(item) => isWalletPaymentAsset(item) && searchedCodeKeys.has(
|
|
232
|
+
String((item == null ? void 0 : item.code) || "").trim().toUpperCase()
|
|
233
|
+
)
|
|
252
234
|
);
|
|
253
|
-
const refreshedAssets = refreshedGroups.flatMap((group) => group.items);
|
|
254
235
|
if (refreshedAssets.length > 0) {
|
|
236
|
+
const replacedCodes = new Set(
|
|
237
|
+
refreshedAssets.map(
|
|
238
|
+
(item) => String((item == null ? void 0 : item.code) || "").trim().toUpperCase()
|
|
239
|
+
)
|
|
240
|
+
);
|
|
255
241
|
this.searchResults = [
|
|
256
242
|
...this.searchResults.filter(
|
|
257
243
|
(item) => !replacedCodes.has(String((item == null ? void 0 : item.code) || "").trim().toUpperCase())
|
|
@@ -259,7 +245,10 @@ var WalletPassPaymentImpl = class {
|
|
|
259
245
|
...refreshedAssets
|
|
260
246
|
];
|
|
261
247
|
}
|
|
262
|
-
return mergeWalletAssets(
|
|
248
|
+
return mergeWalletAssets(
|
|
249
|
+
cachedAssets,
|
|
250
|
+
refreshedAssets
|
|
251
|
+
);
|
|
263
252
|
}
|
|
264
253
|
/**
|
|
265
254
|
* 生成钱包API默认参数
|
|
@@ -468,6 +457,96 @@ var WalletPassPaymentImpl = class {
|
|
|
468
457
|
throw error;
|
|
469
458
|
}
|
|
470
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* 商品或订单金额变化后,使用聚合接口一次重算已选与剩余 WalletPass。
|
|
462
|
+
* Walk-In 不发送 customer_id;会员才携带真实 customer_id。
|
|
463
|
+
*/
|
|
464
|
+
async aggregateRecalculateWalletAssetsAsync(businessData, selectedIds) {
|
|
465
|
+
var _a, _b;
|
|
466
|
+
const walletParams = this.generateWalletParams(businessData);
|
|
467
|
+
const customerId = Number(walletParams.customer_id || 0);
|
|
468
|
+
const requestParams = {
|
|
469
|
+
ids: selectedIds.map((id) => String(id)),
|
|
470
|
+
exact_codes: this.getSearchedWalletAssetCodes(),
|
|
471
|
+
order_product_amount: walletParams.order_product_amount,
|
|
472
|
+
order_expect_amount: walletParams.order_expect_amount,
|
|
473
|
+
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
474
|
+
products: walletParams.products,
|
|
475
|
+
available: 2,
|
|
476
|
+
filter_prepare_wallet_pass: 1,
|
|
477
|
+
sale_channel: walletParams.sale_channel || "pos"
|
|
478
|
+
};
|
|
479
|
+
if (customerId > 1) {
|
|
480
|
+
requestParams.customer_id = customerId;
|
|
481
|
+
}
|
|
482
|
+
const response = await this.paymentModule.request.post(
|
|
483
|
+
"/machinecode/prepare/deduction/aggregate-recalculate",
|
|
484
|
+
requestParams
|
|
485
|
+
);
|
|
486
|
+
const responseData = response == null ? void 0 : response.data;
|
|
487
|
+
const hasAggregateLists = responseData && (Object.prototype.hasOwnProperty.call(
|
|
488
|
+
responseData,
|
|
489
|
+
"recalculate_list"
|
|
490
|
+
) || Object.prototype.hasOwnProperty.call(
|
|
491
|
+
responseData,
|
|
492
|
+
"customer_wallet_pass_list"
|
|
493
|
+
));
|
|
494
|
+
if (!hasAggregateLists) {
|
|
495
|
+
throw new Error("WalletPass aggregate response is missing list data");
|
|
496
|
+
}
|
|
497
|
+
const recalculateList = Array.isArray(responseData == null ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
|
|
498
|
+
const customerWalletPassList = Array.isArray(
|
|
499
|
+
responseData == null ? void 0 : responseData.customer_wallet_pass_list
|
|
500
|
+
) ? responseData.customer_wallet_pass_list : [];
|
|
501
|
+
const allList = mergeWalletAssets(
|
|
502
|
+
recalculateList,
|
|
503
|
+
customerWalletPassList
|
|
504
|
+
);
|
|
505
|
+
const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
506
|
+
const evaluated = (walletPassEvaluator == null ? void 0 : walletPassEvaluator.getRecommendedVouchers) ? walletPassEvaluator.getRecommendedVouchers({
|
|
507
|
+
orderTotalAmount: walletParams.order_wait_pay_amount,
|
|
508
|
+
products: walletParams.products,
|
|
509
|
+
vouchers: allList
|
|
510
|
+
}) : {
|
|
511
|
+
recommended: [],
|
|
512
|
+
transformList: allList.filter(isWalletAssetAvailable),
|
|
513
|
+
noApplicableVoucher: allList.filter(
|
|
514
|
+
(item) => !isWalletAssetAvailable(item)
|
|
515
|
+
)
|
|
516
|
+
};
|
|
517
|
+
const returnedSelectedKeys = new Set(
|
|
518
|
+
recalculateList.filter(isWalletAssetAvailable).map((item) => getWalletAssetKey(item))
|
|
519
|
+
);
|
|
520
|
+
const authoritativeSelectedIds = selectedIds.filter(
|
|
521
|
+
(id) => returnedSelectedKeys.has(String(id))
|
|
522
|
+
);
|
|
523
|
+
this.walletRecommendList = evaluated.recommended || [];
|
|
524
|
+
this.userIdentificationCodes = allList;
|
|
525
|
+
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
526
|
+
userIdentificationCodes: this.userIdentificationCodes
|
|
527
|
+
});
|
|
528
|
+
this.walletInitData = {
|
|
529
|
+
transformList: evaluated.transformList || [],
|
|
530
|
+
noApplicableVoucher: evaluated.noApplicableVoucher || [],
|
|
531
|
+
products: walletParams.products || []
|
|
532
|
+
};
|
|
533
|
+
this.paymentModule.logInfo(
|
|
534
|
+
"[WalletPass] 聚合重算 WalletPass 完成",
|
|
535
|
+
{
|
|
536
|
+
selected_count: recalculateList.length,
|
|
537
|
+
remaining_count: customerWalletPassList.length,
|
|
538
|
+
searched_codes_count: requestParams.exact_codes.length
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
return {
|
|
542
|
+
walletRecommendList: this.walletRecommendList,
|
|
543
|
+
userIdentificationCodes: this.userIdentificationCodes,
|
|
544
|
+
transformList: evaluated.transformList || [],
|
|
545
|
+
noApplicableVoucher: evaluated.noApplicableVoucher || [],
|
|
546
|
+
products: walletParams.products || [],
|
|
547
|
+
authoritativeSelectedIds
|
|
548
|
+
};
|
|
549
|
+
}
|
|
471
550
|
async getWalletPassRecommendListAsync(params) {
|
|
472
551
|
var _a;
|
|
473
552
|
try {
|
|
@@ -681,6 +760,7 @@ var WalletPassPaymentImpl = class {
|
|
|
681
760
|
* 推荐结果只作为可用性/金额计算输入,不会自动成为 selectedIds。
|
|
682
761
|
*/
|
|
683
762
|
async refreshWalletAssetsFromBusinessAsync(businessData, options = {}) {
|
|
763
|
+
var _a;
|
|
684
764
|
const requestSequence = ++this.walletAssetsRequestSequence;
|
|
685
765
|
const nextCustomerId = businessData.customer_id;
|
|
686
766
|
const previousCustomerId = this.walletAssetsState.customerId;
|
|
@@ -697,6 +777,44 @@ var WalletPassPaymentImpl = class {
|
|
|
697
777
|
);
|
|
698
778
|
const selectedIds = preserveSelection ? [...this.walletAssetsState.selectedIds] : [];
|
|
699
779
|
const selectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
|
|
780
|
+
if (!((_a = businessData.products) == null ? void 0 : _a.length)) {
|
|
781
|
+
this.generateWalletParams(businessData);
|
|
782
|
+
const restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map((item) => ({
|
|
783
|
+
...item,
|
|
784
|
+
actualDeduction: 0,
|
|
785
|
+
deductionDetails: [],
|
|
786
|
+
_available_max_amount: 0,
|
|
787
|
+
_unified_available_status: 0,
|
|
788
|
+
_wallet_asset_recommended: false
|
|
789
|
+
}));
|
|
790
|
+
this.walletRecommendList = [];
|
|
791
|
+
this.userIdentificationCodes = [];
|
|
792
|
+
this.walletInitData = {
|
|
793
|
+
transformList: [],
|
|
794
|
+
noApplicableVoucher: restoredSearchedAssets,
|
|
795
|
+
products: []
|
|
796
|
+
};
|
|
797
|
+
this.walletAssetsCalculationContext = {
|
|
798
|
+
orderTotalAmount: 0,
|
|
799
|
+
products: []
|
|
800
|
+
};
|
|
801
|
+
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
802
|
+
userIdentificationCodes: []
|
|
803
|
+
});
|
|
804
|
+
return this.publishWalletAssetsState({
|
|
805
|
+
status: "ready",
|
|
806
|
+
customerId: nextCustomerId,
|
|
807
|
+
items: mergeWalletAssets(
|
|
808
|
+
restoredSearchedAssets,
|
|
809
|
+
committedItems
|
|
810
|
+
),
|
|
811
|
+
selectedIds: [],
|
|
812
|
+
selectedItems: [],
|
|
813
|
+
selectionSources: {},
|
|
814
|
+
totalSelectedAmount: 0,
|
|
815
|
+
error: null
|
|
816
|
+
});
|
|
817
|
+
}
|
|
700
818
|
this.publishWalletAssetsState({
|
|
701
819
|
status: "loading",
|
|
702
820
|
customerId: nextCustomerId,
|
|
@@ -708,9 +826,13 @@ var WalletPassPaymentImpl = class {
|
|
|
708
826
|
error: null
|
|
709
827
|
});
|
|
710
828
|
try {
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
829
|
+
const searchedWalletAssetCodes = preserveSelection ? this.getSearchedWalletAssetCodes() : [];
|
|
830
|
+
const useAggregateRecalculate = preserveSelection && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
|
|
831
|
+
const aggregateResult = useAggregateRecalculate ? await this.aggregateRecalculateWalletAssetsAsync(
|
|
832
|
+
businessData,
|
|
833
|
+
selectedIds
|
|
834
|
+
) : null;
|
|
835
|
+
const result = aggregateResult || await this.initializeWalletDataFromBusinessAsync(businessData);
|
|
714
836
|
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
715
837
|
return this.getWalletAssetsState();
|
|
716
838
|
}
|
|
@@ -718,7 +840,27 @@ var WalletPassPaymentImpl = class {
|
|
|
718
840
|
orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
|
|
719
841
|
products: result.products || businessData.products || []
|
|
720
842
|
};
|
|
721
|
-
const
|
|
843
|
+
const authoritativeSelectedIds = (aggregateResult == null ? void 0 : aggregateResult.authoritativeSelectedIds) || selectedIds;
|
|
844
|
+
if (aggregateResult) {
|
|
845
|
+
const returnedAggregateKeys = new Set(
|
|
846
|
+
[
|
|
847
|
+
...result.transformList || [],
|
|
848
|
+
...result.noApplicableVoucher || []
|
|
849
|
+
].map((item) => getWalletAssetKey(item))
|
|
850
|
+
);
|
|
851
|
+
const missingSelectedKeys = new Set(
|
|
852
|
+
selectedIds.map((id) => String(id)).filter((id) => !returnedAggregateKeys.has(id))
|
|
853
|
+
);
|
|
854
|
+
if (missingSelectedKeys.size > 0) {
|
|
855
|
+
this.searchResults = this.searchResults.filter(
|
|
856
|
+
(item) => !missingSelectedKeys.has(getWalletAssetKey(item))
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
const searchedWalletAssets = preserveSelection ? this.syncSearchedWalletAssets([
|
|
861
|
+
...result.transformList || [],
|
|
862
|
+
...result.noApplicableVoucher || []
|
|
863
|
+
]) : [];
|
|
722
864
|
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
723
865
|
return this.getWalletAssetsState();
|
|
724
866
|
}
|
|
@@ -728,7 +870,7 @@ var WalletPassPaymentImpl = class {
|
|
|
728
870
|
)
|
|
729
871
|
);
|
|
730
872
|
const items = mergeWalletAssets(
|
|
731
|
-
preserveSelection ? this.walletAssetsState.selectedItems : [],
|
|
873
|
+
preserveSelection && !aggregateResult ? this.walletAssetsState.selectedItems : [],
|
|
732
874
|
searchedWalletAssets,
|
|
733
875
|
result.transformList || [],
|
|
734
876
|
result.noApplicableVoucher || []
|
|
@@ -738,7 +880,7 @@ var WalletPassPaymentImpl = class {
|
|
|
738
880
|
getWalletAssetKey(asset)
|
|
739
881
|
)
|
|
740
882
|
}));
|
|
741
|
-
const latestSelectedIds = preserveSelection ?
|
|
883
|
+
const latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
|
|
742
884
|
const latestSelectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
|
|
743
885
|
return this.recalculateWalletAssets(
|
|
744
886
|
items,
|
|
@@ -749,6 +891,15 @@ var WalletPassPaymentImpl = class {
|
|
|
749
891
|
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
750
892
|
return this.getWalletAssetsState();
|
|
751
893
|
}
|
|
894
|
+
this.paymentModule.logError(
|
|
895
|
+
"[WalletPass] 刷新共享钱包资产失败,保留刷新前状态",
|
|
896
|
+
error,
|
|
897
|
+
{
|
|
898
|
+
customer_id: businessData.customer_id,
|
|
899
|
+
selected_ids: selectedIds,
|
|
900
|
+
searched_codes: this.getSearchedWalletAssetCodes()
|
|
901
|
+
}
|
|
902
|
+
);
|
|
752
903
|
return this.publishWalletAssetsState({
|
|
753
904
|
status: "error",
|
|
754
905
|
items: preserveSelection ? this.walletAssetsState.items : committedItems,
|
|
@@ -841,6 +992,17 @@ var WalletPassPaymentImpl = class {
|
|
|
841
992
|
state: this.getWalletAssetsState()
|
|
842
993
|
};
|
|
843
994
|
}
|
|
995
|
+
const selectedAsset = this.walletAssetsState.selectedItems.find(
|
|
996
|
+
(asset2) => matchesWalletAssetCode(asset2, normalizedCode)
|
|
997
|
+
);
|
|
998
|
+
if (selectedAsset) {
|
|
999
|
+
return {
|
|
1000
|
+
type: "normalCode",
|
|
1001
|
+
asset: selectedAsset,
|
|
1002
|
+
selected: true,
|
|
1003
|
+
state: this.getWalletAssetsState()
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
844
1006
|
this.walletAssetsRequestSequence += 1;
|
|
845
1007
|
const result = await this.searchIdentificationCodeAsync({
|
|
846
1008
|
...this.walletParams || {},
|
|
@@ -106,48 +106,39 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
106
106
|
} catch (error) {
|
|
107
107
|
console.error(error);
|
|
108
108
|
}
|
|
109
|
-
const channelMap = {
|
|
110
|
-
online_store: "online-store",
|
|
111
|
-
scan_to_order: "online-store",
|
|
112
|
-
"scan-to-order": "online-store",
|
|
113
|
-
scan_to_order_2: "mobile_order",
|
|
114
|
-
scan_to_order_3: "scantoorder3"
|
|
115
|
-
};
|
|
116
|
-
const rawApplicationCode = (_b = this.otherParams) == null ? void 0 : _b.channel;
|
|
117
|
-
const mappedApplicationCode = typeof rawApplicationCode === "string" ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
118
|
-
const queryPayload = {
|
|
119
|
-
open_quotation: 1,
|
|
120
|
-
open_bundle: 0,
|
|
121
|
-
exclude_extension_type: [
|
|
122
|
-
"product_party",
|
|
123
|
-
"product_event",
|
|
124
|
-
"product_series_event",
|
|
125
|
-
"product_package_ticket",
|
|
126
|
-
"ticket",
|
|
127
|
-
"event_item"
|
|
128
|
-
],
|
|
129
|
-
with: ["category", "collection", "resourceRelation"],
|
|
130
|
-
status,
|
|
131
|
-
num: 500,
|
|
132
|
-
skip: 1,
|
|
133
|
-
customer_id,
|
|
134
|
-
...Array.isArray(category_ids) && category_ids.length ? { category_ids } : {},
|
|
135
|
-
...Array.isArray(product_ids) && product_ids.length ? { ids: product_ids } : {},
|
|
136
|
-
...Array.isArray(collection) && collection.length ? { collection } : {},
|
|
137
|
-
front_end_cache_id: cacheId,
|
|
138
|
-
...Array.isArray(menu_list_ids) && menu_list_ids.length ? { menu_list_ids } : {},
|
|
139
|
-
with_count,
|
|
140
|
-
// client_schedule_ids: schedule_ids,
|
|
141
|
-
schedule_date,
|
|
142
|
-
application_code: mappedApplicationCode,
|
|
143
|
-
is_eject: 1,
|
|
144
|
-
with_schedule,
|
|
145
|
-
schedule_datetime,
|
|
146
|
-
extension_type
|
|
147
|
-
};
|
|
148
109
|
const productsData = await this.request.post(
|
|
149
110
|
`/product/query`,
|
|
150
|
-
|
|
111
|
+
{
|
|
112
|
+
open_quotation: 1,
|
|
113
|
+
open_bundle: 0,
|
|
114
|
+
exclude_extension_type: [
|
|
115
|
+
"product_party",
|
|
116
|
+
"product_event",
|
|
117
|
+
"product_series_event",
|
|
118
|
+
"product_package_ticket",
|
|
119
|
+
"ticket",
|
|
120
|
+
"event_item"
|
|
121
|
+
],
|
|
122
|
+
with: ["category", "collection", "resourceRelation"],
|
|
123
|
+
status,
|
|
124
|
+
num: 500,
|
|
125
|
+
skip: 1,
|
|
126
|
+
customer_id,
|
|
127
|
+
category_ids,
|
|
128
|
+
ids: product_ids,
|
|
129
|
+
collection,
|
|
130
|
+
front_end_cache_id: cacheId,
|
|
131
|
+
menu_list_ids,
|
|
132
|
+
with_count,
|
|
133
|
+
// client_schedule_ids: schedule_ids,
|
|
134
|
+
schedule_date,
|
|
135
|
+
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
136
|
+
is_eject: 1,
|
|
137
|
+
with_schedule,
|
|
138
|
+
schedule_datetime,
|
|
139
|
+
extension_type,
|
|
140
|
+
strategy_context
|
|
141
|
+
},
|
|
151
142
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
152
143
|
} }
|
|
153
144
|
);
|
|
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
21
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
22
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
23
23
|
*
|
|
24
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
24
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
25
25
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
26
26
|
* the requested productId wins.
|
|
27
27
|
*/
|
|
@@ -52,7 +52,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
52
52
|
{ useCache: false, osServer: true }
|
|
53
53
|
);
|
|
54
54
|
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
55
|
-
list.sort((a, b) =>
|
|
55
|
+
list.sort((a, b) => a.sort - b.sort);
|
|
56
56
|
this.store.list = list;
|
|
57
57
|
}
|
|
58
58
|
getQuotationList() {
|
|
@@ -96,7 +96,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
97
97
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
98
98
|
*
|
|
99
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
99
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
100
100
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
101
101
|
* the requested productId wins.
|
|
102
102
|
*/
|
|
@@ -27,6 +27,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
27
27
|
}): {
|
|
28
28
|
isAvailable: boolean;
|
|
29
29
|
discountList: Discount[];
|
|
30
|
+
/** 完整规则计算后的列表;调用方可用于保留暂时无适用商品的扫码卡券。 */
|
|
31
|
+
evaluatedDiscountList?: Discount[];
|
|
30
32
|
productList: any[];
|
|
31
33
|
unavailableReason?: UnavailableReason;
|
|
32
34
|
};
|
|
@@ -94,7 +94,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
94
94
|
productList
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
if (productList.every((item) => {
|
|
97
|
+
if (productList.length > 0 && productList.every((item) => {
|
|
98
98
|
var _a;
|
|
99
99
|
const product = this.hooks.getProduct(item);
|
|
100
100
|
return product.booking_id && (((_a = product.discount_list) == null ? void 0 : _a.length) || product.total == 0);
|
|
@@ -152,6 +152,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
152
152
|
return {
|
|
153
153
|
isAvailable: hasApplicableDiscount,
|
|
154
154
|
discountList: hasApplicableDiscount ? result.discountList : oldDiscountList,
|
|
155
|
+
evaluatedDiscountList: result.discountList,
|
|
155
156
|
productList: hasApplicableDiscount ? result.productList : productList,
|
|
156
157
|
unavailableReason
|
|
157
158
|
};
|
|
@@ -181,9 +182,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
181
182
|
getUnavailableReason(discountList, productList) {
|
|
182
183
|
var _a;
|
|
183
184
|
for (const discount of discountList) {
|
|
184
|
-
|
|
185
|
+
const bookingTimes = productList.length ? productList.map((item) => {
|
|
185
186
|
const product = this.hooks.getProduct(item);
|
|
186
|
-
|
|
187
|
+
return ((product == null ? void 0 : product.startDate) || (0, import_dayjs.default)()).format(
|
|
188
|
+
"YYYY-MM-DD HH:mm:ss"
|
|
189
|
+
);
|
|
190
|
+
}) : [(0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")];
|
|
191
|
+
for (const bookingTime of bookingTimes) {
|
|
187
192
|
const filteredList = (0, import_utils.filterDiscountListByBookingTime)([discount], bookingTime);
|
|
188
193
|
if (filteredList.length === 0) {
|
|
189
194
|
return import_types.UnavailableReason.TimeLimit;
|
|
@@ -300,8 +305,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
300
305
|
_id: product._id,
|
|
301
306
|
parentId: product._id,
|
|
302
307
|
quantity: product.quantity,
|
|
303
|
-
num: product.num
|
|
304
|
-
booking_id: product.booking_id
|
|
308
|
+
num: product.num
|
|
305
309
|
});
|
|
306
310
|
if (product.bundle && Array.isArray(product.bundle) && product.bundle.length > 0) {
|
|
307
311
|
product.bundle.forEach((bundleItem, bundleIndex) => {
|
|
@@ -322,7 +326,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
322
326
|
origin_total: new import_decimal.default(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
|
|
323
327
|
original_price: bundleItem.original_price,
|
|
324
328
|
// 继承主商品属性
|
|
325
|
-
booking_id:
|
|
329
|
+
booking_id: product.booking_id,
|
|
326
330
|
discount_list: bundleItem.discount_list || []
|
|
327
331
|
});
|
|
328
332
|
});
|
|
@@ -684,8 +688,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
684
688
|
discount_product_id: discount.product_id
|
|
685
689
|
},
|
|
686
690
|
metadata: {
|
|
687
|
-
num
|
|
688
|
-
discount_rule_uncheck_flag: discount == null ? void 0 : discount.discount_rule_uncheck_flag
|
|
691
|
+
num
|
|
689
692
|
}
|
|
690
693
|
};
|
|
691
694
|
applicableProducts.push(productData);
|
|
@@ -1133,7 +1136,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1133
1136
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
1134
1137
|
metadata: {
|
|
1135
1138
|
num: 1,
|
|
1136
|
-
discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
|
|
1137
1139
|
// 🔥 order_level 分摊差值
|
|
1138
1140
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference },
|
|
1139
1141
|
/** 仅主商品上的优惠金额(不含 option) */
|
|
@@ -1214,7 +1216,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1214
1216
|
metadata: {
|
|
1215
1217
|
// 🔥 使用拆分后的唯一 _id
|
|
1216
1218
|
custom_product_bundle_map_id: uniqueId,
|
|
1217
|
-
discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
|
|
1218
1219
|
num: 1
|
|
1219
1220
|
},
|
|
1220
1221
|
_num: 1,
|
|
@@ -1244,7 +1245,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1244
1245
|
_id: `${flatItem._id}_split_rest`,
|
|
1245
1246
|
num: normalNum,
|
|
1246
1247
|
quantity: normalNum,
|
|
1247
|
-
discount_list:
|
|
1248
|
+
discount_list: [],
|
|
1248
1249
|
processed: true
|
|
1249
1250
|
});
|
|
1250
1251
|
}
|
|
@@ -1293,7 +1294,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1293
1294
|
metadata: {
|
|
1294
1295
|
// 🔥 使用唯一的 _id
|
|
1295
1296
|
custom_product_bundle_map_id: uniqueId,
|
|
1296
|
-
discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
|
|
1297
1297
|
num: product.num || 1,
|
|
1298
1298
|
// 🔥 order_level 分摊差值
|
|
1299
1299
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
@@ -1308,7 +1308,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1308
1308
|
...flatItem,
|
|
1309
1309
|
total: targetProductTotal,
|
|
1310
1310
|
price: new import_decimal.default(productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
|
|
1311
|
-
discount_list:
|
|
1311
|
+
discount_list: [discountDetail],
|
|
1312
1312
|
processed: true
|
|
1313
1313
|
});
|
|
1314
1314
|
}
|
|
@@ -1729,7 +1729,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1729
1729
|
* @returns 是否可用
|
|
1730
1730
|
*/
|
|
1731
1731
|
checkPackageSubItemUsageRules(discount, flatItem) {
|
|
1732
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1732
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1733
1733
|
const limitedData = discount.limited_relation_product_data;
|
|
1734
1734
|
const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
1735
1735
|
const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
|
|
@@ -1741,7 +1741,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1741
1741
|
const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
|
|
1742
1742
|
const isMainProduct = flatItem.type === "main";
|
|
1743
1743
|
const isBundleItem = flatItem.type === "bundle";
|
|
1744
|
-
const bundleMainProductId = (_a = flatItem.product) == null ? void 0 : _a.product_id;
|
|
1745
1744
|
if (isMainProduct) {
|
|
1746
1745
|
return true;
|
|
1747
1746
|
}
|
|
@@ -1750,9 +1749,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1750
1749
|
return true;
|
|
1751
1750
|
}
|
|
1752
1751
|
if (isBundleItem) {
|
|
1753
|
-
const priceType = (
|
|
1754
|
-
const priceTypeExt = (
|
|
1755
|
-
const mainProductId = ((
|
|
1752
|
+
const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
|
|
1753
|
+
const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
|
|
1754
|
+
const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
|
|
1756
1755
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1757
1756
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1758
1757
|
if (rules.length > 0) {
|
|
@@ -1764,11 +1763,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1764
1763
|
if (!filter) {
|
|
1765
1764
|
isScopeValid = true;
|
|
1766
1765
|
} else {
|
|
1767
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
1766
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
1768
1767
|
}
|
|
1769
1768
|
}
|
|
1770
1769
|
if (scopeType === "specific_packages" || scopeType === "products") {
|
|
1771
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
1770
|
+
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
1772
1771
|
}
|
|
1773
1772
|
if (isPriceValid && isScopeValid) {
|
|
1774
1773
|
return true;
|
|
@@ -1784,26 +1783,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1784
1783
|
return false;
|
|
1785
1784
|
}
|
|
1786
1785
|
if (isBundleItem) {
|
|
1787
|
-
const priceType = (
|
|
1788
|
-
const priceTypeExt = (
|
|
1786
|
+
const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
|
|
1787
|
+
const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
|
|
1789
1788
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1790
1789
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1791
1790
|
if (rules.length > 0) {
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
const isPriceValid = _isOriginalPrice || _isMarkupPrice;
|
|
1795
|
-
let isScopeValid = false;
|
|
1796
|
-
if (scopeType === "all_packages" || scopeType === "product_all") {
|
|
1797
|
-
if (!filter) {
|
|
1798
|
-
isScopeValid = true;
|
|
1799
|
-
} else {
|
|
1800
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
if (scopeType === "specific_packages" || scopeType === "products") {
|
|
1804
|
-
isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
1791
|
+
if (isOriginalPrice && rules.includes("original_price")) {
|
|
1792
|
+
return true;
|
|
1805
1793
|
}
|
|
1806
|
-
if (
|
|
1794
|
+
if (isMarkupPrice && rules.includes("markup_price")) {
|
|
1807
1795
|
return true;
|
|
1808
1796
|
}
|
|
1809
1797
|
return false;
|