@pisell/pisellos 2.1.171 → 2.1.172

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 (230) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -3
  3. package/dist/model/strategy/adapter/index.d.ts +0 -4
  4. package/dist/model/strategy/adapter/index.js +1 -5
  5. package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
  6. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  7. package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
  8. package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
  9. package/dist/model/strategy/engine.d.ts +18 -5
  10. package/dist/model/strategy/engine.js +145 -45
  11. package/dist/model/strategy/type.d.ts +17 -0
  12. package/dist/model/strategy/type.js +4 -0
  13. package/dist/modules/Cart/types.d.ts +2 -0
  14. package/dist/modules/Cart/utils/cartProduct.js +56 -25
  15. package/dist/modules/Cart/utils/changePrice.js +9 -16
  16. package/dist/modules/Discount/index.d.ts +4 -13
  17. package/dist/modules/Discount/index.js +12 -124
  18. package/dist/modules/Discount/types.d.ts +18 -13
  19. package/dist/modules/Order/index.d.ts +1 -67
  20. package/dist/modules/Order/index.js +30 -918
  21. package/dist/modules/Order/types.d.ts +12 -176
  22. package/dist/modules/Order/types.js +0 -2
  23. package/dist/modules/Order/utils.d.ts +0 -118
  24. package/dist/modules/Order/utils.js +2 -586
  25. package/dist/modules/Payment/index.d.ts +2 -1
  26. package/dist/modules/Payment/index.js +10 -7
  27. package/dist/modules/Payment/utils.js +3 -0
  28. package/dist/modules/Payment/walletpass.d.ts +23 -0
  29. package/dist/modules/Payment/walletpass.js +191 -95
  30. package/dist/modules/Product/utils.js +2 -2
  31. package/dist/modules/ProductList/index.d.ts +2 -4
  32. package/dist/modules/ProductList/index.js +12 -24
  33. package/dist/modules/Rules/index.d.ts +9 -5
  34. package/dist/modules/Rules/index.js +669 -173
  35. package/dist/modules/Rules/types.d.ts +2 -0
  36. package/dist/modules/Schedule/getDateIsInSchedule.js +18 -16
  37. package/dist/modules/Schedule/utils.d.ts +1 -1
  38. package/dist/modules/Summary/types.d.ts +2 -0
  39. package/dist/modules/Summary/utils.d.ts +9 -3
  40. package/dist/modules/Summary/utils.js +57 -67
  41. package/dist/modules/index.d.ts +0 -4
  42. package/dist/modules/index.js +1 -5
  43. package/dist/plugins/window.d.ts +2 -0
  44. package/dist/solution/BookingByStep/index.d.ts +3 -2
  45. package/dist/solution/BookingByStep/index.js +43 -46
  46. package/dist/solution/BookingByStep/types.d.ts +1 -3
  47. package/dist/solution/BookingByStep/types.js +1 -5
  48. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  49. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  50. package/dist/solution/Checkout/index.js +2 -0
  51. package/dist/solution/ShopDiscount/index.d.ts +2 -3
  52. package/dist/solution/ShopDiscount/index.js +60 -62
  53. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  54. package/dist/solution/ShopDiscount/types.js +2 -1
  55. package/dist/solution/ShopDiscount/utils.js +26 -12
  56. package/dist/solution/index.d.ts +0 -2
  57. package/dist/solution/index.js +1 -3
  58. package/lib/index.d.ts +1 -1
  59. package/lib/index.js +3 -4
  60. package/lib/model/strategy/adapter/index.d.ts +0 -4
  61. package/lib/model/strategy/adapter/index.js +2 -13
  62. package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
  63. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  64. package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
  65. package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
  66. package/lib/model/strategy/engine.d.ts +18 -5
  67. package/lib/model/strategy/engine.js +85 -21
  68. package/lib/model/strategy/type.d.ts +17 -0
  69. package/lib/modules/Cart/types.d.ts +2 -0
  70. package/lib/modules/Cart/utils/cartProduct.js +39 -12
  71. package/lib/modules/Cart/utils/changePrice.js +9 -13
  72. package/lib/modules/Discount/index.d.ts +4 -13
  73. package/lib/modules/Discount/index.js +5 -76
  74. package/lib/modules/Discount/types.d.ts +18 -13
  75. package/lib/modules/Order/index.d.ts +1 -67
  76. package/lib/modules/Order/index.js +1 -525
  77. package/lib/modules/Order/types.d.ts +12 -176
  78. package/lib/modules/Order/utils.d.ts +0 -118
  79. package/lib/modules/Order/utils.js +2 -483
  80. package/lib/modules/Payment/index.d.ts +2 -1
  81. package/lib/modules/Payment/index.js +1 -0
  82. package/lib/modules/Payment/utils.js +3 -0
  83. package/lib/modules/Payment/walletpass.d.ts +23 -0
  84. package/lib/modules/Payment/walletpass.js +94 -17
  85. package/lib/modules/Product/utils.js +2 -2
  86. package/lib/modules/ProductList/index.d.ts +2 -4
  87. package/lib/modules/ProductList/index.js +39 -46
  88. package/lib/modules/Rules/index.d.ts +9 -5
  89. package/lib/modules/Rules/index.js +776 -292
  90. package/lib/modules/Rules/types.d.ts +2 -0
  91. package/lib/modules/Schedule/getDateIsInSchedule.js +11 -13
  92. package/lib/modules/Schedule/utils.d.ts +1 -1
  93. package/lib/modules/Summary/types.d.ts +2 -0
  94. package/lib/modules/Summary/utils.d.ts +9 -3
  95. package/lib/modules/Summary/utils.js +34 -45
  96. package/lib/modules/index.d.ts +0 -4
  97. package/lib/modules/index.js +1 -9
  98. package/lib/plugins/window.d.ts +2 -0
  99. package/lib/solution/BookingByStep/index.d.ts +3 -2
  100. package/lib/solution/BookingByStep/index.js +4 -6
  101. package/lib/solution/BookingByStep/types.d.ts +1 -3
  102. package/lib/solution/BookingByStep/types.js +0 -10
  103. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  104. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  105. package/lib/solution/Checkout/index.js +2 -0
  106. package/lib/solution/ShopDiscount/index.d.ts +2 -3
  107. package/lib/solution/ShopDiscount/index.js +27 -22
  108. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  109. package/lib/solution/ShopDiscount/utils.js +10 -6
  110. package/lib/solution/index.d.ts +0 -2
  111. package/lib/solution/index.js +1 -5
  112. package/package.json +2 -2
  113. package/dist/apis/picoding.d.ts +0 -0
  114. package/dist/apis/picoding.js +0 -1
  115. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  116. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  117. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  118. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
  119. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  120. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  121. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  122. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  123. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  124. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  125. package/dist/modules/OpenData/index.d.ts +0 -24
  126. package/dist/modules/OpenData/index.js +0 -173
  127. package/dist/modules/OpenData/types.d.ts +0 -73
  128. package/dist/modules/OpenData/types.js +0 -1
  129. package/dist/modules/OpenData/utils.d.ts +0 -2
  130. package/dist/modules/OpenData/utils.js +0 -75
  131. package/dist/modules/Quotation/index.d.ts +0 -48
  132. package/dist/modules/Quotation/index.js +0 -248
  133. package/dist/modules/Quotation/types.d.ts +0 -42
  134. package/dist/modules/Quotation/types.js +0 -1
  135. package/dist/modules/SalesSummary/index.d.ts +0 -63
  136. package/dist/modules/SalesSummary/index.js +0 -174
  137. package/dist/modules/SalesSummary/types.d.ts +0 -60
  138. package/dist/modules/SalesSummary/types.js +0 -1
  139. package/dist/modules/SalesSummary/utils.d.ts +0 -30
  140. package/dist/modules/SalesSummary/utils.js +0 -480
  141. package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
  142. package/dist/modules/ScanOrderLogger/index.js +0 -174
  143. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  144. package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
  145. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  146. package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
  147. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  148. package/dist/modules/ScanOrderLogger/types.js +0 -1
  149. package/dist/solution/ScanOrder/index.d.ts +0 -158
  150. package/dist/solution/ScanOrder/index.js +0 -3474
  151. package/dist/solution/ScanOrder/types.d.ts +0 -306
  152. package/dist/solution/ScanOrder/types.js +0 -35
  153. package/dist/solution/ScanOrder/utils.d.ts +0 -172
  154. package/dist/solution/ScanOrder/utils.js +0 -796
  155. package/dist/solution/VenueBooking/index.d.ts +0 -262
  156. package/dist/solution/VenueBooking/index.js +0 -3991
  157. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  158. package/dist/solution/VenueBooking/types.d.ts +0 -156
  159. package/dist/solution/VenueBooking/types.js +0 -22
  160. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  161. package/dist/solution/VenueBooking/utils/dateSummary.js +0 -91
  162. package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
  163. package/dist/solution/VenueBooking/utils/resource.js +0 -131
  164. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
  165. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -233
  166. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  167. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
  168. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
  169. package/dist/solution/VenueBooking/utils/timeSlot.js +0 -458
  170. package/dist/solution/VenueBooking/utils.d.ts +0 -1
  171. package/dist/solution/VenueBooking/utils.js +0 -1
  172. package/lib/apis/picoding.d.ts +0 -0
  173. package/lib/apis/picoding.js +0 -0
  174. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  175. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  176. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  177. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
  178. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  179. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  180. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  181. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  182. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  183. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
  184. package/lib/modules/OpenData/index.d.ts +0 -24
  185. package/lib/modules/OpenData/index.js +0 -119
  186. package/lib/modules/OpenData/types.d.ts +0 -73
  187. package/lib/modules/OpenData/types.js +0 -17
  188. package/lib/modules/OpenData/utils.d.ts +0 -2
  189. package/lib/modules/OpenData/utils.js +0 -111
  190. package/lib/modules/Quotation/index.d.ts +0 -48
  191. package/lib/modules/Quotation/index.js +0 -152
  192. package/lib/modules/Quotation/types.d.ts +0 -42
  193. package/lib/modules/Quotation/types.js +0 -17
  194. package/lib/modules/SalesSummary/index.d.ts +0 -63
  195. package/lib/modules/SalesSummary/index.js +0 -105
  196. package/lib/modules/SalesSummary/types.d.ts +0 -60
  197. package/lib/modules/SalesSummary/types.js +0 -17
  198. package/lib/modules/SalesSummary/utils.d.ts +0 -30
  199. package/lib/modules/SalesSummary/utils.js +0 -420
  200. package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
  201. package/lib/modules/ScanOrderLogger/index.js +0 -147
  202. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  203. package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
  204. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  205. package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
  206. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  207. package/lib/modules/ScanOrderLogger/types.js +0 -17
  208. package/lib/solution/ScanOrder/index.d.ts +0 -158
  209. package/lib/solution/ScanOrder/index.js +0 -2135
  210. package/lib/solution/ScanOrder/types.d.ts +0 -306
  211. package/lib/solution/ScanOrder/types.js +0 -36
  212. package/lib/solution/ScanOrder/utils.d.ts +0 -172
  213. package/lib/solution/ScanOrder/utils.js +0 -658
  214. package/lib/solution/VenueBooking/index.d.ts +0 -262
  215. package/lib/solution/VenueBooking/index.js +0 -2394
  216. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  217. package/lib/solution/VenueBooking/types.d.ts +0 -156
  218. package/lib/solution/VenueBooking/types.js +0 -45
  219. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  220. package/lib/solution/VenueBooking/utils/dateSummary.js +0 -105
  221. package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
  222. package/lib/solution/VenueBooking/utils/resource.js +0 -92
  223. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
  224. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -236
  225. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  226. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -180
  227. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
  228. package/lib/solution/VenueBooking/utils/timeSlot.js +0 -343
  229. package/lib/solution/VenueBooking/utils.d.ts +0 -1
  230. package/lib/solution/VenueBooking/utils.js +0 -69
