@pisell/pisellos 2.3.65 → 2.3.67

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 (52) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +109 -65
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +1 -0
  4. package/dist/model/strategy/adapter/walletPass/utils.js +2 -0
  5. package/dist/modules/Customer/index.d.ts +0 -4
  6. package/dist/modules/Customer/index.js +59 -91
  7. package/dist/modules/Customer/types.d.ts +0 -2
  8. package/dist/modules/Payment/walletpass.js +5 -4
  9. package/dist/modules/Quotation/index.d.ts +6 -0
  10. package/dist/modules/Quotation/index.js +75 -19
  11. package/dist/plugins/request.d.ts +1 -0
  12. package/dist/server/index.d.ts +8 -2
  13. package/dist/server/index.js +209 -142
  14. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  15. package/dist/server/modules/floor-plan/index.js +240 -98
  16. package/dist/server/modules/menu/index.js +48 -23
  17. package/dist/server/modules/order/index.d.ts +17 -8
  18. package/dist/server/modules/order/index.js +506 -453
  19. package/dist/server/modules/products/index.d.ts +8 -2
  20. package/dist/server/modules/products/index.js +167 -75
  21. package/dist/server/modules/resource/index.js +21 -13
  22. package/dist/server/utils/small-ticket.js +1 -2
  23. package/dist/solution/BookingByStep/index.d.ts +1 -1
  24. package/dist/solution/BookingTicket/index.d.ts +0 -2
  25. package/dist/solution/BookingTicket/index.js +10 -34
  26. package/lib/core/index.d.ts +7 -0
  27. package/lib/core/index.js +20 -2
  28. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  29. package/lib/model/strategy/adapter/walletPass/evaluator.js +1 -0
  30. package/lib/model/strategy/adapter/walletPass/utils.js +1 -0
  31. package/lib/modules/Customer/index.d.ts +0 -4
  32. package/lib/modules/Customer/index.js +0 -11
  33. package/lib/modules/Customer/types.d.ts +0 -2
  34. package/lib/modules/Payment/walletpass.js +1 -0
  35. package/lib/modules/Quotation/index.d.ts +6 -0
  36. package/lib/modules/Quotation/index.js +49 -5
  37. package/lib/plugins/request.d.ts +1 -0
  38. package/lib/server/index.d.ts +8 -2
  39. package/lib/server/index.js +55 -19
  40. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  41. package/lib/server/modules/floor-plan/index.js +54 -6
  42. package/lib/server/modules/menu/index.js +31 -5
  43. package/lib/server/modules/order/index.d.ts +17 -8
  44. package/lib/server/modules/order/index.js +199 -106
  45. package/lib/server/modules/products/index.d.ts +8 -2
  46. package/lib/server/modules/products/index.js +97 -24
  47. package/lib/server/modules/resource/index.js +7 -2
  48. package/lib/server/utils/small-ticket.js +1 -1
  49. package/lib/solution/BookingByStep/index.d.ts +1 -1
  50. package/lib/solution/BookingTicket/index.d.ts +0 -2
  51. package/lib/solution/BookingTicket/index.js +2 -18
  52. package/package.json +1 -1
@@ -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 中获取
@@ -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
 
@@ -45,6 +45,7 @@ var PisellOSCore = /*#__PURE__*/function () {
45
45
  this.serverOptions = options.server;
46
46
  }
47
47
  this.initialize(options);
48
+ console.log('constructor123456');
48
49
  }
