@pisell/pisellos 2.0.4 → 2.0.6

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 (145) hide show
  1. package/dist/modules/Account/index.d.ts +2 -6
  2. package/dist/modules/Account/index.js +21 -103
  3. package/dist/modules/Account/types.d.ts +12 -1
  4. package/dist/modules/AccountList/index.d.ts +20 -1
  5. package/dist/modules/AccountList/index.js +243 -75
  6. package/dist/modules/AccountList/types.d.ts +33 -1
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/AccountList/utils.d.ts +9 -0
  9. package/dist/modules/AccountList/utils.js +25 -0
  10. package/dist/modules/BaseModule.d.ts +2 -2
  11. package/dist/modules/BaseModule.js +1 -1
  12. package/dist/modules/Cart/index.d.ts +8 -5
  13. package/dist/modules/Cart/index.js +101 -25
  14. package/dist/modules/Cart/types.d.ts +82 -5
  15. package/dist/modules/Cart/types.js +22 -0
  16. package/dist/modules/Cart/utils.d.ts +111 -12
  17. package/dist/modules/Cart/utils.js +286 -73
  18. package/dist/modules/Date/index.d.ts +6 -6
  19. package/dist/modules/Date/index.js +41 -58
  20. package/dist/modules/Date/types.d.ts +22 -6
  21. package/dist/modules/Date/utils.d.ts +4 -3
  22. package/dist/modules/Date/utils.js +81 -30
  23. package/dist/modules/Discount/index.d.ts +4 -4
  24. package/dist/modules/Discount/index.js +11 -11
  25. package/dist/modules/Order/index.d.ts +11 -5
  26. package/dist/modules/Order/index.js +47 -18
  27. package/dist/modules/Order/types.d.ts +10 -3
  28. package/dist/modules/Order/utils.d.ts +10 -0
  29. package/dist/modules/Order/utils.js +15 -0
  30. package/dist/modules/Product/index.d.ts +14 -1
  31. package/dist/modules/Product/index.js +35 -0
  32. package/dist/modules/Product/types.d.ts +27 -3
  33. package/dist/modules/ProductList/index.js +11 -5
  34. package/dist/modules/Resource/types.d.ts +1 -0
  35. package/dist/modules/Resource/utils.js +1 -1
  36. package/dist/modules/Rules/index.d.ts +2 -2
  37. package/dist/modules/Rules/index.js +11 -11
  38. package/dist/modules/Rules/types.d.ts +1 -1
  39. package/dist/modules/Schedule/index.d.ts +18 -0
  40. package/dist/modules/Schedule/index.js +111 -0
  41. package/dist/modules/Schedule/type.d.ts +157 -0
  42. package/dist/modules/Schedule/type.js +1 -0
  43. package/dist/modules/Schedule/types.d.ts +182 -0
  44. package/dist/modules/Schedule/types.js +1 -0
  45. package/dist/modules/Schedule/utils.d.ts +67 -0
  46. package/dist/modules/Schedule/utils.js +729 -0
  47. package/dist/modules/Step/index.d.ts +14 -3
  48. package/dist/modules/Step/index.js +54 -2
  49. package/dist/modules/Summary/index.d.ts +12 -5
  50. package/dist/modules/Summary/index.js +33 -7
  51. package/dist/modules/Summary/types.d.ts +23 -2
  52. package/dist/modules/Summary/utils.d.ts +14 -4
  53. package/dist/modules/Summary/utils.js +46 -4
  54. package/dist/modules/index.d.ts +10 -0
  55. package/dist/modules/index.js +11 -1
  56. package/dist/plugins/index.d.ts +3 -3
  57. package/dist/plugins/request.d.ts +3 -3
  58. package/dist/plugins/request.js +30 -30
  59. package/dist/plugins/shopStore.d.ts +1 -1
  60. package/dist/solution/BookingByStep/index.d.ts +97 -24
  61. package/dist/solution/BookingByStep/index.js +1015 -322
  62. package/dist/solution/BookingByStep/types.d.ts +3 -10
  63. package/dist/solution/BookingByStep/types.js +11 -15
  64. package/dist/solution/BookingByStep/utils/products.d.ts +1 -1
  65. package/dist/solution/BookingByStep/utils/products.js +3 -0
  66. package/dist/solution/BookingByStep/utils/resources.d.ts +60 -6
  67. package/dist/solution/BookingByStep/utils/resources.js +293 -52
  68. package/dist/solution/ShopDiscount/index.d.ts +4 -4
  69. package/dist/solution/ShopDiscount/index.js +16 -16
  70. package/dist/solution/ShopDiscount/types.d.ts +2 -2
  71. package/dist/solution/ShopDiscount/utils.js +1 -1
  72. package/lib/core/index.js +7 -2
  73. package/lib/modules/Account/index.d.ts +2 -6
  74. package/lib/modules/Account/index.js +15 -30
  75. package/lib/modules/Account/types.d.ts +12 -1
  76. package/lib/modules/AccountList/index.d.ts +20 -1
  77. package/lib/modules/AccountList/index.js +122 -13
  78. package/lib/modules/AccountList/types.d.ts +33 -1
  79. package/lib/modules/AccountList/utils.d.ts +9 -0
  80. package/lib/modules/AccountList/utils.js +39 -0
  81. package/lib/modules/BaseModule.d.ts +2 -2
  82. package/lib/modules/BaseModule.js +14 -3
  83. package/lib/modules/Cart/index.d.ts +8 -5
  84. package/lib/modules/Cart/index.js +81 -8
  85. package/lib/modules/Cart/types.d.ts +82 -5
  86. package/lib/modules/Cart/types.js +20 -2
  87. package/lib/modules/Cart/utils.d.ts +111 -12
  88. package/lib/modules/Cart/utils.js +186 -43
  89. package/lib/modules/Date/index.d.ts +6 -6
  90. package/lib/modules/Date/index.js +13 -28
  91. package/lib/modules/Date/types.d.ts +22 -6
  92. package/lib/modules/Date/utils.d.ts +4 -3
  93. package/lib/modules/Date/utils.js +47 -13
  94. package/lib/modules/Discount/index.d.ts +4 -4
  95. package/lib/modules/Discount/index.js +9 -2
  96. package/lib/modules/Guests/index.js +4 -1
  97. package/lib/modules/Order/index.d.ts +11 -5
  98. package/lib/modules/Order/index.js +24 -3
  99. package/lib/modules/Order/types.d.ts +10 -3
  100. package/lib/modules/Order/utils.d.ts +10 -0
  101. package/lib/modules/Order/utils.js +45 -0
  102. package/lib/modules/Payment/index.js +1 -6
  103. package/lib/modules/Product/index.d.ts +14 -1
  104. package/lib/modules/Product/index.js +19 -0
  105. package/lib/modules/Product/types.d.ts +27 -3
  106. package/lib/modules/ProductList/index.js +21 -7
  107. package/lib/modules/Resource/index.js +4 -1
  108. package/lib/modules/Resource/types.d.ts +1 -0
  109. package/lib/modules/Resource/utils.js +7 -4
  110. package/lib/modules/Rules/index.d.ts +2 -2
  111. package/lib/modules/Rules/types.d.ts +1 -1
  112. package/lib/modules/Schedule/index.d.ts +18 -0
  113. package/lib/modules/Schedule/index.js +81 -0
  114. package/lib/modules/Schedule/type.d.ts +157 -0
  115. package/lib/modules/Schedule/type.js +17 -0
  116. package/lib/modules/Schedule/types.d.ts +182 -0
  117. package/lib/modules/Schedule/types.js +17 -0
  118. package/lib/modules/Schedule/utils.d.ts +67 -0
  119. package/lib/modules/Schedule/utils.js +600 -0
  120. package/lib/modules/Step/index.d.ts +14 -3
  121. package/lib/modules/Step/index.js +38 -1
  122. package/lib/modules/Summary/index.d.ts +12 -5
  123. package/lib/modules/Summary/index.js +15 -1
  124. package/lib/modules/Summary/types.d.ts +23 -2
  125. package/lib/modules/Summary/utils.d.ts +14 -4
  126. package/lib/modules/Summary/utils.js +30 -1
  127. package/lib/modules/index.d.ts +10 -0
  128. package/lib/modules/index.js +21 -1
  129. package/lib/plugins/index.d.ts +3 -3
  130. package/lib/plugins/request.d.ts +3 -3
  131. package/lib/plugins/request.js +48 -11
  132. package/lib/plugins/shopStore.d.ts +1 -1
  133. package/lib/solution/BookingByStep/index.d.ts +97 -24
  134. package/lib/solution/BookingByStep/index.js +684 -145
  135. package/lib/solution/BookingByStep/types.d.ts +3 -10
  136. package/lib/solution/BookingByStep/types.js +37 -14
  137. package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
  138. package/lib/solution/BookingByStep/utils/products.js +3 -0
  139. package/lib/solution/BookingByStep/utils/resources.d.ts +60 -6
  140. package/lib/solution/BookingByStep/utils/resources.js +286 -54
  141. package/lib/solution/BuyTickets/index.js +34 -20
  142. package/lib/solution/ShopDiscount/index.d.ts +4 -4
  143. package/lib/solution/ShopDiscount/index.js +10 -2
  144. package/lib/solution/ShopDiscount/types.d.ts +2 -2
  145. package/package.json +4 -2
