@pisell/pisellos 2.3.42 → 2.3.44

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 (157) hide show
  1. package/dist/modules/Discount/index.d.ts +1 -0
  2. package/dist/modules/Discount/index.js +40 -11
  3. package/dist/modules/Discount/types.d.ts +1 -0
  4. package/dist/modules/Holder/index.d.ts +48 -0
  5. package/dist/modules/Holder/index.js +640 -0
  6. package/dist/modules/Holder/types.d.ts +123 -0
  7. package/dist/modules/Holder/types.js +1 -0
  8. package/dist/modules/Holder/utils.d.ts +13 -0
  9. package/dist/modules/Holder/utils.js +34 -0
  10. package/dist/modules/OpenData/index.js +2 -2
  11. package/dist/modules/Order/index.d.ts +5 -2
  12. package/dist/modules/Order/index.js +127 -53
  13. package/dist/modules/Order/types.d.ts +11 -0
  14. package/dist/modules/Order/utils.d.ts +10 -0
  15. package/dist/modules/Order/utils.js +35 -3
  16. package/dist/modules/Payment/walletpass.d.ts +10 -3
  17. package/dist/modules/Payment/walletpass.js +425 -282
  18. package/dist/modules/Product/types.d.ts +1 -0
  19. package/dist/modules/ProductList/index.js +33 -14
  20. package/dist/modules/Quotation/index.d.ts +1 -1
  21. package/dist/modules/Quotation/index.js +2 -2
  22. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  23. package/dist/modules/ResourcePlanner/index.js +181 -0
  24. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  25. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  26. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  27. package/dist/modules/ResourcePlanner/types.js +1 -0
  28. package/dist/modules/Rules/index.d.ts +2 -0
  29. package/dist/modules/Rules/index.js +106 -68
  30. package/dist/modules/SalesSummary/index.js +12 -13
  31. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  32. package/dist/modules/ScanOrderLogger/index.js +15 -2
  33. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  34. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  35. package/dist/modules/Schedule/index.d.ts +3 -1
  36. package/dist/modules/Schedule/index.js +21 -16
  37. package/dist/modules/Summary/utils.js +38 -13
  38. package/dist/modules/index.d.ts +2 -0
  39. package/dist/modules/index.js +3 -1
  40. package/dist/plugins/window.d.ts +1 -0
  41. package/dist/server/index.d.ts +14 -0
  42. package/dist/server/index.js +772 -657
  43. package/dist/solution/BaseSales/index.d.ts +7 -0
  44. package/dist/solution/BaseSales/index.js +70 -45
  45. package/dist/solution/BaseSales/types.d.ts +3 -1
  46. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  47. package/dist/solution/BookingByStep/index.d.ts +17 -2
  48. package/dist/solution/BookingByStep/index.js +294 -215
  49. package/dist/solution/BookingByStep/types.d.ts +2 -1
  50. package/dist/solution/BookingByStep/types.js +3 -1
  51. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  52. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  53. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  54. package/dist/solution/BookingTicket/index.js +8 -5
  55. package/dist/solution/BookingTicket/types.d.ts +1 -0
  56. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
  57. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  58. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  59. package/dist/solution/ScanOrder/index.d.ts +26 -14
  60. package/dist/solution/ScanOrder/index.js +1142 -739
  61. package/dist/solution/ScanOrder/types.d.ts +21 -1
  62. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  63. package/dist/solution/ScanOrder/utils.js +66 -25
  64. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  65. package/dist/solution/ShopDiscount/index.js +125 -87
  66. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  67. package/dist/solution/UnifiedBookingSales/index.js +1891 -0
  68. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  69. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  70. package/dist/solution/VenueBooking/index.d.ts +40 -11
  71. package/dist/solution/VenueBooking/index.js +1167 -841
  72. package/dist/solution/VenueBooking/types.d.ts +3 -0
  73. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  74. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  75. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  76. package/dist/solution/index.d.ts +1 -0
  77. package/dist/solution/index.js +2 -1
  78. package/dist/types/index.d.ts +1 -0
  79. package/lib/modules/Discount/index.d.ts +1 -0
  80. package/lib/modules/Discount/index.js +9 -0
  81. package/lib/modules/Discount/types.d.ts +1 -0
  82. package/lib/modules/Holder/index.d.ts +48 -0
  83. package/lib/modules/Holder/index.js +402 -0
  84. package/lib/modules/Holder/types.d.ts +123 -0
  85. package/lib/modules/Holder/types.js +17 -0
  86. package/lib/modules/Holder/utils.d.ts +13 -0
  87. package/lib/modules/Holder/utils.js +71 -0
  88. package/lib/modules/OpenData/index.js +1 -1
  89. package/lib/modules/Order/index.d.ts +5 -2
  90. package/lib/modules/Order/index.js +72 -17
  91. package/lib/modules/Order/types.d.ts +11 -0
  92. package/lib/modules/Order/utils.d.ts +10 -0
  93. package/lib/modules/Order/utils.js +36 -5
  94. package/lib/modules/Payment/walletpass.d.ts +10 -3
  95. package/lib/modules/Payment/walletpass.js +218 -56
  96. package/lib/modules/Product/types.d.ts +1 -0
  97. package/lib/modules/ProductList/index.js +40 -31
  98. package/lib/modules/Quotation/index.d.ts +1 -1
  99. package/lib/modules/Quotation/index.js +2 -2
  100. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  101. package/lib/modules/ResourcePlanner/index.js +148 -0
  102. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  103. package/lib/modules/ResourcePlanner/planner.js +933 -0
  104. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  105. package/lib/modules/ResourcePlanner/types.js +17 -0
  106. package/lib/modules/Rules/index.d.ts +2 -0
  107. package/lib/modules/Rules/index.js +41 -19
  108. package/lib/modules/SalesSummary/index.js +6 -7
  109. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  110. package/lib/modules/ScanOrderLogger/index.js +13 -1
  111. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  112. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  113. package/lib/modules/Schedule/index.d.ts +3 -1
  114. package/lib/modules/Schedule/index.js +10 -8
  115. package/lib/modules/Summary/utils.js +21 -1
  116. package/lib/modules/index.d.ts +2 -0
  117. package/lib/modules/index.js +5 -1
  118. package/lib/plugins/window.d.ts +1 -0
  119. package/lib/server/index.d.ts +14 -0
  120. package/lib/server/index.js +65 -5
  121. package/lib/solution/BaseSales/index.d.ts +7 -0
  122. package/lib/solution/BaseSales/index.js +25 -8
  123. package/lib/solution/BaseSales/types.d.ts +3 -1
  124. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
  125. package/lib/solution/BookingByStep/index.d.ts +17 -2
  126. package/lib/solution/BookingByStep/index.js +60 -18
  127. package/lib/solution/BookingByStep/types.d.ts +2 -1
  128. package/lib/solution/BookingByStep/types.js +5 -0
  129. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  130. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  131. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  132. package/lib/solution/BookingTicket/index.js +11 -2
  133. package/lib/solution/BookingTicket/types.d.ts +1 -0
  134. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
  135. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  136. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  137. package/lib/solution/ScanOrder/index.d.ts +26 -14
  138. package/lib/solution/ScanOrder/index.js +449 -182
  139. package/lib/solution/ScanOrder/types.d.ts +21 -1
  140. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  141. package/lib/solution/ScanOrder/utils.js +31 -0
  142. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  143. package/lib/solution/ShopDiscount/index.js +14 -0
  144. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  145. package/lib/solution/UnifiedBookingSales/index.js +1084 -0
  146. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  147. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  148. package/lib/solution/VenueBooking/index.d.ts +40 -11
  149. package/lib/solution/VenueBooking/index.js +322 -110
  150. package/lib/solution/VenueBooking/types.d.ts +3 -0
  151. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  152. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  153. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  154. package/lib/solution/index.d.ts +1 -0
  155. package/lib/solution/index.js +3 -1
  156. package/lib/types/index.d.ts +1 -0
  157. package/package.json +1 -1
