@pisell/pisellos 2.0.67 → 2.1.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 (82) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -4
  3. package/dist/effects/index.js +6 -15
  4. package/dist/modules/AccountList/index.d.ts +1 -7
  5. package/dist/modules/AccountList/index.js +14 -81
  6. package/dist/modules/AccountList/types.d.ts +0 -28
  7. package/dist/modules/AccountList/types.js +0 -8
  8. package/dist/modules/ProductList/index.d.ts +2 -12
  9. package/dist/modules/ProductList/index.js +8 -28
  10. package/dist/modules/Rules/index.js +14 -27
  11. package/dist/modules/Rules/types.d.ts +0 -1
  12. package/dist/modules/index.d.ts +0 -1
  13. package/dist/modules/index.js +0 -1
  14. package/dist/plugins/window.d.ts +0 -1
  15. package/dist/solution/BookingByStep/utils/resources.js +12 -4
  16. package/dist/solution/ShopDiscount/index.js +2 -4
  17. package/dist/solution/index.d.ts +0 -1
  18. package/dist/solution/index.js +0 -1
  19. package/dist/types/index.d.ts +1 -3
  20. package/lib/core/index.js +1 -1
  21. package/lib/effects/index.d.ts +3 -4
  22. package/lib/effects/index.js +1 -4
  23. package/lib/modules/AccountList/index.d.ts +1 -7
  24. package/lib/modules/AccountList/index.js +0 -27
  25. package/lib/modules/AccountList/types.d.ts +0 -28
  26. package/lib/modules/ProductList/index.d.ts +2 -12
  27. package/lib/modules/ProductList/index.js +6 -30
  28. package/lib/modules/Rules/index.js +12 -20
  29. package/lib/modules/Rules/types.d.ts +0 -1
  30. package/lib/modules/index.d.ts +0 -1
  31. package/lib/modules/index.js +0 -2
  32. package/lib/plugins/window.d.ts +0 -1
  33. package/lib/solution/BookingByStep/utils/resources.js +12 -4
  34. package/lib/solution/ShopDiscount/index.js +1 -2
  35. package/lib/solution/index.d.ts +0 -1
  36. package/lib/solution/index.js +0 -2
  37. package/lib/types/index.d.ts +1 -3
  38. package/package.json +1 -1
  39. package/dist/modules/Customer/constants.d.ts +0 -7
  40. package/dist/modules/Customer/constants.js +0 -12
  41. package/dist/modules/Customer/index.d.ts +0 -122
  42. package/dist/modules/Customer/index.js +0 -697
  43. package/dist/modules/Customer/types.d.ts +0 -146
  44. package/dist/modules/Customer/types.js +0 -41
  45. package/dist/solution/BookingTicket/index.d.ts +0 -172
  46. package/dist/solution/BookingTicket/index.js +0 -665
  47. package/dist/solution/BookingTicket/types.d.ts +0 -68
  48. package/dist/solution/BookingTicket/types.js +0 -43
  49. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  50. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  51. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  52. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
  53. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  54. package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
  55. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  56. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  57. package/dist/utils/task.d.ts +0 -40
  58. package/dist/utils/task.js +0 -171
  59. package/dist/utils/watch.d.ts +0 -102
  60. package/dist/utils/watch.js +0 -294
  61. package/lib/modules/Customer/constants.d.ts +0 -7
  62. package/lib/modules/Customer/constants.js +0 -39
  63. package/lib/modules/Customer/index.d.ts +0 -122
  64. package/lib/modules/Customer/index.js +0 -440
  65. package/lib/modules/Customer/types.d.ts +0 -146
  66. package/lib/modules/Customer/types.js +0 -37
  67. package/lib/solution/BookingTicket/index.d.ts +0 -172
  68. package/lib/solution/BookingTicket/index.js +0 -399
  69. package/lib/solution/BookingTicket/types.d.ts +0 -68
  70. package/lib/solution/BookingTicket/types.js +0 -72
  71. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  72. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  73. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  74. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
  75. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  76. package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
  77. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  78. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  79. package/lib/utils/task.d.ts +0 -40
  80. package/lib/utils/task.js +0 -109
  81. package/lib/utils/watch.d.ts +0 -102
  82. package/lib/utils/watch.js +0 -217
