@pisell/pisellos 0.0.10 → 0.0.13

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 (130) hide show
  1. package/dist/modules/Account/index.d.ts +4 -2
  2. package/dist/modules/Account/index.js +23 -36
  3. package/dist/modules/Account/types.d.ts +1 -0
  4. package/dist/modules/AccountList/index.d.ts +2 -0
  5. package/dist/modules/AccountList/index.js +34 -11
  6. package/dist/modules/Cart/index.d.ts +17 -11
  7. package/dist/modules/Cart/index.js +179 -121
  8. package/dist/modules/Cart/types.d.ts +98 -9
  9. package/dist/modules/Cart/types.js +8 -0
  10. package/dist/modules/Cart/utils.d.ts +114 -0
  11. package/dist/modules/Cart/utils.js +345 -0
  12. package/dist/modules/Date/index.d.ts +11 -12
  13. package/dist/modules/Date/index.js +104 -60
  14. package/dist/modules/Date/types.d.ts +51 -20
  15. package/dist/modules/Date/types.js +2 -5
  16. package/dist/modules/Date/utils.d.ts +35 -0
  17. package/dist/modules/Date/utils.js +211 -0
  18. package/dist/modules/Discount/index.d.ts +26 -0
  19. package/dist/modules/Discount/index.js +234 -0
  20. package/dist/modules/Discount/types.d.ts +66 -0
  21. package/dist/modules/Discount/types.js +5 -0
  22. package/dist/modules/Order/index.d.ts +16 -12
  23. package/dist/modules/Order/index.js +38 -166
  24. package/dist/modules/Order/types.d.ts +18 -41
  25. package/dist/modules/Order/types.js +0 -14
  26. package/dist/modules/Payment/index.d.ts +0 -2
  27. package/dist/modules/Payment/index.js +45 -76
  28. package/dist/modules/Payment/types.d.ts +0 -2
  29. package/dist/modules/Payment/types.js +2 -0
  30. package/dist/modules/Product/types.d.ts +48 -1
  31. package/dist/modules/ProductList/index.d.ts +1 -0
  32. package/dist/modules/ProductList/index.js +21 -1
  33. package/dist/modules/ProductList/types.d.ts +1 -0
  34. package/dist/modules/Resource/types.d.ts +6 -2
  35. package/dist/modules/Rules/index.d.ts +32 -0
  36. package/dist/modules/Rules/index.js +423 -0
  37. package/dist/modules/Rules/types.d.ts +46 -0
  38. package/dist/modules/Rules/types.js +5 -0
  39. package/dist/modules/Summary/index.d.ts +13 -0
  40. package/dist/modules/Summary/index.js +80 -0
  41. package/dist/modules/Summary/types.d.ts +13 -0
  42. package/dist/modules/Summary/types.js +1 -0
  43. package/dist/modules/Summary/utils.d.ts +19 -0
  44. package/dist/modules/Summary/utils.js +56 -0
  45. package/dist/plugins/index.d.ts +3 -2
  46. package/dist/plugins/index.js +2 -1
  47. package/dist/plugins/request.d.ts +4 -3
  48. package/dist/plugins/request.js +30 -30
  49. package/dist/plugins/shopStore.d.ts +4 -0
  50. package/dist/plugins/shopStore.js +1 -0
  51. package/dist/solution/BookingByStep/index.d.ts +73 -12
  52. package/dist/solution/BookingByStep/index.js +635 -99
  53. package/dist/solution/BookingByStep/types.d.ts +2 -0
  54. package/dist/solution/BookingByStep/types.js +11 -8
  55. package/dist/solution/BookingByStep/utils/products.d.ts +11 -0
  56. package/dist/solution/BookingByStep/utils/products.js +47 -0
  57. package/dist/solution/BookingByStep/utils/resources.d.ts +59 -10
  58. package/dist/solution/BookingByStep/utils/resources.js +144 -79
  59. package/dist/solution/ShopDiscount/index.d.ts +50 -0
  60. package/dist/solution/ShopDiscount/index.js +546 -0
  61. package/dist/solution/ShopDiscount/types.d.ts +24 -0
  62. package/dist/solution/ShopDiscount/types.js +10 -0
  63. package/dist/solution/ShopDiscount/utils.d.ts +1 -0
  64. package/dist/solution/ShopDiscount/utils.js +7 -0
  65. package/dist/solution/index.d.ts +1 -0
  66. package/dist/solution/index.js +2 -1
  67. package/lib/modules/Account/index.d.ts +4 -2
  68. package/lib/modules/Account/index.js +14 -3
  69. package/lib/modules/Account/types.d.ts +1 -0
  70. package/lib/modules/AccountList/index.d.ts +2 -0
  71. package/lib/modules/AccountList/index.js +17 -0
  72. package/lib/modules/Cart/index.d.ts +17 -11
  73. package/lib/modules/Cart/index.js +72 -21
  74. package/lib/modules/Cart/types.d.ts +98 -9
  75. package/lib/modules/Cart/utils.d.ts +114 -0
  76. package/lib/modules/Cart/utils.js +320 -0
  77. package/lib/modules/Date/index.d.ts +11 -12
  78. package/lib/modules/Date/index.js +50 -31
  79. package/lib/modules/Date/types.d.ts +51 -20
  80. package/lib/modules/Date/types.js +0 -4
  81. package/lib/modules/Date/utils.d.ts +35 -0
  82. package/lib/modules/Date/utils.js +167 -0
  83. package/lib/modules/Discount/index.d.ts +26 -0
  84. package/lib/modules/Discount/index.js +118 -0
  85. package/lib/modules/Discount/types.d.ts +66 -0
  86. package/lib/modules/Discount/types.js +33 -0
  87. package/lib/modules/Order/index.d.ts +16 -12
  88. package/lib/modules/Order/index.js +23 -51
  89. package/lib/modules/Order/types.d.ts +18 -41
  90. package/lib/modules/Payment/index.d.ts +0 -2
  91. package/lib/modules/Payment/index.js +6 -17
  92. package/lib/modules/Payment/types.d.ts +0 -2
  93. package/lib/modules/Product/types.d.ts +48 -1
  94. package/lib/modules/ProductList/index.d.ts +1 -0
  95. package/lib/modules/ProductList/index.js +4 -0
  96. package/lib/modules/ProductList/types.d.ts +1 -0
  97. package/lib/modules/Resource/types.d.ts +6 -2
  98. package/lib/modules/Rules/index.d.ts +32 -0
  99. package/lib/modules/Rules/index.js +283 -0
  100. package/lib/modules/Rules/types.d.ts +46 -0
  101. package/lib/modules/Rules/types.js +33 -0
  102. package/lib/modules/Summary/index.d.ts +13 -0
  103. package/lib/modules/Summary/index.js +49 -0
  104. package/lib/modules/Summary/types.d.ts +13 -0
  105. package/lib/modules/Summary/types.js +17 -0
  106. package/lib/modules/Summary/utils.d.ts +19 -0
  107. package/lib/modules/Summary/utils.js +79 -0
  108. package/lib/plugins/index.d.ts +3 -2
  109. package/lib/plugins/index.js +3 -1
  110. package/lib/plugins/request.d.ts +4 -3
  111. package/lib/plugins/request.js +4 -20
  112. package/lib/plugins/shopStore.d.ts +4 -0
  113. package/lib/plugins/shopStore.js +17 -0
  114. package/lib/solution/BookingByStep/index.d.ts +73 -12
  115. package/lib/solution/BookingByStep/index.js +451 -24
  116. package/lib/solution/BookingByStep/types.d.ts +2 -0
  117. package/lib/solution/BookingByStep/types.js +3 -0
  118. package/lib/solution/BookingByStep/utils/products.d.ts +11 -0
  119. package/lib/solution/BookingByStep/utils/products.js +60 -0
  120. package/lib/solution/BookingByStep/utils/resources.d.ts +59 -10
  121. package/lib/solution/BookingByStep/utils/resources.js +106 -49
  122. package/lib/solution/ShopDiscount/index.d.ts +50 -0
  123. package/lib/solution/ShopDiscount/index.js +321 -0
  124. package/lib/solution/ShopDiscount/types.d.ts +24 -0
  125. package/lib/solution/ShopDiscount/types.js +38 -0
  126. package/lib/solution/ShopDiscount/utils.d.ts +1 -0
  127. package/lib/solution/ShopDiscount/utils.js +32 -0
  128. package/lib/solution/index.d.ts +1 -0
  129. package/lib/solution/index.js +3 -1
  130. package/package.json +4 -4