@@ -34,6 +34,11 @@ function getWalletAssetKey(assetOrId) {
34
34
  var id = assetOrId && _typeof(assetOrId) === 'object' ? getWalletAssetId(assetOrId) : assetOrId;
35
35
  return id === undefined || id === null ? '' : String(id);
36
36
  }
37
+ function matchesWalletAssetCode(asset, normalizedCode) {
38
+ return [asset === null || asset === void 0 ? void 0 : asset.code, asset === null || asset === void 0 ? void 0 : asset.encoded].some(function (identifier) {
39
+ return String(identifier !== null && identifier !== void 0 ? identifier : '').trim() === normalizedCode;
40
+ });
41
+ }
37
42
  function isWalletAssetAvailable(asset) {
38
43
  if (!asset) return false;
39
44
  if (asset.unified_available_status !== undefined && Number(asset.unified_available_status) !== 1) {
@@ -147,13 +152,17 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
147
152
  var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
148
153
  return String(id);
149
154
  }));
150
- var requestedKeys = new Set(requestedIds.map(function (id) {
155
+ var itemsByKey = new Map(items.map(function (item) {
156
+ return [getWalletAssetKey(item), item];
157
+ }));
158
+ var requested = requestedIds.map(function (id) {
151
159
  return String(id);
152
160
  }).filter(function (id) {
153
161
  return !committedKeys.has(id);
154
- }));
155
- var requested = items.filter(function (item) {
156
- return requestedKeys.has(getWalletAssetKey(item)) && isWalletAssetAvailable(item);
162
+ }).map(function (id) {
163
+ return itemsByKey.get(id);
164
+ }).filter(function (item) {
165
+ return item && isWalletAssetAvailable(item);
157
166
  });
158
167
  var nextItems = items;
159
168
  var selectedItems = requested;
@@ -200,110 +209,52 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
200
209
  });
201
210
  }
202
211
 
212
+ /** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
213
+ }, {
214
+ key: "getSearchedWalletAssetCodes",
215
+ value: function getSearchedWalletAssetCodes() {
216
+ var cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
217
+ var seenCodes = new Set();
218
+ return cachedAssets.map(function (item) {
219
+ return String((item === null || item === void 0 ? void 0 : item.code) || '').trim();
220
+ }).filter(function (code) {
221
+ var normalizedCode = code.toUpperCase();
222
+ if (!normalizedCode || seenCodes.has(normalizedCode)) return false;
223
+ seenCodes.add(normalizedCode);
224
+ return true;
225
+ });
226
+ }
227
+
203
228
  /**
204
- * 使用最新订单参数重验扫码搜索过的支付类 Wallet 资产。
205
- * 请求失败或暂时无匹配结果时保留旧资产,避免商品变化造成列表闪空。
229
+ * 用订单重算接口返回的数据更新扫码 Wallet 缓存。
230
+ * 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
206
231
  */
207
232
  }, {
208
- key: "revalidateSearchedWalletAssets",
209
- value: (function () {
210
- var _revalidateSearchedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(requestSequence) {
211
- var _this = this;
212
- var cachedAssets, searchCodes, preparePayments, refreshedGroups, replacedCodes, refreshedAssets;
213
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
214
- while (1) switch (_context2.prev = _context2.next) {
215
- case 0:
216
- cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
217
- searchCodes = _toConsumableArray(new Set(cachedAssets.map(function (item) {
218
- return String((item === null || item === void 0 ? void 0 : item.code) || '').trim();
219
- }).filter(Boolean)));
220
- if (!(searchCodes.length === 0)) {
221
- _context2.next = 4;
222
- break;
223
- }
224
- return _context2.abrupt("return", cachedAssets);
225
- case 4:
226
- preparePayments = this.formatWalletPassList2PreparePayments(this.walletAssetsState.selectedItems);
227
- _context2.next = 7;
228
- return Promise.all(searchCodes.map( /*#__PURE__*/function () {
229
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchCode) {
230
- var result;
231
- return _regeneratorRuntime().wrap(function _callee$(_context) {
232
- while (1) switch (_context.prev = _context.next) {
233
- case 0:
234
- _context.prev = 0;
235
- _context.next = 3;
236
- return _this.searchIdentificationCodeAsync(_objectSpread(_objectSpread({}, _this.walletParams || {}), {}, {
237
- code: searchCode,
238
- prepare_payments: preparePayments
239
- }), {
240
- noCache: true
241
- });
242
- case 3:
243
- result = _context.sent;
244
- return _context.abrupt("return", {
245
- searchCode: searchCode,
246
- items: result.type === 'normalCode' ? result.data.filter(isWalletPaymentAsset) : []
247
- });
248
- case 7:
249
- _context.prev = 7;
250
- _context.t0 = _context["catch"](0);
251
- _this.paymentModule.logWarning('[WalletPass] 重验扫码 Wallet 资产失败,保留旧结果', {
252
- code: searchCode,
253
- error: _context.t0 instanceof Error ? _context.t0.message : String(_context.t0)
254
- });
255
- return _context.abrupt("return", {
256
- searchCode: searchCode,
257
- items: []
258
- });
259
- case 11:
260
- case "end":
261
- return _context.stop();
262
- }
263
- }, _callee, null, [[0, 7]]);
264
- }));
265
- return function (_x2) {
266
- return _ref9.apply(this, arguments);
267
- };
268
- }()));
269
- case 7:
270
- refreshedGroups = _context2.sent;
271
- if (!(requestSequence !== this.walletAssetsRequestSequence)) {
272
- _context2.next = 10;
273
- break;
274
- }
275
- return _context2.abrupt("return", cachedAssets);
276
- case 10:
277
- replacedCodes = new Set(refreshedGroups.filter(function (group) {
278
- return group.items.length > 0;
279
- }).map(function (group) {
280
- return group.searchCode.toUpperCase();
281
- }));
282
- refreshedAssets = refreshedGroups.flatMap(function (group) {
283
- return group.items;
284
- });
285
- if (refreshedAssets.length > 0) {
286
- this.searchResults = [].concat(_toConsumableArray(this.searchResults.filter(function (item) {
287
- return !replacedCodes.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
288
- })), _toConsumableArray(refreshedAssets));
289
- }
290
- return _context2.abrupt("return", mergeWalletAssets(cachedAssets, refreshedAssets));
291
- case 14:
292
- case "end":
293
- return _context2.stop();
294
- }
295
- }, _callee2, this);
233
+ key: "syncSearchedWalletAssets",
234
+ value: function syncSearchedWalletAssets(refreshedCandidates) {
235
+ var cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
236
+ var searchedCodeKeys = new Set(this.getSearchedWalletAssetCodes().map(function (code) {
237
+ return code.toUpperCase();
296
238
  }));
297
- function revalidateSearchedWalletAssets(_x) {
298
- return _revalidateSearchedWalletAssets.apply(this, arguments);
239
+ if (searchedCodeKeys.size === 0) return cachedAssets;
240
+ var refreshedAssets = refreshedCandidates.filter(function (item) {
241
+ return isWalletPaymentAsset(item) && searchedCodeKeys.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
242
+ });
243
+ if (refreshedAssets.length > 0) {
244
+ var replacedCodes = new Set(refreshedAssets.map(function (item) {
245
+ return String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase();
246
+ }));
247
+ this.searchResults = [].concat(_toConsumableArray(this.searchResults.filter(function (item) {
248
+ return !replacedCodes.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
249
+ })), _toConsumableArray(refreshedAssets));
299
250
  }
300
- return revalidateSearchedWalletAssets;
301
- }()
251
+ return mergeWalletAssets(cachedAssets, refreshedAssets);
252
+ }
253
+
302
254
  /**
303
255
  * 生成钱包API默认参数
304
256
  * 根据业务数据生成标准的钱包API参数,并存储在模块中
305
257
  */