@@ -31,6 +31,7 @@ var WalletPassPaymentImpl = class {
31
31
  this.userIdentificationCodes = [];
32
32
  this.searchResults = [];
33
33
  this.walletParams = null;
34
+ this.walletInitData = null;
34
35
  }
35
36
  /**
36
37
  * 发送事件的辅助方法
@@ -42,7 +43,9 @@ var WalletPassPaymentImpl = class {
42
43
  const fullEventName = `${this.paymentModule.name}:${eventName}`;
43
44
  this.paymentModule.core.effects.emit(fullEventName, data);
44
45
  } catch (error) {
45
- this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
46
+ this.paymentModule.logError("[WalletPass] 发送事件失败", error, {
47
+ hook
48
+ });
46
49
  }
47
50
  }
48
51
  /**
@@ -112,7 +115,10 @@ var WalletPassPaymentImpl = class {
112
115
  if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0) {
113
116
  return {
114
117
  walletRecommendList: [],
115
- userIdentificationCodes: []
118
+ userIdentificationCodes: [],
119
+ transformList: [],
120
+ noApplicableVoucher: [],
121
+ products: []
116
122
  };
117
123
  }
118
124
  this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationStarted, {
@@ -153,11 +159,28 @@ var WalletPassPaymentImpl = class {
153
159
  endTime,
154
160
  duration
155
161
  });
156
- this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
157
- duration: `${duration}ms`,
158
- customer_id: businessData.customer_id,
159
- totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
160
- });
162
+ this.paymentModule.logError(
163
+ `[WalletPass] 从业务数据初始化钱包数据失败`,
164
+ error,
165
+ {
166
+ duration: `${duration}ms`,
167
+ customer_id: businessData.customer_id,
168
+ totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
169
+ }
170
+ );
171
+ throw error;
172
+ }
173
+ }
174
+ /**
175
+ * 获取订单基础详情
176
+ */
177
+ async getOrderBasicDetailAsync(orderId) {
178
+ try {
179
+ const response = await this.paymentModule.request.get(
180
+ `/order/order/${orderId}/basic-detail`
181
+ );
182
+ return (response == null ? void 0 : response.data) || {};
183
+ } catch (error) {
161
184
  throw error;
162
185
  }
163
186
  }
@@ -166,19 +189,49 @@ var WalletPassPaymentImpl = class {
166
189
  * 先获取推荐列表,再获取用户识别码列表(顺序执行)
167
190
  */
168
191
  async initializeWalletDataAsync(baseParams) {
192
+ var _a, _b;
169
193
  try {
170
- const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
171
194
  const identificationParams = {
172
195
  ...baseParams,
173
196
  available: 2,
174
- prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
197
+ prepare_payments: [],
175
198
  other_exact_codes: [],
176
199
  filter_prepare_wallet_pass: 1
177
200
  };
178
- const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
201
+ const [allList, orderBasicDetail] = await Promise.all([
202
+ this.getUserIdentificationCodeListAsync(identificationParams),
203
+ baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)
204
+ ]);
205
+ const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
206
+ if (!walletPassEvaluator) {
207
+ return {
208
+ walletRecommendList: [],
209
+ userIdentificationCodes: [],
210
+ transformList: [],
211
+ noApplicableVoucher: [],
212
+ products: []
213
+ };
214
+ }
215
+ const products = (orderBasicDetail == null ? void 0 : orderBasicDetail.detail) || baseParams.products;
216
+ const res = walletPassEvaluator == null ? void 0 : walletPassEvaluator.getRecommendedVouchers({
217
+ orderTotalAmount: baseParams.order_wait_pay_amount,
218
+ products,
219
+ vouchers: allList
220
+ });
221
+ const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
222
+ console.log(res, "resres12");
223
+ this.walletRecommendList = recommended;
224
+ this.walletInitData = {
225
+ transformList,
226
+ noApplicableVoucher,
227
+ products: products || []
228
+ };
179
229
  return {
180
- walletRecommendList,
181
- userIdentificationCodes
230
+ walletRecommendList: recommended,
231
+ userIdentificationCodes: allList,
232
+ transformList,
233
+ noApplicableVoucher,
234
+ products: products || []
182
235
  };
183
236
  } catch (error) {
184
237
  this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
@@ -261,10 +314,14 @@ var WalletPassPaymentImpl = class {
261
314
  });
262
315
  return this.userIdentificationCodes;
263
316
  } catch (error) {
264
- this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
265
- customer_id: params.customer_id,
266
- available: params.available
267
- });
317
+ this.paymentModule.logError(
318
+ "[WalletPass] 获取用户识别码列表失败",
319
+ error,
320
+ {
321
+ customer_id: params.customer_id,
322
+ available: params.available
323
+ }
324
+ );
268
325
  return [];