49
50
  _createClass(PisellOSCore, [{
50
51
  key: "initialize",
@@ -63,6 +64,49 @@ var PisellOSCore = /*#__PURE__*/function () {
63
64
  this.log('[PisellOS] 核心初始化完成');
64
65
  }
65
66
 
67
+ /**
68
+ * 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
69
+ * 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
70
+ */
71
+ }, {
72
+ key: "preloadServerModule",
73
+ value: (function () {
74
+ var _preloadServerModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
76
+ while (1) switch (_context.prev = _context.next) {
77
+ case 0:
78
+ if (!(this.server || !this.serverOptions)) {
79
+ _context.next = 2;
80
+ break;
81
+ }
82
+ return _context.abrupt("return");
83
+ case 2:
84
+ _context.next = 4;
85
+ return this.loadServerModule();
86
+ case 4:
87
+ case "end":
88
+ return _context.stop();
89
+ }
90
+ }, _callee, this);
91
+ }));
92
+ function preloadServerModule() {
93
+ return _preloadServerModule.apply(this, arguments);
94
+ }
95
+ return preloadServerModule;
96
+ }())
97
+ }, {
98
+ key: "loadServerModule",
99
+ value: function loadServerModule() {
100
+ var _this2 = this;
101
+ if (!this.serverModulePromise) {
102
+ this.serverModulePromise = import("../server").catch(function (error) {
103
+ _this2.serverModulePromise = undefined;
104
+ throw error;
105
+ });
106
+ }
107
+ return this.serverModulePromise;
108
+ }
109
+
66
110
  /**
67
111
  * 初始化 Server(公开方法,需要外部显式调用并等待)
68
112
  * Server 配置从构造函数传入的 options.server 中获取
@@ -70,57 +114,57 @@ var PisellOSCore = /*#__PURE__*/function () {
70
114
  }, {
71
115
  key: "initializeServer",
72
116
  value: (function () {
73
- var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
117
+ var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
74
118
  var ServerModule, Server;
75
- return _regeneratorRuntime().wrap(function _callee$(_context) {
76
- while (1) switch (_context.prev = _context.next) {
119
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
120
+ while (1) switch (_context2.prev = _context2.next) {
77
121
  case 0:
78
122
  if (!this.server) {
79
- _context.next = 3;
123
+ _context2.next = 3;
80
124
  break;
81
125
  }
82
126
  this.log('Server 已经初始化,跳过重复初始化', 'warn');
83
- return _context.abrupt("return");
127
+ return _context2.abrupt("return");
84
128
  case 3:
85
129
  if (this.serverOptions) {
86
- _context.next = 6;
130
+ _context2.next = 6;
87
131
  break;
88
132
  }
89
133
  this.log('未提供 Server 配置,无法初始化', 'warn');
90
- return _context.abrupt("return");
134
+ return _context2.abrupt("return");
91
135
  case 6:
92
- _context.prev = 6;
93
- _context.next = 9;
94
- return import("../server");
136
+ _context2.prev = 6;
137
+ _context2.next = 9;
138
+ return this.loadServerModule();
95
139
  case 9:
96
- ServerModule = _context.sent;
140
+ ServerModule = _context2.sent;
97
141
  Server = ServerModule.default; // 创建 Server 实例
98
142
  this.server = new Server(this);
99
143
  this.log('Server 实例已创建');
100
144
 
101
145
  // 初始化模块并预加载数据
102
146
  if (!this.serverOptions.modules) {
103
- _context.next = 16;
147
+ _context2.next = 16;
104
148
  break;
105
149
  }
106
- _context.next = 16;
150
+ _context2.next = 16;
107
151
  return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
108
152
  case 16:
109
153
  console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
110
154
  this.log('[PisellOS] Server 初始化完成');
111
- _context.next = 25;
155
+ _context2.next = 25;
112
156
  break;
113
157
  case 20:
114
- _context.prev = 20;
115
- _context.t0 = _context["catch"](6);
116
- console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
117
- this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
118
- throw _context.t0;
158
+ _context2.prev = 20;
159
+ _context2.t0 = _context2["catch"](6);
160
+ console.error('[PisellOS] ❌ Server 初始化失败:', _context2.t0);
161
+ this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context2.t0), 'error');
162
+ throw _context2.t0;
119
163
  case 25:
120
164
  case "end":
121
- return _context.stop();
165
+ return _context2.stop();
122
166
  }
123
- }, _callee, this, [[6, 20]]);
167
+ }, _callee2, this, [[6, 20]]);
124
168
  }));
