@pisell/pisellos 0.10.28 → 0.10.30
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/core/index.d.ts +7 -0
- package/dist/core/index.js +108 -65
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +13 -2
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Discount/index.js +4 -1
- package/dist/modules/Discount/types.d.ts +14 -4
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +89 -16
- package/dist/modules/Order/types.d.ts +13 -0
- package/dist/modules/Order/utils.d.ts +17 -2
- package/dist/modules/Order/utils.js +133 -27
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +77 -25
- package/dist/modules/ResourcePlanner/planner.js +14 -4
- package/dist/modules/ResourcePlanner/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +13 -2
- package/dist/server/index.js +1531 -1230
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +48 -23
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +419 -207
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/modules/products/index.d.ts +10 -4
- package/dist/server/modules/products/index.js +177 -84
- package/dist/server/modules/resource/index.js +21 -13
- package/dist/server/utils/product.d.ts +1 -1
- package/dist/server/utils/product.js +186 -22
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +543 -101
- package/dist/solution/BaseSales/index.d.ts +3 -3
- package/dist/solution/BaseSales/index.js +171 -198
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/Sales/index.d.ts +7 -0
- package/dist/solution/Sales/index.js +87 -31
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +38 -21
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +20 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +12 -2
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Discount/index.js +4 -1
- package/lib/modules/Discount/types.d.ts +14 -4
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +69 -1
- package/lib/modules/Order/types.d.ts +13 -0
- package/lib/modules/Order/utils.d.ts +17 -2
- package/lib/modules/Order/utils.js +131 -18
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +52 -8
- package/lib/modules/ResourcePlanner/planner.js +9 -1
- package/lib/modules/ResourcePlanner/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +13 -2
- package/lib/server/index.js +210 -19
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +60 -7
- package/lib/server/modules/menu/index.js +26 -4
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +194 -57
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/modules/products/index.d.ts +10 -4
- package/lib/server/modules/products/index.js +93 -23
- package/lib/server/modules/resource/index.js +12 -2
- package/lib/server/utils/product.d.ts +1 -1
- package/lib/server/utils/product.js +163 -3
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +507 -75
- package/lib/solution/BaseSales/index.d.ts +3 -3
- package/lib/solution/BaseSales/index.js +9 -14
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/Sales/index.d.ts +7 -0
- package/lib/solution/Sales/index.js +48 -3
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +19 -3
- package/package.json +1 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -12,8 +12,15 @@ declare class PisellOSCore implements PisellCore {
|
|
|
12
12
|
context: BusinessContext;
|
|
13
13
|
server: any;
|
|
14
14
|
serverOptions?: ServerOptions;
|
|
15
|
+
private serverModulePromise?;
|
|
15
16
|
constructor(options?: PisellOSOptions);
|
|
16
17
|
private initialize;
|
|
18
|
+
/**
|
|
19
|
+
* 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
|
|
20
|
+
* 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
|
|
21
|
+
*/
|
|
22
|
+
preloadServerModule(): Promise<void>;
|
|
23
|
+
private loadServerModule;
|
|
17
24
|
/**
|
|
18
25
|
* 初始化 Server(公开方法,需要外部显式调用并等待)
|
|
19
26
|
* Server 配置从构造函数传入的 options.server 中获取
|
package/dist/core/index.js
CHANGED
|
@@ -24,8 +24,6 @@ import { EffectsManager } from "../effects";
|
|
|
24
24
|
* pisell OS 核心实现
|
|
25
25
|
*/
|
|
26
26
|
var PisellOSCore = /*#__PURE__*/function () {
|
|
27
|
-
// 保存 Server 配置
|
|
28
|
-
|
|
29
27
|
function PisellOSCore(options) {
|
|
30
28
|
_classCallCheck(this, PisellOSCore);
|
|
31
29
|
_defineProperty(this, "plugins", new Map());
|
|
@@ -37,6 +35,8 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
37
35
|
_defineProperty(this, "server", void 0);
|
|
38
36
|
// Server 实例
|
|
39
37
|
_defineProperty(this, "serverOptions", void 0);
|
|
38
|
+
// 保存 Server 配置
|
|
39
|
+
_defineProperty(this, "serverModulePromise", void 0);
|
|
40
40
|
this.debug = (options === null || options === void 0 ? void 0 : options.debug) || false;
|
|
41
41
|
this.context = (options === null || options === void 0 ? void 0 : options.context) || {};
|
|
42
42
|
|
|
@@ -63,6 +63,49 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
63
63
|
this.log('[PisellOS] 核心初始化完成');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
|
|
68
|
+
* 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
|
|
69
|
+
*/
|
|
70
|
+
}, {
|
|
71
|
+
key: "preloadServerModule",
|
|
72
|
+
value: (function () {
|
|
73
|
+
var _preloadServerModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
if (!(this.server || !this.serverOptions)) {
|
|
78
|
+
_context.next = 2;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
return _context.abrupt("return");
|
|
82
|
+
case 2:
|
|
83
|
+
_context.next = 4;
|
|
84
|
+
return this.loadServerModule();
|
|
85
|
+
case 4:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context.stop();
|
|
88
|
+
}
|
|
89
|
+
}, _callee, this);
|
|
90
|
+
}));
|
|
91
|
+
function preloadServerModule() {
|
|
92
|
+
return _preloadServerModule.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
return preloadServerModule;
|
|
95
|
+
}())
|
|
96
|
+
}, {
|
|
97
|
+
key: "loadServerModule",
|
|
98
|
+
value: function loadServerModule() {
|
|
99
|
+
var _this2 = this;
|
|
100
|
+
if (!this.serverModulePromise) {
|
|
101
|
+
this.serverModulePromise = import("../server").catch(function (error) {
|
|
102
|
+
_this2.serverModulePromise = undefined;
|
|
103
|
+
throw error;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return this.serverModulePromise;
|
|
107
|
+
}
|
|
108
|
+
|
|
66
109
|
/**
|
|
67
110
|
* 初始化 Server(公开方法,需要外部显式调用并等待)
|
|
68
111
|
* Server 配置从构造函数传入的 options.server 中获取
|
|
@@ -70,56 +113,56 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
70
113
|
}, {
|
|
71
114
|
key: "initializeServer",
|
|
72
115
|
value: (function () {
|
|
73
|
-
var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
116
|
+
var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
74
117
|
var ServerModule, Server;
|
|
75
|
-
return _regeneratorRuntime().wrap(function
|
|
76
|
-
while (1) switch (
|
|
118
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
119
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
77
120
|
case 0:
|
|
78
121
|
if (!this.server) {
|
|
79
|
-
|
|
122
|
+
_context2.next = 3;
|
|
80
123
|
break;
|
|
81
124
|
}
|
|
82
125
|
this.log('Server 已经初始化,跳过重复初始化', 'warn');
|
|
83
|
-
return
|
|
126
|
+
return _context2.abrupt("return");
|
|
84
127
|
case 3:
|
|
85
128
|
if (this.serverOptions) {
|
|
86
|
-
|
|
129
|
+
_context2.next = 6;
|
|
87
130
|
break;
|
|
88
131
|
}
|
|
89
132
|
this.log('未提供 Server 配置,无法初始化', 'warn');
|
|
90
|
-
return
|
|
133
|
+
return _context2.abrupt("return");
|
|
91
134
|
case 6:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return
|
|
135
|
+
_context2.prev = 6;
|
|
136
|
+
_context2.next = 9;
|
|
137
|
+
return this.loadServerModule();
|
|
95
138
|
case 9:
|
|
96
|
-
ServerModule =
|
|
139
|
+
ServerModule = _context2.sent;
|
|
97
140
|
Server = ServerModule.default; // 创建 Server 实例
|
|
98
141
|
this.server = new Server(this);
|
|
99
142
|
this.log('Server 实例已创建');
|
|
100
143
|
|
|
101
144
|
// 初始化模块并预加载数据
|
|
102
145
|
if (!this.serverOptions.modules) {
|
|
103
|
-
|
|
146
|
+
_context2.next = 16;
|
|
104
147
|
break;
|
|
105
148
|
}
|
|
106
|
-
|
|
149
|
+
_context2.next = 16;
|
|
107
150
|
return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
|
|
108
151
|
case 16:
|
|
109
152
|
this.log('[PisellOS] Server 初始化完成');
|
|
110
|
-
|
|
153
|
+
_context2.next = 24;
|
|
111
154
|
break;
|
|
112
155
|
case 19:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
console.error('[PisellOS] ❌ Server 初始化失败:',
|
|
116
|
-
this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(
|
|
117
|
-
throw
|
|
156
|
+
_context2.prev = 19;
|
|
157
|
+
_context2.t0 = _context2["catch"](6);
|
|
158
|
+
console.error('[PisellOS] ❌ Server 初始化失败:', _context2.t0);
|
|
159
|
+
this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context2.t0), 'error');
|
|
160
|
+
throw _context2.t0;
|
|
118
161
|
case 24:
|
|
119
162
|
case "end":
|
|
120
|
-
return
|
|
163
|
+
return _context2.stop();
|
|
121
164
|
}
|
|
122
|
-
},
|
|
165
|
+
}, _callee2, this, [[6, 19]]);
|
|
123
166
|
}));
|
|
124
167
|
function initializeServer(_x) {
|
|
125
168
|
return _initializeServer.apply(this, arguments);
|
|
@@ -151,7 +194,7 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
151
194
|
}, {
|
|
152
195
|
key: "registerPlugin",
|
|
153
196
|
value: function registerPlugin(plugin, options) {
|
|
154
|
-
var
|
|
197
|
+
var _this3 = this;
|
|
155
198
|
if (this.plugins.has(plugin.name)) {
|
|
156
199
|
this.log("\u63D2\u4EF6 ".concat(plugin.name, " \u5DF2\u7ECF\u6CE8\u518C\u8FC7\uFF0C\u5C06\u88AB\u8986\u76D6"), 'warn');
|
|
157
200
|
}
|
|
@@ -179,7 +222,7 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
179
222
|
var result = plugin.initialize();
|
|
180
223
|
if (result instanceof Promise) {
|
|
181
224
|
result.catch(function (err) {
|
|
182
|
-
|
|
225
|
+
_this3.log("\u63D2\u4EF6 ".concat(plugin.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
|
|
183
226
|
throw err;
|
|
184
227
|
});
|
|
185
228
|
}
|
|
@@ -205,7 +248,7 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
205
248
|
}, {
|
|
206
249
|
key: "registerModule",
|
|
207
250
|
value: function registerModule(module, options) {
|
|
208
|
-
var
|
|
251
|
+
var _this4 = this;
|
|
209
252
|
if (this.modules.has(module.name)) {
|
|
210
253
|
this.log("\u6A21\u5757 ".concat(module.name, " \u5DF2\u7ECF\u6CE8\u518C\u8FC7\uFF0C\u5C06\u88AB\u8986\u76D6"), 'warn');
|
|
211
254
|
}
|
|
@@ -247,7 +290,7 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
247
290
|
}
|
|
248
291
|
// 预先给模块初始化值系统
|
|
249
292
|
var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
|
|
250
|
-
|
|
293
|
+
_this4.effects.emit("".concat(module.name, ":changed"), {
|
|
251
294
|
path: path,
|
|
252
295
|
value: value
|
|
253
296
|
});
|
|
@@ -262,7 +305,7 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
262
305
|
}, options));
|
|
263
306
|
if (result instanceof Promise) {
|
|
264
307
|
result.catch(function (err) {
|
|
265
|
-
|
|
308
|
+
_this4.log("\u6A21\u5757 ".concat(module.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
|
|
266
309
|
throw err;
|
|
267
310
|
});
|
|
268
311
|
}
|
|
@@ -307,100 +350,100 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
307
350
|
}, {
|
|
308
351
|
key: "destroy",
|
|
309
352
|
value: function () {
|
|
310
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
353
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
311
354
|
var _iterator4, _step4, _step4$value, name, module, _iterator5, _step5, _step5$value, _name, plugin;
|
|
312
|
-
return _regeneratorRuntime().wrap(function
|
|
313
|
-
while (1) switch (
|
|
355
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
356
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
314
357
|
case 0:
|
|
315
358
|
// 先销毁模块
|
|
316
359
|
_iterator4 = _createForOfIteratorHelper(this.modules.entries());
|
|
317
|
-
|
|
360
|
+
_context3.prev = 1;
|
|
318
361
|
_iterator4.s();
|
|
319
362
|
case 3:
|
|
320
363
|
if ((_step4 = _iterator4.n()).done) {
|
|
321
|
-
|
|
364
|
+
_context3.next = 17;
|
|
322
365
|
break;
|
|
323
366
|
}
|
|
324
367
|
_step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], module = _step4$value[1];
|
|
325
368
|
if (!module.destroy) {
|
|
326
|
-
|
|
369
|
+
_context3.next = 15;
|
|
327
370
|
break;
|
|
328
371
|
}
|
|
329
|
-
|
|
330
|
-
|
|
372
|
+
_context3.prev = 6;
|
|
373
|
+
_context3.next = 9;
|
|
331
374
|
return Promise.resolve(module.destroy());
|
|
332
375
|
case 9:
|
|
333
376
|
this.log("\u6A21\u5757 ".concat(name, " \u5DF2\u9500\u6BC1"));
|
|
334
|
-
|
|
377
|
+
_context3.next = 15;
|
|
335
378
|
break;
|
|
336
379
|
case 12:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(
|
|
380
|
+
_context3.prev = 12;
|
|
381
|
+
_context3.t0 = _context3["catch"](6);
|
|
382
|
+
this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context3.t0), 'error');
|
|
340
383
|
case 15:
|
|
341
|
-
|
|
384
|
+
_context3.next = 3;
|
|
342
385
|
break;
|
|
343
386
|
case 17:
|
|
344
|
-
|
|
387
|
+
_context3.next = 22;
|
|
345
388
|
break;
|
|
346
389
|
case 19:
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
_iterator4.e(
|
|
390
|
+
_context3.prev = 19;
|
|
391
|
+
_context3.t1 = _context3["catch"](1);
|
|
392
|
+
_iterator4.e(_context3.t1);
|
|
350
393
|
case 22:
|
|
351
|
-
|
|
394
|
+
_context3.prev = 22;
|
|
352
395
|
_iterator4.f();
|
|
353
|
-
return
|
|
396
|
+
return _context3.finish(22);
|
|
354
397
|
case 25:
|
|
355
398
|
this.modules.clear();
|
|
356
399
|
|
|
357
400
|
// 再销毁插件
|
|
358
401
|
_iterator5 = _createForOfIteratorHelper(this.plugins.entries());
|
|
359
|
-
|
|
402
|
+
_context3.prev = 27;
|
|
360
403
|
_iterator5.s();
|
|
361
404
|
case 29:
|
|
362
405
|
if ((_step5 = _iterator5.n()).done) {
|
|
363
|
-
|
|
406
|
+
_context3.next = 43;
|
|
364
407
|
break;
|
|
365
408
|
}
|
|
366
409
|
_step5$value = _slicedToArray(_step5.value, 2), _name = _step5$value[0], plugin = _step5$value[1];
|
|
367
410
|
if (!plugin.destroy) {
|
|
368
|
-
|
|
411
|
+
_context3.next = 41;
|
|
369
412
|
break;
|
|
370
413
|
}
|
|
371
|
-
|
|
372
|
-
|
|
414
|
+
_context3.prev = 32;
|
|
415
|
+
_context3.next = 35;
|
|
373
416
|
return Promise.resolve(plugin.destroy());
|
|
374
417
|
case 35:
|
|
375
418
|
this.log("\u63D2\u4EF6 ".concat(_name, " \u5DF2\u9500\u6BC1"));
|
|
376
|
-
|
|
419
|
+
_context3.next = 41;
|
|
377
420
|
break;
|
|
378
421
|
case 38:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(
|
|
422
|
+
_context3.prev = 38;
|
|
423
|
+
_context3.t2 = _context3["catch"](32);
|
|
424
|
+
this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context3.t2), 'error');
|
|
382
425
|
case 41:
|
|
383
|
-
|
|
426
|
+
_context3.next = 29;
|
|
384
427
|
break;
|
|
385
428
|
case 43:
|
|
386
|
-
|
|
429
|
+
_context3.next = 48;
|
|
387
430
|
break;
|
|
388
431
|
case 45:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
_iterator5.e(
|
|
432
|
+
_context3.prev = 45;
|
|
433
|
+
_context3.t3 = _context3["catch"](27);
|
|
434
|
+
_iterator5.e(_context3.t3);
|
|
392
435
|
case 48:
|
|
393
|
-
|
|
436
|
+
_context3.prev = 48;
|
|
394
437
|
_iterator5.f();
|
|
395
|
-
return
|
|
438
|
+
return _context3.finish(48);
|
|
396
439
|
case 51:
|
|
397
440
|
this.plugins.clear();
|
|
398
441
|
this.log('PisellOS 核心已销毁');
|
|
399
442
|
case 53:
|
|
400
443
|
case "end":
|
|
401
|
-
return
|
|
444
|
+
return _context3.stop();
|
|
402
445
|
}
|
|
403
|
-
},
|
|
446
|
+
}, _callee3, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
|
|
404
447
|
}));
|
|
405
448
|
function destroy() {
|
|
406
449
|
return _destroy.apply(this, arguments);
|
|
@@ -502,8 +502,17 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
502
502
|
if (!(appliedInfo !== null && appliedInfo !== void 0 && (_appliedInfo$appliedF = appliedInfo.appliedFields) !== null && _appliedInfo$appliedF !== void 0 && _appliedInfo$appliedF.length)) {
|
|
503
503
|
return originalItem;
|
|
504
504
|
}
|
|
505
|
+
|
|
506
|
+
// 套餐加价/减价使用配置价;仅商品原价模式跟随子商品的 Data Variant 价格。
|
|
507
|
+
var isOriginalPriceBundleItem = originalItem.price_type === 'markup' && originalItem.price_type_ext === 'product_price';
|
|
508
|
+
var appliedFields = appliedInfo.appliedFields.filter(function (field) {
|
|
509
|
+
return field !== 'price' || isOriginalPriceBundleItem;
|
|
510
|
+
});
|
|
511
|
+
if (!appliedFields.length) {
|
|
512
|
+
return originalItem;
|
|
513
|
+
}
|
|
505
514
|
var result = _objectSpread({}, originalItem);
|
|
506
|
-
var _iterator8 = _createForOfIteratorHelper(
|
|
515
|
+
var _iterator8 = _createForOfIteratorHelper(appliedFields),
|
|
507
516
|
_step8;
|
|
508
517
|
try {
|
|
509
518
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
@@ -517,7 +526,9 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
517
526
|
} finally {
|
|
518
527
|
_iterator8.f();
|
|
519
528
|
}
|
|
520
|
-
result._dataVariant = appliedInfo
|
|
529
|
+
result._dataVariant = _objectSpread(_objectSpread({}, appliedInfo), {}, {
|
|
530
|
+
appliedFields: appliedFields
|
|
531
|
+
});
|
|
521
532
|
return result;
|
|
522
533
|
}
|
|
523
534
|
}, {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -194,7 +194,10 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
194
194
|
return _context4.abrupt("return", {
|
|
195
195
|
discountList: goodPassList,
|
|
196
196
|
availableWalletIds: availableWalletIds,
|
|
197
|
-
virtualCurrencyList: virtualCurrencyList
|
|
197
|
+
virtualCurrencyList: virtualCurrencyList,
|
|
198
|
+
availableWalletPassList: availableWalletPassList.map(function (item) {
|
|
199
|
+
return _objectSpread({}, item || {});
|
|
200
|
+
})
|
|
198
201
|
});
|
|
199
202
|
case 11:
|
|
200
203
|
case "end":
|
|
@@ -17,7 +17,7 @@ interface Formattitle {
|
|
|
17
17
|
}
|
|
18
18
|
interface PackageSubItemUsageRules {
|
|
19
19
|
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
|
-
rules: (
|
|
20
|
+
rules: ('original_price' | 'markup_price')[];
|
|
21
21
|
package_scope?: {
|
|
22
22
|
type: 'all_packages' | 'specific_packages' | 'product_all' | 'products';
|
|
23
23
|
exclude_bundle_product_ids: number[];
|
|
@@ -68,10 +68,20 @@ export interface DiscountWithReason {
|
|
|
68
68
|
discountList: Discount[];
|
|
69
69
|
unavailableReasonKey: DiscountFilterRejectKey | null;
|
|
70
70
|
}
|
|
71
|
+
export interface WalletPassPrepareConfigItem {
|
|
72
|
+
id?: number | string | null;
|
|
73
|
+
tag?: string | null;
|
|
74
|
+
product_id?: number | string | null;
|
|
75
|
+
product_name?: string | null;
|
|
76
|
+
par_value?: string | number | null;
|
|
77
|
+
used_par_value?: string | number | null;
|
|
78
|
+
[key: string]: any;
|
|
79
|
+
}
|
|
71
80
|
export interface DiscountPrepareConfigResult {
|
|
72
81
|
discountList: Discount[];
|
|
73
82
|
availableWalletIds: number[];
|
|
74
83
|
virtualCurrencyList?: VirtualCurrencyAsset[];
|
|
84
|
+
availableWalletPassList: WalletPassPrepareConfigItem[];
|
|
75
85
|
}
|
|
76
86
|
export interface VirtualCurrencyAsset extends Record<string, any> {
|
|
77
87
|
id: number;
|
|
@@ -113,14 +123,14 @@ export interface Discount {
|
|
|
113
123
|
metadata?: {
|
|
114
124
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
115
125
|
custom_product_bundle_map_id?: string;
|
|
116
|
-
validity_type?:
|
|
126
|
+
validity_type?: 'custom_schedule_validity' | 'fixed_validity';
|
|
117
127
|
discount_calculation_mode: 'item_level' | 'order_level';
|
|
118
128
|
holder: {
|
|
119
|
-
type:
|
|
129
|
+
type: 'customer' | 'custom';
|
|
120
130
|
};
|
|
121
131
|
};
|
|
122
132
|
product: Product;
|
|
123
|
-
type:
|
|
133
|
+
type: 'product' | 'good_pass';
|
|
124
134
|
resource_id?: number;
|
|
125
135
|
savedAmount?: number;
|
|
126
136
|
isEditMode?: boolean;
|
|
@@ -169,6 +169,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
169
169
|
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
170
170
|
notifyTempOrderChanged(): void;
|
|
171
171
|
private createDefaultTempOrderInstance;
|
|
172
|
+
private clearTempOrderPointCardSnapshot;
|
|
173
|
+
private writePointCardSnapshotFromPrepareConfig;
|
|
172
174
|
private createExternalSaleNumber;
|
|
173
175
|
private ensureExternalSaleNumber;
|
|
174
176
|
private ensureRequestUniqueIdempotencyToken;
|
|
@@ -610,4 +612,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
610
612
|
getOrderInfo(order_id: number): Promise<any>;
|
|
611
613
|
getVouchers(): any[];
|
|
612
614
|
}
|
|
613
|
-
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
615
|
+
export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|