269
326
  }
270
327
  }
@@ -462,6 +519,19 @@ var WalletPassPaymentImpl = class {
462
519
  this.searchResults = [];
463
520
  this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
464
521
  }
522
+ /**
523
+ * 获取存储的钱包初始化数据
524
+ */
525
+ getStoredWalletInitData() {
526
+ return this.walletInitData;
527
+ }
528
+ /**
529
+ * 清除存储的钱包初始化数据
530
+ */
531
+ clearStoredWalletInitData() {
532
+ this.walletInitData = null;
533
+ this.paymentModule.logInfo("[WalletPass] 钱包初始化数据已清除");
534
+ }
465
535
  /**
466
536
  * 清除所有缓存数据
467
537
  */
@@ -470,11 +540,18 @@ var WalletPassPaymentImpl = class {
470
540
  this.userIdentificationCodes = [];
471
541
  this.searchResults = [];
472
542
  this.walletParams = null;
543
+ this.walletInitData = null;
473
544
  this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
474
545
  clearedTypes: ["all"]
475
546
  });
476
547
  this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
477
- cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
548
+ cleared_types: [
549
+ "walletRecommendList",
550
+ "userIdentificationCodes",
551
+ "searchResults",
552
+ "walletParams",
553
+ "walletInitData"
554
+ ]
478
555
  });
