@pisell/pisellos 0.0.10 → 0.0.13

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 (130) hide show
  1. package/dist/modules/Account/index.d.ts +4 -2
  2. package/dist/modules/Account/index.js +23 -36
  3. package/dist/modules/Account/types.d.ts +1 -0
  4. package/dist/modules/AccountList/index.d.ts +2 -0
  5. package/dist/modules/AccountList/index.js +34 -11
  6. package/dist/modules/Cart/index.d.ts +17 -11
  7. package/dist/modules/Cart/index.js +179 -121
  8. package/dist/modules/Cart/types.d.ts +98 -9
  9. package/dist/modules/Cart/types.js +8 -0
  10. package/dist/modules/Cart/utils.d.ts +114 -0
  11. package/dist/modules/Cart/utils.js +345 -0
  12. package/dist/modules/Date/index.d.ts +11 -12
  13. package/dist/modules/Date/index.js +104 -60
  14. package/dist/modules/Date/types.d.ts +51 -20
  15. package/dist/modules/Date/types.js +2 -5
  16. package/dist/modules/Date/utils.d.ts +35 -0
  17. package/dist/modules/Date/utils.js +211 -0
  18. package/dist/modules/Discount/index.d.ts +26 -0
  19. package/dist/modules/Discount/index.js +234 -0
  20. package/dist/modules/Discount/types.d.ts +66 -0
  21. package/dist/modules/Discount/types.js +5 -0
  22. package/dist/modules/Order/index.d.ts +16 -12
  23. package/dist/modules/Order/index.js +38 -166
  24. package/dist/modules/Order/types.d.ts +18 -41
  25. package/dist/modules/Order/types.js +0 -14
  26. package/dist/modules/Payment/index.d.ts +0 -2
  27. package/dist/modules/Payment/index.js +45 -76
  28. package/dist/modules/Payment/types.d.ts +0 -2
  29. package/dist/modules/Payment/types.js +2 -0
  30. package/dist/modules/Product/types.d.ts +48 -1
  31. package/dist/modules/ProductList/index.d.ts +1 -0
  32. package/dist/modules/ProductList/index.js +21 -1
  33. package/dist/modules/ProductList/types.d.ts +1 -0
  34. package/dist/modules/Resource/types.d.ts +6 -2
  35. package/dist/modules/Rules/index.d.ts +32 -0
  36. package/dist/modules/Rules/index.js +423 -0
  37. package/dist/modules/Rules/types.d.ts +46 -0
  38. package/dist/modules/Rules/types.js +5 -0
  39. package/dist/modules/Summary/index.d.ts +13 -0
  40. package/dist/modules/Summary/index.js +80 -0
  41. package/dist/modules/Summary/types.d.ts +13 -0
  42. package/dist/modules/Summary/types.js +1 -0
  43. package/dist/modules/Summary/utils.d.ts +19 -0
  44. package/dist/modules/Summary/utils.js +56 -0
  45. package/dist/plugins/index.d.ts +3 -2
  46. package/dist/plugins/index.js +2 -1
  47. package/dist/plugins/request.d.ts +4 -3
  48. package/dist/plugins/request.js +30 -30
  49. package/dist/plugins/shopStore.d.ts +4 -0
  50. package/dist/plugins/shopStore.js +1 -0
  51. package/dist/solution/BookingByStep/index.d.ts +73 -12
  52. package/dist/solution/BookingByStep/index.js +635 -99
  53. package/dist/solution/BookingByStep/types.d.ts +2 -0
  54. package/dist/solution/BookingByStep/types.js +11 -8
  55. package/dist/solution/BookingByStep/utils/products.d.ts +11 -0
  56. package/dist/solution/BookingByStep/utils/products.js +47 -0
  57. package/dist/solution/BookingByStep/utils/resources.d.ts +59 -10
  58. package/dist/solution/BookingByStep/utils/resources.js +144 -79
  59. package/dist/solution/ShopDiscount/index.d.ts +50 -0
  60. package/dist/solution/ShopDiscount/index.js +546 -0
  61. package/dist/solution/ShopDiscount/types.d.ts +24 -0
  62. package/dist/solution/ShopDiscount/types.js +10 -0
  63. package/dist/solution/ShopDiscount/utils.d.ts +1 -0
  64. package/dist/solution/ShopDiscount/utils.js +7 -0
  65. package/dist/solution/index.d.ts +1 -0
  66. package/dist/solution/index.js +2 -1
  67. package/lib/modules/Account/index.d.ts +4 -2
  68. package/lib/modules/Account/index.js +14 -3
  69. package/lib/modules/Account/types.d.ts +1 -0
  70. package/lib/modules/AccountList/index.d.ts +2 -0
  71. package/lib/modules/AccountList/index.js +17 -0
  72. package/lib/modules/Cart/index.d.ts +17 -11
  73. package/lib/modules/Cart/index.js +72 -21
  74. package/lib/modules/Cart/types.d.ts +98 -9
  75. package/lib/modules/Cart/utils.d.ts +114 -0
  76. package/lib/modules/Cart/utils.js +320 -0
  77. package/lib/modules/Date/index.d.ts +11 -12
  78. package/lib/modules/Date/index.js +50 -31
  79. package/lib/modules/Date/types.d.ts +51 -20
  80. package/lib/modules/Date/types.js +0 -4
  81. package/lib/modules/Date/utils.d.ts +35 -0
  82. package/lib/modules/Date/utils.js +167 -0
  83. package/lib/modules/Discount/index.d.ts +26 -0
  84. package/lib/modules/Discount/index.js +118 -0
  85. package/lib/modules/Discount/types.d.ts +66 -0
  86. package/lib/modules/Discount/types.js +33 -0
  87. package/lib/modules/Order/index.d.ts +16 -12
  88. package/lib/modules/Order/index.js +23 -51
  89. package/lib/modules/Order/types.d.ts +18 -41
  90. package/lib/modules/Payment/index.d.ts +0 -2
  91. package/lib/modules/Payment/index.js +6 -17
  92. package/lib/modules/Payment/types.d.ts +0 -2
  93. package/lib/modules/Product/types.d.ts +48 -1
  94. package/lib/modules/ProductList/index.d.ts +1 -0
  95. package/lib/modules/ProductList/index.js +4 -0
  96. package/lib/modules/ProductList/types.d.ts +1 -0
  97. package/lib/modules/Resource/types.d.ts +6 -2
  98. package/lib/modules/Rules/index.d.ts +32 -0
  99. package/lib/modules/Rules/index.js +283 -0
  100. package/lib/modules/Rules/types.d.ts +46 -0
  101. package/lib/modules/Rules/types.js +33 -0
  102. package/lib/modules/Summary/index.d.ts +13 -0
  103. package/lib/modules/Summary/index.js +49 -0
  104. package/lib/modules/Summary/types.d.ts +13 -0
  105. package/lib/modules/Summary/types.js +17 -0
  106. package/lib/modules/Summary/utils.d.ts +19 -0
  107. package/lib/modules/Summary/utils.js +79 -0
  108. package/lib/plugins/index.d.ts +3 -2
  109. package/lib/plugins/index.js +3 -1
  110. package/lib/plugins/request.d.ts +4 -3
  111. package/lib/plugins/request.js +4 -20
  112. package/lib/plugins/shopStore.d.ts +4 -0
  113. package/lib/plugins/shopStore.js +17 -0
  114. package/lib/solution/BookingByStep/index.d.ts +73 -12
  115. package/lib/solution/BookingByStep/index.js +451 -24
  116. package/lib/solution/BookingByStep/types.d.ts +2 -0
  117. package/lib/solution/BookingByStep/types.js +3 -0
  118. package/lib/solution/BookingByStep/utils/products.d.ts +11 -0
  119. package/lib/solution/BookingByStep/utils/products.js +60 -0
  120. package/lib/solution/BookingByStep/utils/resources.d.ts +59 -10
  121. package/lib/solution/BookingByStep/utils/resources.js +106 -49
  122. package/lib/solution/ShopDiscount/index.d.ts +50 -0
  123. package/lib/solution/ShopDiscount/index.js +321 -0
  124. package/lib/solution/ShopDiscount/types.d.ts +24 -0
  125. package/lib/solution/ShopDiscount/types.js +38 -0
  126. package/lib/solution/ShopDiscount/utils.d.ts +1 -0
  127. package/lib/solution/ShopDiscount/utils.js +32 -0
  128. package/lib/solution/index.d.ts +1 -0
  129. package/lib/solution/index.js +3 -1
  130. package/package.json +4 -4
