@pisell/pisellos 2.1.41 → 2.2.2

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 (121) hide show
  1. package/dist/core/index.d.ts +8 -1
  2. package/dist/core/index.js +116 -42
  3. package/dist/modules/Customer/index.js +1 -1
  4. package/dist/modules/Order/index.js +4 -4
  5. package/dist/modules/Order/types.d.ts +0 -1
  6. package/dist/modules/Product/types.d.ts +19 -0
  7. package/dist/modules/ProductList/index.js +3 -11
  8. package/dist/modules/Schedule/types.d.ts +2 -0
  9. package/dist/plugins/request.d.ts +19 -1
  10. package/dist/plugins/request.js +11 -0
  11. package/dist/server/index.d.ts +152 -0
  12. package/dist/server/index.js +946 -0
  13. package/dist/server/modules/index.d.ts +16 -0
  14. package/dist/server/modules/index.js +21 -0
  15. package/dist/server/modules/menu/index.d.ts +63 -0
  16. package/dist/server/modules/menu/index.js +476 -0
  17. package/dist/server/modules/menu/types.d.ts +68 -0
  18. package/dist/server/modules/menu/types.js +16 -0
  19. package/dist/server/modules/products/index.d.ts +141 -0
  20. package/dist/server/modules/products/index.js +774 -0
  21. package/dist/server/modules/products/types.d.ts +94 -0
  22. package/dist/server/modules/products/types.js +43 -0
  23. package/dist/server/modules/quotation/index.d.ts +47 -0
  24. package/dist/server/modules/quotation/index.js +367 -0
  25. package/dist/server/modules/quotation/types.d.ts +50 -0
  26. package/dist/server/modules/quotation/types.js +20 -0
  27. package/dist/server/modules/schedule/index.d.ts +62 -0
  28. package/dist/server/modules/schedule/index.js +431 -0
  29. package/dist/server/modules/schedule/types.d.ts +1 -0
  30. package/dist/server/modules/schedule/types.js +2 -0
  31. package/dist/server/modules/schedule/utils.d.ts +32 -0
  32. package/dist/server/modules/schedule/utils.js +747 -0
  33. package/dist/server/types.d.ts +64 -0
  34. package/dist/server/types.js +1 -0
  35. package/dist/server/utils/index.d.ts +5 -0
  36. package/dist/server/utils/index.js +6 -0
  37. package/dist/server/utils/product.d.ts +18 -0
  38. package/dist/server/utils/product.js +339 -0
  39. package/dist/server/utils/schedule.d.ts +14 -0
  40. package/dist/server/utils/schedule.js +108 -0
  41. package/dist/server/utils/time.d.ts +18 -0
  42. package/dist/server/utils/time.js +53 -0
  43. package/dist/solution/BookingByStep/index.d.ts +2 -22
  44. package/dist/solution/BookingByStep/index.js +29 -502
  45. package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
  46. package/dist/solution/BookingByStep/utils/capacity.js +8 -24
  47. package/dist/solution/BookingTicket/index.d.ts +8 -0
  48. package/dist/solution/BookingTicket/index.js +105 -71
  49. package/dist/solution/ShopDiscount/index.js +9 -27
  50. package/dist/solution/index.d.ts +0 -1
  51. package/dist/solution/index.js +0 -1
  52. package/dist/types/index.d.ts +26 -0
  53. package/lib/core/index.d.ts +8 -1
  54. package/lib/core/index.js +48 -1
  55. package/lib/modules/Customer/index.js +1 -1
  56. package/lib/modules/Order/index.js +2 -5
  57. package/lib/modules/Order/types.d.ts +0 -1
  58. package/lib/modules/Product/types.d.ts +19 -0
  59. package/lib/modules/ProductList/index.js +2 -10
  60. package/lib/modules/Schedule/types.d.ts +2 -0
  61. package/lib/plugins/request.d.ts +19 -1
  62. package/lib/plugins/request.js +11 -1
  63. package/lib/server/index.d.ts +152 -0
  64. package/lib/server/index.js +555 -0
  65. package/lib/server/modules/index.d.ts +16 -0
  66. package/lib/server/modules/index.js +47 -0
  67. package/lib/server/modules/menu/index.d.ts +63 -0
  68. package/lib/server/modules/menu/index.js +234 -0
  69. package/lib/server/modules/menu/types.d.ts +68 -0
  70. package/lib/server/modules/menu/types.js +33 -0
  71. package/lib/server/modules/products/index.d.ts +141 -0
  72. package/lib/server/modules/products/index.js +442 -0
  73. package/lib/server/modules/products/types.d.ts +94 -0
  74. package/lib/server/modules/products/types.js +35 -0
  75. package/lib/server/modules/quotation/index.d.ts +47 -0
  76. package/lib/server/modules/quotation/index.js +177 -0
  77. package/lib/server/modules/quotation/types.d.ts +50 -0
  78. package/lib/server/modules/quotation/types.js +33 -0
  79. package/lib/server/modules/schedule/index.d.ts +62 -0
  80. package/lib/server/modules/schedule/index.js +231 -0
  81. package/lib/server/modules/schedule/types.d.ts +1 -0
  82. package/lib/server/modules/schedule/types.js +23 -0
  83. package/lib/server/modules/schedule/utils.d.ts +32 -0
  84. package/lib/server/modules/schedule/utils.js +451 -0
  85. package/lib/server/types.d.ts +64 -0
  86. package/lib/server/types.js +17 -0
  87. package/lib/server/utils/index.d.ts +5 -0
  88. package/lib/server/utils/index.js +25 -0
  89. package/lib/server/utils/product.d.ts +18 -0
  90. package/lib/server/utils/product.js +262 -0
  91. package/lib/server/utils/schedule.d.ts +14 -0
  92. package/lib/server/utils/schedule.js +88 -0
  93. package/lib/server/utils/time.d.ts +18 -0
  94. package/lib/server/utils/time.js +70 -0
  95. package/lib/solution/BookingByStep/index.d.ts +2 -22
  96. package/lib/solution/BookingByStep/index.js +42 -321
  97. package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
  98. package/lib/solution/BookingByStep/utils/capacity.js +8 -21
  99. package/lib/solution/BookingTicket/index.d.ts +8 -0
  100. package/lib/solution/BookingTicket/index.js +13 -0
  101. package/lib/solution/ShopDiscount/index.js +0 -9
  102. package/lib/solution/index.d.ts +0 -1
  103. package/lib/solution/index.js +0 -2
  104. package/lib/types/index.d.ts +26 -0
  105. package/package.json +2 -2
  106. package/dist/solution/RegisterAndLogin/config.d.ts +0 -87
  107. package/dist/solution/RegisterAndLogin/config.js +0 -792
  108. package/dist/solution/RegisterAndLogin/index.d.ts +0 -189
  109. package/dist/solution/RegisterAndLogin/index.js +0 -2667
  110. package/dist/solution/RegisterAndLogin/types.d.ts +0 -444
  111. package/dist/solution/RegisterAndLogin/types.js +0 -231
  112. package/dist/solution/RegisterAndLogin/utils.d.ts +0 -95
  113. package/dist/solution/RegisterAndLogin/utils.js +0 -322
  114. package/lib/solution/RegisterAndLogin/config.d.ts +0 -87
  115. package/lib/solution/RegisterAndLogin/config.js +0 -594
  116. package/lib/solution/RegisterAndLogin/index.d.ts +0 -189
  117. package/lib/solution/RegisterAndLogin/index.js +0 -1593
  118. package/lib/solution/RegisterAndLogin/types.d.ts +0 -444
  119. package/lib/solution/RegisterAndLogin/types.js +0 -78
  120. package/lib/solution/RegisterAndLogin/utils.d.ts +0 -95
  121. package/lib/solution/RegisterAndLogin/utils.js +0 -279