479
556
  }
480
557
  };
@@ -25,10 +25,10 @@ __export(utils_exports, {
25
25
  module.exports = __toCommonJS(utils_exports);
26
26
  function isNormalProduct(product) {
27
27
  var _a;
28
- if (product == null ? void 0 : product.duration) {
28
+ if (product.duration) {
29
29
  return false;
30
30
  }
31
- if ((_a = product == null ? void 0 : product["schedule.ids"]) == null ? void 0 : _a.length) {
31
+ if ((_a = product["schedule.ids"]) == null ? void 0 : _a.length) {
32
32
  return false;
33
33
  }
34
34
  return true;
@@ -11,19 +11,17 @@ export declare class ProductList extends BaseModule implements Module {
11
11
  constructor(name?: string, version?: string);
12
12
  initialize(core: PisellCore, options: any): Promise<void>;
13
13
  storeChange(path?: string, value?: any): Promise<void>;
14
- loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, with_extra, }: {
14
+ loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
15
15
  category_ids?: number[];
16
16
  product_ids?: number[];
17
17
  collection?: number | string[];
18
18
  schedule_date?: string;
19
- schedule_datetime?: string;
20
19
  cacheId?: string;
21
20
  customer_id?: number;
22
21
  menu_list_ids?: number[];
22
+ schedule_datetime?: string;
23
23
  with_count?: string[];
24
24
  with_schedule?: number;
25
- /** 追加到默认 with 字段(如 dataVariants) */
26
- with_extra?: string[];
27
25
  }): Promise<any>;
28
26
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
29
27
  ids?: number[];
@@ -59,10 +59,9 @@ var ProductList = class extends import_BaseModule.BaseModule {
59
59
  schedule_datetime,
60
60
  schedule_date,
61
61
  cacheId,
62
- with_schedule,
63
- with_extra = []
62
+ with_schedule
64
63
  }) {
65
- var _a;
64
+ var _a, _b, _c;
66
65
  let userPlugin = this.core.getPlugin("user");
67
66
  let customer_id = void 0;
68
67
  try {
@@ -70,49 +69,43 @@ var ProductList = class extends import_BaseModule.BaseModule {
70
69
  } catch (error) {
71
70
  console.error(error);
72
71
  }
73
- try {
74
- const productsData = await this.request.post(
75
- `/product/query`,
76
- {
77
- open_quotation: 1,
78
- open_bundle: 0,
79
- exclude_extension_type: [
80
- "product_party",
81
- "product_event",
82
- "product_series_event",
83
- "product_package_ticket",
84
- "ticket",
85
- "event_item"
86
- ],
87
- with: ["category", "collection", "resourceRelation", ...with_extra],
88
- status: "published",
89
- num: 500,
90
- skip: 1,
91
- customer_id,
92
- category_ids,
93
- ids: product_ids,
94
- collection,
95
- front_end_cache_id: cacheId,
96
- with_count,
97
- // client_schedule_ids: schedule_ids,
98
- schedule_date,
99
- schedule_datetime,
100
- // application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
101
- application_code: "online-store",
102
- with_schedule,
103
- is_eject: 1,
104
- menu_list_ids,
105
- open_deposit: 1
106
- },
107
- { useCache: true, customToast: () => {
108
- } }
109
- );
110
- const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
111
- this.addProduct(sortedList);
112
- return sortedList;
113
- } catch (error) {
114
- return error;
115
- }
72
+ const _platform = this.core.context.platform;
73
+ const productsData = await this.request.post(
74
+ `/product/query`,
75
+ {
76
+ open_quotation: 1,
77
+ open_bundle: 0,
78
+ exclude_extension_type: [
79
+ "product_party",
80
+ "product_event",
81
+ "product_series_event",
82
+ "product_package_ticket",
83
+ "ticket",
84
+ "event_item"
85
+ ],
86
+ with: ["category", "collection", "resourceRelation"],
87
+ status: "published",
88
+ num: 500,
89
+ skip: 1,
90
+ customer_id,
91
+ category_ids,
92
+ ids: product_ids,
93
+ collection,
94
+ front_end_cache_id: cacheId,
95
+ menu_list_ids,
96
+ with_count,
97
+ // client_schedule_ids: schedule_ids,
98
+ schedule_date,
99
+ application_code: _platform === "shop" ? ((_b = this.otherParams) == null ? void 0 : _b.channel) === "online_store" ? "online-store" : (_c = this.otherParams) == null ? void 0 : _c.channel : "online-store",
100
+ with_schedule,
101
+ schedule_datetime,
102
+ is_eject: 1
103
+ },
104
+ { useCache: true }
105
+ );
106
+ const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
107
+ this.addProduct(sortedList);
108
+ return sortedList;
116
109
  }
117
110
  async loadProductsPrice({
118
111
  ids = [],
@@ -1,25 +1,28 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import { Rules, RulesModuleAPI, DiscountResult, UnavailableReason } from './types';
4
- import { Discount } from "../Discount/types";
5
- import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
4
+ import { Discount } from '../Discount/types';
5
+ import { WindowPlugin } from '../../plugins';
6
6
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
7
7
  protected defaultName: string;
8
8
  protected defaultVersion: string;
9
9
  private store;
10
+ window: WindowPlugin;
10
11
  private hooks;
11
12
  constructor(name?: string, version?: string);
12
13
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
13
14
  setRulesList(rulesList: Rules[]): Promise<void>;
14
15
  getRulesList(): Rules[];
15
16
  private checkHolderMatch;
16
- isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, isFormSubject, }: {
17
+ getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
18
+ isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
17
19
  oldDiscountList: Discount[];
18
20
  newDiscountList: Discount[];
19
21
  productList: any[];
20
22
  holders: {
21
23
  form_record_id: number;
22
24
  }[];
25
+ orderTotalAmount: number;
23
26
  isFormSubject: boolean;
24
27
  }): {
25
28
  isAvailable: boolean;
@@ -29,17 +32,18 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
29
32
  };
30
33
  filterDiscountListByType(discountList: Discount[], type: string): Discount[];
31
34
  private getUnavailableReason;
32
- calcDiscount({ discountList, productList, holders, isFormSubject, }: {
35
+ calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
33
36
  discountList: Discount[];
34
37
  productList: any[];
35
38
  holders: {
36
39
  form_record_id: number;
37
40
  }[];
38
41
  isFormSubject: boolean;
42
+ orderTotalAmount: number;
39
43
  }, options?: {
40
44
  isSelected?: boolean;
41
45
  discountId?: number;
42
- selectedList?: SetDiscountSelectedParams[];
46
+ selectedList?: any[];
43
47
  scan?: boolean;
44
48
  }): DiscountResult;
45
49
  /**