@@ -0,0 +1,56 @@
1
+ import Decimal from "decimal.js";
2
+ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, items) {
3
+ var subtotal = new Decimal(calculateSubtotal(items));
4
+ var totalTaxFee = new Decimal(calculateTaxFee(shopInfo, items));
5
+
6
+ // 计算总价
7
+ var total = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subtotal : subtotal.plus(totalTaxFee);
8
+ return {
9
+ subtotal: subtotal.toFixed(2),
10
+ total: total.toFixed(2),
11
+ taxTitle: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_title,
12
+ totalTaxFee: totalTaxFee.toFixed(2),
13
+ isPriceIncludeTax: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.is_price_include_tax
14
+ };
15
+ };
16
+
17
+ /**
18
+ * 计算商品小计(不含其他费用)
19
+ * @param items - 购物车商品数组
20
+ * @returns 商品总价字符串,保留2位小数
21
+ */
22
+ export var calculateSubtotal = function calculateSubtotal(items) {
23
+ if (!(items !== null && items !== void 0 && items.length)) {
24
+ return "0.00";
25
+ }
26
+ var subtotal = items.reduce(function (sum, item) {
27
+ var price = new Decimal(item.price || 0);
28
+ var quantity = new Decimal(item.num || 1);
29
+ return sum.plus(price.times(quantity));
30
+ }, new Decimal(0));
31
+ return subtotal.toFixed(2);
32
+ };
33
+
34
+ /**
35
+ * @title: 单个商品的税费
36
+ * @description:
37
+ * 单个商品的税费 = 商品销售单价(折扣后) * 税率 * is_charge_tax /( 1+ 税率 * is_price_include_tax)
38
+ * $taxFee = $price * $taxRate * $isChargeTax / (1 + $taxRate * $isPriceIncludeTax);
39
+ * @return {*}
40
+ * @Author: xiangfeng.xue
41
+ */
42
+ export var calculateTaxFee = function calculateTaxFee(shopInfo, items) {
43
+ if (!(items !== null && items !== void 0 && items.length)) {
44
+ return "0.00";
45
+ }
46
+ var _ref = shopInfo || {},
47
+ is_price_include_tax = _ref.is_price_include_tax,
48
+ tax_rate = _ref.tax_rate;
49
+ var totalTaxFee = items.reduce(function (sum, item) {
50
+ var price = new Decimal(item.price || 0);
51
+ var taxRate = new Decimal(tax_rate || 0).div(100);
52
+ var productTaxRate = price.times(taxRate).times((item === null || item === void 0 ? void 0 : item.is_charge_tax) || 0).div(taxRate.times(is_price_include_tax || 0).plus(1));
53
+ return sum.plus(productTaxRate);
54
+ }, new Decimal(0));
55
+ return totalTaxFee;
56
+ };
@@ -1,2 +1,3 @@
1
- export * from './request';
2
- export * from './window';
1
+ export * from "./request";
2
+ export * from "./window";
3
+ export * from "./shopStore";
@@ -1,2 +1,3 @@
1
1
  export * from "./request";
