@pisell/pisellos 2.1.38 → 2.2.1

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 (135) hide show
  1. package/dist/core/index.d.ts +8 -1
  2. package/dist/core/index.js +116 -42
  3. package/dist/effects/index.d.ts +1 -0
  4. package/dist/effects/index.js +29 -6
  5. package/dist/modules/Account/index.js +2 -3
  6. package/dist/modules/BaseModule.d.ts +3 -0
  7. package/dist/modules/BaseModule.js +15 -0
  8. package/dist/modules/Customer/index.js +9 -10
  9. package/dist/modules/Customer/types.d.ts +2 -2
  10. package/dist/modules/Customer/types.js +2 -2
  11. package/dist/modules/Discount/index.js +1 -1
  12. package/dist/modules/Guests/index.js +9 -9
  13. package/dist/modules/Order/index.js +1 -1
  14. package/dist/modules/Payment/index.js +63 -73
  15. package/dist/modules/Payment/walletpass.js +4 -1
  16. package/dist/modules/Product/index.d.ts +1 -1
  17. package/dist/modules/Product/types.d.ts +19 -0
  18. package/dist/modules/ProductList/index.js +5 -14
  19. package/dist/modules/Resource/index.js +1 -1
  20. package/dist/modules/Rules/index.js +2 -3
  21. package/dist/modules/Schedule/types.d.ts +2 -0
  22. package/dist/plugins/request.d.ts +1 -0
  23. package/dist/server/index.d.ts +152 -0
  24. package/dist/server/index.js +946 -0
  25. package/dist/server/modules/index.d.ts +16 -0
  26. package/dist/server/modules/index.js +21 -0
  27. package/dist/server/modules/menu/index.d.ts +63 -0
  28. package/dist/server/modules/menu/index.js +476 -0
  29. package/dist/server/modules/menu/types.d.ts +68 -0
  30. package/dist/server/modules/menu/types.js +16 -0
  31. package/dist/server/modules/products/index.d.ts +141 -0
  32. package/dist/server/modules/products/index.js +768 -0
  33. package/dist/server/modules/products/types.d.ts +94 -0
  34. package/dist/server/modules/products/types.js +43 -0
  35. package/dist/server/modules/quotation/index.d.ts +47 -0
  36. package/dist/server/modules/quotation/index.js +367 -0
  37. package/dist/server/modules/quotation/types.d.ts +50 -0
  38. package/dist/server/modules/quotation/types.js +20 -0
  39. package/dist/server/modules/schedule/index.d.ts +62 -0
  40. package/dist/server/modules/schedule/index.js +431 -0
  41. package/dist/server/modules/schedule/types.d.ts +1 -0
  42. package/dist/server/modules/schedule/types.js +2 -0
  43. package/dist/server/modules/schedule/utils.d.ts +32 -0
  44. package/dist/server/modules/schedule/utils.js +747 -0
  45. package/dist/server/types.d.ts +64 -0
  46. package/dist/server/types.js +1 -0
  47. package/dist/server/utils/index.d.ts +5 -0
  48. package/dist/server/utils/index.js +6 -0
  49. package/dist/server/utils/product.d.ts +18 -0
  50. package/dist/server/utils/product.js +339 -0
  51. package/dist/server/utils/schedule.d.ts +14 -0
  52. package/dist/server/utils/schedule.js +108 -0
  53. package/dist/server/utils/time.d.ts +18 -0
  54. package/dist/server/utils/time.js +53 -0
  55. package/dist/solution/BookingByStep/index.d.ts +1 -17
  56. package/dist/solution/BookingByStep/index.js +23 -468
  57. package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
  58. package/dist/solution/BookingByStep/utils/capacity.js +8 -24
  59. package/dist/solution/BookingTicket/index.d.ts +12 -0
  60. package/dist/solution/BookingTicket/index.js +122 -79
  61. package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
  62. package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
  63. package/dist/solution/BuyTickets/index.js +7 -8
  64. package/dist/solution/Checkout/index.d.ts +1 -46
  65. package/dist/solution/Checkout/index.js +530 -850
  66. package/dist/solution/ShopDiscount/index.js +9 -10
  67. package/dist/types/index.d.ts +27 -0
  68. package/lib/core/index.d.ts +8 -1
  69. package/lib/core/index.js +48 -1
  70. package/lib/effects/index.d.ts +1 -0
  71. package/lib/effects/index.js +13 -0
  72. package/lib/modules/Account/index.js +2 -3
  73. package/lib/modules/BaseModule.d.ts +3 -0
  74. package/lib/modules/BaseModule.js +9 -0
  75. package/lib/modules/Customer/index.js +9 -10
  76. package/lib/modules/Customer/types.d.ts +2 -2
  77. package/lib/modules/Customer/types.js +2 -2
  78. package/lib/modules/Discount/index.js +1 -1
  79. package/lib/modules/Guests/index.js +9 -9
  80. package/lib/modules/Order/index.js +1 -1
  81. package/lib/modules/Payment/index.js +56 -43
  82. package/lib/modules/Payment/walletpass.js +3 -1
  83. package/lib/modules/Product/index.d.ts +1 -1
  84. package/lib/modules/Product/types.d.ts +19 -0
  85. package/lib/modules/ProductList/index.js +4 -13
  86. package/lib/modules/Resource/index.js +1 -1
  87. package/lib/modules/Rules/index.js +2 -3
  88. package/lib/modules/Schedule/types.d.ts +2 -0
  89. package/lib/plugins/request.d.ts +1 -0
  90. package/lib/server/index.d.ts +152 -0
  91. package/lib/server/index.js +555 -0
  92. package/lib/server/modules/index.d.ts +16 -0
  93. package/lib/server/modules/index.js +47 -0
  94. package/lib/server/modules/menu/index.d.ts +63 -0
  95. package/lib/server/modules/menu/index.js +234 -0
  96. package/lib/server/modules/menu/types.d.ts +68 -0
  97. package/lib/server/modules/menu/types.js +33 -0
  98. package/lib/server/modules/products/index.d.ts +141 -0
  99. package/lib/server/modules/products/index.js +434 -0
  100. package/lib/server/modules/products/types.d.ts +94 -0
  101. package/lib/server/modules/products/types.js +35 -0
  102. package/lib/server/modules/quotation/index.d.ts +47 -0
  103. package/lib/server/modules/quotation/index.js +177 -0
  104. package/lib/server/modules/quotation/types.d.ts +50 -0
  105. package/lib/server/modules/quotation/types.js +33 -0
  106. package/lib/server/modules/schedule/index.d.ts +62 -0
  107. package/lib/server/modules/schedule/index.js +231 -0
  108. package/lib/server/modules/schedule/types.d.ts +1 -0
  109. package/lib/server/modules/schedule/types.js +23 -0
  110. package/lib/server/modules/schedule/utils.d.ts +32 -0
  111. package/lib/server/modules/schedule/utils.js +451 -0
  112. package/lib/server/types.d.ts +64 -0
  113. package/lib/server/types.js +17 -0
  114. package/lib/server/utils/index.d.ts +5 -0
  115. package/lib/server/utils/index.js +25 -0
  116. package/lib/server/utils/product.d.ts +18 -0
  117. package/lib/server/utils/product.js +262 -0
  118. package/lib/server/utils/schedule.d.ts +14 -0
  119. package/lib/server/utils/schedule.js +88 -0
  120. package/lib/server/utils/time.d.ts +18 -0
  121. package/lib/server/utils/time.js +70 -0
  122. package/lib/solution/BookingByStep/index.d.ts +1 -17
  123. package/lib/solution/BookingByStep/index.js +40 -312
  124. package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
  125. package/lib/solution/BookingByStep/utils/capacity.js +8 -21
  126. package/lib/solution/BookingTicket/index.d.ts +12 -0
  127. package/lib/solution/BookingTicket/index.js +25 -6
  128. package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
  129. package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
  130. package/lib/solution/BuyTickets/index.js +7 -8
  131. package/lib/solution/Checkout/index.d.ts +1 -46
  132. package/lib/solution/Checkout/index.js +92 -289
  133. package/lib/solution/ShopDiscount/index.js +10 -11
  134. package/lib/types/index.d.ts +27 -0
  135. package/package.json +2 -2