@@ -67,8 +67,7 @@ var PisellOSCore = /*#__PURE__*/function () {
67
67
  console.log("".concat(prefix, " ").concat(message));
68
68
  break;
69
69
  case 'warn':
70
- // 使用 console.log 避免显示堆栈跟踪,提升性能
71
- console.log("%c".concat(prefix, "%c ").concat(message), 'color: #f59e0b; font-weight: bold;', 'color: #f59e0b;');
70
+ console.warn("".concat(prefix, " ").concat(message));
72
71
  break;
73
72
  case 'error':
74
73
  console.error("".concat(prefix, " ").concat(message));
@@ -2,17 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
2
2
  status: boolean;
3
3
  message?: string;
4
4
  }>;
5
- type UnsubscribeFunction = () => void;
6
5
  declare class EffectsManager {
7
6
  private listeners;
8
- on(event: string, callback: EffectCallback): UnsubscribeFunction;
7
+ on(event: string, callback: EffectCallback): void;
9
8
  off(event: string, callback: EffectCallback): void;
10
9
  offByModuleDestroy(module: string): void;
11
- once(event: string, callback: EffectCallback): UnsubscribeFunction;
10
+ once(event: string, callback: EffectCallback): void;
12
11
  emit(event: string, payload: any): Promise<{
13
12
  status: boolean;
14
13
  data: any;
15
14
  }>;
16
15
  clear(): void;
17
16
  }
18
- export { EffectsManager, UnsubscribeFunction };
17
+ export { EffectsManager };
@@ -11,7 +11,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
11
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
13
  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); }
