@pisell/pisellos 1.0.0 → 1.0.2

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