@pisell/pisellos 2.1.166 → 2.1.168

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.
Files changed (81) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -3
  3. package/dist/model/strategy/adapter/index.d.ts +0 -4
  4. package/dist/model/strategy/adapter/index.js +1 -5
  5. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  6. package/dist/modules/Cart/utils/changePrice.js +16 -9
  7. package/dist/modules/Discount/index.d.ts +2 -5
  8. package/dist/modules/Discount/index.js +1 -21
  9. package/dist/modules/Discount/types.d.ts +0 -4
  10. package/dist/modules/Order/index.d.ts +0 -1
  11. package/dist/modules/Order/index.js +6 -18
  12. package/dist/modules/Order/types.d.ts +0 -2
  13. package/dist/modules/ProductList/index.d.ts +1 -3
  14. package/dist/modules/ProductList/index.js +11 -22
  15. package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
  16. package/dist/solution/BookingByStep/index.d.ts +2 -2
  17. package/dist/solution/ScanOrder/index.js +1 -1
  18. package/dist/solution/ShopDiscount/index.js +15 -16
  19. package/dist/solution/VenueBooking/index.d.ts +3 -40
  20. package/dist/solution/VenueBooking/index.js +261 -394
  21. package/dist/solution/VenueBooking/types.d.ts +1 -3
  22. package/dist/solution/VenueBooking/types.js +0 -1
  23. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  24. package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
  25. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  26. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  27. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  28. package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
  29. package/lib/index.d.ts +0 -1
  30. package/lib/index.js +0 -3
  31. package/lib/model/strategy/adapter/index.d.ts +0 -4
  32. package/lib/model/strategy/adapter/index.js +2 -13
  33. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  34. package/lib/modules/Cart/utils/changePrice.js +13 -9
  35. package/lib/modules/Discount/index.d.ts +2 -5
  36. package/lib/modules/Discount/index.js +1 -11
  37. package/lib/modules/Discount/types.d.ts +0 -4
  38. package/lib/modules/Order/index.d.ts +0 -1
  39. package/lib/modules/Order/index.js +1 -11
  40. package/lib/modules/Order/types.d.ts +0 -2
  41. package/lib/modules/ProductList/index.d.ts +1 -3
  42. package/lib/modules/ProductList/index.js +39 -45
  43. package/lib/modules/Schedule/getDateIsInSchedule.js +0 -4
  44. package/lib/solution/BookingByStep/index.d.ts +2 -2
  45. package/lib/solution/ScanOrder/index.js +1 -1
  46. package/lib/solution/ShopDiscount/index.js +2 -3
  47. package/lib/solution/VenueBooking/index.d.ts +3 -40
  48. package/lib/solution/VenueBooking/index.js +111 -257
  49. package/lib/solution/VenueBooking/types.d.ts +1 -3
  50. package/lib/solution/VenueBooking/types.js +0 -1
  51. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  52. package/lib/solution/VenueBooking/utils/dateSummary.js +10 -5
  53. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  54. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -3
  55. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  56. package/lib/solution/VenueBooking/utils/timeSlot.js +3 -7
  57. package/package.json +1 -1
  58. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  59. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  60. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  61. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
  62. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  63. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  64. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  65. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  66. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  67. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  68. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  69. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
  70. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  71. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  72. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  73. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
  74. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  75. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  76. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  77. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  78. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  79. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
  80. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  81. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -180