306
- )
307
258
  }, {
308
259
  key: "generateWalletParams",
309
260
  value: function generateWalletParams(businessData) {
@@ -382,19 +333,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
382
333
  }, {
383
334
  key: "initializeWalletDataFromBusinessAsync",
384
335
  value: (function () {
385
- var _initializeWalletDataFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(businessData) {
336
+ var _initializeWalletDataFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(businessData) {
386
337
  var _businessData$amountI, _businessData$amountI2, _businessData$amountI3, _businessData$amountI4, _businessData$product;
387
338
  var startTime, walletParams, _result$walletRecomme, _result$userIdentific, result, endTime, duration, _businessData$amountI5, _endTime, _duration;
388
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
389
- while (1) switch (_context3.prev = _context3.next) {
339
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
340
+ while (1) switch (_context.prev = _context.next) {
390
341
  case 0:
391
342
  startTime = Date.now();
392
343
  walletParams = this.generateWalletParams(businessData);
393
344
  if (!(Number((businessData === null || businessData === void 0 || (_businessData$amountI = businessData.amountInfo) === null || _businessData$amountI === void 0 ? void 0 : _businessData$amountI.totalAmount) || 0) < 0 || Number((businessData === null || businessData === void 0 || (_businessData$amountI2 = businessData.amountInfo) === null || _businessData$amountI2 === void 0 ? void 0 : _businessData$amountI2.subTotal) || 0) < 0)) {
394
- _context3.next = 4;
345
+ _context.next = 4;
395
346
  break;
396
347
  }
397
- return _context3.abrupt("return", {
348
+ return _context.abrupt("return", {
398
349
  walletRecommendList: [],
399
350
  userIdentificationCodes: [],
400
351
  transformList: [],
@@ -403,10 +354,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
403
354
  });
404
355
  case 4:
405
356
  if (![1, 0].includes((walletParams === null || walletParams === void 0 ? void 0 : walletParams.customer_id) || 0)) {
406
- _context3.next = 6;
357
+ _context.next = 6;
407
358
  break;
408
359
  }
409
- return _context3.abrupt("return", {
360
+ return _context.abrupt("return", {
410
361
  walletRecommendList: [],
411
362
  userIdentificationCodes: []
412
363
  });
@@ -423,11 +374,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
423
374
  order_wait_pay_amount: businessData.order_wait_pay_amount,
424
375
  products_count: ((_businessData$product = businessData.products) === null || _businessData$product === void 0 ? void 0 : _businessData$product.length) || 0
425
376
  });
426
- _context3.prev = 8;
427
- _context3.next = 11;
377
+ _context.prev = 8;
378
+ _context.next = 11;
428
379
  return this.initializeWalletDataAsync(walletParams);
429
380
  case 11:
430
- result = _context3.sent;
381
+ result = _context.sent;
431
382
  endTime = Date.now();
432
383
  duration = endTime - startTime; // 发送初始化完成事件
433
384
  this.emitEvent(WalletPassHooks.OnWalletInitializationCompleted, {
@@ -442,32 +393,32 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
442
393
  walletRecommendList_count: ((_result$walletRecomme = result.walletRecommendList) === null || _result$walletRecomme === void 0 ? void 0 : _result$walletRecomme.length) || 0,
443
394
  userIdentificationCodes_count: ((_result$userIdentific = result.userIdentificationCodes) === null || _result$userIdentific === void 0 ? void 0 : _result$userIdentific.length) || 0
444
395
  });
445
- return _context3.abrupt("return", result);
396
+ return _context.abrupt("return", result);
446
397
  case 19:
447
- _context3.prev = 19;
448
- _context3.t0 = _context3["catch"](8);
398
+ _context.prev = 19;
399
+ _context.t0 = _context["catch"](8);
449
400
  _endTime = Date.now();
450
401
  _duration = _endTime - startTime; // 发送初始化失败事件
451
402
  this.emitEvent(WalletPassHooks.OnWalletInitializationFailed, {
452
403
  businessData: businessData,
453
- error: _context3.t0,
404
+ error: _context.t0,
454
405
  startTime: startTime,
455
406
  endTime: _endTime,
456
407
  duration: _duration
457
408
  });
458
- this.paymentModule.logError("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", _context3.t0, {
409
+ this.paymentModule.logError("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", _context.t0, {
459
410
  duration: "".concat(_duration, "ms"),
460
411
  customer_id: businessData.customer_id,
461
412
  totalAmount: (_businessData$amountI5 = businessData.amountInfo) === null || _businessData$amountI5 === void 0 ? void 0 : _businessData$amountI5.totalAmount
462
413
  });
463
- throw _context3.t0;
414
+ throw _context.t0;
464
415
  case 26:
465
416
  case "end":
466
- return _context3.stop();
417
+ return _context.stop();
467
418
  }
468
- }, _callee3, this, [[8, 19]]);
419
+ }, _callee, this, [[8, 19]]);
469
420
  }));
470
- function initializeWalletDataFromBusinessAsync(_x3) {
421
+ function initializeWalletDataFromBusinessAsync(_x) {
471
422
  return _initializeWalletDataFromBusinessAsync.apply(this, arguments);
472
423
  }
473
424
  return initializeWalletDataFromBusinessAsync;
@@ -479,28 +430,28 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
479
430
  }, {
480
431
  key: "getOrderBasicDetailAsync",
481
432
  value: (function () {
482
- var _getOrderBasicDetailAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderId) {
433
+ var _getOrderBasicDetailAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderId) {
483
434
  var response;
484
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
485
- while (1) switch (_context4.prev = _context4.next) {
435
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
436
+ while (1) switch (_context2.prev = _context2.next) {
486
437
  case 0:
487
- _context4.prev = 0;
488
- _context4.next = 3;
438
+ _context2.prev = 0;
439
+ _context2.next = 3;
489
440
  return this.paymentModule.request.get("/order/order/".concat(orderId, "/basic-detail"));
490
441
  case 3:
491
- response = _context4.sent;
492
- return _context4.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || {});
442
+ response = _context2.sent;
443
+ return _context2.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || {});
493
444
  case 7:
494
- _context4.prev = 7;
495
- _context4.t0 = _context4["catch"](0);
496
- throw _context4.t0;
445
+ _context2.prev = 7;
446
+ _context2.t0 = _context2["catch"](0);
447
+ throw _context2.t0;
497
448
  case 10:
498
449
  case "end":
499
- return _context4.stop();
450
+ return _context2.stop();
500
451
  }
501
- }, _callee4, this, [[0, 7]]);
452
+ }, _callee2, this, [[0, 7]]);
502
453
  }));