@@ -16,6 +16,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
17
  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); }
18
18
  import { BaseModule } from "../BaseModule";
19
+ import { generateDuration } from "./utils";
19
20
  export var OrderModule = /*#__PURE__*/function (_BaseModule) {
20
21
  _inherits(OrderModule, _BaseModule);
21
22
  var _super = _createSuper(OrderModule);
@@ -23,8 +24,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
23
24
  var _this;
24
25
  _classCallCheck(this, OrderModule);
25
26
  _this = _super.call(this, name, version);
26
- _defineProperty(_assertThisInitialized(_this), "defaultName", "order");
27
- _defineProperty(_assertThisInitialized(_this), "defaultVersion", "1.0.0");
27
+ _defineProperty(_assertThisInitialized(_this), "defaultName", 'order');
28
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
28
29
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
29
30
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
30
31
  return _this;
@@ -38,7 +39,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
38
39
  case 0:
39
40
  this.core = core;
40
41
  this.store = options.store;
41
- this.request = this.core.getPlugin("request");
42
+ this.request = this.core.getPlugin('request');
42
43
  case 3:
43
44
  case "end":
44
45
  return _context.stop();
@@ -54,46 +55,74 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
54
55
  key: "createOrder",
55
56
  value: function createOrder(params) {
56
57
  var order = {
57
- type: "appointment_booking",
58
- platform: "H5",
59
- sales_channel: "my_pisel",
60
- order_sales_channel: "online_store",
58
+ type: 'appointment_booking',
59
+ platform: 'H5',
60
+ sales_channel: 'my_pisel',
61
+ order_sales_channel: 'online_store',
61
62
  bookings: [],
62
- shop_note: "",
63
- schedule_date: ""
63
+ shop_note: '',
64
+ schedule_date: '',
65
+ is_deposit: 0
64
66
  };
67
+ var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
65
68
  if (params.cartItems.length > 0) {
66
69
  params.cartItems.forEach(function (item) {
70
+ if (!item._origin.duration) {
71
+ var _generateDuration = generateDuration(item),
72
+ duration = _generateDuration.duration,
73
+ durationType = _generateDuration.durationType;
74
+ item._origin.duration = duration;
75
+ item._origin.sub_type = durationType;
76
+ }
67
77
  order.bookings.push(item._origin);
78
+ if (item !== null && item !== void 0 && item.deposit) {
79
+ is_deposit = 1;
80
+ }
68
81
  });
69
82
  var firstCartItem = params.cartItems[0];
70
- order.schedule_date = firstCartItem.start_date + " " + firstCartItem.start_time + ":00";
83
+ order.schedule_date = firstCartItem.start_date + ' ' + firstCartItem.start_time + ':00';
84
+ order.is_deposit = is_deposit;
71
85
  }
72
86
  return order;
73
87
  }
74
88
  }, {
75
- key: "commitOrder",
89
+ key: "checkBeforeSubmitOrder",
90
+ value: function checkBeforeSubmitOrder(params) {
91
+ var cartItems = params.cartItems,
92
+ type = params.type;
93
+ if (type === 'holder') {
94
+ // 判断cartItems中是否有不存在holder_id的商品,如果有则返回false
95
+ var hasNoHolderId = cartItems.some(function (item) {
96
+ return !item.holder_id;
97
+ });
98
+ if (hasNoHolderId) {
99
+ return false;
100
+ }
101
+ }
102
+ return true;
103
+ }
104
+ }, {
105
+ key: "submitOrder",
76
106
  value: function () {
77
- var _commitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(order) {
107
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(order) {
78
108
  var url, query, fetchUrl, params;
79
109
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
80
110
  while (1) switch (_context2.prev = _context2.next) {
81
111
  case 0:
82
112
  url = order.url, query = order.query;
83
- fetchUrl = url || "/order/appointment";
113
+ fetchUrl = url || '/order/appointment';
84
114
  params = this.createOrder(query);
85
- console.log(params);
86
115
  return _context2.abrupt("return", this.request.post(fetchUrl, params));
87
- case 5:
116
+ case 4:
88
117
  case "end":
89
118
  return _context2.stop();
90
119
  }
91
120
  }, _callee2, this);
92
121
  }));