@@ -15,9 +15,8 @@ export declare const formatDefaultCapacitys: ({ capacity, product_bundle, }: any
15
15
  * @return {*}
16
16
  * @Author: zhiwei.Wang
17
17
  */
18
- export declare const getSumCapacity: ({ capacity, num }: {
18
+ export declare const getSumCapacity: ({ capacity }: {
19
19
  capacity: CapacityItem[];
20
- num: number;
21
20
  }) => number;
22
21
  /**
23
22
  * 给定购物车数据,返回对应的 capacity 信息和套餐 capacity
@@ -68,8 +67,4 @@ export declare function getResourcesIdsByProduct(product: any): number[];
68
67
  /**
69
68
  * 检查特定时间段的容量是否足够
70
69
  */
71
- export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]): {
72
- success: boolean;
73
- required: number;
74
- available: number;
75
- };
70
+ export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]): boolean;
@@ -60,9 +60,7 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
60
60
  * @Author: zhiwei.Wang
61
61
  */
62
62
  export var getSumCapacity = function getSumCapacity(_ref2) {
63
- var capacity = _ref2.capacity,
64
- _ref2$num = _ref2.num,
65
- num = _ref2$num === void 0 ? 1 : _ref2$num;
63
+ var capacity = _ref2.capacity;
66
64
  var sum = 0;
67
65
  var _iterator = _createForOfIteratorHelper(capacity || []),
68
66
  _step;
@@ -76,7 +74,7 @@ export var getSumCapacity = function getSumCapacity(_ref2) {
76
74
  } finally {
77
75
  _iterator.f();
78
76
  }
79
- return sum * num;
77
+ return sum;
80
78
  };