503
- function getOrderBasicDetailAsync(_x4) {
454
+ function getOrderBasicDetailAsync(_x2) {
504
455
  return _getOrderBasicDetailAsync.apply(this, arguments);
505
456
  }
506
457
  return getOrderBasicDetailAsync;
@@ -513,12 +464,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
513
464
  }, {
514
465
  key: "initializeWalletDataAsync",
515
466
  value: (function () {
516
- var _initializeWalletDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(baseParams) {
467
+ var _initializeWalletDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(baseParams) {
517
468
  var _this$paymentModule$w3, _this$paymentModule$w4, identificationParams, _yield$Promise$all, _yield$Promise$all2, allList, orderBasicDetail, walletPassEvaluator, products, res, recommended, transformList, noApplicableVoucher, recommendedAmount;
518
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
519
- while (1) switch (_context5.prev = _context5.next) {
469
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
470
+ while (1) switch (_context3.prev = _context3.next) {
520
471
  case 0:
521
- _context5.prev = 0;
472
+ _context3.prev = 0;
522
473
  // 格式化用户识别码列表参数
523
474
  identificationParams = _objectSpread(_objectSpread({}, baseParams), {}, {
524
475
  available: 2,
@@ -526,19 +477,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
526
477
  other_exact_codes: [],
527
478
  filter_prepare_wallet_pass: 1
528
479
  }); // 并行获取用户识别码列表和订单详情
529
- _context5.next = 4;
480
+ _context3.next = 4;
530
481
  return Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id && typeof baseParams.payment_order_id === 'string' && !baseParams.payment_order_id.startsWith('LOCAL_') ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
531
482
  case 4:
532
- _yield$Promise$all = _context5.sent;
483
+ _yield$Promise$all = _context3.sent;
533
484
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
534
485
  allList = _yield$Promise$all2[0];
535
486
  orderBasicDetail = _yield$Promise$all2[1];
536
487
  walletPassEvaluator = (_this$paymentModule$w3 = this.paymentModule.window) === null || _this$paymentModule$w3 === void 0 || (_this$paymentModule$w4 = _this$paymentModule$w3.getWalletPassEvaluator) === null || _this$paymentModule$w4 === void 0 ? void 0 : _this$paymentModule$w4.call(_this$paymentModule$w3);
537
488
  if (walletPassEvaluator) {
538
- _context5.next = 11;
489
+ _context3.next = 11;
539
490
  break;
540
491
  }
541
- return _context5.abrupt("return", {
492
+ return _context3.abrupt("return", {
542
493
  walletRecommendList: [],
543
494
  userIdentificationCodes: [],
544
495
  transformList: [],
@@ -566,7 +517,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
566
517
  // // 再获取用户识别码列表
567
518
  // const userIdentificationCodes =
568
519
  // await this.getUserIdentificationCodeListAsync(identificationParams);
569
- return _context5.abrupt("return", {
520
+ return _context3.abrupt("return", {
570
521
  walletRecommendList: recommended,
571
522
  userIdentificationCodes: allList,
572
523
  transformList: transformList,
@@ -574,33 +525,132 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
574
525
  products: products || []
575
526
  });
576
527
  case 20:
577
- _context5.prev = 20;
578
- _context5.t0 = _context5["catch"](0);
579
- this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', _context5.t0, {
528
+ _context3.prev = 20;
529
+ _context3.t0 = _context3["catch"](0);
530
+ this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', _context3.t0, {
580
531
  customer_id: baseParams.customer_id,
581
532
  order_expect_amount: baseParams.order_expect_amount
582
533
  });
583
- throw _context5.t0;
534
+ throw _context3.t0;
584
535
  case 24:
585
536
  case "end":
586
- return _context5.stop();
537
+ return _context3.stop();
587
538
  }
588
- }, _callee5, this, [[0, 20]]);
539
+ }, _callee3, this, [[0, 20]]);
589
540
  }));
590
- function initializeWalletDataAsync(_x5) {
541
+ function initializeWalletDataAsync(_x3) {
591
542
  return _initializeWalletDataAsync.apply(this, arguments);
592
543
  }
593
544
  return initializeWalletDataAsync;
545
+ }()
546
+ /**
547
+ * 商品或订单金额变化后,使用聚合接口一次重算已选与剩余 WalletPass。
548
+ * Walk-In 不发送 customer_id;会员才携带真实 customer_id。
549
+ */
550
+ )
551
+ }, {
552
+ key: "aggregateRecalculateWalletAssetsAsync",
553
+ value: (function () {
554
+ var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
555
+ var _this$paymentModule$w5, _this$paymentModule$w6;
556
+ var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
557
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
558
+ while (1) switch (_context4.prev = _context4.next) {
559
+ case 0:
560
+ walletParams = this.generateWalletParams(businessData);
561
+ customerId = Number(walletParams.customer_id || 0);
562
+ requestParams = {
563
+ ids: selectedIds.map(function (id) {
564
+ return String(id);
565
+ }),
566
+ exact_codes: this.getSearchedWalletAssetCodes(),
567
+ order_product_amount: walletParams.order_product_amount,
568
+ order_expect_amount: walletParams.order_expect_amount,
569
+ order_wait_pay_amount: walletParams.order_wait_pay_amount,
570
+ products: walletParams.products,
571
+ available: 2,
572
+ filter_prepare_wallet_pass: 1,
573
+ sale_channel: walletParams.sale_channel || 'pos'
574
+ };
575
+ if (customerId > 1) {
576
+ requestParams.customer_id = customerId;
577
+ }
578
+ _context4.next = 6;
579
+ return this.paymentModule.request.post('/machinecode/prepare/deduction/aggregate-recalculate', requestParams);
580
+ case 6:
581
+ response = _context4.sent;
582
+ responseData = response === null || response === void 0 ? void 0 : response.data;
583
+ hasAggregateLists = responseData && (Object.prototype.hasOwnProperty.call(responseData, 'recalculate_list') || Object.prototype.hasOwnProperty.call(responseData, 'customer_wallet_pass_list'));
584
+ if (hasAggregateLists) {
585
+ _context4.next = 11;
586
+ break;
587
+ }
588
+ throw new Error('WalletPass aggregate response is missing list data');
589
+ case 11:
590
+ recalculateList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
591
+ customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
592
+ allList = mergeWalletAssets(recalculateList, customerWalletPassList);
593
+ walletPassEvaluator = (_this$paymentModule$w5 = this.paymentModule.window) === null || _this$paymentModule$w5 === void 0 || (_this$paymentModule$w6 = _this$paymentModule$w5.getWalletPassEvaluator) === null || _this$paymentModule$w6 === void 0 ? void 0 : _this$paymentModule$w6.call(_this$paymentModule$w5);
594
+ evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
595
+ orderTotalAmount: walletParams.order_wait_pay_amount,
596
+ products: walletParams.products,
597
+ vouchers: allList
598
+ }) : {
599
+ recommended: [],
600
+ transformList: allList.filter(isWalletAssetAvailable),
601
+ noApplicableVoucher: allList.filter(function (item) {
602
+ return !isWalletAssetAvailable(item);
603
+ })
604
+ };
605
+ returnedSelectedKeys = new Set(recalculateList.filter(isWalletAssetAvailable).map(function (item) {
606
+ return getWalletAssetKey(item);
607
+ }));
608
+ authoritativeSelectedIds = selectedIds.filter(function (id) {
609
+ return returnedSelectedKeys.has(String(id));
610
+ });
611
+ this.walletRecommendList = evaluated.recommended || [];
612
+ this.userIdentificationCodes = allList;
613
+ this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
614
+ userIdentificationCodes: this.userIdentificationCodes
615
+ });
616
+ this.walletInitData = {
617
+ transformList: evaluated.transformList || [],
618
+ noApplicableVoucher: evaluated.noApplicableVoucher || [],
619
+ products: walletParams.products || []
620
+ };
621
+ this.paymentModule.logInfo('[WalletPass] 聚合重算 WalletPass 完成', {
622
+ selected_count: recalculateList.length,
623
+ remaining_count: customerWalletPassList.length,
624
+ searched_codes_count: requestParams.exact_codes.length
625
+ });
626
+ return _context4.abrupt("return", {
627
+ walletRecommendList: this.walletRecommendList,
628
+ userIdentificationCodes: this.userIdentificationCodes,
629
+ transformList: evaluated.transformList || [],
630
+ noApplicableVoucher: evaluated.noApplicableVoucher || [],
631
+ products: walletParams.products || [],
632
+ authoritativeSelectedIds: authoritativeSelectedIds
633
+ });
634
+ case 24:
635
+ case "end":
636
+ return _context4.stop();
637
+ }
638
+ }, _callee4, this);
639
+ }));
640
+ function aggregateRecalculateWalletAssetsAsync(_x4, _x5) {
641
+ return _aggregateRecalculateWalletAssetsAsync.apply(this, arguments);
642
+ }
643
+ return aggregateRecalculateWalletAssetsAsync;
594
644
  }())
