@pisell/pisellos 3.0.4 → 3.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 (189) 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 +106 -13
  17. package/dist/modules/Cart/utils.js +289 -76
  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 +3 -3
  37. package/dist/modules/Rules/index.js +121 -53
  38. package/dist/modules/Rules/types.d.ts +5 -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 +1024 -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 +106 -13
  88. package/lib/modules/Cart/utils.js +188 -45
  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 +3 -3
  111. package/lib/modules/Rules/index.js +118 -43
  112. package/lib/modules/Rules/types.d.ts +5 -1
  113. package/lib/modules/Schedule/index.d.ts +18 -0
  114. package/lib/modules/Schedule/index.js +81 -0
  115. package/lib/modules/Schedule/type.d.ts +157 -0
  116. package/lib/modules/Schedule/type.js +17 -0
  117. package/lib/modules/Schedule/types.d.ts +182 -0
  118. package/lib/modules/Schedule/types.js +17 -0
  119. package/lib/modules/Schedule/utils.d.ts +67 -0
  120. package/lib/modules/Schedule/utils.js +600 -0
  121. package/lib/modules/Step/index.d.ts +14 -3
  122. package/lib/modules/Step/index.js +38 -1
  123. package/lib/modules/Summary/index.d.ts +12 -5
  124. package/lib/modules/Summary/index.js +15 -1
  125. package/lib/modules/Summary/types.d.ts +23 -2
  126. package/lib/modules/Summary/utils.d.ts +14 -4
  127. package/lib/modules/Summary/utils.js +30 -1
  128. package/lib/modules/index.d.ts +10 -0
  129. package/lib/modules/index.js +21 -1
  130. package/lib/plugins/index.d.ts +3 -3
  131. package/lib/plugins/request.d.ts +3 -3
  132. package/lib/plugins/request.js +48 -11
  133. package/lib/plugins/shopStore.d.ts +1 -1
  134. package/lib/solution/BookingByStep/index.d.ts +97 -24
  135. package/lib/solution/BookingByStep/index.js +693 -145
  136. package/lib/solution/BookingByStep/types.d.ts +3 -10
  137. package/lib/solution/BookingByStep/types.js +37 -14
  138. package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
  139. package/lib/solution/BookingByStep/utils/products.js +3 -0
  140. package/lib/solution/BookingByStep/utils/resources.d.ts +60 -6
  141. package/lib/solution/BookingByStep/utils/resources.js +286 -54
  142. package/lib/solution/BuyTickets/index.js +34 -20
  143. package/lib/solution/ShopDiscount/index.d.ts +4 -4
  144. package/lib/solution/ShopDiscount/index.js +10 -2
  145. package/lib/solution/ShopDiscount/types.d.ts +2 -2
  146. package/package.json +4 -2
  147. package/dist/core/index.d.ts.map +0 -1
  148. package/dist/effects/index.d.ts.map +0 -1
  149. package/dist/index.d.ts.map +0 -1
  150. package/dist/modules/Account/index.d.ts.map +0 -1
  151. package/dist/modules/Account/types.d.ts.map +0 -1
  152. package/dist/modules/AccountList/types.d.ts.map +0 -1
  153. package/dist/modules/Cart/index.d.ts.map +0 -1
  154. package/dist/modules/Cart/types.d.ts.map +0 -1
  155. package/dist/modules/Date/types.d.ts.map +0 -1
  156. package/dist/modules/Date/utils.d.ts.map +0 -1
  157. package/dist/modules/Guests/index.d.ts.map +0 -1
  158. package/dist/modules/Guests/types.d.ts.map +0 -1
  159. package/dist/modules/Order/index.d.ts.map +0 -1
  160. package/dist/modules/Order/types.d.ts.map +0 -1
  161. package/dist/modules/Payment/index.d.ts.map +0 -1
  162. package/dist/modules/Payment/types.d.ts.map +0 -1
  163. package/dist/modules/Product/index.d.ts.map +0 -1
  164. package/dist/modules/Product/types.d.ts.map +0 -1
  165. package/dist/modules/ProductList/types.d.ts.map +0 -1
  166. package/dist/modules/Resource/index.d.ts.map +0 -1
  167. package/dist/modules/Resource/types.d.ts.map +0 -1
  168. package/dist/modules/Resource/utils.d.ts.map +0 -1
  169. package/dist/modules/Rules/types.d.ts.map +0 -1
  170. package/dist/modules/Step/index.d.ts.map +0 -1
  171. package/dist/modules/Step/tyeps.d.ts.map +0 -1
  172. package/dist/modules/Summary/index.d.ts.map +0 -1
  173. package/dist/modules/Summary/types.d.ts.map +0 -1
  174. package/dist/modules/Summary/utils.d.ts.map +0 -1
  175. package/dist/modules/index.d.ts.map +0 -1
  176. package/dist/plugins/index.d.ts.map +0 -1
  177. package/dist/plugins/request.d.ts.map +0 -1
  178. package/dist/plugins/shopStore.d.ts.map +0 -1
  179. package/dist/plugins/window.d.ts.map +0 -1
  180. package/dist/solution/BookingByStep/types.d.ts.map +0 -1
  181. package/dist/solution/BookingByStep/utils/products.d.ts.map +0 -1
  182. package/dist/solution/BuyTickets/index.d.ts.map +0 -1
  183. package/dist/solution/BuyTickets/types.d.ts.map +0 -1
  184. package/dist/solution/PlaceOrder/index.d.ts.map +0 -1
  185. package/dist/solution/ShopDiscount/types.d.ts.map +0 -1
  186. package/dist/solution/ShopDiscount/utils.d.ts.map +0 -1
  187. package/dist/solution/index.d.ts.map +0 -1
  188. package/dist/store/createStore.d.ts.map +0 -1
  189. package/dist/types/index.d.ts.map +0 -1