@@ -34,12 +34,14 @@ var AccountModule = class extends import_BaseModule.BaseModule {
34
34
  this.isGuest = false;
35
35
  this.store = {
36
36
  currentAccount: null,
37
- isLoggedIn: false
37
+ isLoggedIn: false,
38
+ active: false
38
39
  };
39
40
  }
40
41
  async initialize(core, options) {
41
42
  this.core = core;
42
43
  this.store = options == null ? void 0 : options.store;
44
+ this.store.isLoggedIn = false;
43
45
  }
44
46
  getId() {
45
47
  var _a;
@@ -92,14 +94,23 @@ var AccountModule = class extends import_BaseModule.BaseModule {
92
94
  }
93
95
  async updatePassword(oldPassword, newPassword) {
94
96
  }
95
- async getLoginStatus() {
97
+ getLoginStatus() {
96
98
  return this.store.isLoggedIn;
97
99
  }
98
- async getAccount() {
100
+ getAccount() {
99
101
  return this.store.currentAccount;
100
102
  }
101
103
  setAccountInfo(account) {
102
104
  this.store.currentAccount = account;
105
+ if (account.isGuest) {
106
+ this.isGuest = true;
107
+ }
108
+ }
109
+ setActive(active) {
110
+ this.store.active = active;
111
+ }
112
+ isActive() {
113
+ return this.store.active;
103
114
  }
104
115
  };
105
116
  // Annotate the CommonJS export names for ESM import in node:
@@ -23,6 +23,7 @@ export interface Account {
23
23
  export interface AccountState {
24
24
  currentAccount: Account | null;
25
25
  isLoggedIn: boolean;
26
+ active: boolean;
26
27
  }
27
28
  /**
28
29
  * 账户模块 API
@@ -15,4 +15,6 @@ export declare class AccountListModule extends BaseModule implements Module {
15
15
  getAccount(id: string): AccountModule | null;
16
16
  clearAccounts(): Promise<void>;
17
17
  getState(): AccountListState;
18
+ setActiveAccount(id: string | number): void;
19
+ getActiveAccount(): AccountModule | null;
18
20
  }
@@ -50,9 +50,14 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
50
50
  }
51
51
  const accountModule = new import_Account.AccountModule(`account_${account.id}`);
52
52
  this.core.registerModule(accountModule);
53
+ accountModule.setAccountInfo(account);
53
54
  this.store.accounts = [...this.store.accounts, accountModule];
54
55
  await this.core.effects.emit(import_types.AccountListHooks.OnAccountListUpdate, this.store);
56
+ if (this.store.accounts.length === 1) {
57
+ this.setActiveAccount(accountModule.getId());
58
+ }
55
59
  } catch (error) {
60
+ console.error(error);
56
61
  this.store.error = error instanceof Error ? error.message : "Failed to add account";
57
62
  await this.core.effects.emit(import_types.AccountListHooks.OnAccountListError, this.store.error);
58
63
  } finally {
@@ -119,6 +124,18 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
119
124
  getState() {
120
125
  return { ...this.store };
121
126
  }
127
+ setActiveAccount(id) {
128
+ this.store.accounts.forEach((account) => {
129
+ if (account.getId() === id) {
130
+ account.setActive(true);
131
+ } else {
132
+ account.setActive(false);
133
+ }
134
+ });
135
+ }
136
+ getActiveAccount() {
137
+ return this.store.accounts.find((account) => account.isActive()) || null;
138
+ }
122
139
  };
123
140
  // Annotate the CommonJS export names for ESM import in node:
124
141
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
- import { Module, PisellCore, ModuleOptions } from '../../types';
2
- import { BaseModule } from '../BaseModule';
3
- import { CartItem, CartModuleAPI } from './types';
4
- export * from './types';
1
+ import { Module, PisellCore, ModuleOptions } from "../../types";
2
+ import { BaseModule } from "../BaseModule";
3
+ import { CartItem, CartModuleAPI, IAddItemParams, IUpdateItemParams } from "./types";
4
+ export * from "./types";
5
5
  /**
6
6
  * 购物车模块实现
7
7
  */
@@ -18,18 +18,24 @@ export declare class CartModule extends BaseModule implements Module {
18
18
  */
19
19
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
20
20
  /**
21
- * 模块销毁
21
+ * 添加商品到购物车
22
22
  */
23
- destroy(): Promise<void>;
23
+ addItem(params: IAddItemParams): Promise<void>;
24
24
  /**
25
- * 添加商品到购物车
25
+ * 更新购物车信息
26
+ */
27
+ updateItem(params: IUpdateItemParams): Promise<void>;
28
+ /**
29
+ * 批量设置购物车数据
26
30
  */
27
- addItem(item: CartItem): Promise<void>;
31
+ batchSetItems(items: CartItem[]): Promise<void>;
28
32
  getItemCount(): number;
29
33
  getTotalPrice(): number;
30
- getItems(): Promise<CartItem[]>;
31
- updateItem(id: string, item: CartItem): Promise<void>;
34
+ getItems(): CartItem[];
32
35
  removeItem(id: string): Promise<void>;
33
36
  storeTemp(key: string, value: any): Promise<void>;
34
- getTemp(key?: string): Promise<any>;
37
+ getTemp(key?: string): any;
38
+ clear(): void;
39
+ clearCartByAccount(account_id: string): void;
40
+ getCartByAccount(account_id: string | number): CartItem[];
35
41
  }
@@ -25,6 +25,7 @@ __export(Cart_exports, {
25
25
  module.exports = __toCommonJS(Cart_exports);
26
26
  var import_BaseModule = require("../BaseModule");
27
27
  var import_types = require("./types");
28
+ var import_utils = require("./utils");
28
29
  __reExport(Cart_exports, require("./types"), module.exports);
29
30
  var CartModule = class extends import_BaseModule.BaseModule {
30
31
  constructor(name, version) {
@@ -48,6 +49,7 @@ var CartModule = class extends import_BaseModule.BaseModule {
48
49
  async initialize(core, options) {
49
50
  this.core = core;
50
51
  this.store = options.store;
52
+ this.store.list = [];
51
53
  this.request = core.getPlugin("request");
52
54
  this.window = core.getPlugin("window");
53
55
  if (!this.request) {
@@ -60,52 +62,101 @@ var CartModule = class extends import_BaseModule.BaseModule {
60
62
  console.log("[CartModule] 初始化完成");
61
63
  }
62
64
  /**
63
- * 模块销毁
65
+ * 添加商品到购物车
64
66
  */
65
- async destroy() {
66
- console.log("[CartModule] 已销毁");
67
+ async addItem(params) {
68
+ const { account, product, bundle, options } = params;
69
+ let cartItem = {
70
+ _id: (0, import_utils.getUniqueId)(),
71
+ _origin: (0, import_utils.createCartItemOrigin)(),
72
+ _productOrigin: product
73
+ };
74
+ if (product) {
75
+ cartItem = (0, import_utils.formatProductToCartItem)({ cartItem, product, bundle, options });
76
+ }
77
+ if (account) {
78
+ cartItem = (0, import_utils.formatAccountToCartItem)({ cartItem, account });
79
+ }
80
+ const items = [...this.store.list, cartItem];
81
+ this.store.list = items;
82
+ await this.core.effects.emit(import_types.CartHooks.OnAddItem, cartItem);
83
+ await this.core.effects.emit(`${this.name}:changed`, items);
67
84
  }
68
85
  /**
69
- * 添加商品到购物车
86
+ * 更新购物车信息
70
87
  */
71
- async addItem(item) {
72
- const items = [...this.store.list, item];
88
+ async updateItem(params) {
89
+ var _a;
90
+ const { _id, cartItem, account, product, resources, note } = params;
91
+ let tempCartItem = this.store.list.find((i) => i._id === _id);
92
+ if (!tempCartItem) {
93
+ console.warn("[CartModule] 更新购物车商品失败,商品不存在");
94
+ return;
95
+ }
96
+ if (cartItem) {
97
+ tempCartItem = cartItem;
98
+ }
99
+ if (product) {
100
+ tempCartItem = (0, import_utils.formatProductToCartItem)({ cartItem: tempCartItem, product });
101
+ }
102
+ if (account) {
103
+ tempCartItem = (0, import_utils.formatAccountToCartItem)({ cartItem: tempCartItem, account });
104
+ }
105
+ if (resources) {
106
+ tempCartItem = (0, import_utils.formatResourceToCartItem)({ cartItem: tempCartItem, resources });
107
+ }
108
+ if (note && ((_a = tempCartItem._origin) == null ? void 0 : _a.product)) {
109
+ tempCartItem.note = note;
110
+ tempCartItem._origin.product.note = note;
111
+ }
112
+ const items = this.store.list.map((item) => {
113
+ if (item._id === (tempCartItem == null ? void 0 : tempCartItem._id)) {
114
+ return tempCartItem;
115
+ }
116
+ return item;
117
+ });
73
118
  this.store.list = items;
74
- await this.core.effects.emit(import_types.CartHooks.OnAddItem, item);
75
- await this.core.effects.emit(import_types.CartHooks.OnCartChange, items);
119
+ await this.core.effects.emit(`${this.name}:changed`, items);
120
+ }
121
+ /**
122
+ * 批量设置购物车数据
123
+ */
124
+ async batchSetItems(items) {
125
+ this.store.list = items || [];
76
126
  }
77
127
  getItemCount() {
78
128
  return this.store.list.length;
79
129
  }
80
130
  getTotalPrice() {
81
- return this.store.list.reduce((total, item) => total + item.price * item.quantity, 0);
131
+ return 0;
82
132
  }
83
- async getItems() {
133
+ getItems() {
84
134
  return this.store.list;
85
135
  }
86
- async updateItem(id, item) {
87
- const items = this.store.list;
88
- const itemIndex = items.findIndex((i) => i.id === id);
89
- if (itemIndex !== -1) {
90
- items[itemIndex] = item;
91
- this.store.list = items;
92
- await this.core.effects.emit(import_types.CartHooks.OnCartUpdateItem, items);
93
- }
94
- }
95
136
  async removeItem(id) {
96
- const items = this.store.list.filter((i) => i.id !== id);
137
+ const items = this.store.list.filter((i) => i._id !== id);
97
138
  this.store.list = items;
98
139
  await this.core.effects.emit(import_types.CartHooks.OnCartRemove, items);
99
140
  }
100
141
  async storeTemp(key, value) {
101
142
  this.store.temp[key] = value;
143
+ await this.core.effects.emit(`${this.name}:changed`, this.store.temp);
102
144
  }
103
- async getTemp(key) {
145
+ getTemp(key) {
104
146
  if (!key) {
105
147
  return this.store.temp;
106
148
  }
107
149
  return this.store.temp[key];
108
150
  }
151
+ clear() {
152
+ this.store.list = [];
153
+ }
154
+ clearCartByAccount(account_id) {
155
+ this.store.list = this.store.list.filter((item) => item.holder_id !== account_id);
156
+ }
157
+ getCartByAccount(account_id) {
158
+ return this.store.list.filter((item) => item.holder_id === account_id);
159
+ }
109
160
  };
110
161
  // Annotate the CommonJS export names for ESM import in node:
111
162
  0 && (module.exports = {
@@ -1,4 +1,6 @@
1
- import { ProductData } from '../Product/types';
1
+ import { ProductData } from "../Product/types";
2
+ import { Account } from "../Account/types";
3
+ import { Resource } from "../Resource/types";
2
4
  export declare enum CartHooks {
3
5
  OnAddItem = "card:onAddItem",
4
6
  OnCartChange = "card:onCartChange",
@@ -9,16 +11,69 @@ export declare enum CartHooks {
9
11
  * 购物车商品接口
10
12
  */
11
13
  export interface CartItem {
12
- id: string;
13
- price: number;
14
- quantity: number;
15
- product: ProductData;
14
+ /** 购物车ID */
15
+ _id: string;
16
+ /** 商品ID */
17
+ id?: number;
18
+ /** 商品名称 */
19
+ name?: string;
20
+ /** 商品价格 */
21
+ price?: number | string;
22
+ /** 商品总价 */
23
+ total?: number | string;
24
+ /** 商品原价总价,排除原始价格为0的场景 */
25
+ origin_total?: number | string;
26
+ /** 商品数量 */
27
+ num?: number;
28
+ /** 商品图片 */
29
+ image?: string;
30
+ /** 商品时长 */
31
+ duration?: {
32
+ type: string;
33
+ value: number;
34
+ };
35
+ /** 是否显示备注 */
36
+ isShowNote?: boolean;
37
+ /** 备注 */
38
+ note?: string;
39
+ /** 点赞状态 */
40
+ like_status?: "like" | "common";
41
+ /** 用户名称 */
42
+ holder_title?: string;
43
+ /** 用户ID */
44
+ holder_id?: number | string;
45
+ /** 符号 */
46
+ symbol?: string;
47
+ /** 开始日期 */
48
+ start_date?: string;
49
+ /** 开始时间 */
50
+ start_time?: string;
51
+ /** 结束日期 */
52
+ end_date?: string;
53
+ /** 结束时间 */
54
+ end_time?: string;
55
+ /** 是否收取税费 */
56
+ is_charge_tax?: number;
57
+ /** 商品套餐信息 */
58
+ bundle?: any[];
59
+ /** 商品规格信息 */
60
+ options?: any[];
61
+ /** 是否为普通商品 */
62
+ isNormalProduct?: boolean;
63
+ /** 资源ID */
64
+ resource_id?: string | number;
65
+ /** 资源名称 */
66
+ relation_form_name?: string;
67
+ /** 原始数据 */
68
+ _origin: any;
69
+ /** 商品原始数据 */
70
+ _productOrigin: ProductData;
16
71
  }
17
72
  /**
18
73
  * 购物车状态接口
19
74
  */
20
75
  export interface CartState {
21
- list: any[];
76
+ list: CartItem[];
22
77
  total: number;
23
78
  temp: Record<string, any>;
24
79
  }
@@ -26,10 +81,44 @@ export interface CartState {
26
81
  * 购物车模块 API
27
82
  */
28
83
  export interface CartModuleAPI {
29
- addItem: (item: CartItem) => Promise<void>;
84
+ addItem: (item: IAddItemParams) => Promise<void>;
30
85
  getItemCount: () => number;
31
86
  getTotalPrice: () => number;
32
- getItems: () => Promise<CartItem[]>;
33
- updateItem: (id: string, item: CartItem) => Promise<void>;
87
+ getItems: () => CartItem[];
88
+ updateItem: (params: IUpdateItemParams) => Promise<void>;
34
89
  removeItem: (id: string) => Promise<void>;
35
90
  }
91
+ /**
92
+ * 添加商品到购物车参数
93
+ */
94
+ export interface IAddItemParams {
95
+ /** 账户 */
96
+ account: Account;
97
+ /** 商品 */
98
+ product: ProductData;
99
+ /** 数量 */
100
+ quantity?: number;
101
+ /** 商品套餐信息 */
102
+ bundle?: any[];
103
+ /** 商品规格信息 */
104
+ options?: any[];
105
+ }
106
+ /**
107
+ * 更新购物车信息参数
108
+ */
109
+ export interface IUpdateItemParams {
110
+ /** 购物车_id字段 */
111
+ _id?: string;
112
+ /** 购物车商品 */
113
+ cartItem?: CartItem;
114
+ /** 账户 */
115
+ account?: Account;
116
+ /** 商品 */
117
+ product?: ProductData;
118
+ /** 数量 */
119
+ quantity?: number;
120
+ /** 资源 */
121
+ resources?: Resource[];
122
+ /** 备注 */
123
+ note?: string;
124
+ }
@@ -0,0 +1,114 @@
1
+ import { Account } from "../Account";
2
+ import { ProductData } from "../Product/types";
3
+ import { Resource } from "../Resource/types";
4
+ import { CartItem } from "./types";
5
+ /**
6
+ * 生成一个唯一的 ID
7
+ */
8
+ export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
9
+ /**
10
+ * 创建购物车原始数据
11
+ */
12
+ export declare const createCartItemOrigin: () => {
13
+ id: number;
14
+ number: number;
15
+ registration_type: string;
16
+ relation_products: never[];
17
+ is_all: boolean;
18
+ product: null;
19
+ sub_type: null;
20
+ duration: null;
21
+ like_status: string;
22
+ relation_type: string;
23
+ resources: null;
24
+ schedule_id: number;
25
+ start_date: null;
26
+ start_time: null;
27
+ select_date: null;
28
+ end_time: null;
29
+ end_date: null;
30
+ metadata: {};
31
+ };
32
+ /**
33
+ * 格式化商品到购物车
34
+ * @param product 商品
35
+ * @returns 格式化后的商品
36
+ */
37
+ export declare const formatProductToCartItem: (params: {
38
+ cartItem: CartItem;
39
+ product: ProductData;
40
+ bundle?: any;
41
+ options?: any;
42
+ }) => CartItem;
43
+ export declare const formatProductToCartItemOrigin: (params: {
44
+ cartItem: CartItem;
45
+ product: ProductData;
46
+ bundle?: any;
47
+ options?: any;
48
+ }) => any;
49
+ /**
50
+ * 格式化账户到购物车
51
+ * @param account 账户
52
+ * @returns 格式化后的账户
53
+ */
54
+ export declare const formatAccountToCartItem: (params: {
55
+ cartItem: CartItem;
56
+ account: Account;
57
+ }) => CartItem;
58
+ export declare const formatAccountToCartItemOrigin: (params: {
59
+ cartItem: CartItem;
60
+ account: Account;
61
+ }) => any;
62
+ /**
63
+ * 格式化资源到购物车
64
+ * @param resource 资源
65
+ * @returns 格式化后的资源
66
+ */
67
+ export declare const formatResourceToCartItem: (params: {
68
+ cartItem: CartItem;
69
+ resources: Resource[];
70
+ }) => CartItem;
71
+ export declare const formatResourceToCartItemOrigin: (params: {
72
+ cartItem: CartItem;
73
+ resources: Resource[];
74
+ }) => any;
75
+ /**
76
+ * 格式化套餐规格信息
77
+ * @param options 套餐规格信息
78
+ * @returns 格式化后的套餐规格信息
79
+ */
80
+ export declare const formatOptions: (options: any) => any;
81
+ export declare const formatOptionsToOrigin: (options: any) => any;
82
+ /**
83
+ * 格式化商品套餐信息
84
+ * @param bundle 商品套餐信息
85
+ * @returns 格式化后的商品套餐信息
86
+ */
87
+ export declare const formatBundle: (bundle: any) => any;
88
+ export declare const formatBundleToOrigin: (bundle: any) => any;
89
+ /**
90
+ * 判断是否是普通商品
91
+ * @param product 商品
92
+ * @returns 是否是普通商品
93
+ */
94
+ export declare const isNormalProduct: (product: any) => boolean;
95
+ /**
96
+ * 获取商品总价
97
+ * @param item 商品
98
+ * @returns 商品总价
99
+ */
100
+ export declare const getProductTotalPrice: (params: {
101
+ product: ProductData;
102
+ bundle?: any;
103
+ options?: any;
104
+ }) => number;
105
+ /**
106
+ * 获取商品原始总价
107
+ * @param item 商品
108
+ * @returns 商品原始总价
109
+ */
110
+ export declare const getProductOriginTotalPrice: (params: {
111
+ product: ProductData;
112
+ bundle?: any;
113
+ options?: any;
114
+ }) => number | undefined;