@pisell/pisellos 2.2.66 → 2.2.68

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.
@@ -1535,7 +1535,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1535
1535
  throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
1536
1536
  case 34:
1537
1537
  existingActiveVoucherKeys = new Set(orderAfterDelete.payment.filter(function (p) {
1538
- return p.voucher_id && p.status !== 'voided';
1538
+ return p.voucher_id && p.status !== 'voided' && !p.isSynced;
1539
1539
  }).map(function (p) {
1540
1540
  return "".concat(p.voucher_id, "|").concat(p.order_payment_type || 'normal');
1541
1541
  }));
@@ -482,6 +482,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
482
482
  value: (function () {
483
483
  var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
484
484
  var config,
485
+ _ref,
486
+ _response2,
485
487
  code,
486
488
  isWalletCode,
487
489
  walletDetailParams,
@@ -564,20 +566,31 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
564
566
  multiple: searchParams.multiple,
565
567
  payment_order_id: baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.payment_order_id
566
568
  });
567
- _context6.next = 19;
569
+ if (!(!searchParams.products || ((_ref = searchParams.products || []) === null || _ref === void 0 ? void 0 : _ref.length) === 0)) {
570
+ _context6.next = 21;
571
+ break;
572
+ }
573
+ response = {
574
+ data: []
575
+ };
576
+ _context6.next = 24;
577
+ break;
578
+ case 21:
579
+ _context6.next = 23;
568
580
  return this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
569
- case 19:
581
+ case 23:
570
582
  response = _context6.sent;
571
- searchResults = (response === null || response === void 0 ? void 0 : response.data) || [];
583
+ case 24:
584
+ searchResults = ((_response2 = response) === null || _response2 === void 0 ? void 0 : _response2.data) || [];
572
585
  if (!config.noCache) {
573
- _context6.next = 23;
586
+ _context6.next = 27;
574
587
  break;
575
588
  }
576
589
  return _context6.abrupt("return", {
577
590
  type: 'normalCode',
578
591
  data: searchResults
579
592
  });
580
- case 23:
593
+ case 27:
581
594
  // 将搜索结果存储到缓存数组中
582
595
  if (searchResults.length > 0) {
583
596
  // 避免重复存储相同的识别码
@@ -607,8 +620,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
607
620
  type: 'normalCode',
608
621
  data: searchResults
609
622
  });
610
- case 29:
611
- _context6.prev = 29;
623
+ case 33:
624
+ _context6.prev = 33;
612
625
  _context6.t0 = _context6["catch"](1);
613
626
  this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', _context6.t0, {
614
627
  code: params.code,
@@ -616,11 +629,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
616
629
  order_expect_amount: params.order_expect_amount
617
630
  });
618
631
  throw _context6.t0;
619
- case 33:
632
+ case 37:
620
633
  case "end":
621
634
  return _context6.stop();
622
635
  }
623
- }, _callee6, this, [[1, 29]]);
636
+ }, _callee6, this, [[1, 33]]);
624
637
  }));
625
638
  function searchIdentificationCodeAsync(_x6) {
626
639
  return _searchIdentificationCodeAsync.apply(this, arguments);
@@ -801,7 +801,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
801
801
  throw new Error(`订单不存在: ${orderUuid}`);
802
802
  }
803
803
  const existingActiveVoucherKeys = new Set(
804
- orderAfterDelete.payment.filter((p) => p.voucher_id && p.status !== "voided").map((p) => `${p.voucher_id}|${p.order_payment_type || "normal"}`)
804
+ orderAfterDelete.payment.filter((p) => p.voucher_id && p.status !== "voided" && !p.isSynced).map((p) => `${p.voucher_id}|${p.order_payment_type || "normal"}`)
805
805
  );
806
806
  console.log("[PaymentModule] 添加新的代金券支付项:", {
807
807
  orderUuid,
@@ -346,6 +346,7 @@ var WalletPassPaymentImpl = class {
346
346
  * 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
347
347
  */
348
348
  async searchIdentificationCodeAsync(params, config = {}) {
349
+ var _a;
349
350
  try {
350
351
  const { code } = params;
351
352
  this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
@@ -403,10 +404,17 @@ var WalletPassPaymentImpl = class {
403
404
  multiple: searchParams.multiple,
404
405
  payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
405
406
  });
406
- const response = await this.paymentModule.request.post(
407
- "/machinecode/prepare/deduction/search",
408
- searchParams
409
- );
407
+ let response;
408
+ if (!searchParams.products || ((_a = searchParams.products || []) == null ? void 0 : _a.length) === 0) {
409
+ response = {
410
+ data: []
411
+ };
412
+ } else {
413
+ response = await this.paymentModule.request.post(
414
+ "/machinecode/prepare/deduction/search",
415
+ searchParams
416
+ );
417
+ }
410
418
  const searchResults = (response == null ? void 0 : response.data) || [];
411
419
  if (config.noCache) {
412
420
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.66",
4
+ "version": "2.2.68",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",