@pisell/pisellos 0.0.44 → 0.0.46

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 (127) hide show
  1. package/dist/modules/Account/index.d.ts +2 -6
  2. package/dist/modules/Account/index.js +21 -103
  3. package/dist/modules/Account/types.d.ts +12 -1
  4. package/dist/modules/AccountList/index.d.ts +20 -1
  5. package/dist/modules/AccountList/index.js +243 -75
  6. package/dist/modules/AccountList/types.d.ts +33 -1
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/AccountList/utils.d.ts +9 -0
  9. package/dist/modules/AccountList/utils.js +25 -0
  10. package/dist/modules/BaseModule.d.ts +2 -2
  11. package/dist/modules/BaseModule.js +1 -1
  12. package/dist/modules/Cart/index.d.ts +5 -5
  13. package/dist/modules/Cart/index.js +33 -19
  14. package/dist/modules/Cart/types.d.ts +21 -7
  15. package/dist/modules/Cart/utils.d.ts +29 -5
  16. package/dist/modules/Cart/utils.js +72 -26
  17. package/dist/modules/Date/index.d.ts +6 -6
  18. package/dist/modules/Date/index.js +41 -55
  19. package/dist/modules/Date/types.d.ts +22 -6
  20. package/dist/modules/Date/utils.d.ts +4 -3
  21. package/dist/modules/Date/utils.js +74 -23
  22. package/dist/modules/Discount/index.d.ts +4 -4
  23. package/dist/modules/Discount/index.js +11 -11
  24. package/dist/modules/Order/index.d.ts +10 -5
  25. package/dist/modules/Order/index.js +32 -16
  26. package/dist/modules/Order/types.d.ts +10 -3
  27. package/dist/modules/Product/index.d.ts +4 -1
  28. package/dist/modules/Product/index.js +22 -0
  29. package/dist/modules/Product/types.d.ts +7 -3
  30. package/dist/modules/ProductList/index.js +11 -5
  31. package/dist/modules/Resource/utils.js +1 -1
  32. package/dist/modules/Rules/index.d.ts +4 -4
  33. package/dist/modules/Rules/index.js +11 -11
  34. package/dist/modules/Rules/types.d.ts +1 -1
  35. package/dist/modules/Schedule/index.d.ts +8 -3
  36. package/dist/modules/Schedule/index.js +45 -5
  37. package/dist/modules/Schedule/type.d.ts +7 -7
  38. package/dist/modules/Schedule/types.d.ts +8 -8
  39. package/dist/modules/Schedule/utils.d.ts +9 -3
  40. package/dist/modules/Schedule/utils.js +77 -48
  41. package/dist/modules/Step/index.d.ts +14 -3
  42. package/dist/modules/Step/index.js +54 -2
  43. package/dist/modules/Summary/index.d.ts +5 -5
  44. package/dist/modules/Summary/index.js +7 -7
  45. package/dist/modules/Summary/types.d.ts +2 -2
  46. package/dist/modules/Summary/utils.d.ts +4 -4
  47. package/dist/modules/Summary/utils.js +3 -3
  48. package/dist/plugins/index.d.ts +3 -3
  49. package/dist/plugins/request.d.ts +3 -3
  50. package/dist/plugins/request.js +30 -30
  51. package/dist/plugins/shopStore.d.ts +1 -1
  52. package/dist/solution/BookingByStep/index.d.ts +71 -16
  53. package/dist/solution/BookingByStep/index.js +643 -227
  54. package/dist/solution/BookingByStep/types.d.ts +2 -2
  55. package/dist/solution/BookingByStep/types.js +9 -9
  56. package/dist/solution/BookingByStep/utils/products.d.ts +1 -1
  57. package/dist/solution/BookingByStep/utils/products.js +3 -0
  58. package/dist/solution/BookingByStep/utils/resources.d.ts +6 -5
  59. package/dist/solution/BookingByStep/utils/resources.js +37 -19
  60. package/dist/solution/ShopDiscount/index.d.ts +4 -4
  61. package/dist/solution/ShopDiscount/index.js +16 -16
  62. package/dist/solution/ShopDiscount/types.d.ts +2 -2
  63. package/dist/solution/ShopDiscount/utils.js +1 -1
  64. package/lib/core/index.js +7 -2
  65. package/lib/modules/Account/index.d.ts +2 -6
  66. package/lib/modules/Account/index.js +15 -30
  67. package/lib/modules/Account/types.d.ts +12 -1
  68. package/lib/modules/AccountList/index.d.ts +20 -1
  69. package/lib/modules/AccountList/index.js +122 -13
  70. package/lib/modules/AccountList/types.d.ts +33 -1
  71. package/lib/modules/AccountList/utils.d.ts +9 -0
  72. package/lib/modules/AccountList/utils.js +39 -0
  73. package/lib/modules/BaseModule.d.ts +2 -2
  74. package/lib/modules/BaseModule.js +14 -3
  75. package/lib/modules/Cart/index.d.ts +5 -5
  76. package/lib/modules/Cart/index.js +28 -6
  77. package/lib/modules/Cart/types.d.ts +21 -7
  78. package/lib/modules/Cart/utils.d.ts +29 -5
  79. package/lib/modules/Cart/utils.js +47 -3
  80. package/lib/modules/Date/index.d.ts +6 -6
  81. package/lib/modules/Date/index.js +6 -6
  82. package/lib/modules/Date/types.d.ts +22 -6
  83. package/lib/modules/Date/utils.d.ts +4 -3
  84. package/lib/modules/Date/utils.js +37 -6
  85. package/lib/modules/Discount/index.d.ts +4 -4
  86. package/lib/modules/Discount/index.js +9 -2
  87. package/lib/modules/Guests/index.js +4 -1
  88. package/lib/modules/Order/index.d.ts +10 -5
  89. package/lib/modules/Order/index.js +11 -1
  90. package/lib/modules/Order/types.d.ts +10 -3
  91. package/lib/modules/Payment/index.js +1 -6
  92. package/lib/modules/Product/index.d.ts +4 -1
  93. package/lib/modules/Product/index.js +16 -0
  94. package/lib/modules/Product/types.d.ts +7 -3
  95. package/lib/modules/ProductList/index.js +21 -7
  96. package/lib/modules/Resource/index.js +4 -1
  97. package/lib/modules/Resource/utils.js +7 -4
  98. package/lib/modules/Rules/index.d.ts +4 -4
  99. package/lib/modules/Rules/types.d.ts +1 -1
  100. package/lib/modules/Schedule/index.d.ts +8 -3
  101. package/lib/modules/Schedule/index.js +33 -2
  102. package/lib/modules/Schedule/type.d.ts +7 -7
  103. package/lib/modules/Schedule/types.d.ts +8 -8
  104. package/lib/modules/Schedule/utils.d.ts +9 -3
  105. package/lib/modules/Schedule/utils.js +32 -4
  106. package/lib/modules/Step/index.d.ts +14 -3
  107. package/lib/modules/Step/index.js +38 -1
  108. package/lib/modules/Summary/index.d.ts +5 -5
  109. package/lib/modules/Summary/types.d.ts +2 -2
  110. package/lib/modules/Summary/utils.d.ts +4 -4
  111. package/lib/plugins/index.d.ts +3 -3
  112. package/lib/plugins/request.d.ts +3 -3
  113. package/lib/plugins/request.js +48 -11
  114. package/lib/plugins/shopStore.d.ts +1 -1
  115. package/lib/solution/BookingByStep/index.d.ts +71 -16
  116. package/lib/solution/BookingByStep/index.js +396 -48
  117. package/lib/solution/BookingByStep/types.d.ts +2 -2
  118. package/lib/solution/BookingByStep/types.js +36 -9
  119. package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
  120. package/lib/solution/BookingByStep/utils/products.js +3 -0
  121. package/lib/solution/BookingByStep/utils/resources.d.ts +6 -5
  122. package/lib/solution/BookingByStep/utils/resources.js +128 -58
  123. package/lib/solution/BuyTickets/index.js +34 -20
  124. package/lib/solution/ShopDiscount/index.d.ts +4 -4
  125. package/lib/solution/ShopDiscount/index.js +10 -2
  126. package/lib/solution/ShopDiscount/types.d.ts +2 -2
  127. package/package.json +4 -2
