@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.
- package/dist/modules/Account/index.d.ts +2 -6
- package/dist/modules/Account/index.js +21 -103
- package/dist/modules/Account/types.d.ts +12 -1
- package/dist/modules/AccountList/index.d.ts +20 -1
- package/dist/modules/AccountList/index.js +243 -75
- package/dist/modules/AccountList/types.d.ts +33 -1
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/AccountList/utils.d.ts +9 -0
- package/dist/modules/AccountList/utils.js +25 -0
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +1 -1
- package/dist/modules/Cart/index.d.ts +8 -5
- package/dist/modules/Cart/index.js +101 -25
- package/dist/modules/Cart/types.d.ts +82 -5
- package/dist/modules/Cart/types.js +22 -0
- package/dist/modules/Cart/utils.d.ts +106 -13
- package/dist/modules/Cart/utils.js +289 -76
- package/dist/modules/Date/index.d.ts +6 -6
- package/dist/modules/Date/index.js +41 -58
- package/dist/modules/Date/types.d.ts +22 -6
- package/dist/modules/Date/utils.d.ts +4 -3
- package/dist/modules/Date/utils.js +81 -30
- package/dist/modules/Discount/index.d.ts +4 -4
- package/dist/modules/Discount/index.js +11 -11
- package/dist/modules/Order/index.d.ts +11 -5
- package/dist/modules/Order/index.js +47 -18
- package/dist/modules/Order/types.d.ts +10 -3
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +15 -0
- package/dist/modules/Product/index.d.ts +14 -1
- package/dist/modules/Product/index.js +35 -0
- package/dist/modules/Product/types.d.ts +27 -3
- package/dist/modules/ProductList/index.js +11 -5
- package/dist/modules/Resource/types.d.ts +1 -0
- package/dist/modules/Resource/utils.js +1 -1
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +121 -53
- package/dist/modules/Rules/types.d.ts +5 -1
- package/dist/modules/Schedule/index.d.ts +18 -0
- package/dist/modules/Schedule/index.js +111 -0
- package/dist/modules/Schedule/type.d.ts +157 -0
- package/dist/modules/Schedule/type.js +1 -0
- package/dist/modules/Schedule/types.d.ts +182 -0
- package/dist/modules/Schedule/types.js +1 -0
- package/dist/modules/Schedule/utils.d.ts +67 -0
- package/dist/modules/Schedule/utils.js +729 -0
- package/dist/modules/Step/index.d.ts +14 -3
- package/dist/modules/Step/index.js +54 -2
- package/dist/modules/Summary/index.d.ts +12 -5
- package/dist/modules/Summary/index.js +33 -7
- package/dist/modules/Summary/types.d.ts +23 -2
- package/dist/modules/Summary/utils.d.ts +14 -4
- package/dist/modules/Summary/utils.js +46 -4
- package/dist/modules/index.d.ts +10 -0
- package/dist/modules/index.js +11 -1
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/request.d.ts +3 -3
- package/dist/plugins/request.js +30 -30
- package/dist/plugins/shopStore.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +97 -24
- package/dist/solution/BookingByStep/index.js +1024 -322
- package/dist/solution/BookingByStep/types.d.ts +3 -10
- package/dist/solution/BookingByStep/types.js +11 -15
- package/dist/solution/BookingByStep/utils/products.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/products.js +3 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +60 -6
- package/dist/solution/BookingByStep/utils/resources.js +293 -52
- package/dist/solution/ShopDiscount/index.d.ts +4 -4
- package/dist/solution/ShopDiscount/index.js +16 -16
- package/dist/solution/ShopDiscount/types.d.ts +2 -2
- package/dist/solution/ShopDiscount/utils.js +1 -1
- package/lib/core/index.js +7 -2
- package/lib/modules/Account/index.d.ts +2 -6
- package/lib/modules/Account/index.js +15 -30
- package/lib/modules/Account/types.d.ts +12 -1
- package/lib/modules/AccountList/index.d.ts +20 -1
- package/lib/modules/AccountList/index.js +122 -13
- package/lib/modules/AccountList/types.d.ts +33 -1
- package/lib/modules/AccountList/utils.d.ts +9 -0
- package/lib/modules/AccountList/utils.js +39 -0
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +14 -3
- package/lib/modules/Cart/index.d.ts +8 -5
- package/lib/modules/Cart/index.js +81 -8
- package/lib/modules/Cart/types.d.ts +82 -5
- package/lib/modules/Cart/types.js +20 -2
- package/lib/modules/Cart/utils.d.ts +106 -13
- package/lib/modules/Cart/utils.js +188 -45
- package/lib/modules/Date/index.d.ts +6 -6
- package/lib/modules/Date/index.js +13 -28
- package/lib/modules/Date/types.d.ts +22 -6
- package/lib/modules/Date/utils.d.ts +4 -3
- package/lib/modules/Date/utils.js +47 -13
- package/lib/modules/Discount/index.d.ts +4 -4
- package/lib/modules/Discount/index.js +9 -2
- package/lib/modules/Guests/index.js +4 -1
- package/lib/modules/Order/index.d.ts +11 -5
- package/lib/modules/Order/index.js +24 -3
- package/lib/modules/Order/types.d.ts +10 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +45 -0
- package/lib/modules/Payment/index.js +1 -6
- package/lib/modules/Product/index.d.ts +14 -1
- package/lib/modules/Product/index.js +19 -0
- package/lib/modules/Product/types.d.ts +27 -3
- package/lib/modules/ProductList/index.js +21 -7
- package/lib/modules/Resource/index.js +4 -1
- package/lib/modules/Resource/types.d.ts +1 -0
- package/lib/modules/Resource/utils.js +7 -4
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +118 -43
- package/lib/modules/Rules/types.d.ts +5 -1
- package/lib/modules/Schedule/index.d.ts +18 -0
- package/lib/modules/Schedule/index.js +81 -0
- package/lib/modules/Schedule/type.d.ts +157 -0
- package/lib/modules/Schedule/type.js +17 -0
- package/lib/modules/Schedule/types.d.ts +182 -0
- package/lib/modules/Schedule/types.js +17 -0
- package/lib/modules/Schedule/utils.d.ts +67 -0
- package/lib/modules/Schedule/utils.js +600 -0
- package/lib/modules/Step/index.d.ts +14 -3
- package/lib/modules/Step/index.js +38 -1
- package/lib/modules/Summary/index.d.ts +12 -5
- package/lib/modules/Summary/index.js +15 -1
- package/lib/modules/Summary/types.d.ts +23 -2
- package/lib/modules/Summary/utils.d.ts +14 -4
- package/lib/modules/Summary/utils.js +30 -1
- package/lib/modules/index.d.ts +10 -0
- package/lib/modules/index.js +21 -1
- package/lib/plugins/index.d.ts +3 -3
- package/lib/plugins/request.d.ts +3 -3
- package/lib/plugins/request.js +48 -11
- package/lib/plugins/shopStore.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +97 -24
- package/lib/solution/BookingByStep/index.js +693 -145
- package/lib/solution/BookingByStep/types.d.ts +3 -10
- package/lib/solution/BookingByStep/types.js +37 -14
- package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/products.js +3 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +60 -6
- package/lib/solution/BookingByStep/utils/resources.js +286 -54
- package/lib/solution/BuyTickets/index.js +34 -20
- package/lib/solution/ShopDiscount/index.d.ts +4 -4
- package/lib/solution/ShopDiscount/index.js +10 -2
- package/lib/solution/ShopDiscount/types.d.ts +2 -2
- package/package.json +4 -2
- package/dist/core/index.d.ts.map +0 -1
- package/dist/effects/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/modules/Account/index.d.ts.map +0 -1
- package/dist/modules/Account/types.d.ts.map +0 -1
- package/dist/modules/AccountList/types.d.ts.map +0 -1
- package/dist/modules/Cart/index.d.ts.map +0 -1
- package/dist/modules/Cart/types.d.ts.map +0 -1
- package/dist/modules/Date/types.d.ts.map +0 -1
- package/dist/modules/Date/utils.d.ts.map +0 -1
- package/dist/modules/Guests/index.d.ts.map +0 -1
- package/dist/modules/Guests/types.d.ts.map +0 -1
- package/dist/modules/Order/index.d.ts.map +0 -1
- package/dist/modules/Order/types.d.ts.map +0 -1
- package/dist/modules/Payment/index.d.ts.map +0 -1
- package/dist/modules/Payment/types.d.ts.map +0 -1
- package/dist/modules/Product/index.d.ts.map +0 -1
- package/dist/modules/Product/types.d.ts.map +0 -1
- package/dist/modules/ProductList/types.d.ts.map +0 -1
- package/dist/modules/Resource/index.d.ts.map +0 -1
- package/dist/modules/Resource/types.d.ts.map +0 -1
- package/dist/modules/Resource/utils.d.ts.map +0 -1
- package/dist/modules/Rules/types.d.ts.map +0 -1
- package/dist/modules/Step/index.d.ts.map +0 -1
- package/dist/modules/Step/tyeps.d.ts.map +0 -1
- package/dist/modules/Summary/index.d.ts.map +0 -1
- package/dist/modules/Summary/types.d.ts.map +0 -1
- package/dist/modules/Summary/utils.d.ts.map +0 -1
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/request.d.ts.map +0 -1
- package/dist/plugins/shopStore.d.ts.map +0 -1
- package/dist/plugins/window.d.ts.map +0 -1
- package/dist/solution/BookingByStep/types.d.ts.map +0 -1
- package/dist/solution/BookingByStep/utils/products.d.ts.map +0 -1
- package/dist/solution/BuyTickets/index.d.ts.map +0 -1
- package/dist/solution/BuyTickets/types.d.ts.map +0 -1
- package/dist/solution/PlaceOrder/index.d.ts.map +0 -1
- package/dist/solution/ShopDiscount/types.d.ts.map +0 -1
- package/dist/solution/ShopDiscount/utils.d.ts.map +0 -1
- package/dist/solution/index.d.ts.map +0 -1
- package/dist/store/createStore.d.ts.map +0 -1
- 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 {
|
|
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(
|
|
233
|
+
deleteCartItemInfo(type, _id) {
|
|
200
234
|
const list = this.store.list.map((item) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
|
2
|
-
import { Account } from
|
|
3
|
-
import { Resource } from
|
|
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?:
|
|
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
|
|
2
|
-
import { ProductData } from
|
|
3
|
-
import { Resource } from
|
|
4
|
-
import { CartItem, IDiscount } from
|
|
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
|
|
96
|
-
* @returns
|
|
95
|
+
* 格式化关联表单到购物车
|
|
96
|
+
* @param params 参数
|
|
97
|
+
* @returns 格式化后的购物车
|
|
97
98
|
*/
|
|
98
|
-
export declare const
|
|
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
|
|
102
|
-
* @returns
|
|
114
|
+
* 格式化日期到购物车
|
|
115
|
+
* @param date 开始时间和结束时间
|
|
116
|
+
* @returns 格式化后的日期
|
|
103
117
|
*/
|
|
104
|
-
export declare const
|
|
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;
|