@@ -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
  }
@@ -22,11 +22,23 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
22
22
  * @returns 商品列表
23
23
  */
24
24
  loadProducts(params?: ILoadProductsParams): Promise<any>;
25
+ /**
26
+ * 初始化外设扫码结果监听
27
+ */
28
+ initPeripheralsListener(): void;
25
29
  /**
26
30
  * 获取商品列表(不加载到模块中)
27
31
  * @returns 商品列表
28
32
  */
29
33
  getProducts(): Promise<ProductData[]>;
34
+ /**
35
+ * 获取日程时间段点
36
+ * @param params 参数
37
+ * @returns 日程时间段点
38
+ */
39
+ getScheduleTimePoints(params: {
40
+ menu_list_ids: number[];
41
+ }): Promise<any>;
30
42
  /**
31
43
  * 获取客户列表
32
44
  * @param params 查询参数
@@ -18,7 +18,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
20
  import { BaseModule } from "../../modules/BaseModule";
21
- import { BookingTicketHooks, createModule } from "./types";
21
+ import { createModule } from "./types";
22
22
  import Scan from "./utils/scan";
23
23
  import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
24
24
  import scanCache from "./utils/scan/scanCache";
@@ -109,7 +109,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
109
109
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
110
110
  }
111
111
  });
112
- this.core.effects.emit(BookingTicketHooks.onInited, {});
112
+ this.core.effects.emit("".concat(this.name, ":onInited"), {});
113
113
  case 19:
114
114
  case "end":
115
115
  return _context.stop();
@@ -152,7 +152,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
152
152
  }));
153
153
  case 5:
154
154
  result = _context2.sent;
155
- this.core.effects.emit(BookingTicketHooks.onProductsLoaded, result);
155
+ this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
156
156
  return _context2.abrupt("return", result);
157
157
  case 10:
158
158
  _context2.prev = 10;
@@ -170,11 +170,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
170
170
  }
171
171
  return loadProducts;
172
172
  }()
173
+ /**
174
+ * 初始化外设扫码结果监听
175
+ */
176
+ )
177
+ }, {
178
+ key: "initPeripheralsListener",
179
+ value: function initPeripheralsListener() {
180
+ this.scan.initPeripheralsListener();
181
+ }
182
+
173
183
  /**
174
184
  * 获取商品列表(不加载到模块中)
175
185
  * @returns 商品列表
176
186
  */
177
- )
178
187
  }, {
179
188
  key: "getProducts",
180
189
  value: (function () {
@@ -194,6 +203,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
194
203
  }
195
204
  return getProducts;
196
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
+ }()
197
240
  /**
198
241
  * 获取客户列表
199
242
  * @param params 查询参数
@@ -203,30 +246,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
203
246
  }, {
204
247
  key: "getCustomerList",
205
248
  value: (function () {
206
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
249
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
207
250
  var params,
208
251
  result,
209
- _args4 = arguments;
210
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
211
- 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) {
212
255
  case 0:
213
- params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
214
- _context4.prev = 1;
215
- _context4.next = 4;
256
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
257
+ _context5.prev = 1;
258
+ _context5.next = 4;
216
259
  return this.store.customer.getCustomerList(params);
217
260
  case 4:
218
- result = _context4.sent;
219
- return _context4.abrupt("return", result);
261
+ result = _context5.sent;
262
+ return _context5.abrupt("return", result);
220
263
  case 8:
221
- _context4.prev = 8;
222
- _context4.t0 = _context4["catch"](1);
223
- console.error('Failed to get customer list:', _context4.t0);
224
- 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;
225
268
  case 12:
226
269
  case "end":
227
- return _context4.stop();
270
+ return _context5.stop();
228
271
  }
229
- }, _callee4, this, [[1, 8]]);
272
+ }, _callee5, this, [[1, 8]]);
230
273
  }));
231
274
  function getCustomerList() {
232
275
  return _getCustomerList.apply(this, arguments);
@@ -242,7 +285,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
242
285
  key: "setActiveCustomer",
243
286
  value: function setActiveCustomer(customer) {
244
287
  this.store.customer.setSelectedCustomer(customer);
245
- this.core.effects.emit(BookingTicketHooks.onCustomerSelected, {
288
+ this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), {
246
289
  customer: customer
247
290
  });
248
291
  }
@@ -267,7 +310,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
267
310
  var customer = this.store.customer.getCustomerById(customerId);
268
311
  if (customer) {
269
312
  this.store.customer.setSelectedCustomer(customer);
270
- this.core.effects.emit(BookingTicketHooks.onCustomerSelected, {
313
+ this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), {
271
314
  customer: customer
272
315
  });
273
316
  }
@@ -353,29 +396,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
353
396
  }, {
354
397
  key: "changeCustomerPage",
355
398
  value: (function () {
356
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page, pageSize) {
399
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
357
400
  var result;
358
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
359
- while (1) switch (_context5.prev = _context5.next) {
401
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
402
+ while (1) switch (_context6.prev = _context6.next) {
360
403
  case 0:
361
- _context5.prev = 0;
362
- _context5.next = 3;
404
+ _context6.prev = 0;
405
+ _context6.next = 3;
363
406
  return this.store.customer.changeCustomerPage(page, pageSize);
364
407
  case 3:
365
- result = _context5.sent;
366
- return _context5.abrupt("return", result);
408
+ result = _context6.sent;
409
+ return _context6.abrupt("return", result);
367
410
  case 7:
368
- _context5.prev = 7;
369
- _context5.t0 = _context5["catch"](0);
370
- console.error('Failed to change customer page:', _context5.t0);
371
- 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;
372
415
  case 11:
373
416
  case "end":
374
- return _context5.stop();
417
+ return _context6.stop();
375
418
  }
376
- }, _callee5, this, [[0, 7]]);
419
+ }, _callee6, this, [[0, 7]]);
377
420
  }));
378
- function changeCustomerPage(_x3, _x4) {
421
+ function changeCustomerPage(_x4, _x5) {
379
422
  return _changeCustomerPage.apply(this, arguments);
380
423
  }
381
424
  return changeCustomerPage;
@@ -388,28 +431,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
388
431
  }, {
389
432
  key: "loadMoreCustomers",
390
433
  value: (function () {
391
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
434
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
392
435
  var result;
393
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
394
- while (1) switch (_context6.prev = _context6.next) {
436
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
437
+ while (1) switch (_context7.prev = _context7.next) {
395
438
  case 0:
396
- _context6.prev = 0;
397
- _context6.next = 3;
439
+ _context7.prev = 0;
440
+ _context7.next = 3;
398
441
  return this.store.customer.loadMoreCustomers();
399
442
  case 3:
400
- result = _context6.sent;
401
- this.core.effects.emit(BookingTicketHooks.onCustomerListUpdate, result);
402
- return _context6.abrupt("return", result);
443
+ result = _context7.sent;
444
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), result);
445
+ return _context7.abrupt("return", result);
403
446
  case 8:
404
- _context6.prev = 8;
405
- _context6.t0 = _context6["catch"](0);
406
- console.error('Failed to load more customers:', _context6.t0);
407
- 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;
408
451
  case 12:
409
452
  case "end":
410
- return _context6.stop();
453
+ return _context7.stop();
411
454
  }
412
- }, _callee6, this, [[0, 8]]);
455
+ }, _callee7, this, [[0, 8]]);
413
456
  }));
414
457
  function loadMoreCustomers() {
415
458
  return _loadMoreCustomers.apply(this, arguments);
@@ -425,31 +468,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
425
468
  }, {
426
469
  key: "resetAndLoadCustomers",
427
470
  value: (function () {
428
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
471
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
429
472
  var params,
430
473
  result,
431
- _args7 = arguments;
432
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
433
- 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) {
434
477
  case 0:
435
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
436
- _context7.prev = 1;
437
- _context7.next = 4;
478
+ params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
479
+ _context8.prev = 1;
480
+ _context8.next = 4;
438
481
  return this.store.customer.resetAndLoadCustomers(params);
439
482
  case 4:
440
- result = _context7.sent;
441
- this.core.effects.emit(BookingTicketHooks.onCustomerListReset, result);
442
- return _context7.abrupt("return", result);
483
+ result = _context8.sent;
484
+ this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), result);
485
+ return _context8.abrupt("return", result);
443
486
  case 9:
444
- _context7.prev = 9;
445
- _context7.t0 = _context7["catch"](1);
446
- console.error('Failed to reset and load customers:', _context7.t0);
447
- 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;
448
491
  case 13:
449
492
  case "end":
450
- return _context7.stop();
493
+ return _context8.stop();
451
494
  }
452
- }, _callee7, this, [[1, 9]]);
495
+ }, _callee8, this, [[1, 9]]);
453
496
  }));
454
497
  function resetAndLoadCustomers() {
455
498
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -611,15 +654,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
611
654
  }, {
612
655
  key: "setOtherParams",
613
656
  value: (function () {
614
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
657
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
615
658
  var _ref,
616
659
  _ref$cover,
617
660
  cover,
618
- _args8 = arguments;
619
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
620
- 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) {
621
664
  case 0:
622
- _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;
623
666
  if (cover) {
624
667
  this.otherParams = params;
625
668
  } else {
@@ -627,11 +670,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
627
670
  }
628
671
  case 2:
629
672
  case "end":
630
- return _context8.stop();
673
+ return _context9.stop();
631
674
  }
632
- }, _callee8, this);
675
+ }, _callee9, this);
633
676
  }));
634
- function setOtherParams(_x5) {
677
+ function setOtherParams(_x6) {
635
678
  return _setOtherParams.apply(this, arguments);
636
679
  }
637
680
  return setOtherParams;
@@ -644,16 +687,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
644
687
  }, {
645
688
  key: "getOtherParams",
646
689
  value: (function () {
647
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
648
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
649
- 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) {
650
693
  case 0:
651
- return _context9.abrupt("return", this.otherParams);
694
+ return _context10.abrupt("return", this.otherParams);
652
695
  case 1:
653
696
  case "end":
654
- return _context9.stop();
697
+ return _context10.stop();
655
698
  }
656
- }, _callee9, this);
699
+ }, _callee10, this);
657
700
  }));
658
701
  function getOtherParams() {
659
702
  return _getOtherParams.apply(this, arguments);
@@ -18,6 +18,10 @@ export default class Scan {
18
18
  private watchKey;
19
19
  private listenerConfig;
20
20
  constructor(solution: BookingTicketImpl, watchKey: string);
21
+ /**
22
+ * 初始化外设扫码结果监听
23
+ */
24
+ initPeripheralsListener(): void;
21
25
  /**
22
26
  * 处理扫码事件
23
27
  * @param eventKey 事件key
@@ -18,9 +18,6 @@ var ScanResultType = /*#__PURE__*/function (ScanResultType) {
18
18
  }(ScanResultType || {});
19
19
  var Scan = /*#__PURE__*/function () {
20
20
  function Scan(solution, watchKey) {
21
- var _this$solution,
22
- _this$solution$mountF,
23
- _this = this;
24
21
  _classCallCheck(this, Scan);
25
22
  _defineProperty(this, "solution", void 0);
26
23
  _defineProperty(this, "watchKey", void 0);
@@ -28,24 +25,36 @@ var Scan = /*#__PURE__*/function () {
28
25
  this.solution = solution;
29
26
  this.watchKey = watchKey;
30
27
 
31
- // 监听扫码结果
32
- (_this$solution = this.solution) === null || _this$solution === void 0 || (_this$solution = _this$solution.window) === null || _this$solution === void 0 || (_this$solution = _this$solution.interaction) === null || _this$solution === void 0 || (_this$solution = _this$solution.utils) === null || _this$solution === void 0 || (_this$solution$mountF = _this$solution.mountFunction) === null || _this$solution$mountF === void 0 || _this$solution$mountF.call(_this$solution, 'global', 'peripheralsResult', function (strVal) {
33
- try {
34
- var _result = JSON.parse(strVal);
35
- console.log('nativeScannerResult>>>>>>>', _result);
36
- _this.handleScan(_result);
37
- } catch (err) {
38
- console.error(err);
39
- }
40
- });
28
+ // 初始化扫码监听
29
+ this.initPeripheralsListener();
41
30
  }
42
31
 
43
32
  /**
44
- * 处理扫码事件
45
- * @param eventKey 事件key
46
- * @param value 扫码结果
33
+ * 初始化外设扫码结果监听
47
34
  */
48
35
  _createClass(Scan, [{
36
+ key: "initPeripheralsListener",
37
+ value: function initPeripheralsListener() {
38
+ var _this$solution,
39
+ _this$solution$mountF,
40
+ _this = this;
41
+ (_this$solution = this.solution) === null || _this$solution === void 0 || (_this$solution = _this$solution.window) === null || _this$solution === void 0 || (_this$solution = _this$solution.interaction) === null || _this$solution === void 0 || (_this$solution = _this$solution.utils) === null || _this$solution === void 0 || (_this$solution$mountF = _this$solution.mountFunction) === null || _this$solution$mountF === void 0 || _this$solution$mountF.call(_this$solution, 'global', 'peripheralsResult', function (strVal) {
42
+ try {
43
+ var _result = JSON.parse(strVal);
44
+ console.log('nativeScannerResult>>>>>>>', _result);
45
+ _this.handleScan(_result);
46
+ } catch (err) {
47
+ console.error(err);
48
+ }
49
+ });
50
+ }
51
+
52
+ /**
53
+ * 处理扫码事件
54
+ * @param eventKey 事件key
55
+ * @param value 扫码结果
56
+ */
57
+ }, {
49
58
  key: "handleScan",
50
59
  value: function handleScan(result) {
51
60
  var lastEnableEventKey = watch.getLastEnableEventKey(this.watchKey);
@@ -24,7 +24,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
25
25
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
26
  import { ProductList } from "../../modules/";
27
- import { BuyTicketsHooks } from "./types";
28
27
  import { BaseModule } from "../../modules/BaseModule";
29
28
  export * from "./types";
30
29
  export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
@@ -72,7 +71,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
72
71
  return this.loadProductsByIds(this.otherParams.prodctIds);
73
72
  case 11:
74
73
  _context.next = 13;
75
- return this.core.effects.emit(BuyTicketsHooks.onInited, {});
74
+ return this.core.effects.emit("".concat(this.name, ":onInited"), {});
76
75
  case 13:
77
76
  case "end":
78
77
  return _context.stop();
@@ -112,7 +111,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
112
111
  });
113
112
  this.store.mainProducts = mainProducts;
114
113
  _context2.next = 8;
115
- return this.core.effects.emit(BuyTicketsHooks.onMainProductsLoaded, {});
114
+ return this.core.effects.emit("".concat(this.name, ":onMainProductsLoaded"), {});
116
115
  case 8:
117
116
  case "end":
118
117
  return _context2.stop();
@@ -149,7 +148,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
149
148
  while (1) switch (_context4.prev = _context4.next) {
150
149
  case 0:
151
150
  _context4.next = 2;
152
- return this.core.effects.emit(BuyTicketsHooks.onDestroy, {});
151
+ return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
153
152
  case 2:
154
153
  console.log('[BuyTickets] 已销毁');
155
154
  case 3:
@@ -195,7 +194,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
195
194
  case 11:
196
195
  otherData = _context5.t1;
197
196
  _context5.next = 14;
198
- return this.core.effects.emit(BuyTicketsHooks.OnGetProducts, [].concat(_toConsumableArray(mainData), _toConsumableArray(otherData)));
197
+ return this.core.effects.emit("".concat(this.name, ":onGetProducts"), [].concat(_toConsumableArray(mainData), _toConsumableArray(otherData)));
199
198
  case 14:
200
199
  return _context5.abrupt("return", [].concat(_toConsumableArray(mainData), _toConsumableArray(otherData)));
201
200
  case 15:
@@ -259,7 +258,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
259
258
  while (1) switch (_context7.prev = _context7.next) {
260
259
  case 0:
261
260
  _context7.next = 2;
262
- return this.core.effects.emit(BuyTicketsHooks.onListSubmit, _objectSpread(_objectSpread({}, data), {}, {
261
+ return this.core.effects.emit("".concat(this.name, ":onListSubmit"), _objectSpread(_objectSpread({}, data), {}, {
263
262
  products: this.getProducts()
264
263
  }));
265
264
  case 2:
@@ -298,7 +297,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
298
297
  while (1) switch (_context8.prev = _context8.next) {
299
298
  case 0:
300
299
  _context8.next = 2;
301
- return this.core.effects.emit(BuyTicketsHooks.onCartSubmit, _objectSpread(_objectSpread({}, data), {}, {
300
+ return this.core.effects.emit("".concat(this.name, ":onCartSubmit"), _objectSpread(_objectSpread({}, data), {}, {
302
301
  products: this.getProducts()
303
302
  }));
304
303
  case 2:
@@ -320,7 +319,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
320
319
  while (1) switch (_context9.prev = _context9.next) {
321
320
  case 0:
322
321
  _context9.next = 2;
323
- return this.core.effects.emit(BuyTicketsHooks.onCheckoutSubmit, _objectSpread(_objectSpread({}, data), {}, {
322
+ return this.core.effects.emit("".concat(this.name, ":onCheckoutSubmit"), _objectSpread(_objectSpread({}, data), {}, {
324
323
  products: this.getProducts()
325
324
  }));
326
325
  case 2: