@pisell/pisellos 1.0.5 → 1.0.7
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.
- package/dist/modules/Cart/index.d.ts +14 -0
- package/dist/modules/Cart/index.js +36 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -1
- package/dist/modules/Cart/utils/changePrice.d.ts +3 -0
- package/dist/modules/Cart/utils/changePrice.js +100 -0
- package/dist/modules/Date/index.js +57 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +15 -7
- package/dist/modules/Discount/types.d.ts +10 -0
- package/dist/modules/ProductList/index.d.ts +7 -0
- package/dist/modules/ProductList/index.js +102 -39
- package/dist/modules/Rules/index.js +59 -24
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +9 -1
- package/dist/modules/Schedule/index.js +121 -1
- package/dist/modules/Schedule/types.d.ts +13 -0
- package/dist/solution/BookingByStep/index.d.ts +120 -30
- package/dist/solution/BookingByStep/index.js +749 -1083
- package/dist/solution/BookingByStep/utils/capacity.d.ts +47 -0
- package/dist/solution/BookingByStep/utils/capacity.js +132 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +29 -31
- package/dist/solution/BookingByStep/utils/resources.js +39 -94
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +11 -0
- package/dist/solution/BookingByStep/utils/timeslots.js +15 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +63 -24
- package/lib/modules/Cart/index.d.ts +14 -0
- package/lib/modules/Cart/index.js +32 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -1
- package/lib/modules/Cart/utils/changePrice.d.ts +3 -0
- package/lib/modules/Cart/utils/changePrice.js +64 -0
- package/lib/modules/Date/index.js +62 -10
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +18 -6
- package/lib/modules/Discount/types.d.ts +10 -0
- package/lib/modules/ProductList/index.d.ts +7 -0
- package/lib/modules/ProductList/index.js +45 -0
- package/lib/modules/Rules/index.js +59 -22
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +9 -1
- package/lib/modules/Schedule/index.js +78 -0
- package/lib/modules/Schedule/types.d.ts +13 -0
- package/lib/solution/BookingByStep/index.d.ts +120 -30
- package/lib/solution/BookingByStep/index.js +379 -581
- package/lib/solution/BookingByStep/utils/capacity.d.ts +47 -0
- package/lib/solution/BookingByStep/utils/capacity.js +106 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +29 -31
- package/lib/solution/BookingByStep/utils/resources.js +23 -59
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +11 -0
- package/lib/solution/BookingByStep/utils/timeslots.js +7 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +68 -18
- 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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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 |
|
|
121
|
+
getActiveAccount(): Account | undefined;
|
|
77
122
|
removeAccount(id: string): void;
|
|
78
123
|
/**
|
|
79
124
|
* 获取holder类型账户列表
|
|
@@ -126,7 +171,60 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
126
171
|
cover?: boolean;
|
|
127
172
|
}): Promise<void>;
|
|
128
173
|
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;
|
|
129
218
|
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;
|
|
130
228
|
deleteCart(cartItemId: string): void;
|
|
131
229
|
clearCart(): void;
|
|
132
230
|
clearCartByAccount(account_id: string): void;
|
|
@@ -147,7 +245,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
147
245
|
checkCartItems(type: ECartItemCheckType): string[];
|
|
148
246
|
destroy(): void;
|
|
149
247
|
getResourcesList(): any[];
|
|
248
|
+
/**
|
|
249
|
+
* 在日期那边点击下一步的时候,检查这一天购物车里的商品是不是都有资源可以用
|
|
250
|
+
*
|
|
251
|
+
* @return {*}
|
|
252
|
+
* @memberof BookingByStepImpl
|
|
253
|
+
*/
|
|
150
254
|
checkResourceListForDate(): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* 给单个购物车里的商品获取资源列表,给 UI 用的
|
|
257
|
+
*
|
|
258
|
+
* @param {(string | number)} id
|
|
259
|
+
* @return {*}
|
|
260
|
+
* @memberof BookingByStepImpl
|
|
261
|
+
*/
|
|
151
262
|
getResourcesListByCartItem(id: string | number): {
|
|
152
263
|
id: number | undefined;
|
|
153
264
|
_id: string;
|
|
@@ -156,11 +267,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
156
267
|
holder_id: string | number | undefined;
|
|
157
268
|
holder_name: string | undefined;
|
|
158
269
|
} | undefined;
|
|
159
|
-
getResourceTimeSlot({ product, resources, currentResourceId, }: {
|
|
160
|
-
product: ProductData;
|
|
161
|
-
resources: any[];
|
|
162
|
-
currentResourceId: number;
|
|
163
|
-
}): TimeSliceItem[];
|
|
164
270
|
autoSelectAccountResources({ cartItem, holder_id, resources_code, timeSlots, countMap, capacity, }: {
|
|
165
271
|
cartItem: CartItem;
|
|
166
272
|
holder_id: string;
|
|
@@ -204,14 +310,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
204
310
|
count: number;
|
|
205
311
|
left: number;
|
|
206
312
|
}[];
|
|
207
|
-
addProductToCart({ product, date, account, }: {
|
|
208
|
-
product: ProductData;
|
|
209
|
-
date: {
|
|
210
|
-
startTime: string;
|
|
211
|
-
endTime: string;
|
|
212
|
-
};
|
|
213
|
-
account: Account;
|
|
214
|
-
}): void;
|
|
215
313
|
setOtherData(key: string, value: any): void;
|
|
216
314
|
getOtherData(key: string): any;
|
|
217
315
|
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
@@ -235,14 +333,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
235
333
|
scheduleIds?: number[];
|
|
236
334
|
resources?: ProductResourceItem[];
|
|
237
335
|
}): 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
336
|
getAvailableDateForSessionOptimize(params?: {
|
|
247
337
|
startDate?: string;
|
|
248
338
|
endDate?: string;
|