93
- function commitOrder(_x3) {
94
- return _commitOrder.apply(this, arguments);
122
+ function submitOrder(_x3) {
123
+ return _submitOrder.apply(this, arguments);
95
124
  }
96
- return commitOrder;
125
+ return submitOrder;
97
126
  }()
98
127
  }]);
99
128
  return OrderModule;
@@ -1,4 +1,4 @@
1
- import { CartItem } from "../Cart/types";
1
+ import { CartItem } from '../Cart/types';
2
2
  export declare enum OrderHooks {
3
3
  OnOrderCreate = "order:onOrderCreate",
4
4
  OnOrderUpdate = "order:onOrderUpdate",
@@ -25,10 +25,17 @@ export interface OrderModuleAPI {
25
25
  * @param params 订单信息
26
26
  * @returns 订单信息
27
27
  */
28
- createOrder: (params: CommitOrderParams["query"]) => any;
28
+ createOrder: (params: CommitOrderParams['query']) => any;
29
+ /**
30
+ * 检查购物车提交订单前是否符合条件
31
+ */
32
+ checkBeforeSubmitOrder: (params: {
33
+ cartItems: CartItem[];
34
+ type: 'holder' | 'account';
35
+ }) => boolean;
29
36
  /**
30
37
  * 提交订单
31
38
  * @param params 订单信息
32
39
  */
33
- commitOrder: (params: CommitOrderParams) => Promise<void>;
40
+ submitOrder: (params: CommitOrderParams) => Promise<void>;
34
41
  }
@@ -0,0 +1,10 @@
1
+ import { CartItem } from "../Cart";
2
+ /**
3
+ * 通过 session 类商品的开始时间结束时间生成商品的时长
4
+ * @param {CartItem} cartItem
5
+ * @return {*}
6
+ */
7
+ export declare const generateDuration: (cartItem: CartItem) => {
8
+ duration: number;
9
+ durationType: string;
10
+ };
@@ -0,0 +1,15 @@
1
+ import dayjs from "dayjs";
2
+ /**
3
+ * 通过 session 类商品的开始时间结束时间生成商品的时长
4
+ * @param {CartItem} cartItem
5
+ * @return {*}
6
+ */
7
+ export var generateDuration = function generateDuration(cartItem) {
8
+ var startDate = dayjs("".concat(cartItem.start_date, " ").concat(cartItem.start_time));
9
+ var endDate = dayjs("".concat(cartItem.end_date, " ").concat(cartItem.end_time));
10
+ var duration = endDate.diff(startDate, 'minutes');
11
+ return {
12
+ duration: duration,
13
+ durationType: 'minutes'
14
+ };
15
+ };
@@ -2,16 +2,26 @@ import { Module, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import { ProductData, ProductMedia, ProductTag, ProductCategory, ProductBundleGroup } from './types';
4
4
  export * from './types';
5
+ /**
6
+ * 商品详情模块
7
+ * 除了跟商品列表模块组合外,还会提供单独的商品详情页的一些方法
8
+ *
9
+ * @export
10
+ * @class Product
11
+ * @extends {BaseModule}
12
+ * @implements {Module}
13
+ */
5
14
  export declare class Product extends BaseModule implements Module {
6
15
  protected defaultName: string;
7
16
  protected defaultVersion: string;
8
17
  private store;
18
+ protected otherParams: any;
9
19
  constructor(name?: string, version?: string);
10
20
  initialize(core: PisellCore, options: any): Promise<void>;
11
21
  /**
12
22
  * 获取商品数据
13
23
  */
14
- getData(): ProductData | null;
24
+ getData(): ProductData;
15
25
  /**
16
26
  * 获取商品ID
17
27
  */
@@ -36,4 +46,7 @@ export declare class Product extends BaseModule implements Module {
36
46
  * 获取商品分类
37
47
  */
38
48
  getCategories(): ProductCategory[];
49
+ setOtherParams(key: string, value: any): void;
50
+ getOtherParams(): any;
51
+ getProductType(): "duration" | "session" | "normal";
39
52
  }
@@ -17,6 +17,16 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
17
17
  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); }
18
18
  import { BaseModule } from "../BaseModule";
19
19
  export * from "./types";
20
+
21
+ /**
22
+ * 商品详情模块
23
+ * 除了跟商品列表模块组合外,还会提供单独的商品详情页的一些方法
24
+ *
25
+ * @export
26
+ * @class Product
27
+ * @extends {BaseModule}
28
+ * @implements {Module}
29
+ */
20
30
  export var Product = /*#__PURE__*/function (_BaseModule) {
21
31
  _inherits(Product, _BaseModule);
22
32
  var _super = _createSuper(Product);
@@ -27,6 +37,9 @@ export var Product = /*#__PURE__*/function (_BaseModule) {
27
37
  _defineProperty(_assertThisInitialized(_this), "defaultName", 'product');
28
38
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
29
39
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
40
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {
41
+ scheduler: []
42
+ });
30
43
  return _this;
31
44
  }
32
45
  _createClass(Product, [{
@@ -113,6 +126,28 @@ export var Product = /*#__PURE__*/function (_BaseModule) {
113
126
  value: function getCategories() {
114
127
  return this.store.categories;
115
128
  }
129
+ }, {
130
+ key: "setOtherParams",
131
+ value: function setOtherParams(key, value) {
132
+ this.otherParams[key] = value;
133
+ }
134
+ }, {
135
+ key: "getOtherParams",
136
+ value: function getOtherParams() {
137
+ return this.otherParams;
138
+ }
139
+ }, {
140
+ key: "getProductType",
141
+ value: function getProductType() {
142
+ var _this$store$schedule;
143
+ if (this.store.duration) {
144
+ return 'duration';
145
+ }
146
+ if ((_this$store$schedule = this.store['schedule.ids']) !== null && _this$store$schedule !== void 0 && _this$store$schedule.length) {
147
+ return 'session';
148
+ }
149
+ return 'normal';
150
+ }
116
151
  }]);
117
152
  return Product;
118
153
  }(BaseModule);
@@ -17,7 +17,7 @@ export interface ProductData {
17
17
  /** 商品slug */
18
18
  slug: string;
19
19
  /** draft:草稿;published:已发布;pending:待发布;archived:已归档 */
20
- status: "draft" | "published" | "pending" | "archived";
20
+ status: 'draft' | 'published' | 'pending' | 'archived';
21
21
  /** 库存数量 */
22
22
  stock_quantity: number;
23
23
  /** 销售数量 */
@@ -152,6 +152,30 @@ export interface ProductData {
152
152
  options?: any[];
153
153
  /** 商品原信息 */
154
154
  origin?: any;
155
+ /** 容量 */
156
+ capacity?: any;
157
+ /** 商品套餐 */
158
+ product_bundle?: any;
159
+ /** 日程ids */
160
+ 'schedule.ids'?: number[];
161
+ /** 商品日程信息,前端临时用,随时需要回收的 */
162
+ _schedule?: any;
163
+ /** 商品定金信息 */
164
+ custom_deposit_data?: {
165
+ /** 商品是否包含定金 1:是 0:否 */
166
+ has_deposit: 0 | 1;
167
+ /** 定金固定金额 */
168
+ deposit_fixed?: string;
169
+ /** 定金百分比 */
170
+ deposit_percentage?: string;
171
+ /** 定金协议数据 */
172
+ deposit_policy_data?: Array<{
173
+ /** 定金协议id */
174
+ id: number;
175
+ /** 定金协议标题 */
176
+ title: string;
177
+ }>;
178
+ };
155
179
  }
156
180
  /**
157
181
  * 商品媒体信息接口
@@ -414,7 +438,7 @@ export interface ProductResourceItem {
414
438
  /** 资源标题 */
415
439
  title: string;
416
440
  /** 资源编码 */
417
- code: "resource";
441
+ code: 'resource';
418
442
  /** 默认资源 */
419
443
  default_resource?: number[];
420
444
  /** 可选资源 */
@@ -423,7 +447,7 @@ export interface ProductResourceItem {
423
447
  resource_type_id: number;
424
448
  /** 选择类型 */
425
449
  select_type?: {
426
- type: "single";
450
+ type: 'single';
427
451
  min: 1;
428
452
  max: 1;
429
453
  };
@@ -42,16 +42,22 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
42
42
  key: "initialize",
43
43
  value: function () {
44
44
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
45
+ var _options$initialState;
45
46
  return _regeneratorRuntime().wrap(function _callee$(_context) {
46
47
  while (1) switch (_context.prev = _context.next) {
47
48
  case 0:
48
49
  this.core = core;
49
50
  this.store = options.store;
50
- this.store.productMap = new Map();
51
- this.store.list = [];
52
- this.store.selectProducts = [];
53
- this.storeChange();
54
- case 6:
51
+ if (Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.list)) {
52
+ this.store.list = options.initialState.list;
53
+ this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
54
+ this.storeChange();
55
+ } else {
56
+ this.store.list = [];
57
+ this.store.productMap = new Map();
58
+ this.store.selectProducts = [];
59
+ }
60
+ case 3:
55
61
  case "end":
56
62
  return _context.stop();
57
63
  }
@@ -26,6 +26,7 @@ export interface Resource {
26
26
  startTime?: string;
27
27
  endTime?: string;
28
28
  resourceType?: string;
29
+ children?: Resource[];
29
30
  }
30
31
  /**
31
32
  * 资源列表状态
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @title: 获取资源map
3
- * @description:
3
+ * @description:
4
4
  * @param {any} resourceList
5
5
  * @return {*}
6
6
  * @Author: zhiwei.Wang
@@ -1,5 +1,5 @@
1
- import { Module, PisellCore, ModuleOptions } from "../../types";
2
- import { BaseModule } from "../BaseModule";
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
3
  import { Rules, RulesModuleAPI, DiscountResult } from "./types";
4
4
  import { Discount } from "../Discount/types";
5
5
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
@@ -34,8 +34,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
34
34
  var _this;
35
35
  _classCallCheck(this, RulesModule);
36
36
  _this = _super.call(this, name, version);
37
- _defineProperty(_assertThisInitialized(_this), "defaultName", "rules");
38
- _defineProperty(_assertThisInitialized(_this), "defaultVersion", "1.0.0");
37
+ _defineProperty(_assertThisInitialized(_this), "defaultName", 'rules');
38
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
39
39
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
40
40
  _defineProperty(_assertThisInitialized(_this), "hooks", void 0);
41
41
  _this.hooks = {};
@@ -176,8 +176,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
176
176
  var sortedProductList = _toConsumableArray(productList).sort(function (a, b) {
177
177
  var aProduct = _this3.hooks.getProduct(a);
178
178
  var bProduct = _this3.hooks.getProduct(b);
179
- var priceA = parseFloat(aProduct.price || "0");
180
- var priceB = parseFloat(bProduct.price || "0");
179
+ var priceA = parseFloat(aProduct.price || '0');
180
+ var priceB = parseFloat(bProduct.price || '0');
181
181
  return priceB - priceA;
182
182
  });
183
183
 
@@ -210,7 +210,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
210
210
  var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
211
211
 
212
212
  // 是符合折扣的商品
213
- var isLimitedProduct = limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id);
213
+ var isLimitedProduct = limitedData.type === 'product_all' || limitedData.product_ids && limitedData.product_ids.includes(product.id);
214
214
 
215
215
  // 编辑的商品 使用了优惠券不可用
216
216
  var isAvailableProduct = !(product !== null && product !== void 0 && product.booking_id && product !== null && product !== void 0 && (_product$discount_lis = product.discount_list) !== null && _product$discount_lis !== void 0 && _product$discount_lis.length && product !== null && product !== void 0 && (_product$discount_lis2 = product.discount_list) !== null && _product$discount_lis2 !== void 0 && _product$discount_lis2.every(function (discount) {
@@ -257,7 +257,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
257
257
  var limitedData = discount.limited_relation_product_data;
258
258
 
259
259
  // 判断优惠券是否适用于该商品
260
- if (limitedData.type === "product_all") {
260
+ if (limitedData.type === 'product_all') {
261
261
  return true;
262
262
  } else if (limitedData.product_ids && limitedData.product_ids.includes(product.id)) {
263
263
  return true;
@@ -269,7 +269,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
269
269
  var selectedDiscount = applicableDiscounts[0];
270
270
 
271
271
  // 如果是手动折扣,则不适用优惠券
272
- var isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : product.total != product.origin_total && !((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length);
272
+ var isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && !((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length);
273
273
 
274
274
  // 勾选时覆盖手动折扣
275
275
  if (options !== null && options !== void 0 && options.discountId && (options === null || options === void 0 ? void 0 : options.discountId) === (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.id)) {
@@ -411,7 +411,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
411
411
  var isAvailable = applicableProducts.length > 0;
412
412
 
413
413
  // 如果此优惠券被明确设置为不选中,保持其状态,但正确设置isAvailable
414
- if (typeof discount.isSelected === "boolean" && discount.isSelected === false && discount.isManualSelect) {
414
+ if (typeof discount.isSelected === 'boolean' && discount.isSelected === false && discount.isManualSelect) {
415
415
  return _objectSpread(_objectSpread({}, discount), {}, {
416
416
  isSelected: false,
417
417
  isAvailable: isAvailable,
@@ -436,7 +436,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
436
436
  appliedProductDetails: appliedProductDetails
437
437
  });
438
438
  }
439
- var isSelected = typeof discount.isSelected === "boolean" ? discount.isSelected : undefined;
439
+ var isSelected = typeof discount.isSelected === 'boolean' ? discount.isSelected : undefined;
440
440
 
441
441
  // 如果是可用的 并且没有手动标记 则设置为选中
442
442
  if (isAvailable && appliedProductDetails.length && !discount.isManualSelect) {
@@ -472,7 +472,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
472
472
  _context3.next = 3;
473
473
  return this.core.effects.emit(RulesHooks.OnDestroy, {});
474
474
  case 3:
475
- console.log("[Rules] 已销毁");
475
+ console.log('[Rules] 已销毁');
476
476
  case 4:
477
477
  case "end":
478
478
  return _context3.stop();
@@ -491,7 +491,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
491
491
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
492
492
  while (1) switch (_context4.prev = _context4.next) {
493
493
  case 0:
494
- console.log("[Rules] clear");
494
+ console.log('[Rules] clear');
495
495
  case 1:
496
496
  case "end":
497
497
  return _context4.stop();
@@ -1,4 +1,4 @@
1
- import { Discount } from "../Discount/types";
1
+ import { Discount } from '../Discount/types';
2
2
  export declare enum RulesHooks {
3
3
  OnRulesListChange = "rules:onRulesListChange",
4
4
  OnDestroy = "rules:onDestroy"
@@ -0,0 +1,18 @@
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
+ import { ScheduleModuleAPI, ScheduleAvailabilityDateItem, ScheduleItem } from './types';
4
+ export declare class ScheduleModule extends BaseModule implements Module, ScheduleModuleAPI {
5
+ protected defaultName: string;
6
+ protected defaultVersion: string;
7
+ private store;
8
+ private cacheId;
9
+ private openCache;
10
+ private fatherModule;
11
+ constructor(name?: string, version?: string);
12
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
13
+ setScheduleList(list: ScheduleItem[]): void;
14
+ getScheduleListByIds(ids: number[]): ScheduleItem[];
15
+ setAvailabilityScheduleDateList(list: ScheduleAvailabilityDateItem[]): void;
16
+ getAvailabilityScheduleDateList(): ScheduleAvailabilityDateItem[];
17
+ storeChange(): void;
18
+ }
@@ -0,0 +1,111 @@
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); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ 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; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ 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); }
18
+ import { cloneDeep } from 'lodash-es';
19
+ import { BaseModule } from "../BaseModule";
20
+ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
21
+ _inherits(ScheduleModule, _BaseModule);
22
+ var _super = _createSuper(ScheduleModule);
23
+ function ScheduleModule(name, version) {
24
+ var _this;
25
+ _classCallCheck(this, ScheduleModule);
26
+ _this = _super.call(this, name, version);
27
+ _defineProperty(_assertThisInitialized(_this), "defaultName", 'schedule');
28
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
29
+ _defineProperty(_assertThisInitialized(_this), "store", {});
30
+ _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
31
+ _defineProperty(_assertThisInitialized(_this), "openCache", false);
32
+ _defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
33
+ return _this;
34
+ }
35
+ _createClass(ScheduleModule, [{
36
+ key: "initialize",
37
+ value: function () {
38
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
39
+ var _options$otherParams, _options$otherParams2;
40
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
41
+ while (1) switch (_context.prev = _context.next) {
42
+ case 0:
43
+ this.core = core;
44
+ // if (options?.initialState) {
45
+ // this.state = { ...this.state, ...options.initialState }
46
+ // }
47
+ this.store = options === null || options === void 0 ? void 0 : options.store;
48
+ if (options.initialState) {
49
+ this.store.scheduleList = options.initialState.scheduleList;
50
+ this.store.availabilityDateList = options.initialState.availabilityDateList;
51
+ } else {
52
+ this.store.scheduleList = [];
53
+ this.store.availabilityDateList = [];
54
+ }
55
+ if ((_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
56
+ this.openCache = options.otherParams.openCache;
57
+ this.cacheId = options.otherParams.cacheId;
58
+ }
59
+ if ((_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
60
+ this.fatherModule = options.otherParams.fatherModule;
61
+ }
62
+ case 5:
63
+ case "end":
64
+ return _context.stop();
65
+ }
66
+ }, _callee, this);
67
+ }));
68
+ function initialize(_x, _x2) {
69
+ return _initialize.apply(this, arguments);
70
+ }
71
+ return initialize;
72
+ }()
73
+ }, {
74
+ key: "setScheduleList",
75
+ value: function setScheduleList(list) {
76
+ this.store.scheduleList = list;
77
+ }
78
+ }, {
79
+ key: "getScheduleListByIds",
80
+ value: function getScheduleListByIds(ids) {
81
+ return this.store.scheduleList.filter(function (n) {
82
+ return ids.includes(n.id);
83
+ });
84
+ }
85
+ }, {
86
+ key: "setAvailabilityScheduleDateList",
87
+ value: function setAvailabilityScheduleDateList(list) {
88
+ this.store.availabilityDateList = list;
89
+ }
90
+ }, {
91
+ key: "getAvailabilityScheduleDateList",
92
+ value: function getAvailabilityScheduleDateList() {
93
+ return this.store.availabilityDateList;
94
+ }
95
+ }, {
96
+ key: "storeChange",
97
+ value: function storeChange() {
98
+ if (this.openCache) {
99
+ var store = cloneDeep(this.store);
100
+ // store里的 list 要主动基于 id 做下去重,避免重复写入
101
+ this.checkSaveCache({
102
+ cacheId: this.cacheId,
103
+ fatherModule: this.fatherModule,
104
+ store: store,
105
+ cacheKey: ['scheduleList', 'availabilityDateList']
106
+ });
107
+ }
108
+ }
109
+ }]);
110
+ return ScheduleModule;
111
+ }(BaseModule);