@@ -24,6 +24,7 @@ __export(Cart_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(Cart_exports);
26
26
  var import_BaseModule = require("../BaseModule");
27
+ var import_types = require("./types");
27
28
  var import_utils = require("./utils");
28
29
  var import_lodash_es = require("lodash-es");
29
30
  __reExport(Cart_exports, require("./types"), module.exports);
@@ -69,13 +70,16 @@ var CartModule = class extends import_BaseModule.BaseModule {
69
70
  * 添加商品到购物车
70
71
  */
71
72
  async addItem(params) {
72
- const { account, product, bundle, options } = params;
73
+ const { account, product, bundle, options, date } = params;
73
74
  let cartItem = {
74
75
  _id: (0, import_utils.getUniqueId)(),
75
76
  _origin: (0, import_utils.createCartItemOrigin)()
76
77
  };
77
78
  if (product) {
78
79
  cartItem._productOrigin = (0, import_lodash_es.cloneDeep)(product);
80
+ cartItem._productInit = (0, import_lodash_es.cloneDeep)(product);
81
+ cartItem._bundleOrigin = (0, import_lodash_es.cloneDeep)(bundle);
82
+ cartItem._optionsOrigin = (0, import_lodash_es.cloneDeep)(options);
79
83
  cartItem = (0, import_utils.formatProductToCartItem)({
80
84
  cartItem,
81
85
  product,
@@ -86,6 +90,9 @@ var CartModule = class extends import_BaseModule.BaseModule {
86
90
  if (account) {
87
91
  cartItem = (0, import_utils.formatAccountToCartItem)({ cartItem, account });
88
92
  }
93
+ if (date) {
94
+ cartItem = (0, import_utils.formatDateToCartItem)({ cartItem, date });
95
+ }
89
96
  const items = [...this.store.list, cartItem];
90
97
  this.store.list = items;
91
98
  await this.core.effects.emit(`${this.name}:onAddItem`, cartItem);
@@ -112,7 +119,19 @@ var CartModule = class extends import_BaseModule.BaseModule {
112
119
  * 格式化数据到购物车
113
120
  */
114
121
  formatCartItem(params) {
115
- const { _id, cartItem, account, product, discounts, resources, note } = params;
122
+ const {
123
+ _id,
124
+ cartItem,
125
+ account,
126
+ product,
127
+ bundle,
128
+ options,
129
+ discounts,
130
+ resources,
131
+ note,
132
+ date,
133
+ relationForms
134
+ } = params;
116
135
  let tempCartItem = this.store.list.find((i) => i._id === _id);
117
136
  if (!tempCartItem) {
118
137
  throw new Error("[CartModule] 格式化数据到购物车失败,商品不存在");
@@ -122,9 +141,13 @@ var CartModule = class extends import_BaseModule.BaseModule {
122
141
  }
123
142
  if (product) {
124
143
  tempCartItem._productOrigin = (0, import_lodash_es.cloneDeep)(product);
144
+ tempCartItem._bundleOrigin = (0, import_lodash_es.cloneDeep)(bundle);
145
+ tempCartItem._optionsOrigin = (0, import_lodash_es.cloneDeep)(options);
125
146
  tempCartItem = (0, import_utils.formatProductToCartItem)({
126
147
  cartItem: tempCartItem,
127
- product
148
+ product,
149
+ bundle,
150
+ options
128
151
  });
129
152
  }
130
153
  if (discounts) {
@@ -145,6 +168,15 @@ var CartModule = class extends import_BaseModule.BaseModule {
145
168
  resources
146
169
  });
147
170
  }
171
+ if (relationForms) {
172
+ tempCartItem = (0, import_utils.formatRelationFormsToCartItem)({
173
+ cartItem: tempCartItem,
174
+ relationForms
175
+ });
176
+ }
177
+ if (date) {
178
+ tempCartItem = (0, import_utils.formatDateToCartItem)({ cartItem: tempCartItem, date });
179
+ }
148
180
  if (note) {
149
181
  tempCartItem = (0, import_utils.formatNoteToCartItem)({ cartItem: tempCartItem, note });
150
182
  }
@@ -195,13 +227,28 @@ var CartModule = class extends import_BaseModule.BaseModule {
195
227
  }
196
228
  /**
197
229
  * 清除购物车商品中的信息
230
+ * @param type 清除购物车商品中的信息类型
231
+ * @param _id 购物车商品ID
198
232
  */
199
- deleteCartItemInfo(types) {
233
+ deleteCartItemInfo(type, _id) {
200
234
  const list = this.store.list.map((item) => {
201
- if (types === "resource") {
202
- item = (0, import_utils.deleteResourceFromCartItem)(item);
203
- } else if (types === "time") {
204
- item = (0, import_utils.deleteTimeFromCartItem)(item);
235
+ const needDelete = _id ? item._id === _id : true;
236
+ if (!needDelete) {
237
+ return item;
238
+ }
239
+ switch (type) {
240
+ case import_types.ECartItemInfoType.Resource:
241
+ item = (0, import_utils.deleteResourceFromCartItem)(item);
242
+ break;
243
+ case import_types.ECartItemInfoType.Time:
244
+ item = (0, import_utils.deleteTimeFromCartItem)(item);
245
+ break;
246
+ case import_types.ECartItemInfoType.RelationForms:
247
+ item = (0, import_utils.deleteRelationFormsFromCartItem)(item);
248
+ break;
249
+ case import_types.ECartItemInfoType.Holder:
250
+ item = (0, import_utils.deleteHolderFromCartItem)(item);
251
+ break;
205
252
  }
206
253
  return item;
207
254
  });
@@ -227,6 +274,32 @@ var CartModule = class extends import_BaseModule.BaseModule {
227
274
  });
228
275
  }
229
276
  }
277
+ checkCartItemByType(cartItem, type) {
278
+ let result = false;
279
+ const {
280
+ holder,
281
+ metadata,
282
+ resources,
283
+ start_date,
284
+ end_date,
285
+ relation_forms
286
+ } = cartItem._origin || {};
287
+ switch (type) {
288
+ case import_types.ECartItemCheckType.Account:
289
+ result = !!holder || !!(metadata == null ? void 0 : metadata.account);
290
+ break;
291
+ case import_types.ECartItemCheckType.Resources:
292
+ result = !!(resources == null ? void 0 : resources.length);
293
+ break;
294
+ case import_types.ECartItemCheckType.Date:
295
+ result = !!start_date && !!end_date;
296
+ break;
297
+ case import_types.ECartItemCheckType.RelationForms:
298
+ result = !!(relation_forms == null ? void 0 : relation_forms.length);
299
+ break;
300
+ }
301
+ return result;
302
+ }
230
303
  };
231
304
  // Annotate the CommonJS export names for ESM import in node:
232
305
  0 && (module.exports = {
@@ -1,12 +1,38 @@
1
- import { ProductData } from "../Product/types";
2
- import { Account } from "../Account/types";
3
- import { Resource } from "../Resource/types";
1
+ import { ProductData } from '../Product/types';
2
+ import { Account } from '../Account/types';
3
+ import { Resource } from '../Resource/types';
4
4
  export declare enum CartHooks {
5
5
  OnAddItem = "card:onAddItem",
6
6
  OnCartChange = "card:onCartChange",
7
7
  OnCartUpdateItem = "card:onCartUpdateItem",
8
8
  OnCartRemove = "card:onCartRemove"
9
9
  }
10
+ /**
11
+ * 购物车商品信息类型
12
+ */
13
+ export declare enum ECartItemInfoType {
14
+ /** 资源信息 */
15
+ Resource = "resource",
16
+ /** 时间信息 */
17
+ Time = "time",
18
+ /** 关联表单信息 */
19
+ RelationForms = "relationForms",
20
+ /** 账户信息 */
21
+ Holder = "holder"
22
+ }
23
+ /**
24
+ * 购物车商品检查类型
25
+ */
26
+ export declare enum ECartItemCheckType {
27
+ /** 账户信息 */
28
+ Account = "account",
29
+ /** 资源信息 */
30
+ Resources = "resources",
31
+ /** 时间信息 */
32
+ Date = "date",
33
+ /** 关联表单信息 */
34
+ RelationForms = "relationForms"
35
+ }
10
36
  export interface CartModuleAPI {
11
37
  /** 添加商品到购物车 */
12
38
  addItem: (item: IAddItemParams) => Promise<void>;
@@ -26,6 +52,10 @@ export interface CartModuleAPI {
26
52
  getCartByAccount: (account_id: string) => CartItem[];
27
53
  /** 清除购物车 */
28
54
  clear: () => void;
55
+ /** 清除购物车商品中的信息 */
56
+ deleteCartItemInfo: (type: ECartItemInfoType, _id?: string) => void;
57
+ /** 检查购物车商品 */
58
+ checkCartItemByType: (cartItem: CartItem, type: ECartItemCheckType) => boolean;
29
59
  }
30
60
  /**
31
61
  * 购物车商品接口
@@ -57,7 +87,7 @@ export interface CartItem {
57
87
  /** 备注 */
58
88
  note?: string;
59
89
  /** 点赞状态 */
60
- like_status?: "like" | "common";
90
+ like_status?: 'like' | 'common';
61
91
  /** 用户名称 */
62
92
  holder_title?: string;
63
93
  /** 用户ID */
@@ -84,12 +114,32 @@ export interface CartItem {
84
114
  resource_id?: string | number;
85
115
  /** 资源名称 */
86
116
  relation_form_name?: string;
87
- /** 原始数据 */
117
+ /** 定金 */
118
+ deposit?: {
119
+ /** 定金总价 */
120
+ total: number | string;
121
+ /** 定金协议 */
122
+ protocols: {
123
+ /** 定金协议ID */
124
+ id: number;
125
+ /** 定金协议标题 */
126
+ title: string;
127
+ }[];
128
+ } | null;
129
+ /** 接口原始数据 */
88
130
  _origin: any;
131
+ /** 商品加入购物车时初始数据 */
132
+ _productInit?: ProductData;
89
133
  /** 商品原始数据 */
90
134
  _productOrigin?: ProductData;
91
135
  /** 资源原始数据 */
92
136
  _resourceOrigin?: Resource[];
137
+ /** 容量 */
138
+ capacity?: any;
139
+ /** 商品套餐原始数据 */
140
+ _bundleOrigin?: any[];
141
+ /** 商品规格原始数据 */
142
+ _optionsOrigin?: any[];
93
143
  }
94
144
  /**
95
145
  * 购物车状态接口
@@ -111,6 +161,13 @@ export interface IAddItemParams {
111
161
  bundle?: any[];
112
162
  /** 商品规格信息 */
113
163
  options?: any[];
164
+ /** 日期 */
165
+ date?: {
166
+ /** 开始时间 */
167
+ startTime: string;
168
+ /** 结束时间 */
169
+ endTime: string;
170
+ };
114
171
  }
115
172
  /**
116
173
  * 更新购物车信息参数
@@ -124,14 +181,34 @@ export interface IUpdateItemParams {
124
181
  account?: Account;
125
182
  /** 商品 */
126
183
  product?: ProductData;
184
+ /** 商品套餐信息 */
185
+ bundle?: any[];
186
+ /** 商品规格信息 */
187
+ options?: any[];
127
188
  /** 折扣列表 */
128
189
  discounts?: IDiscount[];
129
190
  /** 数量 */
130
191
  quantity?: number;
131
192
  /** 资源 */
132
193
  resources?: Resource[];
194
+ /** 元数据 */
195
+ metadata?: any;
133
196
  /** 备注 */
134
197
  note?: string;
198
+ /** 日期 */
199
+ date?: {
200
+ /** 开始时间 */
201
+ startTime: string;
202
+ /** 结束时间 */
203
+ endTime: string;
204
+ };
205
+ /** 关联表单 */
206
+ relationForms?: {
207
+ /** 关联表单ID */
208
+ form_id: number;
209
+ /** 关联表单记录ID */
210
+ form_record_ids: number[];
211
+ }[];
135
212
  }
136
213
  /**
137
214
  * 折扣
@@ -19,7 +19,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/modules/Cart/types.ts
20
20
  var types_exports = {};
21
21
  __export(types_exports, {
22
- CartHooks: () => CartHooks
22
+ CartHooks: () => CartHooks,
23
+ ECartItemCheckType: () => ECartItemCheckType,
24
+ ECartItemInfoType: () => ECartItemInfoType
23
25
  });
24
26
  module.exports = __toCommonJS(types_exports);
25
27
  var CartHooks = /* @__PURE__ */ ((CartHooks2) => {
@@ -29,7 +31,23 @@ var CartHooks = /* @__PURE__ */ ((CartHooks2) => {
29
31
  CartHooks2["OnCartRemove"] = "card:onCartRemove";
30
32
  return CartHooks2;
31
33
  })(CartHooks || {});
34
+ var ECartItemInfoType = /* @__PURE__ */ ((ECartItemInfoType2) => {
35
+ ECartItemInfoType2["Resource"] = "resource";
36
+ ECartItemInfoType2["Time"] = "time";
37
+ ECartItemInfoType2["RelationForms"] = "relationForms";
38
+ ECartItemInfoType2["Holder"] = "holder";
39
+ return ECartItemInfoType2;
40
+ })(ECartItemInfoType || {});
41
+ var ECartItemCheckType = /* @__PURE__ */ ((ECartItemCheckType2) => {
42
+ ECartItemCheckType2["Account"] = "account";
43
+ ECartItemCheckType2["Resources"] = "resources";
44
+ ECartItemCheckType2["Date"] = "date";
45
+ ECartItemCheckType2["RelationForms"] = "relationForms";
46
+ return ECartItemCheckType2;
47
+ })(ECartItemCheckType || {});
32
48
  // Annotate the CommonJS export names for ESM import in node:
33
49
  0 && (module.exports = {
34
- CartHooks
50
+ CartHooks,
51
+ ECartItemCheckType,
52
+ ECartItemInfoType
35
53
  });
@@ -1,7 +1,8 @@
1
- import { Account } from "../Account";
2
- import { ProductData } from "../Product/types";
3
- import { Resource } from "../Resource/types";
4
- import { CartItem, IDiscount } from "./types";
1
+ import { Account } from '../Account';
2
+ import { ProductData } from '../Product/types';
3
+ import { Resource } from '../Resource/types';
4
+ import { CartItem, IDiscount } from './types';
5
+ import Decimal from 'decimal.js';
5
6
  /**
6
7
  * 生成一个唯一的 ID
7
8
  */
@@ -19,7 +20,6 @@ export declare const createCartItemOrigin: () => {
19
20
  sub_type: null;
20
21
  duration: null;
21
22
  like_status: string;
22
- relation_type: string;
23
23
  resources: null;
24
24
  schedule_id: number;
25
25
  start_date: null;
@@ -28,6 +28,7 @@ export declare const createCartItemOrigin: () => {
28
28
  end_time: null;
29
29
  end_date: null;
30
30
  metadata: {};
31
+ holder: null;
31
32
  };
32
33
  /**
33
34
  * 格式化商品到购物车
@@ -91,17 +92,48 @@ export declare const formatResourceToCartItemOrigin: (params: {
91
92
  resources: Resource[];
92
93
  }) => any;
93
94
  /**
94
- * 从购物车中删除资源相关信息
95
- * @param cartItem 购物车
96
- * @returns 删除后的购物车
95
+ * 格式化关联表单到购物车
96
+ * @param params 参数
97
+ * @returns 格式化后的购物车
97
98
  */
98
- export declare const deleteResourceFromCartItem: (cartItem: CartItem) => CartItem;
99
+ export declare const formatRelationFormsToCartItem: (params: {
100
+ cartItem: CartItem;
101
+ relationForms: {
102
+ form_id: number;
103
+ form_record_ids: number[];
104
+ }[];
105
+ }) => CartItem;
106
+ export declare const formatRelationFormsToCartItemOrigin: (params: {
107
+ cartItem: CartItem;
108
+ relationForms: {
109
+ form_id: number;
110
+ form_record_ids: number[];
111
+ }[];
112
+ }) => any;
99
113
  /**
100
- * 从购物车中删除时间
101
- * @param cartItem 购物车
102
- * @returns 删除后的购物车
114
+ * 格式化日期到购物车
115
+ * @param date 开始时间和结束时间
116
+ * @returns 格式化后的日期
103
117
  */
104
- export declare const deleteTimeFromCartItem: (cartItem: CartItem) => CartItem;
118
+ export declare const formatDateToCartItem: (params: {
119
+ cartItem: CartItem;
120
+ date: {
121
+ startTime: string;
122
+ endTime: string;
123
+ };
124
+ }) => CartItem;
125
+ /**
126
+ * 格式化日期到购物车原始数据
127
+ * @param date 开始时间和结束时间
128
+ * @returns 格式化后的日期原始数据
129
+ */
130
+ export declare const formatDateToCartItemOrigin: (params: {
131
+ cartItem: CartItem;
132
+ date: {
133
+ startTime: string;
134
+ endTime: string;
135
+ };
136
+ }) => any;
105
137
  /**
106
138
  * 格式化备注到购物车
107
139
  * @param params 参数
@@ -142,6 +174,7 @@ export declare const formatBundleToOrigin: (bundle: any) => any;
142
174
  export declare const isNormalProduct: (product: any) => boolean;
143
175
  /**
144
176
  * 获取商品总价
177
+ * @description 当前总价计算基于商品数量为1
145
178
  * @param item 商品
146
179
  * @returns 商品总价
147
180
  */
@@ -149,9 +182,11 @@ export declare const getProductTotalPrice: (params: {
149
182
  product: ProductData;
150
183
  bundle?: any;
151
184
  options?: any;
185
+ num?: number;
152
186
  }) => number;
153
187
  /**
154
188
  * 获取商品原始总价
189
+ * @description 当前总价计算基于商品数量为1
155
190
  * @param item 商品
156
191
  * @returns 商品原始总价
157
192
  */
@@ -159,4 +194,62 @@ export declare const getProductOriginTotalPrice: (params: {
159
194
  product: ProductData;
160
195
  bundle?: any;
161
196
  options?: any;
197
+ num?: number;
162
198
  }) => number | undefined;
199
+ /**
200
+ * 获取商品定金
201
+ * @description 定金基于商品售价来算,最终乘商品数量
202
+ * 1、如果套餐主商品有定金规则,则定金为:(套餐商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
203
+ * 2、如果套餐主商品没有定金规则,子商品有定金规则,则定金为:(套餐子商品售价 * 套餐子商品定金百分比 + 套餐子商品定金固定金额)* 商品数量,最终将所有子商品定金相加
204
+ * 3、普通商品/单规格商品/组合规则商品,定金规则:(商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
205
+ * @param params 参数
206
+ * @returns 商品定金
207
+ */
208
+ export declare const getProductDeposit: (params: {
209
+ cartItem: CartItem;
210
+ product: ProductData;
211
+ bundle?: any;
212
+ options?: any;
213
+ num?: number;
214
+ }) => {
215
+ total: number;
216
+ protocols: {
217
+ id: number;
218
+ title: string;
219
+ }[];
220
+ } | null;
221
+ /**
222
+ * 计算商品定金
223
+ * @param params 参数
224
+ * @returns 商品定金
225
+ */
226
+ export declare const handleProductDeposit: (params: {
227
+ depositData: {
228
+ deposit_fixed?: string;
229
+ deposit_percentage?: string;
230
+ };
231
+ total: string | number;
232
+ num: number;
233
+ }) => {
234
+ result: boolean;
235
+ depositTotal: Decimal;
236
+ };
237
+ /**
238
+ * 从购物车中删除资源相关信息
239
+ * @param cartItem 购物车
240
+ * @returns 删除后的购物车
241
+ */
242
+ export declare const deleteResourceFromCartItem: (cartItem: CartItem) => CartItem;
243
+ /**
244
+ * 从购物车中删除时间
245
+ * @param cartItem 购物车
246
+ * @returns 删除后的购物车
247
+ */
248
+ export declare const deleteTimeFromCartItem: (cartItem: CartItem) => CartItem;
249
+ /**
250
+ * 从购物车中删除关联表单信息
251
+ * @param cartItem 购物车
252
+ * @returns 删除后的购物车
253
+ */
254
+ export declare const deleteRelationFormsFromCartItem: (cartItem: CartItem) => CartItem;
255
+ export declare const deleteHolderFromCartItem: (cartItem: CartItem) => CartItem;