2
- export * from "./window";
2
+ export * from "./window";
3
+ export * from "./shopStore";
@@ -1,4 +1,4 @@
1
- import { Plugin } from '../types';
1
+ import { Plugin } from "../types";
2
2
  /**
3
3
  * RequestPlugin 接口定义
4
4
  */
@@ -40,14 +40,15 @@ export interface RequestPlugin extends Plugin {
40
40
  */
41
41
  export interface RequestOptions {
42
42
  url?: string;
43
- method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
43
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
44
44
  headers?: Record<string, string>;
45
45
  data?: any;
46
46
  body?: any;
47
47
  params?: Record<string, string | number | boolean>;
48
48
  timeout?: number;
49
- responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
49
+ responseType?: "json" | "text" | "arraybuffer" | "blob";
50
50
  withCredentials?: boolean;
51
+ useCache?: boolean;
51
52
  }
52
53
  /**
53
54
  * 响应接口
@@ -52,7 +52,7 @@ export var RequestError = /*#__PURE__*/function (_Error) {
52
52
  _defineProperty(_assertThisInitialized(_this), "response", void 0);
53
53
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
54
54
  _defineProperty(_assertThisInitialized(_this), "config", void 0);
55
- _this.name = 'RequestError';
55
+ _this.name = "RequestError";
56
56
  _this.config = config;
57
57
  _this.request = request;
58
58
  _this.response = response;
@@ -67,19 +67,19 @@ export var RequestError = /*#__PURE__*/function (_Error) {
67
67
  var RequestPluginImpl = /*#__PURE__*/function () {
68
68
  function RequestPluginImpl() {
69
69
  _classCallCheck(this, RequestPluginImpl);
70
- _defineProperty(this, "name", 'request');
71
- _defineProperty(this, "version", '1.0.0');
70
+ _defineProperty(this, "name", "request");
71
+ _defineProperty(this, "version", "1.0.0");
72
72
  _defineProperty(this, "core", null);
73
73
  /**
74
74
  * 默认请求选项
75
75
  */
76
76
  _defineProperty(this, "defaultOptions", {
77
- method: 'GET',
77
+ method: "GET",
78
78
  headers: {
79
- 'Content-Type': 'application/json'
79
+ "Content-Type": "application/json"
80
80
  },
81
81
  timeout: 30000,
82
- responseType: 'json'
82
+ responseType: "json"
83
83
  });
84
84
  /**
85
85
  * 全局拦截器
@@ -96,14 +96,14 @@ var RequestPluginImpl = /*#__PURE__*/function () {
96
96
  // 初始化方法
97
97
  function initialize() {
98
98
  this.core = globalThis.pisellOS;
99
- console.log('[RequestPlugin] 初始化完成');
99
+ console.log("[RequestPlugin] 初始化完成");
100
100
  }
101
101
 
102
102
  // 销毁方法
103
103
  }, {
104
104
  key: "destroy",
105
105
  value: function destroy() {
106
- console.log('[RequestPlugin] 已销毁');
106
+ console.log("[RequestPlugin] 已销毁");
107
107
  }
108
108
 
109
109
  /**
@@ -142,7 +142,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
142
142
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
143
143
  return this.request(_objectSpread(_objectSpread({}, options), {}, {
144
144
  url: url,
145
- method: 'GET'
145
+ method: "GET"
146
146
  }));
147
147
  }
148
148
 
@@ -155,7 +155,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
155
155
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
156
156
  return this.request(_objectSpread(_objectSpread({}, options), {}, {
157
157
  url: url,
158
- method: 'POST',
158
+ method: "POST",
159
159
  data: data
160
160
  }));
161
161
  }
@@ -169,7 +169,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
169
169
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
170
170
  return this.request(_objectSpread(_objectSpread({}, options), {}, {
171
171
  url: url,
172
- method: 'PUT',
172
+ method: "PUT",
173
173
  data: data
174
174
  }));
175
175
  }
@@ -183,7 +183,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
183
183
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
184
184
  return this.request(_objectSpread(_objectSpread({}, options), {}, {
185
185
  url: url,
186
- method: 'DELETE'
186
+ method: "DELETE"
187
187
  }));
188
188
  }
189
189
 
@@ -202,10 +202,10 @@ var RequestPluginImpl = /*#__PURE__*/function () {
202
202
  config = _objectSpread(_objectSpread(_objectSpread({}, this.defaultOptions), options), {}, {
203
203
  headers: _objectSpread(_objectSpread({}, this.defaultOptions.headers), options.headers)
204
204
  });
205
- if (!config.headers['authorization'] && this.core) {
206
- windowPlugin = this.core.getPlugin('window');
205
+ if (!config.headers["authorization"] && this.core) {
206
+ windowPlugin = this.core.getPlugin("window");
207
207
  if (windowPlugin) {
208
- config.headers['authorization'] = windowPlugin.localStorage.getItem('token') || '';
208
+ config.headers["authorization"] = windowPlugin.localStorage.getItem("token") || "";
209
209
  }
210
210
  }
211
211
 
@@ -229,7 +229,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
229
229
  case 13:
230
230
  _context.prev = 13;
231
231
  _context.t0 = _context["catch"](7);
232
- _requestError2 = _context.t0 instanceof RequestError ? _context.t0 : new RequestError(_context.t0 instanceof Error ? _context.t0.message : '请求拦截器错误', config); // 应用错误拦截器
232
+ _requestError2 = _context.t0 instanceof RequestError ? _context.t0 : new RequestError(_context.t0 instanceof Error ? _context.t0.message : "请求拦截器错误", config); // 应用错误拦截器
233
233
  _processedError2 = _requestError2;
234
234
  _iterator5 = _createForOfIteratorHelper(this.interceptors.error);
235
235
  _context.prev = 18;
@@ -307,7 +307,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
307
307
  case 67:
308
308
  _context.prev = 67;
309
309
  _context.t4 = _context["catch"](61);
310
- requestError = _context.t4 instanceof RequestError ? _context.t4 : new RequestError(_context.t4 instanceof Error ? _context.t4.message : '响应拦截器错误', config, null, _response); // 应用错误拦截器
310
+ requestError = _context.t4 instanceof RequestError ? _context.t4 : new RequestError(_context.t4 instanceof Error ? _context.t4.message : "响应拦截器错误", config, null, _response); // 应用错误拦截器
311
311
  processedError = requestError;
312
312
  _iterator3 = _createForOfIteratorHelper(this.interceptors.error);
313
313
  _context.prev = 72;
@@ -363,7 +363,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
363
363
  case 108:
364
364
  _context.prev = 108;
365
365
  _context.t8 = _context["catch"](51);
366
- _requestError = _context.t8 instanceof RequestError ? _context.t8 : new RequestError(_context.t8 instanceof Error ? _context.t8.message : '请求错误', config); // 应用错误拦截器
366
+ _requestError = _context.t8 instanceof RequestError ? _context.t8 : new RequestError(_context.t8 instanceof Error ? _context.t8.message : "请求错误", config); // 应用错误拦截器
367
367
  _processedError = _requestError;
368
368
  _iterator4 = _createForOfIteratorHelper(this.interceptors.error);
369
369
  _context.prev = 113;
@@ -429,7 +429,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
429
429
  _context2.next = 3;
430
430
  break;
431
431
  }
432
- throw new RequestError('URL不能为空', config);
432
+ throw new RequestError("URL不能为空", config);
433
433
  case 3:
434
434
  // 处理 URL 参数
435
435
  fullUrl = url;
@@ -439,22 +439,22 @@ var RequestPluginImpl = /*#__PURE__*/function () {
439
439
  key = _ref2[0],
440
440
  value = _ref2[1];
441
441
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
442
- }).join('&');
443
- fullUrl += (url.includes('?') ? '&' : '?') + queryString;
442
+ }).join("&");
443
+ fullUrl += (url.includes("?") ? "&" : "?") + queryString;
444
444
  }
445
445
 
446
446
  // 准备请求选项
447
447
  fetchOptions = {
448
448
  method: method,
449
449
  headers: _objectSpread({}, headers),
450
- credentials: withCredentials ? 'include' : 'same-origin'
450
+ credentials: withCredentials ? "include" : "same-origin"
451
451
  }; // 处理请求体
452
- if (data !== undefined && method !== 'GET' && method !== 'HEAD') {
452
+ if (data !== undefined && method !== "GET" && method !== "HEAD") {
453
453
  if (data instanceof FormData) {
454
454
  fetchOptions.body = data;
455
455
  // 当使用 FormData 时,删除 Content-Type,让浏览器自动设置
456
- delete fetchOptions.headers['Content-Type'];
457
- } else if (_typeof(data) === 'object') {
456
+ delete fetchOptions.headers["Content-Type"];
457
+ } else if (_typeof(data) === "object") {
458
458
  fetchOptions.body = JSON.stringify(data);
459
459
  } else {
460
460
  fetchOptions.body = data;
@@ -471,7 +471,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
471
471
  });
472
472
  _context2.prev = 8;
473
473
  // 发起请求,并竞争超时
474
- fetchPromise = typeof fetch !== 'undefined' ? fetch(fullUrl, fetchOptions) : Promise.reject(new RequestError('当前环境不支持 fetch API', config));
474
+ fetchPromise = typeof fetch !== "undefined" ? fetch(fullUrl, fetchOptions) : Promise.reject(new RequestError("当前环境不支持 fetch API", config));
475
475
  _context2.next = 12;
476
476
  return Promise.race([fetchPromise, timeoutPromise]);
477
477
  case 12:
@@ -483,7 +483,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
483
483
  });
484
484
 
485
485
  // 解析响应内容
486
- if (!(responseType === 'json')) {
486
+ if (!(responseType === "json")) {
487
487
  _context2.next = 29;
488
488
  break;
489
489
  }
@@ -505,7 +505,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
505
505
  _context2.next = 58;
506
506
  break;
507
507
  case 29:
508
- if (!(responseType === 'text')) {
508
+ if (!(responseType === "text")) {
509
509
  _context2.next = 35;
510
510
  break;
511
511
  }
@@ -516,7 +516,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
516
516
  _context2.next = 58;
517
517
  break;
518
518
  case 35:
519
- if (!(responseType === 'arraybuffer')) {
519
+ if (!(responseType === "arraybuffer")) {
520
520
  _context2.next = 41;
521
521
  break;
522
522
  }
@@ -527,7 +527,7 @@ var RequestPluginImpl = /*#__PURE__*/function () {
527
527
  _context2.next = 58;
528
528
  break;
529
529
  case 41:
530
- if (!(responseType === 'blob')) {
530
+ if (!(responseType === "blob")) {
531
531
  _context2.next = 47;
532
532
  break;
533
533
  }
@@ -0,0 +1,4 @@
1
+ import { Plugin } from "../types";
2
+ export interface ShopStorePlugin extends Plugin {
3
+ get(model: string): any;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,14 +1,18 @@
1
1
  import { Module, PisellCore } from "../../types";
2
2
  import { BaseModule } from "../../modules/BaseModule";
3
3
  import { BookingByStepState } from "./types";
4
+ import { IUpdateItemParams, ProductData } from "../../modules";
4
5
  import { Account } from "../../modules/Account/types";
5
6
  import { IStep } from "../../modules/Step/tyeps";
7
+ import { TimeSliceItem } from "./utils/resources";
8
+ import { ITime } from "../../modules/Date/types";
6
9
  export declare class BookingByStepImpl extends BaseModule implements Module {
7
10
  protected defaultName: string;
8
11
  protected defaultVersion: string;
9
12
  isSolution: boolean;
10
13
  private request;
11
14
  private window;
15
+ private shopStore;
12
16
  private store;
13
17
  private otherParams;
14
18
  initialize(core: PisellCore, options: any): Promise<void>;
@@ -18,23 +22,42 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
18
22
  step: IStep;
19
23
  };
20
24
  next(): void;
25
+ back(): void;
26
+ gotoStep(index: number): void;
27
+ getStepList(): IStep[];
21
28
  getStoreCart(key?: string): Promise<any>;
22
- loadProducts({ category_ids, product_ids }: {
29
+ loadProducts({ category_ids, product_ids, collection, }: {
23
30
  category_ids?: number[];
24
31
  product_ids?: number[];
25
- }): Promise<void>;
26
- storeProducts(productData: any[], { cover }?: {
27
- cover?: boolean;
28
- }): Promise<void>;
32
+ collection?: number | string[];
33
+ }): Promise<any>;
34
+ storeProduct(productData: ProductData): Promise<void>;
29
35
  addAccount(accounts: Account[]): Promise<void>;
30
- getAccounts(): Promise<import("../../modules/Account").AccountModule[]>;
31
- setDateRange(dateRange: string[]): Promise<void>;
36
+ getAccounts(): Promise<(Account | null)[]>;
37
+ checkHasLoginAccount(): boolean;
38
+ setActiveAccount(id: string): void;
39
+ getActiveAccount(): Account | null;
40
+ removeAccount(id: string): void;
41
+ setDateRange(dateRange: ITime[]): Promise<void>;
32
42
  getRangeDate(): Promise<string>;
33
- getAvailableDate(): Promise<void>;
34
- getResourceTimeslot(): Promise<void>;
35
- getProducts(): Promise<import("../../modules").ProductData[]>;
36
- storeResources(resources: any[]): Promise<void>;
37
- setLoginAccount(account: Account): Promise<void>;
43
+ getCart(): Promise<import("../../modules").CartItem[]>;
44
+ getAvailableDate(params?: {
45
+ products?: ProductData[];
46
+ startDate?: string;
47
+ endDate?: string;
48
+ }): Promise<ITime[]>;
49
+ /**
50
+ * 获取购物车汇总信息
51
+ */
52
+ getSummary(): Promise<{
53
+ subtotal: string | number;
54
+ total: string | number;
55
+ taxTitle?: string | undefined;
56
+ totalTaxFee?: string | number | undefined;
57
+ isPriceIncludeTax?: 0 | 1 | undefined;
58
+ }>;
59
+ getProducts(): Promise<ProductData[]>;
60
+ setLoginAccount(accountId: string, accountInfo: Account): Promise<void>;
38
61
  generateCartData(): Promise<void>;
39
62
  submitOrder(): Promise<void>;
40
63
  pay(): Promise<void>;
@@ -43,4 +66,42 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
43
66
  cover?: boolean;
44
67
  }): Promise<void>;
45
68
  getOtherParams(): Promise<Record<string, any>>;
69
+ updateCart(params: IUpdateItemParams): void;
70
+ deleteCart(product_id: string): void;
71
+ clearCart(): void;
72
+ clearCartByAccount(account_id: string): void;
73
+ destory(): void;
74
+ getResourcesList(): any[];
75
+ getResourceTimeSlot({ product, resources, currentResourceId, }: {
76
+ product: ProductData;
77
+ resources: any[];
78
+ currentResourceId: number;
79
+ }): TimeSliceItem[];
80
+ autoSelectResource({ resourceProductData, resources, timeSlots, }: {
81
+ resourceProductData: any;
82
+ resources: any[];
83
+ timeSlots?: TimeSliceItem;
84
+ }): {
85
+ selectedResource: any;
86
+ timeSlots?: undefined;
87
+ } | {
88
+ timeSlots: any[];
89
+ selectedResource: any;
90
+ } | undefined;
91
+ autoSelectAccountResources({ holder_id, resources_code, timeSlots, }: {
92
+ holder_id: string;
93
+ resources_code: string | number;
94
+ timeSlots?: TimeSliceItem;
95
+ }): {
96
+ selectedResource: any;
97
+ timeSlots?: undefined;
98
+ } | {
99
+ timeSlots: any[];
100
+ selectedResource: any;
101
+ } | undefined;
102
+ autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
103
+ errorList: any[];
104
+ };
105
+ getTimeSlotByAllResources(resources_code: string): any[];
106
+ submitTimeSlot(timeSlots: TimeSliceItem): void;
46
107
  }