@pisell/pisellos 2.1.170 → 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 (231) 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/promotion/index.js +0 -9
  7. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  8. package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
  9. package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
  10. package/dist/model/strategy/engine.d.ts +18 -5
  11. package/dist/model/strategy/engine.js +145 -45
  12. package/dist/model/strategy/type.d.ts +17 -0
  13. package/dist/model/strategy/type.js +4 -0
  14. package/dist/modules/Cart/types.d.ts +2 -0
  15. package/dist/modules/Cart/utils/cartProduct.js +56 -25
  16. package/dist/modules/Cart/utils/changePrice.js +9 -16
  17. package/dist/modules/Discount/index.d.ts +4 -13
  18. package/dist/modules/Discount/index.js +12 -124
  19. package/dist/modules/Discount/types.d.ts +18 -13
  20. package/dist/modules/Order/index.d.ts +1 -67
  21. package/dist/modules/Order/index.js +30 -918
  22. package/dist/modules/Order/types.d.ts +12 -176
  23. package/dist/modules/Order/types.js +0 -2
  24. package/dist/modules/Order/utils.d.ts +0 -118
  25. package/dist/modules/Order/utils.js +2 -586
  26. package/dist/modules/Payment/index.d.ts +2 -1
  27. package/dist/modules/Payment/index.js +10 -7
  28. package/dist/modules/Payment/utils.js +3 -0
  29. package/dist/modules/Payment/walletpass.d.ts +23 -0
  30. package/dist/modules/Payment/walletpass.js +191 -95
  31. package/dist/modules/Product/utils.js +2 -2
  32. package/dist/modules/ProductList/index.d.ts +2 -4
  33. package/dist/modules/ProductList/index.js +12 -24
  34. package/dist/modules/Rules/index.d.ts +9 -5
  35. package/dist/modules/Rules/index.js +669 -173
  36. package/dist/modules/Rules/types.d.ts +2 -0
  37. package/dist/modules/Schedule/getDateIsInSchedule.js +18 -16
  38. package/dist/modules/Schedule/utils.d.ts +1 -1
  39. package/dist/modules/Summary/types.d.ts +2 -0
  40. package/dist/modules/Summary/utils.d.ts +9 -3
  41. package/dist/modules/Summary/utils.js +57 -67
  42. package/dist/modules/index.d.ts +0 -4
  43. package/dist/modules/index.js +1 -5
  44. package/dist/plugins/window.d.ts +2 -0
  45. package/dist/solution/BookingByStep/index.d.ts +3 -2
  46. package/dist/solution/BookingByStep/index.js +43 -46
  47. package/dist/solution/BookingByStep/types.d.ts +1 -3
  48. package/dist/solution/BookingByStep/types.js +1 -5
  49. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  50. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  51. package/dist/solution/Checkout/index.js +2 -0
  52. package/dist/solution/ShopDiscount/index.d.ts +2 -3
  53. package/dist/solution/ShopDiscount/index.js +60 -62
  54. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  55. package/dist/solution/ShopDiscount/types.js +2 -1
  56. package/dist/solution/ShopDiscount/utils.js +26 -12
  57. package/dist/solution/index.d.ts +0 -2
  58. package/dist/solution/index.js +1 -3
  59. package/lib/index.d.ts +1 -1
  60. package/lib/index.js +3 -4
  61. package/lib/model/strategy/adapter/index.d.ts +0 -4
  62. package/lib/model/strategy/adapter/index.js +2 -13
  63. package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
  64. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  65. package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
  66. package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
  67. package/lib/model/strategy/engine.d.ts +18 -5
  68. package/lib/model/strategy/engine.js +85 -21
  69. package/lib/model/strategy/type.d.ts +17 -0
  70. package/lib/modules/Cart/types.d.ts +2 -0
  71. package/lib/modules/Cart/utils/cartProduct.js +39 -12
  72. package/lib/modules/Cart/utils/changePrice.js +9 -13
  73. package/lib/modules/Discount/index.d.ts +4 -13
  74. package/lib/modules/Discount/index.js +5 -76
  75. package/lib/modules/Discount/types.d.ts +18 -13
  76. package/lib/modules/Order/index.d.ts +1 -67
  77. package/lib/modules/Order/index.js +1 -525
  78. package/lib/modules/Order/types.d.ts +12 -176
  79. package/lib/modules/Order/utils.d.ts +0 -118
  80. package/lib/modules/Order/utils.js +2 -483
  81. package/lib/modules/Payment/index.d.ts +2 -1
  82. package/lib/modules/Payment/index.js +1 -0
  83. package/lib/modules/Payment/utils.js +3 -0
  84. package/lib/modules/Payment/walletpass.d.ts +23 -0
  85. package/lib/modules/Payment/walletpass.js +94 -17
  86. package/lib/modules/Product/utils.js +2 -2
  87. package/lib/modules/ProductList/index.d.ts +2 -4
  88. package/lib/modules/ProductList/index.js +39 -46
  89. package/lib/modules/Rules/index.d.ts +9 -5
  90. package/lib/modules/Rules/index.js +776 -292
  91. package/lib/modules/Rules/types.d.ts +2 -0
  92. package/lib/modules/Schedule/getDateIsInSchedule.js +11 -13
  93. package/lib/modules/Schedule/utils.d.ts +1 -1
  94. package/lib/modules/Summary/types.d.ts +2 -0
  95. package/lib/modules/Summary/utils.d.ts +9 -3
  96. package/lib/modules/Summary/utils.js +34 -45
  97. package/lib/modules/index.d.ts +0 -4
  98. package/lib/modules/index.js +1 -9
  99. package/lib/plugins/window.d.ts +2 -0
  100. package/lib/solution/BookingByStep/index.d.ts +3 -2
  101. package/lib/solution/BookingByStep/index.js +4 -6
  102. package/lib/solution/BookingByStep/types.d.ts +1 -3
  103. package/lib/solution/BookingByStep/types.js +0 -10
  104. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  105. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  106. package/lib/solution/Checkout/index.js +2 -0
  107. package/lib/solution/ShopDiscount/index.d.ts +2 -3
  108. package/lib/solution/ShopDiscount/index.js +27 -22
  109. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  110. package/lib/solution/ShopDiscount/utils.js +10 -6
  111. package/lib/solution/index.d.ts +0 -2
  112. package/lib/solution/index.js +1 -5
  113. package/package.json +2 -2
  114. package/dist/apis/picoding.d.ts +0 -0
  115. package/dist/apis/picoding.js +0 -1
  116. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  117. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  118. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  119. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -867
  120. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  121. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  122. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  123. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  124. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -149
  125. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  126. package/dist/modules/OpenData/index.d.ts +0 -24
  127. package/dist/modules/OpenData/index.js +0 -173
  128. package/dist/modules/OpenData/types.d.ts +0 -73
  129. package/dist/modules/OpenData/types.js +0 -1
  130. package/dist/modules/OpenData/utils.d.ts +0 -2
  131. package/dist/modules/OpenData/utils.js +0 -75
  132. package/dist/modules/Quotation/index.d.ts +0 -48
  133. package/dist/modules/Quotation/index.js +0 -248
  134. package/dist/modules/Quotation/types.d.ts +0 -42
  135. package/dist/modules/Quotation/types.js +0 -1
  136. package/dist/modules/SalesSummary/index.d.ts +0 -63
  137. package/dist/modules/SalesSummary/index.js +0 -174
  138. package/dist/modules/SalesSummary/types.d.ts +0 -60
  139. package/dist/modules/SalesSummary/types.js +0 -1
  140. package/dist/modules/SalesSummary/utils.d.ts +0 -30
  141. package/dist/modules/SalesSummary/utils.js +0 -480
  142. package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
  143. package/dist/modules/ScanOrderLogger/index.js +0 -174
  144. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  145. package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
  146. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  147. package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
  148. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  149. package/dist/modules/ScanOrderLogger/types.js +0 -1
  150. package/dist/solution/ScanOrder/index.d.ts +0 -158
  151. package/dist/solution/ScanOrder/index.js +0 -3474
  152. package/dist/solution/ScanOrder/types.d.ts +0 -306
  153. package/dist/solution/ScanOrder/types.js +0 -35
  154. package/dist/solution/ScanOrder/utils.d.ts +0 -172
  155. package/dist/solution/ScanOrder/utils.js +0 -796
  156. package/dist/solution/VenueBooking/index.d.ts +0 -252
  157. package/dist/solution/VenueBooking/index.js +0 -3769
  158. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  159. package/dist/solution/VenueBooking/types.d.ts +0 -156
  160. package/dist/solution/VenueBooking/types.js +0 -22
  161. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  162. package/dist/solution/VenueBooking/utils/dateSummary.js +0 -91
  163. package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
  164. package/dist/solution/VenueBooking/utils/resource.js +0 -131
  165. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
  166. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -233
  167. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -71
  168. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -302
  169. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
  170. package/dist/solution/VenueBooking/utils/timeSlot.js +0 -458
  171. package/dist/solution/VenueBooking/utils.d.ts +0 -1
  172. package/dist/solution/VenueBooking/utils.js +0 -1
  173. package/lib/apis/picoding.d.ts +0 -0
  174. package/lib/apis/picoding.js +0 -0
  175. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  176. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  177. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  178. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -666
  179. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  180. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  181. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  182. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  183. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -149
  184. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
  185. package/lib/modules/OpenData/index.d.ts +0 -24
  186. package/lib/modules/OpenData/index.js +0 -119
  187. package/lib/modules/OpenData/types.d.ts +0 -73
  188. package/lib/modules/OpenData/types.js +0 -17
  189. package/lib/modules/OpenData/utils.d.ts +0 -2
  190. package/lib/modules/OpenData/utils.js +0 -111
  191. package/lib/modules/Quotation/index.d.ts +0 -48
  192. package/lib/modules/Quotation/index.js +0 -152
  193. package/lib/modules/Quotation/types.d.ts +0 -42
  194. package/lib/modules/Quotation/types.js +0 -17
  195. package/lib/modules/SalesSummary/index.d.ts +0 -63
  196. package/lib/modules/SalesSummary/index.js +0 -105
  197. package/lib/modules/SalesSummary/types.d.ts +0 -60
  198. package/lib/modules/SalesSummary/types.js +0 -17
  199. package/lib/modules/SalesSummary/utils.d.ts +0 -30
  200. package/lib/modules/SalesSummary/utils.js +0 -420
  201. package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
  202. package/lib/modules/ScanOrderLogger/index.js +0 -147
  203. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  204. package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
  205. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  206. package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
  207. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  208. package/lib/modules/ScanOrderLogger/types.js +0 -17
  209. package/lib/solution/ScanOrder/index.d.ts +0 -158
  210. package/lib/solution/ScanOrder/index.js +0 -2135
  211. package/lib/solution/ScanOrder/types.d.ts +0 -306
  212. package/lib/solution/ScanOrder/types.js +0 -36
  213. package/lib/solution/ScanOrder/utils.d.ts +0 -172
  214. package/lib/solution/ScanOrder/utils.js +0 -658
  215. package/lib/solution/VenueBooking/index.d.ts +0 -252
  216. package/lib/solution/VenueBooking/index.js +0 -2204
  217. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  218. package/lib/solution/VenueBooking/types.d.ts +0 -156
  219. package/lib/solution/VenueBooking/types.js +0 -45
  220. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  221. package/lib/solution/VenueBooking/utils/dateSummary.js +0 -105
  222. package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
  223. package/lib/solution/VenueBooking/utils/resource.js +0 -92
  224. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
  225. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -236
  226. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -71
  227. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -225
  228. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
  229. package/lib/solution/VenueBooking/utils/timeSlot.js +0 -343
  230. package/lib/solution/VenueBooking/utils.d.ts +0 -1
  231. 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
  /**