595
645
  }, {
596
646
  key: "getWalletPassRecommendListAsync",
597
647
  value: function () {
598
- var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
648
+ var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
599
649
  var _this$walletParams, response;
600
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
601
- while (1) switch (_context6.prev = _context6.next) {
650
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
651
+ while (1) switch (_context5.prev = _context5.next) {
602
652
  case 0:
603
- _context6.prev = 0;
653
+ _context5.prev = 0;
604
654
  this.paymentModule.logInfo('[WalletPass] 开始获取钱包推荐列表', {
605
655
  customer_id: params.customer_id,
606
656
  order_expect_amount: params.order_expect_amount,
@@ -610,11 +660,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
610
660
  if (typeof params.payment_order_id === 'string' && params.payment_order_id.startsWith('LOCAL_')) {
611
661
  params.payment_order_id = undefined;
612
662
  }
613
- _context6.next = 5;
663
+ _context5.next = 5;
614
664
  return this.paymentModule.request.post('/machinecode/prepare/deduction/recommend', params // 将 params 作为请求体数据
615
665
  );
616
666
  case 5:
617
- response = _context6.sent;
667
+ response = _context5.sent;
618
668
  this.walletRecommendList = (response === null || response === void 0 ? void 0 : response.data) || [];
619
669
 
620
670
  // 发送钱包推荐列表更新事件(使用专用的WalletPassHooks)
@@ -632,22 +682,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
632
682
  };
633
683
  })
634
684
  });
635
- return _context6.abrupt("return", this.walletRecommendList);
685
+ return _context5.abrupt("return", this.walletRecommendList);
636
686
  case 12:
637
- _context6.prev = 12;
638
- _context6.t0 = _context6["catch"](0);
639
- this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败', _context6.t0, {
687
+ _context5.prev = 12;
688
+ _context5.t0 = _context5["catch"](0);
689
+ this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败', _context5.t0, {
640
690
  customer_id: params.customer_id,
641
691
  order_expect_amount: params.order_expect_amount,
642
692
  sale_channel: params.sale_channel
643
693
  });
644
694
  // throw error;
645
- return _context6.abrupt("return", []);
695
+ return _context5.abrupt("return", []);
646
696
  case 16:
647
697
  case "end":
648
- return _context6.stop();
698
+ return _context5.stop();
649
699
  }
650
- }, _callee6, this, [[0, 12]]);
700
+ }, _callee5, this, [[0, 12]]);
651
701
  }));
652
702
  function getWalletPassRecommendListAsync(_x6) {
653
703
  return _getWalletPassRecommendListAsync.apply(this, arguments);
@@ -662,19 +712,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
662
712
  }, {
663
713
  key: "getUserIdentificationCodeListAsync",
664
714
  value: function () {
665
- var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
715
+ var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
666
716
  var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, response, sortedData;
667
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
668
- while (1) switch (_context7.prev = _context7.next) {
717
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
718
+ while (1) switch (_context6.prev = _context6.next) {
669
719
  case 0:
670
- _context7.prev = 0;
720
+ _context6.prev = 0;
671
721
  newParams = _objectSpread(_objectSpread({}, this.walletParams), params);
672
722
  if ((_newParams$products = newParams.products) !== null && _newParams$products !== void 0 && _newParams$products.length) {
673
- _context7.next = 5;
723
+ _context6.next = 5;
674
724
  break;
675
725
  }
676
726
  this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
677
- return _context7.abrupt("return", []);
727
+ return _context6.abrupt("return", []);
678
728
  case 5:
679
729
  if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
680
730
  newParams.payment_order_id = undefined;
@@ -686,10 +736,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
686
736
  filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
687
737
  payment_order_id: (_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.payment_order_id
688
738
  });
689
- _context7.next = 9;
739
+ _context6.next = 9;
690
740
  return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
691
741
  case 9:
692
- response = _context7.sent;
742
+ response = _context6.sent;
693
743
  // 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
694
744
  sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
695
745
  this.userIdentificationCodes = sortedData;
@@ -708,20 +758,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
708
758
  };
709
759
  })
710
760
  });
711
- return _context7.abrupt("return", this.userIdentificationCodes);
761
+ return _context6.abrupt("return", this.userIdentificationCodes);
712
762
  case 17:
713
- _context7.prev = 17;
714
- _context7.t0 = _context7["catch"](0);
715
- this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context7.t0, {
763
+ _context6.prev = 17;
764
+ _context6.t0 = _context6["catch"](0);
765
+ this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
716
766
  customer_id: params.customer_id,
717
767
  available: params.available
718
768
  });
719
- return _context7.abrupt("return", []);
769
+ return _context6.abrupt("return", []);
720
770
  case 21:
721
771
  case "end":
722
- return _context7.stop();
772
+ return _context6.stop();
723
773
  }
724
- }, _callee7, this, [[0, 17]]);
774
+ }, _callee6, this, [[0, 17]]);
725
775
  }));