81
79
 
82
80
  /**
@@ -93,8 +91,7 @@ export function getCapacityInfoByCartItem(targetCartItem) {
93
91
  product_bundle: targetCartItem._origin.product.product_bundle
94
92
  });
95
93
  var currentCapacity = getSumCapacity({
96
- capacity: formatCapacity,
97
- num: (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.num) || 1
94
+ capacity: formatCapacity
98
95
  });
99
96
  return {
100
97
  formatCapacity: formatCapacity,
@@ -265,7 +262,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
265
262
  if (needsThisResourceType) {
266
263
  // 需要判断是单个预约还是多个预约,如果是单个预约,不用加 capacity,只用+1
267
264
  if (selectType === 'single') {
268
- requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + ((cartItem === null || cartItem === void 0 ? void 0 : cartItem.num) || 1);
265
+ requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
269
266
  } else {
270
267
  requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
271
268
  }
@@ -330,11 +327,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
330
327
  if (totalAvailableCapacity < requiredCapacity) {
331
328
  console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
332
329
  return {
333
- v: {
334
- success: false,
335
- required: requiredCapacity,
336
- available: totalAvailableCapacity
337
- }
330
+ v: false
338
331
  };
339
332
  }
340
333
  } else {
@@ -343,8 +336,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
343
336
  resourcesInType.forEach(function (resource) {
344
337
  // 过滤出在时间段内的资源时间片
345
338
  var availableTimes = resource.times.filter(function (time) {
346
- var _time$event_list;
347
- return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute') && ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.length) === 0;
339
+ return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute');
348
340
  });
349
341
  if (availableTimes.length > 0) {
350
342
  availableResourceCount++;
@@ -354,11 +346,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
354
346
  if (availableResourceCount < requiredCapacity) {
355
347
  console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
356
348
  return {
357
- v: {
358
- success: false,
359
- required: requiredCapacity,
360
- available: availableResourceCount
361
- }
349
+ v: false
362
350
  };
363
351
  }
364
352
  }
@@ -369,9 +357,5 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
369
357
  if (_ret === 0) continue;
370
358
  if (_ret) return _ret.v;
371
359
  }
372
- return {
373
- success: true,
374
- required: 0,
375
- available: 0
376
- };
360
+ return true;
377
361
  }
@@ -31,6 +31,14 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
31
31
  * @returns 商品列表
32
32
  */
