@pisell/pisellos 3.0.41 → 3.0.43

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 (61) hide show
  1. package/dist/modules/AccountList/index.js +17 -12
  2. package/dist/modules/Cart/index.d.ts +14 -0
  3. package/dist/modules/Cart/index.js +38 -1
  4. package/dist/modules/Cart/utils/cartProduct.d.ts +3 -0
  5. package/dist/modules/Cart/utils/cartProduct.js +28 -8
  6. package/dist/modules/Cart/utils/changePrice.d.ts +3 -0
  7. package/dist/modules/Cart/utils/changePrice.js +104 -0
  8. package/dist/modules/Date/index.js +74 -10
  9. package/dist/modules/Date/types.d.ts +2 -0
  10. package/dist/modules/Discount/index.d.ts +1 -0
  11. package/dist/modules/Discount/index.js +13 -6
  12. package/dist/modules/Discount/types.d.ts +10 -0
  13. package/dist/modules/ProductList/index.d.ts +7 -0
  14. package/dist/modules/ProductList/index.js +102 -39
  15. package/dist/modules/Rules/index.js +218 -80
  16. package/dist/modules/Rules/types.d.ts +7 -1
  17. package/dist/modules/Schedule/index.d.ts +9 -1
  18. package/dist/modules/Schedule/index.js +122 -2
  19. package/dist/modules/Schedule/types.d.ts +13 -0
  20. package/dist/modules/Schedule/utils.js +4 -0
  21. package/dist/solution/BookingByStep/index.d.ts +121 -30
  22. package/dist/solution/BookingByStep/index.js +760 -1065
  23. package/dist/solution/BookingByStep/utils/capacity.d.ts +47 -0
  24. package/dist/solution/BookingByStep/utils/capacity.js +132 -0
  25. package/dist/solution/BookingByStep/utils/resources.d.ts +21 -29
  26. package/dist/solution/BookingByStep/utils/resources.js +39 -95
  27. package/dist/solution/BookingByStep/utils/timeslots.d.ts +11 -0
  28. package/dist/solution/BookingByStep/utils/timeslots.js +15 -0
  29. package/dist/solution/ShopDiscount/index.d.ts +2 -0
  30. package/dist/solution/ShopDiscount/index.js +119 -44
  31. package/lib/modules/AccountList/index.js +4 -0
  32. package/lib/modules/Cart/index.d.ts +14 -0
  33. package/lib/modules/Cart/index.js +34 -1
  34. package/lib/modules/Cart/utils/cartProduct.d.ts +3 -0
  35. package/lib/modules/Cart/utils/cartProduct.js +20 -8
  36. package/lib/modules/Cart/utils/changePrice.d.ts +3 -0
  37. package/lib/modules/Cart/utils/changePrice.js +78 -0
  38. package/lib/modules/Date/index.js +62 -5
  39. package/lib/modules/Date/types.d.ts +2 -0
  40. package/lib/modules/Discount/index.d.ts +1 -0
  41. package/lib/modules/Discount/index.js +17 -6
  42. package/lib/modules/Discount/types.d.ts +10 -0
  43. package/lib/modules/ProductList/index.d.ts +7 -0
  44. package/lib/modules/ProductList/index.js +45 -0
  45. package/lib/modules/Rules/index.js +154 -63
  46. package/lib/modules/Rules/types.d.ts +7 -1
  47. package/lib/modules/Schedule/index.d.ts +9 -1
  48. package/lib/modules/Schedule/index.js +79 -1
  49. package/lib/modules/Schedule/types.d.ts +13 -0
  50. package/lib/modules/Schedule/utils.js +4 -1
  51. package/lib/solution/BookingByStep/index.d.ts +121 -30
  52. package/lib/solution/BookingByStep/index.js +395 -585
  53. package/lib/solution/BookingByStep/utils/capacity.d.ts +47 -0
  54. package/lib/solution/BookingByStep/utils/capacity.js +106 -0
  55. package/lib/solution/BookingByStep/utils/resources.d.ts +21 -29
  56. package/lib/solution/BookingByStep/utils/resources.js +21 -58
  57. package/lib/solution/BookingByStep/utils/timeslots.d.ts +11 -0
  58. package/lib/solution/BookingByStep/utils/timeslots.js +7 -0
  59. package/lib/solution/ShopDiscount/index.d.ts +2 -0
  60. package/lib/solution/ShopDiscount/index.js +91 -19
  61. package/package.json +1 -1