14
- // 取消监听函数类型
15
14
  var EffectsManager = /*#__PURE__*/function () {
16
15
  function EffectsManager() {
17
16
  _classCallCheck(this, EffectsManager);
@@ -20,15 +19,9 @@ var EffectsManager = /*#__PURE__*/function () {
20
19
  _createClass(EffectsManager, [{
21
20
  key: "on",
22
21
  value: function on(event, callback) {
23
- var _this$listeners$get,
24
- _this = this;
22
+ var _this$listeners$get;
25
23
  if (!this.listeners.has(event)) this.listeners.set(event, new Set());
26
24
  (_this$listeners$get = this.listeners.get(event)) === null || _this$listeners$get === void 0 || _this$listeners$get.add(callback);
27
-
28
- // 返回取消函数
29
- return function () {
30
- _this.off(event, callback);
31
- };
32
25
  }
33
26
  }, {
34
27
  key: "off",
@@ -41,17 +34,17 @@ var EffectsManager = /*#__PURE__*/function () {
41
34
  }, {
42
35
  key: "offByModuleDestroy",
43
36
  value: function offByModuleDestroy(module) {
44
- var _this2 = this;
37
+ var _this = this;
45
38
  Array.from(this.listeners.keys()).forEach(function (item) {
46
39
  if (item.startsWith(module)) {
47
- _this2.listeners.delete(item);
40
+ _this.listeners.delete(item);
48
41
  }
49
42
  });
50
43
  }
51
44
  }, {
52
45
  key: "once",
53
46
  value: function once(event, callback) {
54
- var _this3 = this;
47
+ var _this2 = this;
55
48
  var wrapper = /*#__PURE__*/function () {
56
49
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
57
50
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -60,7 +53,7 @@ var EffectsManager = /*#__PURE__*/function () {
60
53
  _context.next = 2;
61
54
  return callback(payload);
62
55
  case 2:
63
- _this3.off(event, wrapper);
56
+ _this2.off(event, wrapper);
64
57
  case 3:
65
58
  case "end":
66
59
  return _context.stop();
@@ -71,9 +64,7 @@ var EffectsManager = /*#__PURE__*/function () {
71
64
  return _ref.apply(this, arguments);
72
65
  };
73
66
  }();
74
-
75
- // 调用修改后的on方法,它会返回取消函数
76
- return this.on(event, wrapper);
67
+ this.on(event, wrapper);
77
68
  }
78
69
  }, {
79
70
  key: "emit",
@@ -1,7 +1,7 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { AccountModule, Account } from '../Account';
3
3
  import { BaseModule } from '../BaseModule';
4
- import { IFetchHolderAccountsParams, IHolder, IGetCustomerListParams } from './types';
4
+ import { IFetchHolderAccountsParams, IHolder } from './types';
5
5
  export declare class AccountListModule extends BaseModule implements Module {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
37
37
  customerId: number;
38
38
  type?: 'unshift' | 'push';
39
39
  }): Promise<AccountModule[]>;
40
- /**
41
- * 获取客户列表
42
- * @param params 查询参数
43
- * @returns 客户列表
44
- */
45
- getCustomerList(params?: IGetCustomerListParams): Promise<any>;
46
40
  /**
47
41
  * 获取holder类型账户列表
48
42
  * @param params
@@ -1,9 +1,4 @@
1
- var _excluded = ["page", "pageSize", "keyword"];
2
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -509,68 +504,6 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
509
504
  }
510
505
  return addHolderAccounts;
511
506
  }()
512
- /**
513
- * 获取客户列表
514
- * @param params 查询参数
515
- * @returns 客户列表
516
- */
517
- )
518
- }, {
519
- key: "getCustomerList",
520
- value: (function () {
521
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
522
- var params,
523
- url,
524
- _params$page,
525
- page,
526
- _params$pageSize,
527
- pageSize,
528
- keyword,
529
- otherParams,
530
- queryParams,
531
- res,
532
- _args9 = arguments;
533
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
534
- while (1) switch (_context9.prev = _context9.next) {
535
- case 0:
536
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
537
- url = '/customer/es/data';
538
- _params$page = params.page, page = _params$page === void 0 ? 1 : _params$page, _params$pageSize = params.pageSize, pageSize = _params$pageSize === void 0 ? 20 : _params$pageSize, keyword = params.keyword, otherParams = _objectWithoutProperties(params, _excluded);
539
- _context9.prev = 3;
540
- this.store.isLoading = true;
541
- this.store.error = null;
542
- queryParams = _objectSpread(_objectSpread({
543
- page: page,
544
- pageSize: pageSize
545
- }, keyword && {
546
- keyword: keyword
547
- }), otherParams);
548
- _context9.next = 9;
549
- return this.request.get(url, queryParams);
550
- case 9:
551
- res = _context9.sent;
552
- return _context9.abrupt("return", (res === null || res === void 0 ? void 0 : res.data) || []);
553
- case 13:
554
- _context9.prev = 13;
555
- _context9.t0 = _context9["catch"](3);
556
- console.error('Failed to fetch customer list:', _context9.t0);
557
- this.store.error = _context9.t0 instanceof Error ? _context9.t0.message : 'Failed to fetch customer list';
558
- throw _context9.t0;
559
- case 18:
560
- _context9.prev = 18;
561
- this.store.isLoading = false;
562
- return _context9.finish(18);
563
- case 21:
564
- case "end":
565
- return _context9.stop();
566
- }
567
- }, _callee9, this, [[3, 13, 18, 21]]);
568
- }));
569
- function getCustomerList() {
570
- return _getCustomerList.apply(this, arguments);
571
- }
572
- return getCustomerList;
573
- }()
574
507
  /**
575
508
  * 获取holder类型账户列表
576
509
  * @param params
@@ -579,15 +512,15 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
579
512
  }, {
580
513
  key: "fetchHolderAccounts",
581
514
  value: (function () {
582
- var _fetchHolderAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
515
+ var _fetchHolderAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
583
516
  var url, _ref, form_id, shop_id, num, skip, customer_id, _res$data, res;
584
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
585
- while (1) switch (_context10.prev = _context10.next) {
517
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
518
+ while (1) switch (_context9.prev = _context9.next) {
586
519
  case 0:
587
520
  url = params.url || '/account/holder';
588
521
  _ref = (params === null || params === void 0 ? void 0 : params.query) || {}, form_id = _ref.form_id, shop_id = _ref.shop_id, num = _ref.num, skip = _ref.skip, customer_id = _ref.customer_id;
589
- _context10.prev = 2;
590
- _context10.next = 5;
522
+ _context9.prev = 2;
523
+ _context9.next = 5;
591
524
  return this.request.get(url, {
592
525
  customer_id: customer_id,
593
526
  form_id: form_id,
@@ -596,30 +529,30 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
596
529
  skip: skip || 1
597
530
  });
598
531
  case 5:
599
- res = _context10.sent;
532
+ res = _context9.sent;
600
533
  this.store.accountList = [];
601
534
  this.store.accounts = [];
602
535
  if (!(res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && (_res$data = _res$data.list) !== null && _res$data !== void 0 && _res$data.length)) {
603
- _context10.next = 11;
536
+ _context9.next = 11;
604
537
  break;
605
538
  }
606
- _context10.next = 11;
539
+ _context9.next = 11;
607
540
  return this.addHolderAccounts({
608
541
  holders: res.data.list,
609
542
  customerId: customer_id
610
543
  });
611
544
  case 11:
612
- _context10.next = 16;
545
+ _context9.next = 16;
613
546
  break;
614
547
  case 13:
615
- _context10.prev = 13;
616
- _context10.t0 = _context10["catch"](2);
617
- console.error(_context10.t0);
548
+ _context9.prev = 13;
549
+ _context9.t0 = _context9["catch"](2);
550
+ console.error(_context9.t0);
618
551
  case 16:
619
552
  case "end":
620
- return _context10.stop();
553
+ return _context9.stop();
621
554
  }
622
- }, _callee10, this, [[2, 13]]);
555
+ }, _callee9, this, [[2, 13]]);
623
556
  }));
624
557
  function fetchHolderAccounts(_x11) {
625
558
  return _fetchHolderAccounts.apply(this, arguments);
@@ -67,31 +67,3 @@ export interface IHolder {
67
67
  main_field: string;
68
68
  customer_cover?: string;
69
69
  }
70
- /**
71
- * 获取客户列表参数
72
- */
73
- export interface IGetCustomerListParams {
74
- /** 页码 */
75
- page?: number;
76
- /** 每页数量 */
77
- pageSize?: number;
78
- /** 搜索关键词 */
79
- keyword?: string;
80
- /** 其他筛选参数 */
81
- [key: string]: any;
82
- }
83
- /**
84
- * 客户数据
85
- */
86
- export interface ICustomer {
87
- /** 客户ID */
88
- id: string | number;
89
- /** 客户姓名 */
90
- name: string;
91
- /** 客户电话 */
92
- phone?: string;
93
- /** 客户邮箱 */
94
- email?: string;
95
- /** 其他客户信息 */
96
- [key: string]: any;
97
- }
@@ -22,12 +22,4 @@ export var AccountListHooks = /*#__PURE__*/function (AccountListHooks) {
22
22
 
23
23
  /**
24
24
  * holder类型数据
25
- */
26
-
27
- /**
28
- * 获取客户列表参数
29
- */
30
-
31
- /**
32
- * 客户数据
33
25
  */
@@ -8,20 +8,16 @@ export declare class ProductList extends BaseModule implements Module {
8
8
  protected defaultVersion: string;
9
9
  private store;
10
10
  private request;
11
+ private otherParams;
11
12
  constructor(name?: string, version?: string);
12
13
  initialize(core: PisellCore, options: any): Promise<void>;
13
14
  storeChange(path?: string, value?: any): Promise<void>;
14
- loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
15
+ loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
15
16
  category_ids?: number[];
16
17
  product_ids?: number[];
17
18
  collection?: number | string[];
18
19
  schedule_date?: string;
19
20
  cacheId?: string;
20
- customer_id?: number;
21
- menu_list_ids?: number[];
22
- schedule_datetime?: string;
23
- with_count?: string[];
24
- with_schedule?: number;
25
21
  }): Promise<any>;
26
22
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
27
23
  ids?: number[];
@@ -33,10 +29,4 @@ export declare class ProductList extends BaseModule implements Module {
33
29
  getProduct(id: number): Promise<Product | undefined>;
34
30
  addProduct(products: ProductData[]): Promise<void>;
35
31
  selectProducts(products: ProductData[]): Promise<void>;
36
- /**
37
- * 根据商品编码或条码搜索商品
38
- * @param code 商品编码或条码
39
- * @returns 匹配的商品列表,如果没有匹配则返回空数组
40
- */
41
- findProductsByCodeOrBarcode(code: string): ProductData[];
42
32
  }
@@ -31,6 +31,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
31
31
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
32
32
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
33
33
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
34
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
34
35
  return _this;
35
36
  }
36
37
  _createClass(ProductList, [{
@@ -43,6 +44,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
43
44
  case 0:
44
45
  this.core = core;
45
46
  this.store = options.store;
47
+ this.otherParams = options.otherParams || {};
46
48
  if (Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.list)) {
47
49
  this.store.list = options.initialState.list;
48
50
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
@@ -53,7 +55,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
53
55
  this.store.selectProducts = [];
54
56
  }
55
57
  this.request = core.getPlugin('request');
56
- case 4:
58
+ case 5:
57
59
  case "end":
58
60
  return _context.stop();
59
61
  }
@@ -100,11 +102,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
100
102
  key: "loadProducts",
101
103
  value: function () {
102
104
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
103
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData;
105
+ var _this$otherParams;
106
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, cacheId, userPlugin, customer_id, _userPlugin$get, productsData;
104
107
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
105
108
  while (1) switch (_context3.prev = _context3.next) {
106
109
  case 0:
107
- _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule;
110
+ _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId;
108
111
  // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
109
112
  // if (!schedule_ids?.length) {
110
113
  // const schedule_ids_data = this.store.schedule
@@ -120,7 +123,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
120
123
  userPlugin = this.core.getPlugin('user');
121
124
  customer_id = undefined;
122
125
  try {
123
- customer_id = paramsCustomerId || (userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
126
+ customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id;
124
127
  } catch (error) {
125
128
  console.error(error);
126
129
  }
@@ -139,12 +142,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
139
142
  ids: product_ids,
140
143
  collection: collection,
141
144
  front_end_cache_id: cacheId,
142
- menu_list_ids: menu_list_ids,
143
- with_count: with_count,
144
145
  // client_schedule_ids: schedule_ids,
145
146
  schedule_date: schedule_date,
146
- with_schedule: with_schedule,
147
- schedule_datetime: schedule_datetime
147
+ application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel
148
148
  }, {
149
149
  useCache: true
150
150
  });
@@ -301,26 +301,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
301
301
  }
302
302
  return selectProducts;
303
303
  }()
304
- /**
305
- * 根据商品编码或条码搜索商品
306
- * @param code 商品编码或条码
307
- * @returns 匹配的商品列表,如果没有匹配则返回空数组
308
- */
309
- }, {
310
- key: "findProductsByCodeOrBarcode",
311
- value: function findProductsByCodeOrBarcode(code) {
312
- if (!code || typeof code !== 'string') {
313
- return [];
314
- }
315
- var trimmedCode = code.trim();
316
- if (!trimmedCode) {
317
- return [];
318
- }
319
- var matchingProducts = this.store.list.filter(function (product) {
320
- return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
321
- });
322
- return cloneDeep(matchingProducts);
323
- }
324
304
  }]);