726
776
  function getUserIdentificationCodeListAsync(_x7) {
727
777
  return _getUserIdentificationCodeListAsync.apply(this, arguments);
@@ -737,20 +787,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
737
787
  }, {
738
788
  key: "searchIdentificationCodeAsync",
739
789
  value: (function () {
740
- var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
790
+ var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
741
791
  var config,
742
- _ref10,
792
+ _ref9,
743
793
  _params$sale_channel,
744
794
  _params$customer_id,
745
795
  _params$order_expect_,
746
796
  _params$order_product,
747
797
  _params$order_wait_pa,
798
+ _ref10,
748
799
  _ref11,
749
- _ref12,
750
800
  _params$order_behavio,
751
- _ref13,
801
+ _ref12,
752
802
  _params$products,
753
- _ref14,
803
+ _ref13,
754
804
  _params$prepare_payme,
755
805
  code,
756
806
  isWalletCode,
@@ -764,12 +814,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
764
814
  _this$searchResults,
765
815
  existingCodes,
766
816
  newResults,
767
- _args8 = arguments;
768
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
769
- while (1) switch (_context8.prev = _context8.next) {
817
+ _args7 = arguments;
818
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
819
+ while (1) switch (_context7.prev = _context7.next) {
770
820
  case 0:
771
- config = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
772
- _context8.prev = 1;
821
+ config = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
822
+ _context7.prev = 1;
773
823
  code = params.code;
774
824
  this.paymentModule.logInfo('[WalletPass] 开始搜索识别码', {
775
825
  code: code,
@@ -780,7 +830,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
780
830
  // 新钱包规则
781
831
  isWalletCode = code.startsWith('WL') || code.startsWith('200') && code.length === 10;
782
832
  if (!isWalletCode) {
783
- _context8.next = 14;
833
+ _context7.next = 14;
784
834
  break;
785
835
  }
786
836
  // 钱包识别码直接调用专门接口,不缓存,直接返回
@@ -794,17 +844,17 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
794
844
  with_customer: walletDetailParams.with_customer,
795
845
  with: walletDetailParams.with
796
846
  });
797
- _context8.next = 10;
847
+ _context7.next = 10;
798
848
  return this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
799
849
  case 10:
800
- _response = _context8.sent;
850
+ _response = _context7.sent;
801
851
  _searchResults = (_response === null || _response === void 0 ? void 0 : _response.data) || [];
802
852
  this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
803
853
  code: code,
804
854
  results_count: _searchResults.length,
805
855
  type: 'walletCode'
806
856
  });
807
- return _context8.abrupt("return", {
857
+ return _context7.abrupt("return", {
808
858
  type: 'walletCode',
809
859
  data: _searchResults
810
860
  });
@@ -813,14 +863,14 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
813
863
  baseWalletParams = this.walletParams; // 构建完整的搜索参数,包含钱包扣款推荐的所有参数
814
864
  searchParams = {
815
865
  // 基础钱包参数
816
- sale_channel: (_ref10 = (_params$sale_channel = params.sale_channel) !== null && _params$sale_channel !== void 0 ? _params$sale_channel : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.sale_channel) !== null && _ref10 !== void 0 ? _ref10 : 'pos',
866
+ sale_channel: (_ref9 = (_params$sale_channel = params.sale_channel) !== null && _params$sale_channel !== void 0 ? _params$sale_channel : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.sale_channel) !== null && _ref9 !== void 0 ? _ref9 : 'pos',
817
867
  customer_id: (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id,
818
868
  order_expect_amount: (_params$order_expect_ = params.order_expect_amount) !== null && _params$order_expect_ !== void 0 ? _params$order_expect_ : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_expect_amount,
819
869
  order_product_amount: (_params$order_product = params.order_product_amount) !== null && _params$order_product !== void 0 ? _params$order_product : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_product_amount,
820
870
  order_wait_pay_amount: (_params$order_wait_pa = params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_wait_pay_amount,
821
- order_behavior_count_customer_id: (_ref11 = (_ref12 = (_params$order_behavio = params.order_behavior_count_customer_id) !== null && _params$order_behavio !== void 0 ? _params$order_behavio : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_behavior_count_customer_id) !== null && _ref12 !== void 0 ? _ref12 : params.customer_id) !== null && _ref11 !== void 0 ? _ref11 : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id,
822
- products: (_ref13 = (_params$products = params.products) !== null && _params$products !== void 0 ? _params$products : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.products) !== null && _ref13 !== void 0 ? _ref13 : [],
823
- prepare_payments: (_ref14 = (_params$prepare_payme = params.prepare_payments) !== null && _params$prepare_payme !== void 0 ? _params$prepare_payme : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.prepare_payments) !== null && _ref14 !== void 0 ? _ref14 : [],
871
+ order_behavior_count_customer_id: (_ref10 = (_ref11 = (_params$order_behavio = params.order_behavior_count_customer_id) !== null && _params$order_behavio !== void 0 ? _params$order_behavio : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_behavior_count_customer_id) !== null && _ref11 !== void 0 ? _ref11 : params.customer_id) !== null && _ref10 !== void 0 ? _ref10 : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id,
872
+ products: (_ref12 = (_params$products = params.products) !== null && _params$products !== void 0 ? _params$products : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.products) !== null && _ref12 !== void 0 ? _ref12 : [],
873
+ prepare_payments: (_ref13 = (_params$prepare_payme = params.prepare_payments) !== null && _params$prepare_payme !== void 0 ? _params$prepare_payme : baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.prepare_payments) !== null && _ref13 !== void 0 ? _ref13 : [],
824
874
  multiple: 1,
825
875
  // 搜索特有参数
826
876
  code: params.code,
@@ -836,16 +886,16 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
836
886
  if (typeof searchParams.payment_order_id === 'string' && searchParams.payment_order_id.startsWith('LOCAL_')) {
837
887
  searchParams.payment_order_id = undefined;
838
888
  }
839
- _context8.next = 20;
889
+ _context7.next = 20;
840
890
  return this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
841
891
  case 20:
842
- response = _context8.sent;
892
+ response = _context7.sent;
843
893
  searchResults = (response === null || response === void 0 ? void 0 : response.data) || [];
844
894
  if (!config.noCache) {
845
- _context8.next = 24;
895
+ _context7.next = 24;
846
896
  break;
847
897
  }
848
- return _context8.abrupt("return", {
898
+ return _context7.abrupt("return", {
849
899
  type: 'normalCode',
850
900
  data: searchResults
851
901
  });
@@ -875,24 +925,24 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
875
925
  cached_results_count: this.searchResults.length,
876
926
  type: 'normalCode'
877
927
  });
878
- return _context8.abrupt("return", {
928
+ return _context7.abrupt("return", {
879
929
  type: 'normalCode',
880
930
  data: searchResults
881
931
  });
882
932
  case 30:
883
- _context8.prev = 30;
884
- _context8.t0 = _context8["catch"](1);
885
- this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', _context8.t0, {
933
+ _context7.prev = 30;
934
+ _context7.t0 = _context7["catch"](1);
935
+ this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', _context7.t0, {
886
936
  code: params.code,
887
937
  customer_id: params.customer_id,
888
938
  order_expect_amount: params.order_expect_amount
889
939
  });
890
- throw _context8.t0;
940
+ throw _context7.t0;
891
941
  case 34:
892
942
  case "end":
893
- return _context8.stop();
943
+ return _context7.stop();
894
944
  }
895
- }, _callee8, this, [[1, 30]]);
945
+ }, _callee7, this, [[1, 30]]);
896
946
  }));