@@ -50,6 +50,9 @@ var getAvailableProductResources = (products) => {
50
50
  if (tempResourceIds) {
51
51
  rule.resourceFormIds = [...new Set(tempResourceIds)];
52
52
  }
53
+ if (product == null ? void 0 : product._schedule) {
54
+ rule.schedule = product == null ? void 0 : product._schedule;
55
+ }
53
56
  rules.push(rule);
54
57
  });
55
58
  return { resourceIds: [...new Set(resourceIds)], rules, resourcesMap };
@@ -27,7 +27,7 @@ interface BookingItem {
27
27
  * @return {*}
28
28
  * @Author: zhiwei.Wang
29
29
  */
30
- export declare const getIsUsableByTimeItem: ({ timeSlice, time, resource, currentCount }: {
30
+ export declare const getIsUsableByTimeItem: ({ timeSlice, time, resource, currentCount, }: {
31
31
  timeSlice: TimeSliceItem;
32
32
  time: any;
33
33
  resource: ResourceItem;
@@ -36,6 +36,7 @@ export declare const getIsUsableByTimeItem: ({ timeSlice, time, resource, curren
36
36
  afterToDay: boolean;
37
37
  capacity: boolean;
38
38
  usable: boolean;
39
+ remainingCapacity: number;
39
40
  };
40
41
  /**
41
42
  * @title: 获取商品下绑定的资源列表
@@ -53,7 +54,7 @@ export declare const getResourcesByProduct: (resourcesMap: Record<string, Resour
53
54
  * @Author: zhiwei.Wang
54
55
  * @Date: 2024-01-09 13:38
55
56
  */
56
- export declare const formatResources: ({ booking, resources }: {
57
+ export declare const formatResources: ({ booking, resources, }: {
57
58
  booking: BookingItem;
58
59
  resources: ResourceItem[];
59
60
  }) => {
@@ -66,7 +67,7 @@ export declare const formatResources: ({ booking, resources }: {
66
67
  * @return {*}
67
68
  * @Author: zhiwei.Wang
68
69
  */
69
- export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity }: {
70
+ export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, }: {
70
71
  resource: ResourceItem;
71
72
  duration: number;
72
73
  split: number;
@@ -100,7 +101,7 @@ export declare const getResourcesByIds: (resourcesMap: Record<string, ResourceIt
100
101
  * @return {*}
101
102
  * @Author: zhiwei.Wang
102
103
  */
103
- export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity }: {
104
+ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, }: {
104
105
  resourceIds: number[];
105
106
  resourcesMap: any;
106
107
  duration: number;
@@ -129,7 +130,7 @@ interface CapacityItem {
129
130
  * @return {*}
130
131
  * @Author: zhiwei.Wang
131
132
  */
132
- export declare const formatDefaultCapacitys: ({ capacity, product_bundle }: any) => CapacityItem[];
133
+ export declare const formatDefaultCapacitys: ({ capacity, product_bundle, }: any) => CapacityItem[];
133
134
  /**
134
135
  * @title: 获取总容量
135
136
  * @description:
@@ -74,42 +74,79 @@ var formatResource = (resourceItem, booking) => {
74
74
  _resourceItem.labelText = _resourceItem.main_field;
75
75
  return _resourceItem;
76
76
  };
77
- var checkCapacity = ({ event_list, timeSlice, resource, currentCount = 1 }) => {
77
+ var checkCapacity = ({
78
+ event_list,
79
+ timeSlice,
80
+ resource,
81
+ currentCount = 1
82
+ }) => {
78
83
  if (currentCount > resource.capacity) {
79
- return false;
84
+ return {
85
+ status: false,
86
+ capacity: resource.capacity
87
+ };
80
88
  }
81
89
  let conflict = (event_list || []).filter((d) => {
82
- return isConflict({ start_at: d.start_at, end_at: d.end_at }, { start_at: timeSlice.start_at, end_at: timeSlice.end_at });
90
+ return isConflict(
91
+ { start_at: d.start_at, end_at: d.end_at },
92
+ { start_at: timeSlice.start_at, end_at: timeSlice.end_at }
93
+ );
83
94
  });
84
95
  if (resource.resourceType === "single") {
85
96
  if (conflict.length === 0) {
86
- return true;
97
+ return {
98
+ status: true,
99
+ capacity: 1
100
+ };
87
101
  } else {
88
- return false;
102
+ return {
103
+ status: false,
104
+ capacity: 1
105
+ };
89
106
  }
90
107
  } else {
91
108
  let conflictCount = getUseableEventCount(conflict, resource.capacity);
92
109
  if (currentCount <= conflictCount) {
93
- return true;
110
+ return {
111
+ status: true,
112
+ capacity: conflictCount
113
+ };
94
114
  } else {
95
- return false;
115
+ return {
116
+ status: false,
117
+ capacity: conflictCount
118
+ };
96
119
  }
97
120
  }
98
121
  };
99
- var getIsUsableByTimeItem = ({ timeSlice, time, resource, currentCount = 1 }) => {
122
+ var getIsUsableByTimeItem = ({
123
+ timeSlice,
124
+ time,
125
+ resource,
126
+ currentCount = 1
127
+ }) => {
100
128
  let status = {
101
129
  afterToDay: false,
102
130
  capacity: false,
103
- usable: false
131
+ usable: false,
132
+ remainingCapacity: 0
133
+ // 剩余容量
104
134
  };
105
135
  let earliest = (0, import_dayjs.default)();
106
136
  if (!checkAfterToDay(timeSlice.start_at, earliest)) {
107
137
  return status;
108
138
  }
109
139
  status.afterToDay = true;
110
- if (!checkCapacity({ event_list: time == null ? void 0 : time.event_list, timeSlice, resource, currentCount })) {
140
+ const checkCapacityResult = checkCapacity({
141
+ event_list: time == null ? void 0 : time.event_list,
142
+ timeSlice,
143
+ resource,
144
+ currentCount
145
+ });
146
+ if (!checkCapacityResult.status) {
111
147
  return status;
112
148
  }
149
+ status.remainingCapacity = checkCapacityResult.capacity;
113
150
  status.capacity = true;
114
151
  status.usable = true;
115
152
  return status;
@@ -121,51 +158,65 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
121
158
  item.optional_resource = (item.optional_resource || []).filter(
122
159
  (d) => item.default_resource.indexOf(d) == -1
123
160
  );
124
- let optional_resource = item.optional_resource.reduce((childAcc, d) => {
125
- if (resourcesMap[d] && !selectedResources.includes(resourcesMap[d].id) && capacity <= resourcesMap[d].capacity) {
126
- const combiningResources = [];
127
- if (resourcesMap[d].combined_resource && resourcesMap[d].combined_resource.status === 1) {
128
- resourcesMap[d].combined_resource.resource_ids.forEach((id) => {
129
- if (resourcesMap[id]) {
130
- combiningResources.push(resourcesMap[id]);
131
- }
132
- });
133
- }
134
- childAcc.push(Object.assign({}, resourcesMap[d], {
135
- form_id,
136
- resourceType: item.type,
137
- children: combiningResources,
138
- metadata: {
139
- ...resourcesMap[d].metadata,
140
- combined_resource: resourcesMap[d].combined_resource
161
+ let optional_resource = item.optional_resource.reduce(
162
+ (childAcc, d) => {
163
+ if (resourcesMap[d] && !selectedResources.includes(resourcesMap[d].id) && capacity <= resourcesMap[d].capacity) {
164
+ const combiningResources = [];
165
+ if (resourcesMap[d].combined_resource && resourcesMap[d].combined_resource.status === 1) {
166
+ resourcesMap[d].combined_resource.resource_ids.forEach(
167
+ (id) => {
168
+ if (resourcesMap[id]) {
169
+ combiningResources.push(resourcesMap[id]);
170
+ }
171
+ }
172
+ );
141
173
  }
142
- }));
143
- }
144
- return childAcc;
145
- }, []);
146
- let default_resource = item.default_resource.reduce((childAcc, d) => {
147
- if (resourcesMap[d] && !selectedResources.includes(resourcesMap[d].id) && capacity <= resourcesMap[d].capacity) {
148
- const combiningResources = [];
149
- if (resourcesMap[d].combined_resource && resourcesMap[d].combined_resource.status === 1) {
150
- resourcesMap[d].combined_resource.resource_ids.forEach((id) => {
151
- if (resourcesMap[id]) {
152
- combiningResources.push(resourcesMap[id]);
153
- }
154
- });
174
+ childAcc.push(
175
+ Object.assign({}, resourcesMap[d], {
176
+ form_id,
177
+ resourceType: item.type,
178
+ children: combiningResources,
179
+ metadata: {
180
+ ...resourcesMap[d].metadata,
181
+ combined_resource: resourcesMap[d].combined_resource
182
+ }
183
+ })
184
+ );
155
185
  }
156
- childAcc.push(Object.assign({}, resourcesMap[d], {
157
- form_id,
158
- resourceType: item.type,
159
- is_default: 1,
160
- children: combiningResources,
161
- metadata: {
162
- ...resourcesMap[d].metadata,
163
- combined_resource: resourcesMap[d].combined_resource
186
+ return childAcc;
187
+ },
188
+ []
189
+ );
190
+ let default_resource = item.default_resource.reduce(
191
+ (childAcc, d) => {
192
+ if (resourcesMap[d] && !selectedResources.includes(resourcesMap[d].id) && capacity <= resourcesMap[d].capacity) {
193
+ const combiningResources = [];
194
+ if (resourcesMap[d].combined_resource && resourcesMap[d].combined_resource.status === 1) {
195
+ resourcesMap[d].combined_resource.resource_ids.forEach(
196
+ (id) => {
197
+ if (resourcesMap[id]) {
198
+ combiningResources.push(resourcesMap[id]);
199
+ }
200
+ }
201
+ );
164
202
  }
165
- }));
166
- }
167
- return childAcc;
168
- }, []);
203
+ childAcc.push(
204
+ Object.assign({}, resourcesMap[d], {
205
+ form_id,
206
+ resourceType: item.type,
207
+ is_default: 1,
208
+ children: combiningResources,
209
+ metadata: {
210
+ ...resourcesMap[d].metadata,
211
+ combined_resource: resourcesMap[d].combined_resource
212
+ }
213
+ })
214
+ );
215
+ }
216
+ return childAcc;
217
+ },
218
+ []
219
+ );
169
220
  item.renderList = optional_resource.concat(default_resource);
170
221
  item.renderList = item.renderList.filter((d) => {
171
222
  const latestTime = d.times.reduce((latest, current) => {
@@ -179,7 +230,10 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
179
230
  return acc;
180
231
  }, []);
181
232
  };
182
- var formatResources = ({ booking, resources }) => {
233
+ var formatResources = ({
234
+ booking,
235
+ resources
236
+ }) => {
183
237
  try {
184
238
  let _list = [...resources];
185
239
  let maps = {};
@@ -274,9 +328,20 @@ var getTimeSlicesByResources = ({
274
328
  capacity
275
329
  }) => {
276
330
  let resources = getResourcesByIds(resourcesMap, resourceIds);
277
- let timeSliceList = resources.reduce((acc, item) => {
278
- return acc.concat(getTimeSlicesByResource({ resource: item, duration, split, currentDate, capacity }));
279
- }, []);
331
+ let timeSliceList = resources.reduce(
332
+ (acc, item) => {
333
+ return acc.concat(
334
+ getTimeSlicesByResource({
335
+ resource: item,
336
+ duration,
337
+ split,
338
+ currentDate,
339
+ capacity
340
+ })
341
+ );
342
+ },
343
+ []
344
+ );
280
345
  let intersection = getTimesIntersection(timeSliceList, resources.length);
281
346
  return intersection;
282
347
  };
@@ -287,7 +352,9 @@ var getOthersSelectedResources = (cartItems, accountId, resourcesMap) => {
287
352
  if ((_a = d._origin) == null ? void 0 : _a.resources) {
288
353
  d._origin.resources.forEach((n) => {
289
354
  if (n.metadata.combined_resource && n.metadata.combined_resource.status === 1) {
290
- if (n.metadata.combined_resource.resource_ids.some((m) => acc.includes(m))) {
355
+ if (n.metadata.combined_resource.resource_ids.some(
356
+ (m) => acc.includes(m)
357
+ )) {
291
358
  return acc;
292
359
  }
293
360
  acc.push(...n.metadata.combined_resource.resource_ids);
@@ -307,7 +374,10 @@ var getOthersSelectedResources = (cartItems, accountId, resourcesMap) => {
307
374
  return acc;
308
375
  }, []);
309
376
  };
310
- var formatDefaultCapacitys = ({ capacity, product_bundle }) => {
377
+ var formatDefaultCapacitys = ({
378
+ capacity,
379
+ product_bundle
380
+ }) => {
311
381
  if ((capacity == null ? void 0 : capacity.type) === "package") {
312
382
  return (product_bundle || []).map((d) => {
313
383
  const id = d.bundle_product_id;
@@ -53,22 +53,21 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
53
53
  }
54
54
  // 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
55
55
  async loadProductsByIds(ids) {
56
- const productsData = await this.request.post(
57
- "/product/query",
58
- {
59
- ids,
60
- open_quotation: 1,
61
- open_bundle: 1,
62
- with: ["bundleGroup.bundleItem"],
63
- status: "published",
64
- num: 10,
65
- skip: 1
66
- }
67
- );
56
+ const productsData = await this.request.post("/product/query", {
57
+ ids,
58
+ open_quotation: 1,
59
+ open_bundle: 1,
60
+ with: ["bundleGroup.bundleItem"],
61
+ status: "published",
62
+ num: 10,
63
+ skip: 1
64
+ });
68
65
  const mainProducts = new import_modules.ProductList(`product-kiosk-main-list`);
69
- this.core.registerModule(mainProducts, { initialState: {
70
- list: productsData.data.list
71
- } });
66
+ this.core.registerModule(mainProducts, {
67
+ initialState: {
68
+ list: productsData.data.list
69
+ }
70
+ });
72
71
  this.store.mainProducts = mainProducts;
73
72
  await this.core.effects.emit(import_types.BuyTicketsHooks.onMainProductsLoaded, {});
74
73
  }
@@ -84,7 +83,10 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
84
83
  var _a;
85
84
  const mainData = await this.store.mainProducts.getProducts() || [];
86
85
  const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
87
- await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [...mainData, ...otherData]);
86
+ await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [
87
+ ...mainData,
88
+ ...otherData
89
+ ]);
88
90
  return [...mainData, ...otherData];
89
91
  }
90
92
  // 根据 id 获取商品详情,他会尝试先去主列表里找,找不到再去子列表,还找不到就报错
@@ -100,19 +102,31 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
100
102
  }
101
103
  // 商品列表页提交
102
104
  async listSubmit(data) {
103
- const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, { ...data, products: this.getProducts() });
105
+ const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, {
106
+ ...data,
107
+ products: this.getProducts()
108
+ });
104
109
  if (res.status === false)
105
110
  return res;
106
- this.window.localStorage.setItem("buyTickets:listSubmit", JSON.stringify({ ...data, products: this.getProducts() }));
111
+ this.window.localStorage.setItem(
112
+ "buyTickets:listSubmit",
113
+ JSON.stringify({ ...data, products: this.getProducts() })
114
+ );
107
115
  console.log("listSubmit 应该走逻辑层的 API 发请求了");
108
116
  }
109
117
  // 购物车提交
110
118
  async cartSubmit(data) {
111
- await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, { ...data, products: this.getProducts() });
119
+ await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, {
120
+ ...data,
121
+ products: this.getProducts()
122
+ });
112
123
  }
113
124
  // 结算提交
114
125
  async checkoutSubmit(data) {
115
- await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, { ...data, products: this.getProducts() });
126
+ await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, {
127
+ ...data,
128
+ products: this.getProducts()
129
+ });
116
130
  }
117
131
  };
118
132
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
- import { Module, PisellCore } from "../../types";
2
- import { BaseModule } from "../../modules/BaseModule";
3
- import { Customer } from "./types";
4
- import { Discount } from "../../modules/Discount/types";
1
+ import { Module, PisellCore } from '../../types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { Customer } from './types';
4
+ import { Discount } from '../../modules/Discount/types';
5
5
  export declare class ShopDiscountImpl extends BaseModule implements Module {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -288,7 +288,13 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
288
288
  });
289
289
  }
290
290
  });
291
- const newDiscountList = (0, import_utils.uniqueById)([...editModeDiscountList, ...discountList.filter((item) => !item.isDisabled)], "product_id");
291
+ const newDiscountList = (0, import_utils.uniqueById)(
292
+ [
293
+ ...editModeDiscountList,
294
+ ...discountList.filter((item) => !item.isDisabled)
295
+ ],
296
+ "product_id"
297
+ );
292
298
  (_a = this.store.discount) == null ? void 0 : _a.setDiscountList(newDiscountList);
293
299
  this.emitDiscountListChange(newDiscountList);
294
300
  return newDiscountList;
@@ -322,7 +328,9 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
322
328
  action: "create",
323
329
  with_good_pass: 1
324
330
  }));
325
- const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter((item) => item.isScan);
331
+ const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
332
+ (item) => item.isScan
333
+ );
326
334
  const newDiscountList = [...scanDiscount, ...goodPassList || []];
327
335
  this.setDiscountList(newDiscountList || []);
328
336
  if ((_d = this.store.productList) == null ? void 0 : _d.length) {
@@ -1,5 +1,5 @@
1
- import { DiscountModule } from "../../modules/Discount";
2
- import { RulesModule } from "../../modules/Rules";
1
+ import { DiscountModule } from '../../modules/Discount';
2
+ import { RulesModule } from '../../modules/Rules';
3
3
  export declare enum ShopDiscountHooks {
4
4
  onInited = "shopDiscount:onInited",
5
5
  onDestroy = "shopDiscount:onDestroy",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.44",
4
+ "version": "0.0.46",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -14,6 +14,7 @@
14
14
  "dev": "father dev --watch",
15
15
  "test": "vitest",
16
16
  "lint": "eslint src --ext .ts",
17
+ "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
17
18
  "changeset": "changeset",
18
19
  "version": "changeset version",
19
20
  "release": "changeset publish --registry=https://registry.npmjs.com/ && npm run sync && git push",
@@ -54,6 +55,7 @@
54
55
  "axios": "1.7.2",
55
56
  "eslint": "^8.37.0",
56
57
  "father": "^4.1.0",
58
+ "prettier": "^3.5.3",
57
59
  "ts-node": "^10.9.1",
58
60
  "typedoc": "^0.28.2",
59
61
  "typescript": "^5.0.3",
@@ -65,4 +67,4 @@
65
67
  "publishConfig": {
66
68
  "access": "public"
67
69
  }
68
- }
70
+ }