@@ -1,39 +0,0 @@
1
- import type { StrategyConfig } from '../../type';
2
- import type { ScheduleItem } from '../../../../modules/Schedule/types';
3
- import type { DataVariantItem, DataVariantMenu, DataVariantProduct, DataVariantRuleMetadata } from './type';
4
- /**
5
- * 构造示例用 data_variant 记录,字段结构与后端 /product/query 返回一致。
6
- */
7
- export declare function createExampleDataVariant(ruleId: number | string, data: Record<string, any>, overrides?: Partial<Omit<DataVariantItem, 'data_variant_rule_id' | 'data'>>): DataVariantItem;
8
- /**
9
- * 晚场餐牌价:命中日程 + 餐牌商品范围后覆盖 price / stock。
10
- */
11
- export declare const EVENING_MENU_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
12
- /**
13
- * VIP 商品价:演示 product_match 与更高优先级字段覆盖。
14
- */
15
- export declare const VIP_PRODUCT_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
16
- /**
17
- * 客户/渠道/业务范围价:演示 customer_id、channel、business_code 的 in 条件。
18
- */
19
- export declare const CUSTOMER_SCOPE_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
20
- /**
21
- * 示例日程:2026-06-26 17:00 ~ 20:00 生效。
22
- */
23
- export declare const DATA_VARIANT_EXAMPLE_SCHEDULES: ScheduleItem[];
24
- /**
25
- * 示例餐牌:product_collection = 128 的商品均属于餐牌。
26
- */
27
- export declare const DATA_VARIANT_EXAMPLE_MENUS: DataVariantMenu[];
28
- /**
29
- * 示例商品:同时带两条 Data Variant 覆盖数据。
30
- */
31
- export declare const DATA_VARIANT_EXAMPLE_PRODUCTS: DataVariantProduct[];
32
- /**
33
- * Data Variant 评估器示例调用。
34
- */
35
- export declare function runDataVariantDemo(): import("./type").ResolvedDataVariantResult;
36
- /**
37
- * 客户/渠道/业务范围条件示例调用。
38
- */
39
- export declare function runCustomerScopeDataVariantDemo(): import("./type").ResolvedDataVariantResult;
@@ -1,277 +0,0 @@
1
- import { DataVariantEvaluator } from "./evaluator";
2
- import { DATA_VARIANT_ACTION_TYPES } from "./type";
3
- /**
4
- * 构造示例用 data_variant 记录,字段结构与后端 /product/query 返回一致。
5
- */
6
- export function createExampleDataVariant(ruleId, data, overrides) {
7
- var _overrides$id, _overrides$shop_id, _overrides$module, _overrides$module_dat, _overrides$created_at, _overrides$updated_at, _overrides$deleted_at;
8
- return {
9
- id: (_overrides$id = overrides === null || overrides === void 0 ? void 0 : overrides.id) !== null && _overrides$id !== void 0 ? _overrides$id : 1,
10
- shop_id: (_overrides$shop_id = overrides === null || overrides === void 0 ? void 0 : overrides.shop_id) !== null && _overrides$shop_id !== void 0 ? _overrides$shop_id : 9,
11
- module: (_overrides$module = overrides === null || overrides === void 0 ? void 0 : overrides.module) !== null && _overrides$module !== void 0 ? _overrides$module : 'product',
12
- module_data_id: (_overrides$module_dat = overrides === null || overrides === void 0 ? void 0 : overrides.module_data_id) !== null && _overrides$module_dat !== void 0 ? _overrides$module_dat : 61416,
13
- data_variant_rule_id: ruleId,
14
- data: data,
15
- created_at: (_overrides$created_at = overrides === null || overrides === void 0 ? void 0 : overrides.created_at) !== null && _overrides$created_at !== void 0 ? _overrides$created_at : null,
16
- updated_at: (_overrides$updated_at = overrides === null || overrides === void 0 ? void 0 : overrides.updated_at) !== null && _overrides$updated_at !== void 0 ? _overrides$updated_at : null,
17
- deleted_at: (_overrides$deleted_at = overrides === null || overrides === void 0 ? void 0 : overrides.deleted_at) !== null && _overrides$deleted_at !== void 0 ? _overrides$deleted_at : null
18
- };
19
- }
20
-
21
- /**
22
- * 晚场餐牌价:命中日程 + 餐牌商品范围后覆盖 price / stock。
23
- */
24
- export var EVENING_MENU_PRICE_STRATEGY = {
25
- metadata: {
26
- id: '1',
27
- type: 'data_variant',
28
- name: {
29
- 'zh-CN': '晚场餐牌价',
30
- en: 'Evening menu price'
31
- },
32
- custom: {
33
- module: 'product',
34
- priority: 100,
35
- status: 'active',
36
- updated_at: '2026-06-26 12:00:00'
37
- }
38
- },
39
- conditions: {
40
- operator: 'and',
41
- rules: [{
42
- type: 'operator',
43
- field: 'schedule',
44
- operator: 'schedule_match',
45
- value: [1042]
46
- }, {
47
- type: 'operator',
48
- field: 'product',
49
- operator: 'menu_match',
50
- value: [43209]
51
- }],
52
- actionIds: ['apply_data_variant']
53
- },
54
- actions: [{
55
- id: 'apply_data_variant',
56
- type: DATA_VARIANT_ACTION_TYPES.APPLY,
57
- target: 'product',
58
- value: null,
59
- priority: 100
60
- }]
61
- };
62
-
63
- /**
64
- * VIP 商品价:演示 product_match 与更高优先级字段覆盖。
65
- */
66
- export var VIP_PRODUCT_PRICE_STRATEGY = {
67
- metadata: {
68
- id: '2',
69
- type: 'data_variant',
70
- name: {
71
- 'zh-CN': 'VIP 商品价',
72
- en: 'VIP product price'
73
- },
74
- custom: {
75
- module: 'product',
76
- priority: 200,
77
- status: 'active',
78
- updated_at: '2026-06-26 13:00:00'
79
- }
80
- },
81
- conditions: {
82
- operator: 'and',
83
- rules: [{
84
- type: 'operator',
85
- field: 'productIdAndVariantId',
86
- operator: 'product_match',
87
- value: [{
88
- product_id: 2001,
89
- product_variant_id: 0
90
- }]
91
- }],
92
- actionIds: ['apply_data_variant']
93
- },
94
- actions: [{
95
- id: 'apply_data_variant',
96
- type: DATA_VARIANT_ACTION_TYPES.APPLY,
97
- target: 'product',
98
- value: null,
99
- priority: 200
100
- }]
101
- };
102
-
103
- /**
104
- * 客户/渠道/业务范围价:演示 customer_id、channel、business_code 的 in 条件。
105
- */
106
- export var CUSTOMER_SCOPE_PRICE_STRATEGY = {
107
- metadata: {
108
- id: '3',
109
- type: 'data_variant',
110
- name: {
111
- 'zh-CN': '指定客户渠道业务价',
112
- en: 'Scoped customer channel business price'
113
- },
114
- custom: {
115
- module: 'product',
116
- priority: 150,
117
- status: 'active',
118
- updated_at: '2026-06-26 14:00:00'
119
- }
120
- },
121
- conditions: {
122
- operator: 'and',
123
- rules: [{
124
- type: 'operator',
125
- field: 'customer_id',
126
- operator: 'in',
127
- value: [333, 444]
128
- }, {
129
- type: 'operator',
130
- field: 'channel',
131
- operator: 'in',
132
- value: ['pos', 'online']
133
- }, {
134
- type: 'operator',
135
- field: 'business_code',
136
- operator: 'in',
137
- value: ['venue', 'retail']
138
- }],
139
- actionIds: ['apply_data_variant']
140
- },
141
- actions: [{
142
- id: 'apply_data_variant',
143
- type: DATA_VARIANT_ACTION_TYPES.APPLY,
144
- target: 'product',
145
- value: null,
146
- priority: 150
147
- }]
148
- };
149
-
150
- /**
151
- * 示例日程:2026-06-26 17:00 ~ 20:00 生效。
152
- */
153
- export var DATA_VARIANT_EXAMPLE_SCHEDULES = [{
154
- id: 1042,
155
- name: '晚场 17~20',
156
- color: '#1890ff',
157
- start_time: '2026-06-26 17:00:00',
158
- end_time: '2026-06-26 20:00:00',
159
- repeat_type: 'none',
160
- repeat_rule: {
161
- end: {
162
- type: 'never',
163
- end_date: null,
164
- occurrence: null
165
- },
166
- frequency: 1,
167
- excluded_date: [],
168
- included_date: [],
169
- frequency_date: []
170
- },
171
- type: 'standard',
172
- time_slot: [],
173
- designation: [],
174
- is_all: 0,
175
- created_at: '2026-06-26 00:00:00',
176
- updated_at: '2026-06-26 00:00:00',
177
- order_count: 0,
178
- relation_count: 0
179
- }];
180
-
181
- /**
182
- * 示例餐牌:product_collection = 128 的商品均属于餐牌。
183
- */
184
- export var DATA_VARIANT_EXAMPLE_MENUS = [{
185
- form_record_id: 43209,
186
- name: 'kiosk餐牌1 17~20',
187
- status: 'valid',
188
- schedule: [1042],
189
- partyroom_package: {
190
- type: 'product_collection',
191
- products: [{
192
- product_collection_id: 128,
193
- product_id: 0,
194
- product_variant_id: 0
195
- }]
196
- }
197
- }];
198
-
199
- /**
200
- * 示例商品:同时带两条 Data Variant 覆盖数据。
201
- */
202
- export var DATA_VARIANT_EXAMPLE_PRODUCTS = [{
203
- id: 2001,
204
- title: '入场票',
205
- price: 100,
206
- stock: 50,
207
- collection: [{
208
- id: 128,
209
- title: 'Tickets'
210
- }],
211
- data_variants: [createExampleDataVariant(1, {
212
- price: 80,
213
- stock: 20
214
- }, {
215
- id: 1,
216
- module_data_id: 2001
217
- }), createExampleDataVariant(2, {
218
- price: 70,
219
- title: 'VIP专属票'
220
- }, {
221
- id: 2,
222
- module_data_id: 2001
223
- }), createExampleDataVariant(3, {
224
- price: 65,
225
- title: 'VIP渠道价'
226
- }, {
227
- id: 4,
228
- module_data_id: 2001
229
- })]
230
- }, {
231
- id: 2002,
232
- title: '普通票',
233
- price: 100,
234
- stock: 50,
235
- collection: [{
236
- id: 999,
237
- title: 'Other'
238
- }],
239
- data_variants: [createExampleDataVariant(1, {
240
- price: 80,
241
- stock: 20
242
- }, {
243
- id: 3,
244
- module_data_id: 2002
245
- })]
246
- }];
247
-
248
- /**
249
- * Data Variant 评估器示例调用。
250
- */
251
- export function runDataVariantDemo() {
252
- var evaluator = new DataVariantEvaluator();
253
- evaluator.setStrategyConfigs([EVENING_MENU_PRICE_STRATEGY, VIP_PRODUCT_PRICE_STRATEGY]);
254
- var businessData = {
255
- products: DATA_VARIANT_EXAMPLE_PRODUCTS,
256
- scheduleDateTime: '2026-06-26 18:00:00',
257
- scheduleList: DATA_VARIANT_EXAMPLE_SCHEDULES,
258
- menuList: DATA_VARIANT_EXAMPLE_MENUS,
259
- orderType: 'booking'
260
- };
261
- return evaluator.resolveProducts(businessData);
262
- }
263
-
264
- /**
265
- * 客户/渠道/业务范围条件示例调用。
266
- */
267
- export function runCustomerScopeDataVariantDemo() {
268
- var evaluator = new DataVariantEvaluator();
269
- evaluator.setStrategyConfigs([CUSTOMER_SCOPE_PRICE_STRATEGY]);
270
- var businessData = {
271
- products: [DATA_VARIANT_EXAMPLE_PRODUCTS[0]],
272
- customerId: 333,
273
- channel: 'pos',
274
- businessCode: 'venue'
275
- };
276
- return evaluator.resolveProducts(businessData);
277
- }
@@ -1,4 +0,0 @@
1
- export { DataVariantAdapter } from './adapter';
2
- export { DataVariantEvaluator } from './evaluator';
3
- export { runDataVariantDemo } from './examples';
4
- export * from './type';
@@ -1,4 +0,0 @@
1
- export { DataVariantAdapter } from "./adapter";
2
- export { DataVariantEvaluator } from "./evaluator";
3
- export { runDataVariantDemo } from "./examples";
4
- export * from "./type";
@@ -1,148 +0,0 @@
1
- import type { ConditionRule, EvaluationResult, StrategyConfig } from '../../type';
2
- import type { ScheduleItem } from '../../../../modules/Schedule/types';
3
- /**
4
- * Data Variant 动作类型。
5
- *
6
- * 当前阶段动作只用于标识“该策略可应用 data variant 覆盖”,真实覆盖数据来自商品 data_variants。
7
- */
8
- export declare const DATA_VARIANT_ACTION_TYPES: {
9
- readonly APPLY: "DATA_VARIANT_APPLY";
10
- };
11
- export type DataVariantActionType = (typeof DATA_VARIANT_ACTION_TYPES)[keyof typeof DATA_VARIANT_ACTION_TYPES];
12
- /**
13
- * Data Variant 规则元数据。
14
- *
15
- * priority 数字越大优先级越高,合并时后覆盖低优先级字段。
16
- */
17
- export interface DataVariantRuleMetadata {
18
- module?: 'product' | string;
19
- priority?: number;
20
- status?: 'active' | 'inactive' | string;
21
- updated_at?: string;
22
- [key: string]: any;
23
- }
24
- /**
25
- * 商品上的单条 Data Variant 记录,结构与后端 data_variant 表对齐。
26
- */
27
- export interface DataVariantItem {
28
- /** 变体记录 id */
29
- id?: number;
30
- /** 店铺 id */
31
- shop_id?: number;
32
- /** 所属模块,商品场景固定为 product */
33
- module?: 'product' | string;
34
- /** 模块数据 id,商品场景对应 product.id */
35
- module_data_id?: number;
36
- /** 关联策略模型 metadata.id / data_variant_rule.id */
37
- data_variant_rule_id: number | string;
38
- /** 命中策略后需要覆盖到商品上的字段 */
39
- data: Record<string, any>;
40
- created_at?: string | null;
41
- updated_at?: string | null;
42
- deleted_at?: string | null;
43
- }
44
- /**
45
- * Data Variant 评估使用的轻量商品结构。
46
- */
47
- export interface DataVariantProduct {
48
- id?: number | string;
49
- product_id?: number | string;
50
- product_variant_id?: number | string;
51
- variant_id?: number | string;
52
- collection?: Array<{
53
- id?: number | string;
54
- [key: string]: any;
55
- }>;
56
- /** 后端 /product/query with dataVariants 返回的智能定价变体列表 */
57
- data_variants?: DataVariantItem[];
58
- _dataVariant?: DataVariantAppliedInfo;
59
- [key: string]: any;
60
- }
61
- /**
62
- * 餐牌商品配置项。
63
- */
64
- export interface DataVariantMenuProductItem {
65
- product_collection_id?: number | string;
66
- product_id?: number | string;
67
- product_variant_id?: number | string;
68
- }
69
- /**
70
- * 餐牌数据的最小结构。
71
- */
72
- export interface DataVariantMenu {
73
- form_record_id: number | string;
74
- status?: string;
75
- schedule?: Array<number | string>;
76
- partyroom_package?: {
77
- type?: 'product_all' | 'product_collection' | 'products' | string;
78
- products?: DataVariantMenuProductItem[];
79
- };
80
- [key: string]: any;
81
- }
82
- /**
83
- * 单个餐牌预构建后的商品范围索引。
84
- */
85
- export interface MenuScope {
86
- isAllProducts: boolean;
87
- collectionIds: Set<number>;
88
- productKeys: Set<string>;
89
- productAllVariantIds: Set<number>;
90
- }
91
- /**
92
- * 批量评估输入。
93
- */
94
- export interface DataVariantBusinessData {
95
- products: DataVariantProduct[];
96
- strategyConfigs?: StrategyConfig<DataVariantRuleMetadata>[];
97
- scheduleDateTime?: string;
98
- scheduleList?: ScheduleItem[];
99
- menuList?: DataVariantMenu[];
100
- channel?: string;
101
- orderType?: string;
102
- /** 当前业务编码,对应策略条件 field: business_code */
103
- businessCode?: string;
104
- customerId?: number | string;
105
- /** 当前客户可用 wallet/pass id 合并列表,对应策略条件 field: available_wallet_ids */
106
- availableWalletIds?: Array<number | string>;
107
- custom?: Record<string, any>;
108
- }
109
- /**
110
- * 全局预计算后的规则信息。
111
- */
112
- export interface EffectiveRuleInfo {
113
- ruleId: string;
114
- priority: number;
115
- strategyConfig: StrategyConfig<DataVariantRuleMetadata>;
116
- productRules: ConditionRule[];
117
- globalResult: EvaluationResult;
118
- }
119
- export type GlobalEffectiveRuleMap = Map<string, EffectiveRuleInfo>;
120
- /**
121
- * 单条商品命中的变体覆盖信息。
122
- */
123
- export interface MatchedDataVariant {
124
- ruleId: string;
125
- priority: number;
126
- data: Record<string, any>;
127
- variant: DataVariantItem;
128
- }
129
- /**
130
- * 商品上记录的 Data Variant 调试信息。
131
- */
132
- export interface DataVariantAppliedInfo {
133
- appliedRuleIds: string[];
134
- appliedFields: string[];
135
- original: DataVariantProduct;
136
- }
137
- /**
138
- * 批量解析结果。
139
- */
140
- export interface ResolvedDataVariantResult {
141
- products: DataVariantProduct[];
142
- globalEffectiveRuleMap: GlobalEffectiveRuleMap;
143
- menuScopeMap: Map<number, MenuScope>;
144
- /** 当前策略中 schedule_match 绑定的日程提取出的时间点,格式如 ["10:00", "13:00"] */
145
- scheduleTimePoints: string[];
146
- rawResults: EvaluationResult[];
147
- }
148
- export type ConditionScope = 'global' | 'product';
@@ -1,54 +0,0 @@
1
- /**
2
- * Data Variant 动作类型。
3
- *
4
- * 当前阶段动作只用于标识“该策略可应用 data variant 覆盖”,真实覆盖数据来自商品 data_variants。
5
- */
6
- export var DATA_VARIANT_ACTION_TYPES = {
7
- APPLY: 'DATA_VARIANT_APPLY'
8
- };
9
-
10
- /**
11
- * Data Variant 规则元数据。
12
- *
13
- * priority 数字越大优先级越高,合并时后覆盖低优先级字段。
14
- */
15
-
16
- /**
17
- * 商品上的单条 Data Variant 记录,结构与后端 data_variant 表对齐。
18
- */
19
-
20
- /**
21
- * Data Variant 评估使用的轻量商品结构。
22
- */
23
-
24
- /**
25
- * 餐牌商品配置项。
26
- */
27
-
28
- /**
29
- * 餐牌数据的最小结构。
30
- */
31
-
32
- /**
33
- * 单个餐牌预构建后的商品范围索引。
34
- */
35
-
36
- /**
37
- * 批量评估输入。
38
- */
39
-
40
- /**
41
- * 全局预计算后的规则信息。
42
- */
43
-
44
- /**
45
- * 单条商品命中的变体覆盖信息。
46
- */
47
-
48
- /**
49
- * 商品上记录的 Data Variant 调试信息。
50
- */
51
-
52
- /**
53
- * 批量解析结果。
54
- */
@@ -1,70 +0,0 @@
1
- import type { ProductData } from '../../../modules/Product/types';
2
- import type { ScheduleItem } from '../../../modules/Schedule/types';
3
- import type { DataVariantBusinessData, DataVariantMenu, DataVariantProduct } from '../../../model/strategy/adapter/dataVariant/type';
4
- import type { DataVariantEvaluator } from '../../../model/strategy/adapter/dataVariant/evaluator';
5
- import type { StrategyConfig } from '../../../model/strategy/type';
6
- import type { VenueBookingSlotConfig } from '../types';
7
- /** VenueBooking 智能定价运行时上下文 */
8
- export interface VenueBookingSmartPricingContext {
9
- evaluator?: DataVariantEvaluator | null;
10
- scheduleList?: ScheduleItem[];
11
- menuList?: DataVariantMenu[];
12
- customerId?: number | string;
13
- availableWalletIds?: Array<number | string>;
14
- channel?: string;
15
- businessCode?: string;
16
- orderType?: string;
17
- strategy_context?: Record<string, any>;
18
- strategyConfigs?: StrategyConfig[];
19
- }
20
- /** 从商品上读取展示/算价用的 price 字段 */
21
- export declare function extractProductPrice(product: DataVariantProduct): string | null;
22
- /** 组装 DataVariant 评估入参,对齐 OS Server buildProductFormatterContext 语义 */
23
- export declare function buildDataVariantBusinessData(products: ProductData[], context: VenueBookingSmartPricingContext, scheduleDateTime: string): DataVariantBusinessData;
24
- /**
25
- * 对商品列表执行一次智能定价格式化(loadProducts 后使用)。
26
- * evaluator 未注入时原样返回并打 warning。
27
- */
28
- export declare function formatProductsWithDataVariant(products: ProductData[], context: VenueBookingSmartPricingContext, scheduleDateTime?: string): ProductData[];
29
- /**
30
- * 根据 schedule_time_points 与营业开始时间,构造当天需要评估的 datetime 列表(升序)。
31
- * 跨日营业时,早于营业开始小时的时间点归到次日。
32
- */
33
- export declare function buildEvaluationDatetimes(params: {
34
- date: string;
35
- config: VenueBookingSlotConfig;
36
- scheduleTimePoints: string[];
37
- }): string[];
38
- /** 找到 slot 时间所属分段的评估 datetime(max(evalDt <= slotDt)) */
39
- export declare function findSegmentEvalDatetime(slotDatetime: string, evalDatetimes: string[]): string;
40
- /** 将 slot 标签转为与 timeSlot 网格一致的 slotStart 字符串 */
41
- export declare function buildSlotStartDatetime(date: string, label: string, config: VenueBookingSlotConfig): string;
42
- /**
43
- * 按 schedule 分段批量 resolveProducts,输出与 quotation 相同 key 格式的 slot 价格 Map。
44
- * key: `${productId}:${slotStart}`,value: price | null
45
- */
46
- export declare function buildSlotPriceMapByScheduleSegments(params: {
47
- products: ProductData[];
48
- productIds: number[];
49
- date: string;
50
- timeLabels: string[];
51
- config: VenueBookingSlotConfig;
52
- context: VenueBookingSmartPricingContext;
53
- }): Map<string, string | null>;
54
- /**
55
- * 指定商品在某一 datetime 的智能定价(addon / 单点重算用)。
56
- */
57
- export declare function getPriceForProductAtDatetime(params: {
58
- products: ProductData[];
59
- context: VenueBookingSmartPricingContext;
60
- productId: number;
61
- datetime: string;
62
- fallbackPrice?: string;
63
- }): string;
64
- /** 从 slot 价格 Map 读取单价,找不到则回退 fallback */
65
- export declare function getSlotPriceFromMap(params: {
66
- slotPriceMap: Map<string, string | null>;
67
- productId: number;
68
- slotStartTime: string;
69
- fallbackPrice?: string;
70
- }): string;