897
947
  function searchIdentificationCodeAsync(_x8) {
898
948
  return _searchIdentificationCodeAsync.apply(this, arguments);
@@ -909,7 +959,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
909
959
  }, {
910
960
  key: "refreshWalletAssetsFromBusinessAsync",
911
961
  value: (function () {
912
- var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(businessData) {
962
+ var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(businessData) {
963
+ var _businessData$product2;
913
964
  var options,
914
965
  requestSequence,
915
966
  nextCustomerId,
@@ -920,17 +971,24 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
920
971
  committedItems,
921
972
  selectedIds,
922
973
  selectionSources,
974
+ restoredSearchedAssets,
975
+ searchedWalletAssetCodes,
976
+ useAggregateRecalculate,
977
+ aggregateResult,
923
978
  result,
979
+ authoritativeSelectedIds,
980
+ returnedAggregateKeys,
981
+ missingSelectedKeys,
924
982
  searchedWalletAssets,
925
983
  recommendedKeys,
926
984
  items,
927
985
  latestSelectedIds,
928
986
  latestSelectionSources,
929
- _args9 = arguments;
930
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
931
- while (1) switch (_context9.prev = _context9.next) {
987
+ _args8 = arguments;
988
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
989
+ while (1) switch (_context8.prev = _context8.next) {
932
990
  case 0:
933
- options = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {};
991
+ options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
934
992
  requestSequence = ++this.walletAssetsRequestSequence;
935
993
  nextCustomerId = businessData.customer_id;
936
994
  previousCustomerId = this.walletAssetsState.customerId;
@@ -946,7 +1004,47 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
946
1004
  return committedKeys.has(getWalletAssetKey(item));
947
1005
  });
948
1006
  selectedIds = preserveSelection ? _toConsumableArray(this.walletAssetsState.selectedIds) : [];
949
- selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
1007
+ selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {}; // aggregate-recalculate 不接受空商品列表。
1008
+ // 清空购物车时保留扫码资产供后续加购恢复,但必须取消当前选择。
1009
+ if ((_businessData$product2 = businessData.products) !== null && _businessData$product2 !== void 0 && _businessData$product2.length) {
1010
+ _context8.next = 20;
1011
+ break;
1012
+ }
1013
+ this.generateWalletParams(businessData);
1014
+ restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map(function (item) {
1015
+ return _objectSpread(_objectSpread({}, item), {}, {
1016
+ actualDeduction: 0,
1017
+ deductionDetails: [],
1018
+ _available_max_amount: 0,
1019
+ _unified_available_status: 0,
1020
+ _wallet_asset_recommended: false
1021
+ });
1022
+ });
1023
+ this.walletRecommendList = [];
1024
+ this.userIdentificationCodes = [];
1025
+ this.walletInitData = {
1026
+ transformList: [],
1027
+ noApplicableVoucher: restoredSearchedAssets,
1028
+ products: []
1029
+ };
1030
+ this.walletAssetsCalculationContext = {
1031
+ orderTotalAmount: 0,
1032
+ products: []
1033
+ };
1034
+ this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
1035
+ userIdentificationCodes: []
1036
+ });
1037
+ return _context8.abrupt("return", this.publishWalletAssetsState({
1038
+ status: 'ready',
1039
+ customerId: nextCustomerId,
1040
+ items: mergeWalletAssets(restoredSearchedAssets, committedItems),
1041
+ selectedIds: [],
1042
+ selectedItems: [],
1043
+ selectionSources: {},
1044
+ totalSelectedAmount: 0,
1045
+ error: null
1046
+ }));
1047
+ case 20:
950
1048
  this.publishWalletAssetsState({
951
1049
  status: 'loading',
952
1050
  customerId: nextCustomerId,
@@ -957,62 +1055,93 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
957
1055
  totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
958
1056
  error: null
959
1057
  });
960
- _context9.prev = 12;
961
- _context9.next = 15;
1058
+ _context8.prev = 21;
1059
+ searchedWalletAssetCodes = preserveSelection ? this.getSearchedWalletAssetCodes() : [];
1060
+ useAggregateRecalculate = preserveSelection && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
1061
+ if (!useAggregateRecalculate) {
1062
+ _context8.next = 30;
1063
+ break;
1064
+ }
1065
+ _context8.next = 27;
1066
+ return this.aggregateRecalculateWalletAssetsAsync(businessData, selectedIds);
1067
+ case 27:
1068
+ _context8.t0 = _context8.sent;
1069
+ _context8.next = 31;
1070
+ break;
1071
+ case 30:
1072
+ _context8.t0 = null;
1073
+ case 31:
1074
+ aggregateResult = _context8.t0;
1075
+ _context8.t1 = aggregateResult;
1076
+ if (_context8.t1) {
1077
+ _context8.next = 37;
1078
+ break;
1079
+ }
1080
+ _context8.next = 36;
962
1081
  return this.initializeWalletDataFromBusinessAsync(businessData);
963
- case 15:
964
- result = _context9.sent;
1082
+ case 36:
1083
+ _context8.t1 = _context8.sent;
1084
+ case 37:
1085
+ result = _context8.t1;
965
1086
  if (!(requestSequence !== this.walletAssetsRequestSequence)) {
966
- _context9.next = 18;
1087
+ _context8.next = 40;
967
1088
  break;
968
1089
  }
969
- return _context9.abrupt("return", this.getWalletAssetsState());
970
- case 18:
1090
+ return _context8.abrupt("return", this.getWalletAssetsState());
1091
+ case 40:
971
1092
  this.walletAssetsCalculationContext = {
972
1093
  orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
973
1094
  products: result.products || businessData.products || []
974
1095
  };
975
- if (!preserveSelection) {
976
- _context9.next = 25;
977
- break;
1096
+ authoritativeSelectedIds = (aggregateResult === null || aggregateResult === void 0 ? void 0 : aggregateResult.authoritativeSelectedIds) || selectedIds;
1097
+ if (aggregateResult) {
1098
+ returnedAggregateKeys = new Set([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || [])).map(function (item) {
1099
+ return getWalletAssetKey(item);
1100
+ }));
1101
+ missingSelectedKeys = new Set(selectedIds.map(function (id) {
1102
+ return String(id);
1103
+ }).filter(function (id) {
1104
+ return !returnedAggregateKeys.has(id);
1105
+ }));
1106
+ if (missingSelectedKeys.size > 0) {
1107
+ this.searchResults = this.searchResults.filter(function (item) {
1108
+ return !missingSelectedKeys.has(getWalletAssetKey(item));
1109
+ });
1110
+ }
978
1111
  }
979
- _context9.next = 22;
980
- return this.revalidateSearchedWalletAssets(requestSequence);
981
- case 22:
982
- _context9.t0 = _context9.sent;
983
- _context9.next = 26;
984
- break;
985
- case 25:
986
- _context9.t0 = [];
987
- case 26:
988
- searchedWalletAssets = _context9.t0;
1112
+ searchedWalletAssets = preserveSelection ? this.syncSearchedWalletAssets([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || []))) : [];
989
1113
  if (!(requestSequence !== this.walletAssetsRequestSequence)) {
990
- _context9.next = 29;
1114
+ _context8.next = 46;
991
1115
  break;
992
1116
  }
993
- return _context9.abrupt("return", this.getWalletAssetsState());
994
- case 29:
1117
+ return _context8.abrupt("return", this.getWalletAssetsState());
1118
+ case 46:
995
1119
  recommendedKeys = new Set((result.walletRecommendList || []).map(function (asset) {
996
1120
  return getWalletAssetKey(asset);
997
1121
  }));
998
- items = mergeWalletAssets(preserveSelection ? this.walletAssetsState.selectedItems : [], searchedWalletAssets, result.transformList || [], result.noApplicableVoucher || []).map(function (asset) {
1122
+ items = mergeWalletAssets(preserveSelection && !aggregateResult ? this.walletAssetsState.selectedItems : [], searchedWalletAssets, result.transformList || [], result.noApplicableVoucher || []).map(function (asset) {
999
1123
  return _objectSpread(_objectSpread({}, asset), {}, {
1000
1124
  _wallet_asset_recommended: recommendedKeys.has(getWalletAssetKey(asset))
1001
1125
  });
1002
1126
  });
1003
- latestSelectedIds = preserveSelection ? _toConsumableArray(this.walletAssetsState.selectedIds) : [];
1127
+ latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
1004
1128
  latestSelectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
1005
- return _context9.abrupt("return", this.recalculateWalletAssets(items, latestSelectedIds, latestSelectionSources));
1006
- case 36:
1007
- _context9.prev = 36;
1008
- _context9.t1 = _context9["catch"](12);
1129
+ return _context8.abrupt("return", this.recalculateWalletAssets(items, latestSelectedIds, latestSelectionSources));
1130
+ case 53:
1131
+ _context8.prev = 53;
1132
+ _context8.t2 = _context8["catch"](21);
1009
1133
  if (!(requestSequence !== this.walletAssetsRequestSequence)) {
1010
- _context9.next = 40;
1134
+ _context8.next = 57;
1011
1135
  break;
1012
1136
  }
1013
- return _context9.abrupt("return", this.getWalletAssetsState());
1014
- case 40:
1015
- return _context9.abrupt("return", this.publishWalletAssetsState({
1137
+ return _context8.abrupt("return", this.getWalletAssetsState());
1138
+ case 57:
1139
+ this.paymentModule.logError('[WalletPass] 刷新共享钱包资产失败,保留刷新前状态', _context8.t2, {
1140
+ customer_id: businessData.customer_id,
1141
+ selected_ids: selectedIds,
1142
+ searched_codes: this.getSearchedWalletAssetCodes()
1143
+ });
1144
+ return _context8.abrupt("return", this.publishWalletAssetsState({
1016
1145
  status: 'error',
1017
1146
  items: preserveSelection ? this.walletAssetsState.items : committedItems,
1018
1147
  selectedIds: preserveSelection ? this.walletAssetsState.selectedIds : [],
@@ -1020,13 +1149,13 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1020
1149
  selectionSources: preserveSelection ? this.walletAssetsState.selectionSources : {},
1021
1150
  totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
1022
1151
  customerId: nextCustomerId,
1023
- error: _context9.t1 instanceof Error ? _context9.t1.message : String(_context9.t1)
1152
+ error: _context8.t2 instanceof Error ? _context8.t2.message : String(_context8.t2)
1024
1153
  }));
1025
- case 41:
1154
+ case 59:
1026
1155
  case "end":
1027
- return _context9.stop();
1156
+ return _context8.stop();
1028
1157
  }
1029
- }, _callee9, this, [[12, 36]]);
1158
+ }, _callee8, this, [[21, 53]]);
1030
1159
  }));