33
33
  getProducts(): Promise<ProductData[]>;
34
+ /**
35
+ * 获取日程时间段点
36
+ * @param params 参数
37
+ * @returns 日程时间段点
38
+ */
39
+ getScheduleTimePoints(params: {
40
+ menu_list_ids: number[];
41
+ }): Promise<any>;
34
42
  /**
35
43
  * 获取客户列表
36
44
  * @param params 查询参数
@@ -203,6 +203,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
203
203
  }
204
204
  return getProducts;
205
205
  }()
206
+ /**
207
+ * 获取日程时间段点
208
+ * @param params 参数
209
+ * @returns 日程时间段点
210
+ */
211
+ )
212
+ }, {
213
+ key: "getScheduleTimePoints",
214
+ value: (function () {
215
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
216
+ var result;
217
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
218
+ while (1) switch (_context4.prev = _context4.next) {
219
+ case 0:
220
+ _context4.next = 2;
221
+ return this.request.post('/menu/schedule-time-points', {
222
+ menu_list_ids: params.menu_list_ids
223
+ }, {
224
+ osServer: true
225
+ });
226
+ case 2:
227
+ result = _context4.sent;
228
+ return _context4.abrupt("return", result.data || []);
229
+ case 4:
230
+ case "end":
231
+ return _context4.stop();
232
+ }
233
+ }, _callee4, this);
234
+ }));
235
+ function getScheduleTimePoints(_x3) {
236
+ return _getScheduleTimePoints.apply(this, arguments);
237
+ }
238
+ return getScheduleTimePoints;
239
+ }()
206
240
  /**
207
241
  * 获取客户列表
208
242
  * @param params 查询参数
@@ -212,30 +246,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
212
246
  }, {
213
247
  key: "getCustomerList",
214
248
  value: (function () {
215
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
249
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
216
250
  var params,
217
251
  result,
218
- _args4 = arguments;
219
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
220
- while (1) switch (_context4.prev = _context4.next) {
252
+ _args5 = arguments;
253
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
254
+ while (1) switch (_context5.prev = _context5.next) {
221
255
  case 0:
222
- params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
223
- _context4.prev = 1;
224
- _context4.next = 4;
256
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
257
+ _context5.prev = 1;
258
+ _context5.next = 4;
225
259
  return this.store.customer.getCustomerList(params);
226
260
  case 4:
227
- result = _context4.sent;
228
- return _context4.abrupt("return", result);
261
+ result = _context5.sent;
262
+ return _context5.abrupt("return", result);
229
263
  case 8:
230
- _context4.prev = 8;
231
- _context4.t0 = _context4["catch"](1);
232
- console.error('Failed to get customer list:', _context4.t0);
233
- throw _context4.t0;
264
+ _context5.prev = 8;
265
+ _context5.t0 = _context5["catch"](1);
266
+ console.error('Failed to get customer list:', _context5.t0);
267
+ throw _context5.t0;
234
268
  case 12:
235
269
  case "end":
236
- return _context4.stop();
270
+ return _context5.stop();
237
271
  }
238
- }, _callee4, this, [[1, 8]]);
272
+ }, _callee5, this, [[1, 8]]);
239
273
  }));
240
274
  function getCustomerList() {
241
275
  return _getCustomerList.apply(this, arguments);
@@ -362,29 +396,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
362
396
  }, {
363
397
  key: "changeCustomerPage",
364
398
  value: (function () {
365
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page, pageSize) {
399
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
366
400
  var result;
367
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
368
- while (1) switch (_context5.prev = _context5.next) {
401
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
402
+ while (1) switch (_context6.prev = _context6.next) {
369
403
  case 0:
370
- _context5.prev = 0;
371
- _context5.next = 3;
404
+ _context6.prev = 0;
405
+ _context6.next = 3;
372
406
  return this.store.customer.changeCustomerPage(page, pageSize);
373
407
  case 3:
374
- result = _context5.sent;
375
- return _context5.abrupt("return", result);
408
+ result = _context6.sent;
409
+ return _context6.abrupt("return", result);
376
410
  case 7:
377
- _context5.prev = 7;
378
- _context5.t0 = _context5["catch"](0);
379
- console.error('Failed to change customer page:', _context5.t0);
380
- throw _context5.t0;
411
+ _context6.prev = 7;
412
+ _context6.t0 = _context6["catch"](0);
413
+ console.error('Failed to change customer page:', _context6.t0);
414
+ throw _context6.t0;
381
415
  case 11:
382
416
  case "end":
383
- return _context5.stop();
417
+ return _context6.stop();
384
418
  }
385
- }, _callee5, this, [[0, 7]]);
419
+ }, _callee6, this, [[0, 7]]);
386
420
  }));
387
- function changeCustomerPage(_x3, _x4) {
421
+ function changeCustomerPage(_x4, _x5) {
388
422
  return _changeCustomerPage.apply(this, arguments);
389
423
  }
390
424
  return changeCustomerPage;
@@ -397,28 +431,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
397
431
  }, {
398
432
  key: "loadMoreCustomers",
399
433
  value: (function () {
400
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
434
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
401
435
  var result;
402
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
403
- while (1) switch (_context6.prev = _context6.next) {
436
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
437
+ while (1) switch (_context7.prev = _context7.next) {
404
438
  case 0:
405
- _context6.prev = 0;
406
- _context6.next = 3;
439
+ _context7.prev = 0;
440
+ _context7.next = 3;
407
441
  return this.store.customer.loadMoreCustomers();
408
442
  case 3:
409
- result = _context6.sent;
443
+ result = _context7.sent;
410
444
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), result);
411
- return _context6.abrupt("return", result);
445
+ return _context7.abrupt("return", result);
412
446
  case 8:
413
- _context6.prev = 8;
414
- _context6.t0 = _context6["catch"](0);
415
- console.error('Failed to load more customers:', _context6.t0);
416
- throw _context6.t0;
447
+ _context7.prev = 8;
448
+ _context7.t0 = _context7["catch"](0);
449
+ console.error('Failed to load more customers:', _context7.t0);
450
+ throw _context7.t0;
417
451
  case 12:
418
452
  case "end":
419
- return _context6.stop();
453
+ return _context7.stop();
420
454
  }
421
- }, _callee6, this, [[0, 8]]);
455
+ }, _callee7, this, [[0, 8]]);
422
456
  }));
423
457
  function loadMoreCustomers() {
424
458
  return _loadMoreCustomers.apply(this, arguments);
@@ -434,31 +468,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
434
468
  }, {
435
469
  key: "resetAndLoadCustomers",
436
470
  value: (function () {
437
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
471
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
438
472
  var params,
439
473
  result,
440
- _args7 = arguments;
441
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
442
- while (1) switch (_context7.prev = _context7.next) {
474
+ _args8 = arguments;
475
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
476
+ while (1) switch (_context8.prev = _context8.next) {
443
477
  case 0:
444
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
445
- _context7.prev = 1;
446
- _context7.next = 4;
478
+ params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
479
+ _context8.prev = 1;
480
+ _context8.next = 4;
447
481
  return this.store.customer.resetAndLoadCustomers(params);
448
482
  case 4:
449
- result = _context7.sent;
483
+ result = _context8.sent;
450
484
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), result);
451
- return _context7.abrupt("return", result);
485
+ return _context8.abrupt("return", result);
452
486
  case 9:
453
- _context7.prev = 9;
454
- _context7.t0 = _context7["catch"](1);
455
- console.error('Failed to reset and load customers:', _context7.t0);
456
- throw _context7.t0;
487
+ _context8.prev = 9;
488
+ _context8.t0 = _context8["catch"](1);
489
+ console.error('Failed to reset and load customers:', _context8.t0);
490
+ throw _context8.t0;
457
491
  case 13:
458
492
  case "end":
459
- return _context7.stop();
493
+ return _context8.stop();
460
494
  }
461
- }, _callee7, this, [[1, 9]]);
495
+ }, _callee8, this, [[1, 9]]);
462
496
  }));
463
497
  function resetAndLoadCustomers() {
464
498
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -620,15 +654,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
620
654
  }, {
621
655
  key: "setOtherParams",
622
656
  value: (function () {
623
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
657
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
624
658
  var _ref,
625
659
  _ref$cover,
626
660
  cover,
627
- _args8 = arguments;
628
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
629
- while (1) switch (_context8.prev = _context8.next) {
661
+ _args9 = arguments;
662
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
663
+ while (1) switch (_context9.prev = _context9.next) {
630
664
  case 0:
631
- _ref = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
665
+ _ref = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
632
666
  if (cover) {
633
667
  this.otherParams = params;
634
668
  } else {
@@ -636,11 +670,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
636
670
  }
637
671
  case 2:
638
672
  case "end":
639
- return _context8.stop();
673
+ return _context9.stop();
640
674
  }
641
- }, _callee8, this);
675
+ }, _callee9, this);
642
676
  }));
643
- function setOtherParams(_x5) {
677
+ function setOtherParams(_x6) {
644
678
  return _setOtherParams.apply(this, arguments);
645
679
  }
646
680
  return setOtherParams;
@@ -653,16 +687,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
653
687
  }, {
654
688
  key: "getOtherParams",
655
689
  value: (function () {
656
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
657
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
658
- while (1) switch (_context9.prev = _context9.next) {
690
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
691
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
692
+ while (1) switch (_context10.prev = _context10.next) {
659
693
  case 0:
660
- return _context9.abrupt("return", this.otherParams);
694
+ return _context10.abrupt("return", this.otherParams);
661
695
  case 1:
662
696
  case "end":
663
- return _context9.stop();
697
+ return _context10.stop();
664
698
  }
665
- }, _callee9, this);
699
+ }, _callee10, this);
666
700
  }));
667
701
  function getOtherParams() {
668
702
  return _getOtherParams.apply(this, arguments);
@@ -320,7 +320,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
320
320
  key: "scanCode",
321
321
  value: function () {
322
322
  var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
323
- var _this$store$discount3, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
323
+ var _this$store$discount3, resultDiscountList, rulesModule, withScanList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
324
324
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
325
325
  while (1) switch (_context5.prev = _context5.next) {
326
326
  case 0:
@@ -363,25 +363,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
363
363
  return _objectSpread(_objectSpread({}, item), {}, {
364
364
  isScan: true
365
365
  });
366
- }); // 如果扫回来的券当前有选中的,则不进行计算
367
- currentSelectedDiscountList = this.getDiscountList().filter(function (n) {
368
- return n.isSelected;
369
366
  });
370
- if (!(currentSelectedDiscountList.length && currentSelectedDiscountList.some(function (n) {
371
- return withScanList.some(function (m) {
372
- return m.id === n.id;
373
- });
374
- }))) {
375
- _context5.next = 16;
376
- break;
377
- }
378
- return _context5.abrupt("return", {
379
- type: "clientCalc",
380
- isAvailable: true,
381
- productList: this.store.productList || [],
382
- discountList: this.getDiscountList()
383
- });
384
- case 16:
385
367
  _ref2 = rulesModule.isDiscountListAvailable({
386
368
  productList: this.store.productList || [],
387
369
  oldDiscountList: this.getDiscountList(),
@@ -392,27 +374,27 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
392
374
  discountList: this.getDiscountList()
393
375
  }, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, isAvailable = _ref2.isAvailable;
394
376
  if (!isAvailable) {
395
- _context5.next = 24;
377
+ _context5.next = 21;
396
378
  break;
397
379
  }
398
380
  this.setDiscountList(newDiscountList || []);
399
381
  this.store.originalDiscountList = newDiscountList || [];
400
382
  this.setProductList(newProductList || []);
401
383
  if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
402
- _context5.next = 24;
384
+ _context5.next = 21;
403
385
  break;
404
386
  }
405
- _context5.next = 24;
387
+ _context5.next = 21;
406
388
  return this.getCustomerWallet(resultDiscountList[0].customer_id);
407
- case 24:
389
+ case 21:
408
390
  return _context5.abrupt("return", {
409
391
  type: "clientCalc",
410
392
  isAvailable: isAvailable || false,
411
393
  productList: newProductList || this.store.productList || [],
412
394
  discountList: newDiscountList || this.getDiscountList()
413
395
  });
414
- case 27:
415
- _context5.prev = 27;
396
+ case 24:
397
+ _context5.prev = 24;
416
398
  _context5.t1 = _context5["catch"](0);
417
399
  console.error('[ShopDiscount] 扫码出错:', _context5.t1);
418
400
  return _context5.abrupt("return", {
@@ -421,11 +403,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
421
403
  productList: this.store.productList || [],
422
404
  discountList: this.getDiscountList()
423
405
  });
424
- case 31:
406
+ case 28:
425
407
  case "end":
426
408
  return _context5.stop();
427
409
  }
428
- }, _callee5, this, [[0, 27]]);
410
+ }, _callee5, this, [[0, 24]]);
429
411
  }));
430
412
  function scanCode(_x4, _x5) {
431
413
  return _scanCode.apply(this, arguments);
@@ -2,5 +2,4 @@ export * from './BuyTickets';
2
2
  export * from './BookingByStep';
3
3
  export * from './BookingTicket';
4
4
  export * from './ShopDiscount';
5
- export * from './RegisterAndLogin';
6
5
  export * from './Checkout';
@@ -2,5 +2,4 @@ export * from "./BuyTickets";
2
2
  export * from "./BookingByStep";
3
3
  export * from "./BookingTicket";
4
4
  export * from "./ShopDiscount";
5
- export * from "./RegisterAndLogin";
6
5
  export * from "./Checkout";
@@ -75,6 +75,26 @@ export interface ModuleContextConfig {
75
75
  name: string;
76
76
  validations: ContextValidationRule[];
77
77
  }
78
+ /**
79
+ * Server 模块配置
80
+ */
81
+ export interface ServerModuleConfig {
82
+ /** 模块名称 */
83
+ name: string;
84
+ /** 是否自动预加载数据 */
85
+ preload?: boolean;
86
+ /** 模块配置参数 */
87
+ config?: Record<string, any>;
88
+ }
89
+ /**
90
+ * Server 配置选项
91
+ */
92
+ export interface ServerOptions {
93
+ /** 要启用的模块列表 */
94
+ modules?: string[] | ServerModuleConfig[];
95
+ /** 是否自动初始化数据 */
96
+ autoInitData?: boolean;
97
+ }
78
98
  export interface PisellOSOptions {
79
99
  debug?: boolean;
80
100
  plugins?: Array<{
@@ -86,4 +106,10 @@ export interface PisellOSOptions {
86
106
  options?: ModuleOptions;
87
107
  }>;
88
108
  context?: BusinessContext;
109
+ /** Server 配置 */
110
+ server?: ServerOptions;
111
+ }
112
+ export interface InitializeServerOptions {
113
+ onModuleLoad?: (module: string) => void;
114
+ onModuleLoadComplete?: (module: string) => void;
89
115
  }
@@ -1,4 +1,4 @@
1
- import { Plugin, PluginOptions, Module, ModuleOptions, PisellCore, PisellOSOptions, BusinessContext, ModuleContextConfig } from '../types';
1
+ import { Plugin, PluginOptions, Module, ModuleOptions, PisellCore, PisellOSOptions, BusinessContext, ModuleContextConfig, InitializeServerOptions } from '../types';
2
2
  import { EffectsManager } from '../effects';
3
3
  /**
4
4
  * pisell OS 核心实现
@@ -10,8 +10,15 @@ declare class PisellOSCore implements PisellCore {
10
10
  effects: EffectsManager;
11
11
  private debug;
12
12
  context: BusinessContext;
13
+ server: any;
14
+ private serverOptions?;
13
15
  constructor(options?: PisellOSOptions);
14
16
  private initialize;
17
+ /**
18
+ * 初始化 Server(公开方法,需要外部显式调用并等待)
19
+ * Server 配置从构造函数传入的 options.server 中获取
20
+ */
21
+ initializeServer(options?: InitializeServerOptions): Promise<void>;
15
22
  private log;
16
23
  registerPlugin(plugin: Plugin, options?: PluginOptions): void;
17
24
  getPlugin<T extends Plugin>(name: string): T | null;
package/lib/core/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/core/index.ts
@@ -26,6 +36,7 @@ module.exports = __toCommonJS(core_exports);
26
36
  var import_createStore = require("../store/createStore");
27
37
  var import_effects = require("../effects");
28
38
  var PisellOSCore = class {
39
+ // 保存 Server 配置
29
40
  constructor(options) {
30
41
  this.plugins = /* @__PURE__ */ new Map();
31
42
  this.modules = /* @__PURE__ */ new Map();
@@ -35,6 +46,9 @@ var PisellOSCore = class {
35
46
  this.context = {};
36
47
  this.debug = (options == null ? void 0 : options.debug) || false;
37
48
  this.context = (options == null ? void 0 : options.context) || {};
49
+ if (options == null ? void 0 : options.server) {
50
+ this.serverOptions = options.server;
51
+ }
38
52
  this.initialize(options);
39
53
  }
40
54
  initialize(options) {
@@ -48,7 +62,40 @@ var PisellOSCore = class {
48
62
  this.registerModule(item.module, item.options);
49
63
  });
50
64
  }
51
- this.log("PisellOS 核心初始化完成");
65
+ this.log("[PisellOS] 核心初始化完成");
66
+ }
67
+ /**
68
+ * 初始化 Server(公开方法,需要外部显式调用并等待)
69
+ * Server 配置从构造函数传入的 options.server 中获取
70
+ */
71
+ async initializeServer(options) {
72
+ if (this.server) {
73
+ this.log("Server 已经初始化,跳过重复初始化", "warn");
74
+ return;
75
+ }
76
+ if (!this.serverOptions) {
77
+ this.log("未提供 Server 配置,无法初始化", "warn");
78
+ return;
79
+ }
80
+ try {
81
+ const ServerModule = await import("../server");
82
+ const Server = ServerModule.default;
83
+ this.server = new Server(this);
84
+ this.log("Server 实例已创建");
85
+ if (this.serverOptions.modules) {
86
+ await this.server.initialize(
87
+ this.serverOptions.modules,
88
+ this.serverOptions.autoInitData !== false,
89
+ options
90
+ );
91
+ }
92
+ console.log("[PisellOS] ✅ Server 初始化完成,所有数据已预加载");
93
+ this.log("[PisellOS] Server 初始化完成");
94
+ } catch (error) {
95
+ console.error("[PisellOS] ❌ Server 初始化失败:", error);
96
+ this.log(`Server 初始化失败: ${error}`, "error");
97
+ throw error;
98
+ }
52
99
  }
53
100
  // 日志方法
54
101
  log(message, level = "info") {
@@ -101,7 +101,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
101
101
  skip,
102
102
  num,
103
103
  sort_by: import_constants.SORT_BY,
104
- with: ["latestWalletDetail.wallet", "contactsInfo"],
104
+ with: ["latestWalletDetail.wallet"],
105
105
  search_wallet_flag: 1,
106
106
  search_wallet_pass_flag: 1,
107
107
  ...search && { search },