@pisell/pisellos 2.3.172 → 2.3.174
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +14 -8
- package/dist/modules/BookingContext/utils/productExtend.d.ts +5 -0
- package/dist/modules/BookingContext/utils/productExtend.js +61 -23
- package/dist/modules/Discount/index.js +0 -1
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +13 -0
- package/dist/modules/Order/index.d.ts +3 -25
- package/dist/modules/Order/index.js +1313 -1772
- package/dist/modules/Order/types.d.ts +0 -7
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/ProductList/index.js +12 -33
- package/dist/modules/Rules/index.d.ts +0 -2
- package/dist/modules/Rules/index.js +21 -29
- package/dist/solution/BaseSales/index.d.ts +1 -16
- package/dist/solution/BaseSales/index.js +1325 -1511
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +108 -200
- package/dist/solution/BookingTicket/types.d.ts +2 -14
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -4
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +1 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +23 -2
- package/dist/solution/UnifiedBookingSales/index.js +923 -683
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/utils/platform.d.ts +0 -2
- package/dist/utils/platform.js +0 -6
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -12
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +13 -7
- package/lib/modules/BookingContext/utils/productExtend.d.ts +5 -0
- package/lib/modules/BookingContext/utils/productExtend.js +36 -3
- package/lib/modules/Discount/index.js +0 -1
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +13 -0
- package/lib/modules/Order/index.d.ts +3 -25
- package/lib/modules/Order/index.js +38 -192
- package/lib/modules/Order/types.d.ts +0 -7
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/ProductList/index.js +0 -15
- package/lib/modules/Rules/index.d.ts +0 -2
- package/lib/modules/Rules/index.js +0 -6
- package/lib/solution/BaseSales/index.d.ts +1 -16
- package/lib/solution/BaseSales/index.js +9 -89
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +2 -38
- package/lib/solution/BookingTicket/types.d.ts +2 -14
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +1 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +23 -2
- package/lib/solution/UnifiedBookingSales/index.js +131 -15
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/utils/platform.d.ts +0 -2
- package/lib/utils/platform.js +0 -7
- package/package.json +1 -1
- package/dist/inventory/index.d.ts +0 -92
- package/dist/inventory/index.js +0 -509
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +0 -15
- package/dist/modules/Order/utils/productVoucherGroups.js +0 -115
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -117
- package/lib/inventory/index.d.ts +0 -92
- package/lib/inventory/index.js +0 -287
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +0 -15
- package/lib/modules/Order/utils/productVoucherGroups.js +0 -64
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -71
|
@@ -457,8 +457,6 @@ export type AddProductBookingInput = Record<string, any>;
|
|
|
457
457
|
* 避免步进器修改数量改变该组展示位置。
|
|
458
458
|
*/
|
|
459
459
|
export interface AddProductToOrderOptions {
|
|
460
|
-
/** Associates a selection with an existing runtime voucher group. */
|
|
461
|
-
productVoucherGroupKey?: string;
|
|
462
460
|
insertAfterProductUid?: string;
|
|
463
461
|
/** 新增商品行插入 products 首位,优先于 insertAfterProductUid。 */
|
|
464
462
|
insertAtStart?: boolean;
|
|
@@ -559,11 +557,6 @@ export interface OrderHooksConfig {
|
|
|
559
557
|
beforeCartIntentCommit?: (context: OrderCartIntentCommitContext) => void;
|
|
560
558
|
/** Captures tenant/business runtime identity for asynchronous cart intents. */
|
|
561
559
|
getCartIntentScope?: () => unknown;
|
|
562
|
-
/** Awaited before a local cart draft is published. Reject to leave the live order unchanged. */
|
|
563
|
-
onBeforeCartCommit?: (context: {
|
|
564
|
-
currentItems: readonly OrderProduct[];
|
|
565
|
-
proposedItems: readonly OrderProduct[];
|
|
566
|
-
}) => void | Promise<void>;
|
|
567
560
|
onBeforeMergeProductToOrder?: (context: OrderProductMergeDecisionContext) => OrderProductMergeDecisionResult | Promise<OrderProductMergeDecisionResult>;
|
|
568
561
|
}
|
|
569
562
|
/**
|
|
@@ -279,7 +279,7 @@ export function consolidateDiscountFreeProductLines(tempOrder) {
|
|
|
279
279
|
_step6;
|
|
280
280
|
try {
|
|
281
281
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
282
|
-
var _product$booking_uid, _product$metadata4, _booking_id, _product$metadata5, _product$order_detail, _holder_id, _product$metadata6, _product$metadata7, _product$metadata8, _product$product_sku2, _product$metadata9, _tempOrder$_extend, _product$selling_pric, _product$original_pri, _custom_price, _product$is_charge_ta, _product$gift_card, _product$bundle_edit, _product$metadata$pri, _product$metadata10, _product$metadata$sou, _product$metadata11, _product$metadata$mai, _product$metadata12, _product$metadata$mai2, _product$metadata13,
|
|
282
|
+
var _product$booking_uid, _product$metadata4, _booking_id, _product$metadata5, _product$order_detail, _holder_id, _product$metadata6, _product$metadata7, _product$metadata8, _product$product_sku2, _product$metadata9, _tempOrder$_extend, _product$selling_pric, _product$original_pri, _custom_price, _product$is_charge_ta, _product$gift_card, _product$bundle_edit, _product$metadata$pri, _product$metadata10, _product$metadata$sou, _product$metadata11, _product$metadata$mai, _product$metadata12, _product$metadata$mai2, _product$metadata13, _product$product_vari;
|
|
283
283
|
var product = _step6.value;
|
|
284
284
|
var productBundle = Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
285
285
|
var hasDiscount = (product.discount_list || []).length > 0 || productBundle.some(function (bundle) {
|
|
@@ -337,7 +337,7 @@ export function consolidateDiscountFreeProductLines(tempOrder) {
|
|
|
337
337
|
};
|
|
338
338
|
})
|
|
339
339
|
});
|
|
340
|
-
var mergeKey = [discountSplitOriginUid,
|
|
340
|
+
var mergeKey = [discountSplitOriginUid, product.product_id, (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0, fingerprint, priceSignature].join('#');
|
|
341
341
|
var matchedIndex = productIndexByKey.get(mergeKey);
|
|
342
342
|
|
|
343
343
|
// 当前拆分来源 + 商品结构组合第一次出现时,保留该行作为回并目标。
|
|
@@ -99,13 +99,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
99
99
|
}, {
|
|
100
100
|
key: "updateOtherParams",
|
|
101
101
|
value: function updateOtherParams(params) {
|
|
102
|
-
var previousScope = this.otherParams.catalogScopeKey;
|
|
103
102
|
this.otherParams = params || {};
|
|
104
|
-
if (previousScope !== this.otherParams.catalogScopeKey && (previousScope || this.otherParams.catalogScopeKey)) {
|
|
105
|
-
this.store.list = [];
|
|
106
|
-
this.rawProductPriceSources.clear();
|
|
107
|
-
this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
|
|
108
|
-
}
|
|
109
103
|
}
|
|
110
104
|
}, {
|
|
111
105
|
key: "storeChange",
|
|
@@ -161,12 +155,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
161
155
|
key: "loadProducts",
|
|
162
156
|
value: function () {
|
|
163
157
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
164
|
-
var
|
|
165
|
-
_this$otherParams,
|
|
158
|
+
var _this$otherParams,
|
|
166
159
|
_this$otherParams$bus,
|
|
167
160
|
_this$otherParams2,
|
|
168
161
|
_this$otherParams3,
|
|
169
|
-
_this$otherParams4
|
|
162
|
+
_this$otherParams4,
|
|
163
|
+
_this2 = this;
|
|
170
164
|
var _ref,
|
|
171
165
|
_ref$category_ids,
|
|
172
166
|
category_ids,
|
|
@@ -188,8 +182,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
188
182
|
status,
|
|
189
183
|
strategy_context,
|
|
190
184
|
options,
|
|
191
|
-
scope,
|
|
192
|
-
assertScope,
|
|
193
185
|
userPlugin,
|
|
194
186
|
customer_id,
|
|
195
187
|
_userPlugin$get,
|
|
@@ -211,12 +203,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
211
203
|
case 0:
|
|
212
204
|
_ref = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status, strategy_context = _ref.strategy_context;
|
|
213
205
|
options = _args5.length > 1 ? _args5[1] : undefined;
|
|
214
|
-
|
|
215
|
-
assertScope = function assertScope() {
|
|
216
|
-
if (scope !== _this2.otherParams.catalogScopeKey) throw Object.assign(new Error('Product catalog context changed'), {
|
|
217
|
-
name: 'AbortError'
|
|
218
|
-
});
|
|
219
|
-
}; // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
206
|
+
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
220
207
|
// if (!schedule_ids?.length) {
|
|
221
208
|
// const schedule_ids_data = this.store.schedule
|
|
222
209
|
// .getScheduleListByIds(schedule_ids)
|
|
@@ -293,20 +280,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
293
280
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
294
281
|
while (1) switch (_context4.prev = _context4.next) {
|
|
295
282
|
case 0:
|
|
296
|
-
if (!(scope !== _this2.otherParams.catalogScopeKey)) {
|
|
297
|
-
_context4.next = 2;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
return _context4.abrupt("return");
|
|
301
|
-
case 2:
|
|
302
283
|
callbackList = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list;
|
|
303
284
|
if (Array.isArray(callbackList)) {
|
|
304
|
-
_context4.next =
|
|
285
|
+
_context4.next = 4;
|
|
305
286
|
break;
|
|
306
287
|
}
|
|
307
288
|
originalCallback(result);
|
|
308
289
|
return _context4.abrupt("return");
|
|
309
|
-
case
|
|
290
|
+
case 4:
|
|
310
291
|
if (!handledByOsServer) {
|
|
311
292
|
// Subscription callbacks may contain only changed products. Upsert
|
|
312
293
|
// their raw records without evicting other IDs from the scope.
|
|
@@ -319,16 +300,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
319
300
|
queryPayload: queryPayload,
|
|
320
301
|
handledByOsServer: handledByOsServer
|
|
321
302
|
});
|
|
322
|
-
|
|
323
|
-
_context4.next = 11;
|
|
303
|
+
_context4.next = 8;
|
|
324
304
|
return _this2.addProduct(products);
|
|
325
|
-
case
|
|
305
|
+
case 8:
|
|
326
306
|
originalCallback(handledByOsServer ? result : _objectSpread(_objectSpread({}, result), {}, {
|
|
327
307
|
data: _objectSpread(_objectSpread({}, result.data), {}, {
|
|
328
308
|
list: products
|
|
329
309
|
})
|
|
330
310
|
}));
|
|
331
|
-
case
|
|
311
|
+
case 9:
|
|
332
312
|
case "end":
|
|
333
313
|
return _context4.stop();
|
|
334
314
|
}
|
|
@@ -338,16 +318,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
338
318
|
return _ref2.apply(this, arguments);
|
|
339
319
|
};
|
|
340
320
|
}()) : undefined;
|
|
341
|
-
_context5.next =
|
|
321
|
+
_context5.next = 16;
|
|
342
322
|
return this.request.post("/product/query", queryPayload, {
|
|
343
323
|
osServer: true,
|
|
344
324
|
callback: subscriptionCallback,
|
|
345
325
|
subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
|
|
346
326
|
customToast: function customToast() {}
|
|
347
327
|
});
|
|
348
|
-
case
|
|
328
|
+
case 16:
|
|
349
329
|
productsData = _context5.sent;
|
|
350
|
-
assertScope();
|
|
351
330
|
if (!handledByOsServer && Array.isArray(productsData.data.list)) {
|
|
352
331
|
this.replaceRawProductQueryResult(productsData.data.list, product_ids);
|
|
353
332
|
}
|
|
@@ -369,7 +348,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
369
348
|
// }
|
|
370
349
|
this.addProduct(sortedList);
|
|
371
350
|
return _context5.abrupt("return", sortedList);
|
|
372
|
-
case
|
|
351
|
+
case 22:
|
|
373
352
|
case "end":
|
|
374
353
|
return _context5.stop();
|
|
375
354
|
}
|
|
@@ -9,8 +9,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
9
9
|
private store;
|
|
10
10
|
window: WindowPlugin;
|
|
11
11
|
private hooks;
|
|
12
|
-
private discountScope?;
|
|
13
|
-
setDiscountScope(scope: (product: any, discount: Discount) => boolean): void;
|
|
14
12
|
constructor(name?: string, version?: string);
|
|
15
13
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
16
14
|
setRulesList(rulesList: Rules[]): Promise<void>;
|
|
@@ -60,16 +60,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
60
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
61
61
|
// WindowPlugin 实例
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "hooks", void 0);
|
|
63
|
-
_defineProperty(_assertThisInitialized(_this), "discountScope", void 0);
|
|
64
63
|
_this.hooks = {};
|
|
65
64
|
return _this;
|
|
66
65
|
}
|
|
67
66
|
_createClass(RulesModule, [{
|
|
68
|
-
key: "setDiscountScope",
|
|
69
|
-
value: function setDiscountScope(scope) {
|
|
70
|
-
this.discountScope = scope;
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
67
|
key: "initialize",
|
|
74
68
|
value: function () {
|
|
75
69
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
@@ -323,7 +317,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
323
317
|
_step;
|
|
324
318
|
try {
|
|
325
319
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
326
|
-
var
|
|
320
|
+
var discount = _step.value;
|
|
327
321
|
var bookingTimes = productList.length ? productList.map(function (item) {
|
|
328
322
|
var product = _this3.hooks.getProduct(item);
|
|
329
323
|
return ((product === null || product === void 0 ? void 0 : product.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss');
|
|
@@ -333,7 +327,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
333
327
|
try {
|
|
334
328
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
335
329
|
var bookingTime = _step3.value;
|
|
336
|
-
var filteredList = filterDiscountListByBookingTime([
|
|
330
|
+
var filteredList = filterDiscountListByBookingTime([discount], bookingTime);
|
|
337
331
|
if (filteredList.length === 0) {
|
|
338
332
|
return UnavailableReason.TimeLimit;
|
|
339
333
|
}
|
|
@@ -355,8 +349,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
355
349
|
_step2;
|
|
356
350
|
try {
|
|
357
351
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
358
|
-
var
|
|
359
|
-
var limitedData =
|
|
352
|
+
var _discount = _step2.value;
|
|
353
|
+
var limitedData = _discount.limited_relation_product_data;
|
|
360
354
|
var hasApplicableProduct = false;
|
|
361
355
|
var _iterator4 = _createForOfIteratorHelper(productList),
|
|
362
356
|
_step4;
|
|
@@ -364,11 +358,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
364
358
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
365
359
|
var _limitedData$product_;
|
|
366
360
|
var item = _step4.value;
|
|
367
|
-
var
|
|
361
|
+
var product = this.hooks.getProduct(item);
|
|
368
362
|
if (limitedData.type === 'product_all') {
|
|
369
363
|
hasApplicableProduct = true;
|
|
370
364
|
break;
|
|
371
|
-
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(
|
|
365
|
+
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(product.id)) {
|
|
372
366
|
hasApplicableProduct = true;
|
|
373
367
|
break;
|
|
374
368
|
}
|
|
@@ -456,13 +450,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
456
450
|
return selectedDiscount.isEditMode === true && selectedDiscount.isSelected === true && ['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(discountType !== null && discountType !== void 0 ? discountType : '');
|
|
457
451
|
};
|
|
458
452
|
var resolveReapplyBookingDiscountPercent = function resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount) {
|
|
459
|
-
var
|
|
453
|
+
var _discount2;
|
|
460
454
|
if (!shouldReapplyBookingDiscount(originProduct, selectedDiscount)) return undefined;
|
|
461
455
|
var discountType = (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.tag) || (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.type);
|
|
462
456
|
if (discountType !== 'discount_card' && discountType !== 'product_discount_card') {
|
|
463
457
|
return undefined;
|
|
464
458
|
}
|
|
465
|
-
var percent = Number((
|
|
459
|
+
var percent = Number((_discount2 = selectedDiscount.discount) === null || _discount2 === void 0 ? void 0 : _discount2.percent);
|
|
466
460
|
return Number.isFinite(percent) ? percent : undefined;
|
|
467
461
|
};
|
|
468
462
|
var editModeDiscount = [];
|
|
@@ -998,8 +992,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
998
992
|
|
|
999
993
|
// 辅助函数:检查商品是否对某个折扣卡可用
|
|
1000
994
|
var checkItemApplicableForDiscount = function checkItemApplicableForDiscount(flatItem, discount) {
|
|
1001
|
-
var _discount$config2, _product2, _product3,
|
|
1002
|
-
if (_this5.discountScope && !_this5.discountScope(flatItem.originProduct, discount)) return false;
|
|
995
|
+
var _discount$config2, _product, _product2, _product3, _flatItem$bundleItem, _flatItem$bundleItem2, _product4;
|
|
1003
996
|
if (((_discount$config2 = discount.config) === null || _discount$config2 === void 0 ? void 0 : _discount$config2.isAvailable) === false) return false;
|
|
1004
997
|
if (isCardBlockedByPromotion(flatItem, discount)) return false;
|
|
1005
998
|
var product;
|
|
@@ -1023,7 +1016,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1023
1016
|
}
|
|
1024
1017
|
|
|
1025
1018
|
// 编辑的商品使用了优惠券不可用
|
|
1026
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
1019
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product = product) !== null && _product !== void 0 && _product.booking_id && (_product2 = product) !== null && _product2 !== void 0 && (_product2 = _product2.discount_list) !== null && _product2 !== void 0 && _product2.length && (_product3 = product) !== null && _product3 !== void 0 && (_product3 = _product3.discount_list) !== null && _product3 !== void 0 && _product3.every(function (d) {
|
|
1027
1020
|
return d.id && ['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(d.tag || d.type);
|
|
1028
1021
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem = flatItem.bundleItem) !== null && _flatItem$bundleItem !== void 0 && (_flatItem$bundleItem = _flatItem$bundleItem.discount_list) !== null && _flatItem$bundleItem !== void 0 && _flatItem$bundleItem.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem2 = flatItem.bundleItem) !== null && _flatItem$bundleItem2 !== void 0 && (_flatItem$bundleItem2 = _flatItem$bundleItem2.discount_list) !== null && _flatItem$bundleItem2 !== void 0 && _flatItem$bundleItem2.every(function (d) {
|
|
1029
1022
|
return d.id;
|
|
@@ -1044,7 +1037,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1044
1037
|
var limitedData = discount.limited_relation_product_data;
|
|
1045
1038
|
|
|
1046
1039
|
// 时间限制检查
|
|
1047
|
-
var timeLimit = !!filterDiscountListByBookingTime([discount], (((
|
|
1040
|
+
var timeLimit = !!filterDiscountListByBookingTime([discount], (((_product4 = product) === null || _product4 === void 0 ? void 0 : _product4.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
1048
1041
|
if (!timeLimit) {
|
|
1049
1042
|
return false;
|
|
1050
1043
|
}
|
|
@@ -1274,7 +1267,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1274
1267
|
}
|
|
1275
1268
|
var isItemRewardProductDiscount = _this5.isItemRewardProductDiscount(product);
|
|
1276
1269
|
addModeDiscount.forEach(function (discount) {
|
|
1277
|
-
var _product6, _product7, _product8,
|
|
1270
|
+
var _product5, _product6, _product7, _product8, _flatItem$bundleItem3, _flatItem$bundleItem4, _discount$config5;
|
|
1278
1271
|
var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
|
|
1279
1272
|
// 拿到discount配置的holder信息 product信息 product.holder 加在 isLimitedProduct
|
|
1280
1273
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
@@ -1282,14 +1275,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1282
1275
|
isNeedHolder: resolveIsFormSubject(_tempVar) && !(_tempVar !== null && _tempVar !== void 0 && _tempVar.isNormalProduct),
|
|
1283
1276
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
1284
1277
|
}, flatItem.originProduct, holders);
|
|
1285
|
-
var timeReason = getDiscountTimeUnavailableReason(discount, (((
|
|
1278
|
+
var timeReason = getDiscountTimeUnavailableReason(discount, (((_product5 = product) === null || _product5 === void 0 ? void 0 : _product5.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss'));
|
|
1286
1279
|
var timeLimit = !timeReason;
|
|
1287
1280
|
// 是符合折扣的商品
|
|
1288
1281
|
var isProductInScope = limitedData.type === 'product_all' && limitedData.filter !== 1 || limitedData.type === 'product_all' && limitedData.filter === 1 && !limitedData.exclude_product_ids.includes(product.id) || limitedData.product_ids && limitedData.product_ids.includes(product.id);
|
|
1289
1282
|
var isLimitedProduct = isProductInScope && isHolderMatch;
|
|
1290
1283
|
|
|
1291
1284
|
// 编辑的商品 使用了优惠券不可用
|
|
1292
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
1285
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product6 = product) !== null && _product6 !== void 0 && _product6.booking_id && (_product7 = product) !== null && _product7 !== void 0 && (_product7 = _product7.discount_list) !== null && _product7 !== void 0 && _product7.length && (_product8 = product) !== null && _product8 !== void 0 && (_product8 = _product8.discount_list) !== null && _product8 !== void 0 && _product8.every(function (discount) {
|
|
1293
1286
|
return discount.id && ['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(discount.tag || discount.type);
|
|
1294
1287
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem3 = flatItem.bundleItem) !== null && _flatItem$bundleItem3 !== void 0 && (_flatItem$bundleItem3 = _flatItem$bundleItem3.discount_list) !== null && _flatItem$bundleItem3 !== void 0 && _flatItem$bundleItem3.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem4 = flatItem.bundleItem) !== null && _flatItem$bundleItem4 !== void 0 && (_flatItem$bundleItem4 = _flatItem$bundleItem4.discount_list) !== null && _flatItem$bundleItem4 !== void 0 && _flatItem$bundleItem4.every(function (discount) {
|
|
1295
1288
|
return discount.id;
|
|
@@ -1409,7 +1402,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1409
1402
|
// 然后再处理应用哪些优惠券,此时只考虑filteredDiscountList中的优惠券
|
|
1410
1403
|
// 🔥 使用扁平化后的列表进行处理
|
|
1411
1404
|
sortedFlattenedList.forEach(function (flatItem, index) {
|
|
1412
|
-
var
|
|
1405
|
+
var _product9, _originProduct, _originProduct2, _originProduct3, _product$discount_lis3, _product10;
|
|
1413
1406
|
// 获取商品数据
|
|
1414
1407
|
var product, originProduct;
|
|
1415
1408
|
if (flatItem.type === 'main') {
|
|
@@ -1433,8 +1426,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1433
1426
|
};
|
|
1434
1427
|
originProduct = flatItem.originProduct;
|
|
1435
1428
|
}
|
|
1436
|
-
var isPersistedProduct = ((
|
|
1437
|
-
var hasExistingWalletDiscount = ((_product$discount_lis3 = product.discount_list) === null || _product$discount_lis3 === void 0 ? void 0 : _product$discount_lis3.length) && ((
|
|
1429
|
+
var isPersistedProduct = ((_product9 = product) === null || _product9 === void 0 ? void 0 : _product9.booking_id) || ((_originProduct = originProduct) === null || _originProduct === void 0 ? void 0 : _originProduct.order_detail_id) || ((_originProduct2 = originProduct) === null || _originProduct2 === void 0 ? void 0 : _originProduct2.orderDetailId) || ((_originProduct3 = originProduct) === null || _originProduct3 === void 0 ? void 0 : _originProduct3.booking_id);
|
|
1430
|
+
var hasExistingWalletDiscount = ((_product$discount_lis3 = product.discount_list) === null || _product$discount_lis3 === void 0 ? void 0 : _product$discount_lis3.length) && ((_product10 = product) === null || _product10 === void 0 || (_product10 = _product10.discount_list) === null || _product10 === void 0 ? void 0 : _product10.every(function (discount) {
|
|
1438
1431
|
var _discount$id, _discount$discount4;
|
|
1439
1432
|
var discountIdentity = (_discount$id = discount.id) !== null && _discount$id !== void 0 ? _discount$id : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.resource_id;
|
|
1440
1433
|
var discountType = discount.tag || discount.type;
|
|
@@ -1456,7 +1449,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1456
1449
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
1457
1450
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
1458
1451
|
var _product$discount_lis4;
|
|
1459
|
-
if (_this5.discountScope && !_this5.discountScope(originProduct, discount)) return false;
|
|
1460
1452
|
if (_this5.isItemRewardProductDiscount(product)) return false;
|
|
1461
1453
|
if (isCardBlockedByPromotion(flatItem, discount)) return false;
|
|
1462
1454
|
// 🔥 检查策略可用性(针对全额抵扣卡和折扣卡)
|
|
@@ -1575,14 +1567,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1575
1567
|
var isManualDiscount = false;
|
|
1576
1568
|
var isItemRewardProductDiscount = false;
|
|
1577
1569
|
if (flatItem.type === 'main') {
|
|
1578
|
-
var _product$discount_lis5, _product$discount_lis6,
|
|
1570
|
+
var _product$discount_lis5, _product$discount_lis6, _product11, _product11$every;
|
|
1579
1571
|
// 主商品:判断自身是否手动折扣
|
|
1580
1572
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : ((_product$discount_lis5 = product.discount_list) === null || _product$discount_lis5 === void 0 ? void 0 : _product$discount_lis5.some(function (item) {
|
|
1581
1573
|
return item.type === 'product';
|
|
1582
1574
|
})) || product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
1583
1575
|
var _ref23;
|
|
1584
1576
|
return !((_ref23 = item.discount_list || []) !== null && _ref23 !== void 0 && _ref23.length);
|
|
1585
|
-
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((
|
|
1577
|
+
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((_product11 = product) === null || _product11 === void 0 || (_product11 = _product11.discount_list) === null || _product11 === void 0 || (_product11$every = _product11.every) === null || _product11$every === void 0 ? void 0 : _product11$every.call(_product11, function (item) {
|
|
1586
1578
|
return item.type === 'product';
|
|
1587
1579
|
})));
|
|
1588
1580
|
isItemRewardProductDiscount = _this5.isItemRewardProductDiscount(product);
|
|
@@ -1691,8 +1683,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1691
1683
|
discount_list: isManualDiscount ? _this5.resolveDiscountListForManualOverride(product.discount_list) : _this5.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1692
1684
|
}))]);
|
|
1693
1685
|
} else {
|
|
1694
|
-
var _ref25, _product$_promotion$f,
|
|
1695
|
-
var total = product.inPromotion ? (_ref25 = (_product$_promotion$f = (
|
|
1686
|
+
var _ref25, _product$_promotion$f, _product12, _product$origin_total;
|
|
1687
|
+
var total = product.inPromotion ? (_ref25 = (_product$_promotion$f = (_product12 = product) === null || _product12 === void 0 || (_product12 = _product12._promotion) === null || _product12 === void 0 ? void 0 : _product12.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref25 !== void 0 ? _ref25 : product.total : (_product$origin_total = product.origin_total) !== null && _product$origin_total !== void 0 ? _product$origin_total : product.total;
|
|
1696
1688
|
var main_product_selling_price = product.price;
|
|
1697
1689
|
if ((product.discount_list || []).some(function (item) {
|
|
1698
1690
|
return item.type === 'promotion';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InventoryController, type CheckoutRuntimeSnapshot } from '../../inventory';
|
|
2
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
3
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
4
3
|
import { type LocalEftposFinalization } from '../../modules/Order/localEftposState';
|
|
@@ -53,8 +52,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
53
52
|
protected appPlugin: AppPlugin;
|
|
54
53
|
protected store: BaseSalesState;
|
|
55
54
|
protected otherParams: Record<string, any>;
|
|
56
|
-
getInventory(): InventoryController | undefined;
|
|
57
|
-
prepareCheckout(signal?: AbortSignal): Promise<CheckoutRuntimeSnapshot | undefined>;
|
|
58
55
|
protected cacheId: string | undefined;
|
|
59
56
|
/**
|
|
60
57
|
* 由已在初始化阶段解析过设备短号的业务解决方案写入。
|
|
@@ -197,7 +194,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
197
194
|
* 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
|
|
198
195
|
*/
|
|
199
196
|
protected createSubModule(moduleName: string): Module | null;
|
|
200
|
-
private inventoryOrderHooks?;
|
|
201
197
|
protected getSubModuleHooks(moduleName: string): any;
|
|
202
198
|
/**
|
|
203
199
|
* 构造传给 BaseSales 子模块的完整运行态参数,保证初始化和后续同步语义一致。
|
|
@@ -235,11 +231,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
235
231
|
private isActiveVirtualSettlementOrder;
|
|
236
232
|
private isHistoricalVirtualSettlementOrder;
|
|
237
233
|
private syncAppDataToTempOrder;
|
|
238
|
-
private initialization?;
|
|
239
|
-
/** Hosts can await readiness without changing Core's synchronous registration API. */
|
|
240
|
-
whenInitialized(): Promise<void>;
|
|
241
234
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
242
|
-
private initializeSalesRuntime;
|
|
243
235
|
destroy(): Promise<void>;
|
|
244
236
|
/**
|
|
245
237
|
* 加载销售订单到统一 tempOrder 工作区。
|
|
@@ -348,9 +340,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
348
340
|
discountList: Discount[];
|
|
349
341
|
originalDiscountList?: Discount[];
|
|
350
342
|
}): Promise<void>;
|
|
351
|
-
scanPromotionCode(code: string, customerId?: number
|
|
352
|
-
productVouchersOnly?: boolean;
|
|
353
|
-
}): Promise<BaseSalesScanCodeResult>;
|
|
343
|
+
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
354
344
|
setDiscountSelected(params: {
|
|
355
345
|
discountId: number;
|
|
356
346
|
isSelected: boolean;
|
|
@@ -535,11 +525,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
535
525
|
private hasSmartPricingStrategies;
|
|
536
526
|
shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
|
|
537
527
|
calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
|
|
538
|
-
setProductVoucherGroups(groups: Array<{
|
|
539
|
-
key: string;
|
|
540
|
-
discountIds: Array<number | string>;
|
|
541
|
-
}>): void;
|
|
542
|
-
validateProductVoucherSelection(): void;
|
|
543
528
|
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
544
529
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
545
530
|
updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
|