125
169
  function initializeServer(_x) {
126
170
  return _initializeServer.apply(this, arguments);
@@ -153,7 +197,7 @@ var PisellOSCore = /*#__PURE__*/function () {
153
197
  }, {
154
198
  key: "registerPlugin",
155
199
  value: function registerPlugin(plugin, options) {
156
- var _this2 = this;
200
+ var _this3 = this;
157
201
  if (this.plugins.has(plugin.name)) {
158
202
  this.log("\u63D2\u4EF6 ".concat(plugin.name, " \u5DF2\u7ECF\u6CE8\u518C\u8FC7\uFF0C\u5C06\u88AB\u8986\u76D6"), 'warn');
159
203
  }
@@ -181,7 +225,7 @@ var PisellOSCore = /*#__PURE__*/function () {
181
225
  var result = plugin.initialize();
182
226
  if (result instanceof Promise) {
183
227
  result.catch(function (err) {
184
- _this2.log("\u63D2\u4EF6 ".concat(plugin.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
228
+ _this3.log("\u63D2\u4EF6 ".concat(plugin.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
185
229
  throw err;
186
230
  });
187
231
  }
@@ -207,7 +251,7 @@ var PisellOSCore = /*#__PURE__*/function () {
207
251
  }, {
208
252
  key: "registerModule",
209
253
  value: function registerModule(module, options) {
210
- var _this3 = this;
254
+ var _this4 = this;
211
255
  if (this.modules.has(module.name)) {
212
256
  this.log("\u6A21\u5757 ".concat(module.name, " \u5DF2\u7ECF\u6CE8\u518C\u8FC7\uFF0C\u5C06\u88AB\u8986\u76D6"), 'warn');
213
257
  }
@@ -250,7 +294,7 @@ var PisellOSCore = /*#__PURE__*/function () {
250
294
  // 预先给模块初始化值系统
251
295
  var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
252
296
  console.log('core 检测到模块值更新', module.name, path, value);
253
- _this3.effects.emit("".concat(module.name, ":changed"), {
297
+ _this4.effects.emit("".concat(module.name, ":changed"), {
254
298
  path: path,
255
299
  value: value
256
300
  });
@@ -265,7 +309,7 @@ var PisellOSCore = /*#__PURE__*/function () {
265
309
  }, options));
266
310
  if (result instanceof Promise) {
267
311
  result.catch(function (err) {
268
- _this3.log("\u6A21\u5757 ".concat(module.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
312
+ _this4.log("\u6A21\u5757 ".concat(module.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
269
313
  throw err;
270
314
  });
271
315
  }
@@ -310,100 +354,100 @@ var PisellOSCore = /*#__PURE__*/function () {
310
354
  }, {
311
355
  key: "destroy",
312
356
  value: function () {
313
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
357
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
314
358
  var _iterator4, _step4, _step4$value, name, module, _iterator5, _step5, _step5$value, _name, plugin;
315
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
316
- while (1) switch (_context2.prev = _context2.next) {
359
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
360
+ while (1) switch (_context3.prev = _context3.next) {
317
361
  case 0:
318
362
  // 先销毁模块
319
363
  _iterator4 = _createForOfIteratorHelper(this.modules.entries());
320
- _context2.prev = 1;
364
+ _context3.prev = 1;
321
365
  _iterator4.s();
322
366
  case 3:
323
367
  if ((_step4 = _iterator4.n()).done) {
324
- _context2.next = 17;
368
+ _context3.next = 17;
325
369
  break;
326
370
  }
327
371
  _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], module = _step4$value[1];
328
372
  if (!module.destroy) {
329
- _context2.next = 15;
373
+ _context3.next = 15;
330
374
  break;
331
375
  }
332
- _context2.prev = 6;
333
- _context2.next = 9;
376
+ _context3.prev = 6;
377
+ _context3.next = 9;
334
378
  return Promise.resolve(module.destroy());
335
379
  case 9:
336
380
  this.log("\u6A21\u5757 ".concat(name, " \u5DF2\u9500\u6BC1"));
337
- _context2.next = 15;
381
+ _context3.next = 15;
338
382
  break;
339
383
  case 12:
340
- _context2.prev = 12;
341
- _context2.t0 = _context2["catch"](6);
342
- this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context2.t0), 'error');
384
+ _context3.prev = 12;
385
+ _context3.t0 = _context3["catch"](6);
386
+ this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context3.t0), 'error');
343
387
  case 15:
344
- _context2.next = 3;
388
+ _context3.next = 3;
345
389
  break;
346
390
  case 17:
347
- _context2.next = 22;
391
+ _context3.next = 22;
348
392
  break;
349
393
  case 19:
350
- _context2.prev = 19;
351
- _context2.t1 = _context2["catch"](1);
352
- _iterator4.e(_context2.t1);
394
+ _context3.prev = 19;
395
+ _context3.t1 = _context3["catch"](1);
396
+ _iterator4.e(_context3.t1);
353
397
  case 22:
354
- _context2.prev = 22;
398
+ _context3.prev = 22;
355
399
  _iterator4.f();
356
- return _context2.finish(22);
400
+ return _context3.finish(22);
357
401
  case 25:
358
402
  this.modules.clear();
359
403
 
360
404
  // 再销毁插件
361
405
  _iterator5 = _createForOfIteratorHelper(this.plugins.entries());
362
- _context2.prev = 27;
406
+ _context3.prev = 27;
363
407
  _iterator5.s();
364
408
  case 29:
365
409
  if ((_step5 = _iterator5.n()).done) {
366
- _context2.next = 43;
410
+ _context3.next = 43;
367
411
  break;
368
412
  }
369
413
  _step5$value = _slicedToArray(_step5.value, 2), _name = _step5$value[0], plugin = _step5$value[1];
370
414
  if (!plugin.destroy) {
371
- _context2.next = 41;
415
+ _context3.next = 41;
372
416
  break;
373
417
  }
374
- _context2.prev = 32;
375
- _context2.next = 35;
418
+ _context3.prev = 32;
419
+ _context3.next = 35;
376
420
  return Promise.resolve(plugin.destroy());
377
421
  case 35:
378
422
  this.log("\u63D2\u4EF6 ".concat(_name, " \u5DF2\u9500\u6BC1"));
379
- _context2.next = 41;
423
+ _context3.next = 41;
380
424
  break;
381
425
  case 38:
382
- _context2.prev = 38;
383
- _context2.t2 = _context2["catch"](32);
384
- this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context2.t2), 'error');
426
+ _context3.prev = 38;
427
+ _context3.t2 = _context3["catch"](32);
428
+ this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context3.t2), 'error');
385
429
  case 41:
386
- _context2.next = 29;
430
+ _context3.next = 29;
387
431
  break;
388
432
  case 43:
389
- _context2.next = 48;
433
+ _context3.next = 48;
390
434
  break;
391
435
  case 45:
392
- _context2.prev = 45;
393
- _context2.t3 = _context2["catch"](27);
394
- _iterator5.e(_context2.t3);
436
+ _context3.prev = 45;
437
+ _context3.t3 = _context3["catch"](27);
438
+ _iterator5.e(_context3.t3);
395
439
  case 48:
396
- _context2.prev = 48;
440
+ _context3.prev = 48;
397
441
  _iterator5.f();
398
- return _context2.finish(48);
442
+ return _context3.finish(48);
399
443
  case 51:
400
444
  this.plugins.clear();
401
445
  this.log('PisellOS 核心已销毁');
402
446
  case 53:
403
447
  case "end":
404
- return _context2.stop();
448
+ return _context3.stop();
405
449
  }
406
- }, _callee2, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
450
+ }, _callee3, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
407
451
  }));
408
452
  function destroy() {
409
453
  return _destroy.apply(this, arguments);
@@ -505,6 +505,7 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
505
505
  }, {
506
506
  key: "calculateApplicableProducts",
507
507
  value: function calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
508
+ console.log(products, 'products1234');
508
509
  var total = 0;
509
510
  var count = 0;
510
511
 
@@ -189,6 +189,8 @@ var getApplicableProducts = function getApplicableProducts(voucher, productsData
189
189
  * @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status
190
190
  */
191
191
  export function processVouchers(applicableVouchers, orderTotalAmount, products) {
192
+ console.log(products, 'products123');
193
+
192
194
  // 拆分商品数据,同时维护含税和不含税两个金额池
193
195
  // remainingAmountWithTax: 含税费的剩余可抵扣金额
194
196
  // remainingAmountPure: 纯商品金额(不含税费)的剩余可抵扣金额
@@ -44,10 +44,6 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
44
44
  * 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
45
45
  */
46
46
  queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
47
- /**
48
- * 查询单个客户详情,不写入 customerList / pagination 状态。
49
- */
50
- queryCustomerDetail(id: string | number): Promise<ShopCustomer | null>;
51
47
  /**
52
48
  * 获取客户列表
53
49
  * @param params 查询参数