1031
1160
  function refreshWalletAssetsFromBusinessAsync(_x9) {
1032
1161
  return _refreshWalletAssetsFromBusinessAsync.apply(this, arguments);
@@ -1105,45 +1234,59 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1105
1234
  }, {
1106
1235
  key: "scanWalletAssetAsync",
1107
1236
  value: function () {
1108
- var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(code) {
1109
- var normalizedCode, result, paymentAssets, asset, items, assetId, selected;
1110
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1111
- while (1) switch (_context10.prev = _context10.next) {
1237
+ var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
1238
+ var normalizedCode, selectedAsset, result, paymentAssets, asset, items, assetId, selected;
1239
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1240
+ while (1) switch (_context9.prev = _context9.next) {
1112
1241
  case 0:
1113
1242
  normalizedCode = String(code || '').trim();
1114
1243
  if (normalizedCode) {
1115
- _context10.next = 3;
1244
+ _context9.next = 3;
1116
1245
  break;
1117
1246
  }
1118
- return _context10.abrupt("return", {
1247
+ return _context9.abrupt("return", {
1119
1248
  type: 'normalCode',
1120
1249
  selected: false,
1121
1250
  state: this.getWalletAssetsState()
1122
1251
  });
1123
1252
  case 3:
1253
+ selectedAsset = this.walletAssetsState.selectedItems.find(function (asset) {
1254
+ return matchesWalletAssetCode(asset, normalizedCode);
1255
+ });
1256
+ if (!selectedAsset) {
1257
+ _context9.next = 6;
1258
+ break;
1259
+ }
1260
+ return _context9.abrupt("return", {
1261
+ type: 'normalCode',
1262
+ asset: selectedAsset,
1263
+ selected: true,
1264
+ state: this.getWalletAssetsState()
1265
+ });
1266
+ case 6:
1124
1267
  this.walletAssetsRequestSequence += 1;
1125
- _context10.next = 6;
1268
+ _context9.next = 9;
1126
1269
  return this.searchIdentificationCodeAsync(_objectSpread(_objectSpread({}, this.walletParams || {}), {}, {
1127
1270
  code: normalizedCode,
1128
1271
  prepare_payments: this.formatWalletPassList2PreparePayments(this.walletAssetsState.selectedItems)
1129
1272
  }));
1130
- case 6:
1131
- result = _context10.sent;
1273
+ case 9:
1274
+ result = _context9.sent;
1132
1275
  paymentAssets = result.data.filter(isWalletPaymentAsset);
1133
1276
  asset = paymentAssets.find(function (item) {
1134
1277
  return String((item === null || item === void 0 ? void 0 : item.code) || '') === normalizedCode;
1135
1278
  }) || paymentAssets[0];
1136
1279
  if (!(!asset || result.type === 'walletCode')) {
1137
- _context10.next = 11;
1280
+ _context9.next = 14;
1138
1281
  break;
1139
1282
  }
1140
- return _context10.abrupt("return", {
1283
+ return _context9.abrupt("return", {
1141
1284
  type: result.type,
1142
1285
  asset: asset,
1143
1286
  selected: false,
1144
1287
  state: this.getWalletAssetsState()
1145
1288
  });
1146
- case 11:
1289
+ case 14:
1147
1290
  items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
1148
1291
  this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1149
1292
  assetId = getWalletAssetId(asset);
@@ -1151,7 +1294,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1151
1294
  selected: true,
1152
1295
  source: 'scan'
1153
1296
  }) : this.getWalletAssetsState();
1154
- return _context10.abrupt("return", {
1297
+ return _context9.abrupt("return", {
1155
1298
  type: result.type,
1156
1299
  asset: asset,
1157
1300
  selected: assetId !== undefined && selected.selectedIds.some(function (id) {
@@ -1159,11 +1302,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1159
1302
  }),
1160
1303
  state: selected
1161
1304
  });
1162
- case 16:
1305
+ case 19:
1163
1306
  case "end":
1164
- return _context10.stop();
1307
+ return _context9.stop();
1165
1308
  }
1166
- }, _callee10, this);
1309
+ }, _callee9, this);
1167
1310
  }));
1168
1311
  function scanWalletAssetAsync(_x10) {
1169
1312
  return _scanWalletAssetAsync.apply(this, arguments);
@@ -1185,10 +1328,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1185
1328
  var selectedIds = this.walletAssetsState.selectedIds.filter(function (id) {
1186
1329
  return !committedKeys.has(String(id));
1187
1330
  });
1188
- var selectionSources = Object.entries(this.walletAssetsState.selectionSources).reduce(function (result, _ref15) {
1189
- var _ref16 = _slicedToArray(_ref15, 2),
1190
- key = _ref16[0],
1191
- source = _ref16[1];
1331
+ var selectionSources = Object.entries(this.walletAssetsState.selectionSources).reduce(function (result, _ref14) {
1332
+ var _ref15 = _slicedToArray(_ref14, 2),
1333
+ key = _ref15[0],
1334
+ source = _ref15[1];
1192
1335
  if (!committedKeys.has(key)) result[key] = source;
1193
1336
  return result;
1194
1337
  }, {});
@@ -1201,22 +1344,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1201
1344
  }, {
1202
1345
  key: "processWalletPayment",
1203
1346
  value: function () {
1204
- var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(amount, orderUuid, voucherId) {
1347
+ var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(amount, orderUuid, voucherId) {
1205
1348
  var walletMethod, paymentItem;
1206
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1207
- while (1) switch (_context11.prev = _context11.next) {
1349
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1350
+ while (1) switch (_context10.prev = _context10.next) {
1208
1351
  case 0:
1209
1352
  this.paymentModule.logInfo('[WalletPass] 开始处理钱包支付', {
1210
1353
  amount: amount,
1211
1354
  orderUuid: orderUuid,
1212
1355
  voucherId: voucherId || 'none'
1213
1356
  });
1214
- _context11.next = 3;
1357
+ _context10.next = 3;
1215
1358
  return this.paymentModule.getWalletPaymentMethod();
1216
1359
  case 3:
1217
- walletMethod = _context11.sent;
1360
+ walletMethod = _context10.sent;
1218
1361
  if (walletMethod) {
1219
- _context11.next = 7;
1362
+ _context10.next = 7;
1220
1363
  break;
1221
1364
  }
1222
1365
  this.paymentModule.logError('[WalletPass] 钱包支付方式未找到', null, {
@@ -1234,7 +1377,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1234
1377
  type: walletMethod.type,
1235
1378
  voucher_id: voucherId || ''
1236
1379
  };
1237
- _context11.next = 10;
1380
+ _context10.next = 10;
1238
1381
  return this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
1239
1382
  case 10:
1240
1383
  this.paymentModule.logInfo('[WalletPass] 钱包支付处理完成', {
@@ -1245,9 +1388,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1245
1388
  });
1246
1389
  case 11:
1247
1390
  case "end":
1248
- return _context11.stop();
1391
+ return _context10.stop();
1249
1392
  }
1250
- }, _callee11, this);
1393
+ }, _callee10, this);
1251
1394
  }));
1252
1395
  function processWalletPayment(_x11, _x12, _x13) {
1253
1396
  return _processWalletPayment.apply(this, arguments);
@@ -1257,16 +1400,16 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1257
1400
  }, {
1258
1401
  key: "getWalletBalance",
1259
1402
  value: function () {
1260
- var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(voucherId) {
1261
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1262
- while (1) switch (_context12.prev = _context12.next) {
1403
+ var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(voucherId) {
1404
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1405
+ while (1) switch (_context11.prev = _context11.next) {
1263
1406
  case 0:
1264
- return _context12.abrupt("return", 0);
1407
+ return _context11.abrupt("return", 0);
1265
1408
  case 1:
1266
1409
  case "end":
1267
- return _context12.stop();
1410
+ return _context11.stop();
1268
1411
  }
1269
- }, _callee12);
1412
+ }, _callee11);
1270
1413
  }));
1271
1414
  function getWalletBalance(_x14) {
1272
1415
  return _getWalletBalance.apply(this, arguments);