325
305
  return ProductList;
326
306
  }(BaseModule);
@@ -28,7 +28,6 @@ import { RulesHooks } from "./types";
28
28
  import { uniqueById } from "../../solution/ShopDiscount/utils";
29
29
  import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
30
30
  import Decimal from 'decimal.js';
31
- import { isBoolean } from 'lodash-es';
32
31
  export var RulesModule = /*#__PURE__*/function (_BaseModule) {
33
32
  _inherits(RulesModule, _BaseModule);
34
33
  var _super = _createSuper(RulesModule);
@@ -297,25 +296,19 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
297
296
 
298
297
  // 记录可抵扣的商品详情
299
298
  var applicableProducts = discountApplicableProducts.get(discount.id) || [];
300
- var discountType = discount.tag || discount.type;
301
- var productData = {
299
+ applicableProducts.push({
302
300
  amount: product.price,
303
- type: discountType,
304
- tag: discountType,
301
+ type: discount.tag || discount.type,
302
+ tag: discount.tag || discount.type,
305
303
  discount: {
306
304
  resource_id: discount.id,
307
305
  title: discount.format_title,
308
306
  original_amount: product.origin_total,
309
307
  pre_value: discount.par_value,
310
308
  product_id: originProduct.id
311
- }
312
- };
313
-
314
- // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
315
- if (discountType !== 'good_pass') {
316
- productData.num = product.num || 1;
317
- }
318
- applicableProducts.push(productData);
309
+ },
310
+ num: product.num || 1
311
+ });
319
312
  discountApplicableProducts.set(discount.id, applicableProducts);
