@pisell/pisellos 0.10.43 → 0.10.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/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/Customer/index.js +2 -1
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/index.d.ts +1 -3
- package/dist/modules/Discount/index.js +12 -151
- package/dist/modules/Discount/types.d.ts +6 -0
- package/dist/modules/Order/index.d.ts +41 -9
- package/dist/modules/Order/index.js +1457 -872
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +105 -8
- package/dist/modules/Order/types.js +6 -1
- package/dist/modules/Order/utils.d.ts +4 -2
- package/dist/modules/Order/utils.js +224 -79
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +17 -367
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +2 -1
- package/dist/modules/ProductList/index.js +100 -20
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/modules/Rules/index.js +50 -16
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +45 -3
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +9 -0
- package/dist/server/utils/small-ticket.d.ts +1 -0
- package/dist/server/utils/small-ticket.js +142 -14
- package/dist/solution/BaseSales/index.d.ts +15 -1
- package/dist/solution/BaseSales/index.js +1240 -877
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -0
- package/dist/solution/BookingTicket/index.js +37 -16
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +59 -22
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +40 -21
- package/dist/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/dist/solution/UnifiedBookingSales/index.js +777 -510
- package/dist/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +8 -4
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/Customer/index.js +1 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/index.d.ts +1 -3
- package/lib/modules/Discount/index.js +10 -131
- package/lib/modules/Discount/types.d.ts +6 -0
- package/lib/modules/Order/index.d.ts +41 -9
- package/lib/modules/Order/index.js +456 -69
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +105 -8
- package/lib/modules/Order/types.js +5 -1
- package/lib/modules/Order/utils.d.ts +4 -2
- package/lib/modules/Order/utils.js +134 -3
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +9 -354
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +2 -1
- package/lib/modules/ProductList/index.js +47 -2
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/modules/Rules/index.js +42 -5
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +39 -3
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +9 -0
- package/lib/server/utils/small-ticket.d.ts +1 -0
- package/lib/server/utils/small-ticket.js +136 -12
- package/lib/solution/BaseSales/index.d.ts +15 -1
- package/lib/solution/BaseSales/index.js +192 -22
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -0
- package/lib/solution/BookingTicket/index.js +23 -5
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +1 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +29 -3
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +39 -23
- package/lib/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/lib/solution/UnifiedBookingSales/index.js +125 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +5 -1
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ import { uniqueById } from "../../solution/ShopDiscount/utils";
|
|
|
29
29
|
import { BaseModule } from "../BaseModule";
|
|
30
30
|
import { DiscountHooks } from "./types";
|
|
31
31
|
import Decimal from 'decimal.js';
|
|
32
|
-
import {
|
|
32
|
+
import { getDiscountLifecycleReason, getDiscountUsageBlockReason, getDiscountUsageLimitFailKey, hasAvailableDiscountBalance } from "./availability";
|
|
33
33
|
export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
34
34
|
_inherits(DiscountModule, _BaseModule);
|
|
35
35
|
var _super = _createSuper(DiscountModule);
|
|
@@ -325,169 +325,30 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
325
325
|
return _batchSearchByProductIds.apply(this, arguments);
|
|
326
326
|
}
|
|
327
327
|
return batchSearchByProductIds;
|
|
328
|
-
}()
|
|
328
|
+
}() // 展示列表只剔除已失效项,当前不可用项保留并携带原因。
|
|
329
329
|
}, {
|
|
330
330
|
key: "filterEnabledDiscountList",
|
|
331
331
|
value: function filterEnabledDiscountList(discountList) {
|
|
332
|
-
var _this2 = this;
|
|
333
332
|
return discountList.filter(function (discount) {
|
|
334
|
-
return discount.limit_status === 'enable' &&
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (isEntitlementPass(discount)) {
|
|
341
|
-
return hasAvailableEntitlementUses(discount);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// good_pass 与折扣卡继续沿用原有金额余额判断。
|
|
345
|
-
return new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// 检查使用次数限制
|
|
349
|
-
}, {
|
|
350
|
-
key: "checkUsageCreditsLimit",
|
|
351
|
-
value: function checkUsageCreditsLimit(discount) {
|
|
352
|
-
// 如果没有 extension_data,则不需要限制
|
|
353
|
-
if (!discount.extension_data || discount.extension_data.length === 0) {
|
|
354
|
-
return true;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// 查找 field_key 为 usage_credits 的数据
|
|
358
|
-
var usageCreditsData = discount.extension_data.find(function (data) {
|
|
359
|
-
return data.field_key === 'usage_credits';
|
|
333
|
+
return discount.limit_status === 'enable' && hasAvailableDiscountBalance(discount) && !getDiscountLifecycleReason(discount);
|
|
334
|
+
}).map(function (discount) {
|
|
335
|
+
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
336
|
+
usageLimitFailKey: getDiscountUsageLimitFailKey(discount),
|
|
337
|
+
reasonCode: getDiscountUsageBlockReason(discount)
|
|
338
|
+
});
|
|
360
339
|
});
|
|
361
|
-
|
|
362
|
-
// 如果没有找到 usage_credits 数据,则不需要限制
|
|
363
|
-
if (!usageCreditsData) {
|
|
364
|
-
return true;
|
|
365
|
-
}
|
|
366
|
-
var value = usageCreditsData.value;
|
|
367
|
-
|
|
368
|
-
// 检查总次数限制
|
|
369
|
-
if (value.total_credits && value.total_credits > 0) {
|
|
370
|
-
if ((discount.total_order_behavior_count || 0) >= value.total_credits) {
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// 检查单用户限制
|
|
376
|
-
if (value.per_user_limit && value.per_user_limit > 0) {
|
|
377
|
-
if ((discount.customer_order_behavior_count || 0) >= value.per_user_limit) {
|
|
378
|
-
return false;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// 检查单日限制
|
|
383
|
-
if (value.max_per_day && value.max_per_day > 0) {
|
|
384
|
-
if ((discount.today_order_behavior_count || 0) >= value.max_per_day) {
|
|
385
|
-
return false;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// 检查单周限制
|
|
390
|
-
if (value.max_per_week && value.max_per_week > 0) {
|
|
391
|
-
if ((discount.week_order_behavior_count || 0) >= value.max_per_week) {
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// 检查单月限制
|
|
397
|
-
if (value.max_per_month && value.max_per_month > 0) {
|
|
398
|
-
if ((discount.month_order_behavior_count || 0) >= value.max_per_month) {
|
|
399
|
-
return false;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// 所有检查都通过
|
|
404
|
-
return true;
|
|
405
340
|
}
|
|
406
|
-
|
|
407
|
-
// 过滤启用且可用的优惠券,并返回校验失败原因
|
|
408
341
|
}, {
|
|
409
342
|
key: "filterEnabledDiscountListWithReason",
|
|
410
343
|
value: function filterEnabledDiscountListWithReason(discountList) {
|
|
411
|
-
var _this3 = this;
|
|
412
|
-
var lists = discountList.filter(function (discount) {
|
|
413
|
-
return discount.limit_status === 'enable';
|
|
414
|
-
}).filter(function (discount) {
|
|
415
|
-
return _this3.hasAvailableBalance(discount);
|
|
416
|
-
}).map(function (discount) {
|
|
417
|
-
var limitFailKey = _this3.checkUsageCreditsLimitWithFailKey(discount);
|
|
418
|
-
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
419
|
-
usageLimitFailKey: limitFailKey
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
// 可用的列表
|
|
424
|
-
var availableLists = lists.filter(function (item) {
|
|
425
|
-
return !item.usageLimitFailKey && item.unified_available_status !== 0;
|
|
426
|
-
});
|
|
427
|
-
// 不可用数据
|
|
428
|
-
var currentFailDiscount = lists.find(function (item) {
|
|
429
|
-
return item.usageLimitFailKey;
|
|
430
|
-
});
|
|
431
344
|
return {
|
|
432
|
-
discountList:
|
|
433
|
-
unavailableReasonKey:
|
|
345
|
+
discountList: this.filterEnabledDiscountList(discountList),
|
|
346
|
+
unavailableReasonKey: discountList.map(getDiscountUsageLimitFailKey).find(function (key) {
|
|
347
|
+
return key !== null;
|
|
348
|
+
}) || null
|
|
434
349
|
};
|
|
435
350
|
}
|
|
436
351
|
|
|
437
|
-
// 检查使用次数限制,并返回校验失败原因
|
|
438
|
-
}, {
|
|
439
|
-
key: "checkUsageCreditsLimitWithFailKey",
|
|
440
|
-
value: function checkUsageCreditsLimitWithFailKey(discount) {
|
|
441
|
-
if (!discount.extension_data || discount.extension_data.length === 0) {
|
|
442
|
-
return null;
|
|
443
|
-
}
|
|
444
|
-
var usageCreditsData = discount.extension_data.find(function (data) {
|
|
445
|
-
return data.field_key === 'usage_credits';
|
|
446
|
-
});
|
|
447
|
-
if (!usageCreditsData) {
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
var value = usageCreditsData.value;
|
|
451
|
-
|
|
452
|
-
// 总次数限制
|
|
453
|
-
if (value.total_credits && value.total_credits > 0) {
|
|
454
|
-
if ((discount.total_order_behavior_count || 0) >= value.total_credits) {
|
|
455
|
-
return 'total_credits';
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// 单用户限制
|
|
460
|
-
if (value.per_user_limit && value.per_user_limit > 0) {
|
|
461
|
-
if ((discount.customer_order_behavior_count || 0) >= value.per_user_limit) {
|
|
462
|
-
return 'per_user_limit';
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// 单日限制
|
|
467
|
-
if (value.max_per_day && value.max_per_day > 0) {
|
|
468
|
-
if ((discount.today_order_behavior_count || 0) >= value.max_per_day) {
|
|
469
|
-
return 'max_per_day';
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// 单周限制
|
|
474
|
-
if (value.max_per_week && value.max_per_week > 0) {
|
|
475
|
-
if ((discount.week_order_behavior_count || 0) >= value.max_per_week) {
|
|
476
|
-
return 'max_per_week';
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// 单月限制
|
|
481
|
-
if (value.max_per_month && value.max_per_month > 0) {
|
|
482
|
-
if ((discount.month_order_behavior_count || 0) >= value.max_per_month) {
|
|
483
|
-
return 'max_per_month';
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// 全部通过
|
|
488
|
-
return null;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
352
|
// 根据productIds去重
|
|
492
353
|
}, {
|
|
493
354
|
key: "uniqueByProductId",
|
|
@@ -201,6 +201,12 @@ export interface Discount {
|
|
|
201
201
|
start_time?: string;
|
|
202
202
|
discount_rule_uncheck_flag?: boolean;
|
|
203
203
|
usageLimitFailKey?: string | null;
|
|
204
|
+
/** 本次规则计算的不可用原因;可用性恢复后清除。 */
|
|
205
|
+
reason?: string;
|
|
206
|
+
reasonCode?: string;
|
|
207
|
+
unified_messages?: {
|
|
208
|
+
title?: string | Record<string, string>;
|
|
209
|
+
};
|
|
204
210
|
unified_available_status?: number | undefined | null;
|
|
205
211
|
}
|
|
206
212
|
export interface DiscountState {
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -20,6 +20,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
20
20
|
private openCache;
|
|
21
21
|
private sessionStoragePersistEnabled;
|
|
22
22
|
private sessionStorageRestoreRecord;
|
|
23
|
+
/** 只允许当前订单最新的 prepare/config 请求回写客户资产态。 */
|
|
24
|
+
private customerWalletPrepareConfigEpoch;
|
|
23
25
|
private salesSummaryModuleName;
|
|
24
26
|
private rulesHooksOverride?;
|
|
25
27
|
private moduleHooksOverride?;
|
|
@@ -29,8 +31,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
29
31
|
private promotionEvaluator;
|
|
30
32
|
/** 赠品选择 resolver;由 SDK host bridge 注入 */
|
|
31
33
|
private giftSelectResolver;
|
|
32
|
-
/**
|
|
34
|
+
/** 促销评估递归保护 flag(写路径同步评估促销,禁止重入) */
|
|
33
35
|
private isApplyingPromotion;
|
|
36
|
+
/** 保持旧事件语义:同步事件监听器内触发的订单写入不得递归评估促销。 */
|
|
37
|
+
private isEmittingPromotionApplied;
|
|
34
38
|
/** 商品曾应用过客户券卡,客户变更剥离后需强制跑一次 calcDiscount 复位价格 */
|
|
35
39
|
private hasActiveCustomerBoundDiscount;
|
|
36
40
|
/** 最近一次 applyPromotion 的未满足促销提示 */
|
|
@@ -76,6 +80,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
76
80
|
private logError;
|
|
77
81
|
private registerDiscountModules;
|
|
78
82
|
private createDefaultRulesHooks;
|
|
83
|
+
/**
|
|
84
|
+
* Stable across notifyTempOrderChanged's immutable copy, but changes when a
|
|
85
|
+
* different local/server order becomes current.
|
|
86
|
+
*/
|
|
87
|
+
private getDiscountConfigOrderIdentityKey;
|
|
79
88
|
loadDiscountConfig(params: {
|
|
80
89
|
customerId: number;
|
|
81
90
|
action?: 'create' | 'edit';
|
|
@@ -85,6 +94,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
85
94
|
getDiscountList(): Discount[];
|
|
86
95
|
getAvailableWalletIds(): number[];
|
|
87
96
|
getVirtualCurrencyList(): import("../Discount/types").VirtualCurrencyAsset[];
|
|
97
|
+
getCustomerWalletPrepareConfigEpoch(): number;
|
|
88
98
|
private syncScannedDiscountsToOriginalDiscountList;
|
|
89
99
|
private ensureEditDiscountConfigForProductChange;
|
|
90
100
|
scanCode(code: string, customerId?: number): Promise<{
|
|
@@ -124,7 +134,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
124
134
|
*/
|
|
125
135
|
appendPromotionTags<T extends Record<string, any>>(products: T[]): T[];
|
|
126
136
|
/**
|
|
127
|
-
*
|
|
137
|
+
* 只执行购物车促销评估与赠品写回,不发布稳定态事件。
|
|
128
138
|
*
|
|
129
139
|
* 调用时机:写路径(add/update/remove/clear/setCustomer)末尾自动触发;外部一般无需手动调。
|
|
130
140
|
*
|
|
@@ -132,8 +142,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
132
142
|
* - 不调用任何公开 CRUD API(如 removeProductFromOrder),全部内部 mutate tempOrder.products,避免事件风暴;
|
|
133
143
|
* - 用 `isApplyingPromotion` 防递归;
|
|
134
144
|
* - 多选项赠品依赖 giftSelectResolver,未注入则跳过且 console.warn;
|
|
135
|
-
* - 不主动调用 applyDiscount / recalculateSummary
|
|
145
|
+
* - 不主动调用 applyDiscount / recalculateSummary,调用方负责跟进;
|
|
146
|
+
* - 返回的 payload 只能在 applyDiscount(商品写路径还需 summary/persist)完成后发布。
|
|
136
147
|
*/
|
|
148
|
+
private evaluatePromotion;
|
|
149
|
+
/** 发布促销稳定态;products 必须读取折扣计算后的当前数组。 */
|
|
150
|
+
private emitPromotionApplied;
|
|
151
|
+
/** 公开入口:促销、折扣、summary 与持久化完成后发布稳定态事件。 */
|
|
137
152
|
applyPromotion(): Promise<void>;
|
|
138
153
|
/** 最近一次 applyPromotion 输出的未满足促销列表 */
|
|
139
154
|
getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
|
|
@@ -169,8 +184,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
169
184
|
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
170
185
|
notifyTempOrderChanged(): void;
|
|
171
186
|
private createDefaultTempOrderInstance;
|
|
172
|
-
private
|
|
173
|
-
private
|
|
187
|
+
private clearTempOrderCustomerWalletSnapshots;
|
|
188
|
+
private clearCustomerWalletState;
|
|
189
|
+
private clearCustomerWalletRuntimeState;
|
|
190
|
+
private writeCustomerWalletSnapshotsFromPrepareConfig;
|
|
174
191
|
private createExternalSaleNumber;
|
|
175
192
|
private ensureExternalSaleNumber;
|
|
176
193
|
private ensureRequestUniqueIdempotencyToken;
|
|
@@ -306,9 +323,24 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
306
323
|
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
307
324
|
syncTempOrderNoteToRemote(orderId: number | string, note: string): Promise<string>;
|
|
308
325
|
getTempOrderNote(): string;
|
|
326
|
+
private ensureSalesNotesRuntimeState;
|
|
327
|
+
private ensureSalesNotesLoadedForMutation;
|
|
328
|
+
private normalizeSalesNoteUuid;
|
|
329
|
+
private getSalesNotePrimaryRelation;
|
|
330
|
+
private removeSalesNotesForMissingProductLines;
|
|
331
|
+
private setSalesNoteOnTempOrder;
|
|
332
|
+
getSalesNotes(): SalesNote[];
|
|
333
|
+
createSalesNotesMutationSnapshot(): SalesNotesMutationSnapshot;
|
|
334
|
+
restoreSalesNotesMutationSnapshot(snapshot: SalesNotesMutationSnapshot): void;
|
|
335
|
+
setSalesNote(input: SetSalesNoteInput): Promise<SalesNote>;
|
|
336
|
+
removeSalesNote(uuid: string): Promise<void>;
|
|
337
|
+
clearSalesNotes(): Promise<void>;
|
|
309
338
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
310
339
|
updateTempOrderDepositAmount(amount: string | number): OrderSummary;
|
|
311
340
|
updateTempOrderBuzzer(buzzer: string): string;
|
|
341
|
+
private updateTempOrderShopServiceData;
|
|
342
|
+
updateTempOrderPickupReferenceMode(mode: PickupReferenceMode): ShopServiceData;
|
|
343
|
+
updateTempOrderServiceType(serviceType: ShopServiceType): ShopServiceData;
|
|
312
344
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
313
345
|
private buildTempOrderCustomer;
|
|
314
346
|
private isCustomerBoundDiscount;
|
|
@@ -476,7 +508,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
476
508
|
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
477
509
|
/**
|
|
478
510
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
479
|
-
*
|
|
511
|
+
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
480
512
|
*/
|
|
481
513
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
482
514
|
/**
|
|
@@ -540,7 +572,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
540
572
|
generateIdempotencyToken(): string;
|
|
541
573
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
542
574
|
createOrder(params: CommitOrderParams['query']): {
|
|
543
|
-
type: "
|
|
575
|
+
type: "virtual" | "appointment_booking";
|
|
544
576
|
platform: string;
|
|
545
577
|
sales_channel: string;
|
|
546
578
|
order_sales_channel: string;
|
|
@@ -618,4 +650,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
618
650
|
getOrderInfo(order_id: number): Promise<any>;
|
|
619
651
|
getVouchers(): any[];
|
|
620
652
|
}
|
|
621
|
-
export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
653
|
+
export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, VirtualCurrencySnapshotItem, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|