@@ -8,6 +8,7 @@ import { IStep } from '../../modules/Step/tyeps';
8
8
  import { TimeSliceItem, ResourceItem } from './utils/resources';
9
9
  import { ITime } from '../../modules/Date/types';
10
10
  import dayjs from 'dayjs';
11
+ import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
11
12
  import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
12
13
  export declare class BookingByStepImpl extends BaseModule implements Module {
13
14
  protected defaultName: string;
@@ -42,26 +43,70 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
42
43
  * 更新step
43
44
  */
44
45
  updateStep(key: string, step: IStep): void;
46
+ /**
47
+ *
48
+ * 加载商品,然后导到商品列表里去
49
+ * @param {({
50
+ * category_ids?: number[];
51
+ * product_ids?: number[];
52
+ * collection?: number | string[];
53
+ * schedule_date?: string;
54
+ * })} {
55
+ * category_ids = [],
56
+ * product_ids = [],
57
+ * collection = [],
58
+ * schedule_date,
59
+ * }
60
+ * @return {*}
61
+ * @memberof BookingByStepImpl
62
+ */
45
63
  loadProducts({ category_ids, product_ids, collection, schedule_date, }: {
46
64
  category_ids?: number[];
47
65
  product_ids?: number[];
48
66
  collection?: number | string[];
49
67
  schedule_date?: string;
50
68
  }): Promise<any>;
69
+ /**
70
+ * 通过 schedule 来读取商品,适用于 session 类商品
71
+ *
72
+ * @param {{
73
+ * date: string;
74
+ * product_ids?: number[];
75
+ * category_ids?: number[];
76
+ * }} {
77
+ * date,
78
+ * product_ids = [],
79
+ * category_ids = [],
80
+ * }
81
+ * @return {*}
82
+ * @memberof BookingByStepImpl
83
+ */
51
84
  loadProductByScheduleDate({ date, product_ids, category_ids, }: {
52
85
  date: string;
53
86
  product_ids?: number[];
54
87
  category_ids?: number[];
55
88
  }): Promise<any>;
89
+ /**
90
+ * 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
91
+ *
92
+ * @param {string} date
93
+ * @memberof BookingByStepImpl
94
+ */
56
95
  updateQuotationPriceAndCart(date: string): Promise<void>;
57
- loadAllSchedule(): Promise<void>;
58
- loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: {
59
- startDate: string;
60
- endDate: string;
61
- custom_page_id?: number;
62
- channel?: string;
63
- }): Promise<ITime[]>;
64
- storeProduct(productData: ProductData): Promise<void>;
96
+ /**
97
+ * ui 层提供日期的起始范围,返回一个起始范围内日期的可用情况
98
+ * 适用于先选日期的流程,确定日期是否可用
99
+ * 已知问题:如果挂接的商品的资源不可用,后端是不会计算的
100
+ *
101
+ * @param {LoadScheduleAvailableDateParams} {
102
+ * startDate,
103
+ * endDate,
104
+ * custom_page_id,
105
+ * channel,
106
+ * }
107
+ * @memberof BookingByStepImpl
108
+ */
109
+ loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: LoadScheduleAvailableDateParams): Promise<ITime[]>;
65
110
  addAccount(account: Account | IHolder, extra?: {
66
111
  type: 'account' | 'holder';
67
112
  customerId: number;
@@ -73,7 +118,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
73
118
  getAccounts(): Promise<(Account | null)[]>;
74
119
  checkHasLoginAccount(): boolean;
75
120
  setActiveAccount(id: string): void;
76
- getActiveAccount(): Account | null;
121
+ getActiveAccount(): Account | undefined;
77
122
  removeAccount(id: string): void;
78
123
  /**
79
124
  * 获取holder类型账户列表
@@ -86,6 +131,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
86
131
  getCart(): CartItem[];
87
132
  getAvailableDate(params?: {
88
133
  url?: string;
134
+ useCache?: boolean;
89
135
  products?: ProductData[];
90
136
  startDate?: string;
91
137
  endDate?: string;
@@ -126,7 +172,60 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
126
172
  cover?: boolean;
127
173
  }): Promise<void>;
128
174
  getOtherParams(): Promise<Record<string, any>>;
175
+ /**
176
+ * 往购物车加商品数据(duration 类、普通商品)
177
+ * 老接口,先不删,怕 UI 有问题,直接桥接到新接口addProductToCart上
178
+ *
179
+ * @param {ProductData} productData
180
+ * @memberof BookingByStepImpl
181
+ */
182
+ storeProduct(productData: ProductData): Promise<void>;
183
+ /**
184
+ * 往购物车加商品数据
185
+ *
186
+ * @param {({
187
+ * product: ProductData;
188
+ * date?: { startTime: string; endTime: string } | null;
189
+ * account?: Account | null;
190
+ * })} {
191
+ * product,
192
+ * date,
193
+ * account,
194
+ * }
195
+ * @return {*}
196
+ * @memberof BookingByStepImpl
197
+ */
198
+ addProductToCart({ product, date, account, }: {
199
+ product: ProductData;
200
+ date?: {
201
+ startTime: string;
202
+ endTime: string;
203
+ } | null;
204
+ account?: Account | null;
205
+ }): void;
206
+ /**
207
+ * 添加完购物车以后做的一些检测,比如日期是否在同一天
208
+ *
209
+ * @param {({ date?: { startTime: string; endTime: string } | null })} { date }
210
+ * @memberof BookingByStepImpl
211
+ */
212
+ addProductCheck({ date, }: {
213
+ date?: {
214
+ startTime: string;
215
+ endTime: string;
216
+ } | null;
217
+ }): void;
218
+ beforeUpdateCart(params: IUpdateItemParams, targetCartItem: CartItem): void;
129
219
  updateCart(params: IUpdateItemParams): void;
220
+ /**
221
+ * 更新购物车以后的一些操作,比如检测资源是否重复,检测资源容量是否足够
222
+ *
223
+ * @param {IUpdateItemParams} params
224
+ * @param {CartItem} targetCartItem
225
+ * @return {*}
226
+ * @memberof BookingByStepImpl
227
+ */
228
+ updateCartCheck(params: IUpdateItemParams, targetCartItem: CartItem): void;
130
229
  deleteCart(cartItemId: string): void;
131
230
  clearCart(): void;
132
231
  clearCartByAccount(account_id: string): void;
@@ -147,7 +246,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
147
246
  checkCartItems(type: ECartItemCheckType): string[];
148
247
  destroy(): void;
149
248
  getResourcesList(): any[];
249
+ /**
250
+ * 在日期那边点击下一步的时候,检查这一天购物车里的商品是不是都有资源可以用
251
+ *
252
+ * @return {*}
253
+ * @memberof BookingByStepImpl
254
+ */
150
255
  checkResourceListForDate(): boolean;
256
+ /**
257
+ * 给单个购物车里的商品获取资源列表,给 UI 用的
258
+ *
259
+ * @param {(string | number)} id
260
+ * @return {*}
261
+ * @memberof BookingByStepImpl
262
+ */
151
263
  getResourcesListByCartItem(id: string | number): {
152
264
  id: number | undefined;
153
265
  _id: string;
@@ -156,11 +268,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
156
268
  holder_id: string | number | undefined;
157
269
  holder_name: string | undefined;
158
270
  } | undefined;
159
- getResourceTimeSlot({ product, resources, currentResourceId, }: {
160
- product: ProductData;
161
- resources: any[];
162
- currentResourceId: number;
163
- }): TimeSliceItem[];
164
271
  autoSelectAccountResources({ cartItem, holder_id, resources_code, timeSlots, countMap, capacity, }: {
165
272
  cartItem: CartItem;
166
273
  holder_id: string;
@@ -204,14 +311,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
204
311
  count: number;
205
312
  left: number;
206
313
  }[];
207
- addProductToCart({ product, date, account, }: {
208
- product: ProductData;
209
- date: {
210
- startTime: string;
211
- endTime: string;
212
- };
213
- account: Account;
214
- }): void;
215
314
  setOtherData(key: string, value: any): void;
216
315
  getOtherData(key: string): any;
217
316
  getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
@@ -235,14 +334,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
235
334
  scheduleIds?: number[];
236
335
  resources?: ProductResourceItem[];
237
336
  }): Promise<Record<string, TimeSliceItem[]>>;
238
- getAvailableDateForSession(params?: {
239
- startDate?: string;
240
- endDate?: string;
241
- type?: 'month';
242
- }): Promise<{
243
- dateList: ITime[];
244
- firstAvailableDate: ITime | undefined;
245
- }>;
246
337
  getAvailableDateForSessionOptimize(params?: {
247
338
  startDate?: string;
248
339
  endDate?: string;