320
313
  }
321
314
  });
@@ -337,10 +330,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
337
330
  var applicableDiscounts = sortedDiscountList.filter(function (discount) {
338
331
  var _product$discount_lis6;
339
332
  // 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
340
- // 商品券时主商品价格小于等于0不可用
341
- if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
342
- // 折扣卡时总价小于等于0时不可用
343
- if ((Number(product.total) <= 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
333
+ // 商品券时主商品价格为0不可用
334
+ if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
335
+ // 折扣卡时总价为0时不可用
336
+ if ((Number(product.total) === 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
344
337
  var _n$discount;
345
338
  return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
346
339
  })) && (discount.tag || discount.type) !== 'good_pass') return false;
@@ -380,8 +373,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
380
373
  }
381
374
 
382
375
  // 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
383
- // 自定义商品:如果未开启适用折扣卡(product.vouchersApplicable),则不适用优惠券
384
- if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
376
+ if (applicableDiscounts.length === 0 || isManualDiscount) {
385
377
  if (product.isClient) {
386
378
  processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
387
379
  origin_total: getProductOriginTotalPrice({
@@ -457,23 +449,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
457
449
 
458
450
  // 计算使用折扣卡/商品券以后,单个商品的总 total
459
451
  var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(productOriginTotal).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(productOriginTotal)).toNumber();
460
- var discountType = _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag;
461
452
  var discountDetail = {
462
453
  amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
463
- type: discountType,
454
+ type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
464
455
  discount: {
465
456
  resource_id: _selectedDiscount.id,
466
457
  title: _selectedDiscount.format_title,
467
458
  original_amount: productOriginTotal,
468
459
  product_id: originProduct.id,
469
460
  percent: _selectedDiscount.par_value
470
- }
461
+ },
462
+ num: product.num || 1
471
463
  };
472
-
473
- // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
474
- if ((_selectedDiscount.tag || _selectedDiscount.type) !== 'good_pass') {
475
- discountDetail.num = product.num || 1;
476
- }
477
464
  appliedProducts.push(discountDetail);
478
465
  appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
479
466
 
@@ -39,7 +39,6 @@ type ProductDetail = {
39
39
  original_price?: number | string;
40
40
  num?: number;
41
41
  quantity: number;
42
- vouchersApplicable?: boolean;
43
42
  };
44
43
  export interface RulesParamsHooks {
45
44
  getProduct: (product: Record<string, any>) => ProductDetail;
@@ -3,7 +3,6 @@ export * from './ProductList';
3
3
  export * from './Cart';
4
4
  export * from './Account';
5
5
  export * from './AccountList';
6
- export * from './Customer';
7
6
  export * from './Date';
8
7
  export * from './Guests';
9
8
  export * from './Order';
@@ -3,7 +3,6 @@ export * from "./ProductList";
3
3
  export * from "./Cart";
4
4
  export * from "./Account";
5
5
  export * from "./AccountList";
6
- export * from "./Customer";
7
6
  export * from "./Date";
8
7
  export * from "./Guests";
9
8
  export * from "./Order";
@@ -13,7 +13,6 @@ export interface WindowPlugin extends Plugin {
13
13
  navigator: Partial<Navigator>;
14
14
  document: Partial<Document>;
15
15
  history: History;
16
- interaction?: any;
17
16
  }
18
17
  /**
19
18
  * 简单的 Storage 接口实现
@@ -281,7 +281,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
281
281
  onlyComputed: true,
282
282
  // 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
283
283
  metadata: _objectSpread(_objectSpread({}, resourcesMap[id].metadata), {}, {
284
- combined_resource: resourcesMap[id].combined_resource
284
+ combined_resource: resourcesMap[id].combined_resource,
285
+ form_name: item.title,
286
+ resource_name: resourcesMap[id].main_field
285
287
  })
286
288
  }));
287
289
  }
@@ -292,7 +294,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
292
294
  resourceType: item.type,
293
295
  children: combiningResources,
294
296
  metadata: _objectSpread(_objectSpread({}, resourcesMap[d].metadata), {}, {
295
- combined_resource: resourcesMap[d].combined_resource
297
+ combined_resource: resourcesMap[d].combined_resource,
298
+ form_name: item.title,
299
+ resource_name: resourcesMap[d].main_field
296
300
  })
297
301
  }));
298
302
  }
@@ -315,7 +319,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
315
319
  onlyComputed: true,
316
320
  // 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
317
321
  metadata: _objectSpread(_objectSpread({}, resourcesMap[id].metadata), {}, {
318
- combined_resource: resourcesMap[id].combined_resource
322
+ combined_resource: resourcesMap[id].combined_resource,
323
+ form_name: item.title,
324
+ resource_name: resourcesMap[id].main_field
319
325
  })
320
326
  }));
321
327
  }
@@ -327,7 +333,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
327
333
  is_default: 1,
328
334
  children: combiningResources,
329
335
  metadata: _objectSpread(_objectSpread({}, resourcesMap[d].metadata), {}, {
330
- combined_resource: resourcesMap[d].combined_resource
336
+ combined_resource: resourcesMap[d].combined_resource,
337
+ form_name: item.title,
338
+ resource_name: resourcesMap[d].main_field
331
339
  })
332
340
  }));
333
341
  }
@@ -29,7 +29,6 @@ import { ShopDiscountHooks } from "./types";
29
29
  import { DiscountModule } from "../../modules/Discount";
30
30
  import { RulesModule } from "../../modules/Rules";
31
31
  import Decimal from 'decimal.js';
32
- import { isBoolean } from 'lodash-es';
33
32
  export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
34
33
  _inherits(ShopDiscountImpl, _BaseModule);
35
34
  var _super = _createSuper(ShopDiscountImpl);
@@ -496,9 +495,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
496
495
  return n.id === id;
497
496
  });
498
497
  var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
499
- // 如果 product.total 是小于等于0有可能是她已经用过商品券或者折扣卡导致的,或者本身就是负数价格,所以此时还需要判断 origin_total 是否小于等于0
500
- // 如果 product.vouchersApplicable是布尔值,并且是 false,也当做免费商品处理,此商品不可用优惠券或折扣卡
501
- return Number(product === null || product === void 0 ? void 0 : product.total) <= 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) <= 0 || !(product !== null && product !== void 0 && product.origin_total)) || isBoolean(product === null || product === void 0 ? void 0 : product.vouchersApplicable) && !(product !== null && product !== void 0 && product.vouchersApplicable);
498
+ // 如果 product.total 0有可能是她已经用过商品券或者折扣卡导致的 0,所以此时还需要判断 origin_total 是否为 0
499
+ return Number(product === null || product === void 0 ? void 0 : product.total) === 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) === 0 || !(product !== null && product !== void 0 && product.origin_total));
502
500
  };
503
501
  var allUsedProductIds = newDiscountList.map(function (n) {
504
502
  var _n$appliedProductDeta;
@@ -1,4 +1,3 @@
1
1
  export * from './BuyTickets';
2
2
  export * from './BookingByStep';
3
- export * from './BookingTicket';
4
3
  export * from './ShopDiscount';
@@ -1,4 +1,3 @@
1
1
  export * from "./BuyTickets";
2
2
  export * from "./BookingByStep";
3
- export * from "./BookingTicket";
4
3
  export * from "./ShopDiscount";
@@ -38,9 +38,7 @@ export interface PisellCore {
38
38
  getModuleExports: <T = any>(name: string) => T | null;
39
39
  hasModule: (name: string) => boolean;
40
40
  effects: {
41
- on: (event: string, callback: (payload: any) => void) => () => void;
42
- once: (event: string, callback: (payload: any) => void) => () => void;
43
- off: (event: string, callback: (payload: any) => void) => void;
41
+ on: (event: string, callback: (payload: any) => void) => void;
44
42
  emit: (event: string, payload: any, value?: any) => Promise<{
45
43
  status: boolean;
46
44
  data: any;