@pisell/pisellos 0.0.287 → 0.0.289

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.
@@ -536,7 +536,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
536
536
  } else {
537
537
  arr.push(_this3.hooks.setProduct(originProduct, {
538
538
  discount_list: [discountDetail],
539
- _id: product._id.split('___')[0] + "___" + _selectedDiscount.id + index,
539
+ _id: product._id.split('___')[0] + "___" + _selectedDiscount.id + "___" + index,
540
540
  price: _selectedDiscount.tag === 'good_pass' ? 0 : product.price,
541
541
  quantity: isNeedSplit ? 1 : product.quantity,
542
542
  total: targetProductTotal,
@@ -1407,7 +1407,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1407
1407
 
1408
1408
  // 更新 stateAmount 为剩余未支付金额
1409
1409
  _context17.next = 22;
1410
- return this.updateStateAmountToRemaining();
1410
+ return this.updateStateAmountToRemaining(false);
1411
1411
  case 22:
1412
1412
  _context17.next = 24;
1413
1413
  return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
@@ -2838,14 +2838,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2838
2838
  key: "updateStateAmountToRemaining",
2839
2839
  value: (function () {
2840
2840
  var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2841
- var remainingAmount, currentStateAmount;
2841
+ var checkOrder,
2842
+ remainingAmount,
2843
+ currentStateAmount,
2844
+ _args34 = arguments;
2842
2845
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2843
2846
  while (1) switch (_context34.prev = _context34.next) {
2844
2847
  case 0:
2845
- _context34.prev = 0;
2846
- _context34.next = 3;
2848
+ checkOrder = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : true;
2849
+ _context34.prev = 1;
2850
+ _context34.next = 4;
2847
2851
  return this.calculateRemainingAmountAsync();
2848
- case 3:
2852
+ case 4:
2849
2853
  remainingAmount = _context34.sent;
2850
2854
  currentStateAmount = this.store.stateAmount; // 只有当剩余金额与当前 stateAmount 不同时才更新
2851
2855
  if (remainingAmount !== currentStateAmount) {
@@ -2869,23 +2873,30 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2869
2873
  }
2870
2874
 
2871
2875
  // 同步更新系统内部的 balanceDueAmount
2872
- _context34.next = 8;
2876
+ _context34.next = 9;
2873
2877
  return this.updateBalanceDueAmount();
2874
- case 8:
2875
- _context34.next = 10;
2878
+ case 9:
2879
+ if (checkOrder) {
2880
+ _context34.next = 12;
2881
+ break;
2882
+ }
2883
+ this.logInfo('外部传入无需 checkOrder,不执行订单支付完成检测和同步');
2884
+ return _context34.abrupt("return");
2885
+ case 12:
2886
+ _context34.next = 14;
2876
2887
  return this.checkOrderPaymentCompletion();
2877
- case 10:
2878
- _context34.next = 15;
2888
+ case 14:
2889
+ _context34.next = 19;
2879
2890
  break;
2880
- case 12:
2881
- _context34.prev = 12;
2882
- _context34.t0 = _context34["catch"](0);
2891
+ case 16:
2892
+ _context34.prev = 16;
2893
+ _context34.t0 = _context34["catch"](1);
2883
2894
  this.logError('更新 stateAmount 为剩余金额失败:', _context34.t0);
2884
- case 15:
2895
+ case 19:
2885
2896
  case "end":
2886
2897
  return _context34.stop();
2887
2898
  }
2888
- }, _callee34, this, [[0, 12]]);
2899
+ }, _callee34, this, [[1, 16]]);
2889
2900
  }));
2890
2901
  function updateStateAmountToRemaining() {
2891
2902
  return _updateStateAmountToRemaining.apply(this, arguments);
@@ -379,7 +379,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
379
379
  } else {
380
380
  arr.push(this.hooks.setProduct(originProduct, {
381
381
  discount_list: [discountDetail],
382
- _id: product._id.split("___")[0] + "___" + selectedDiscount2.id + index,
382
+ _id: product._id.split("___")[0] + "___" + selectedDiscount2.id + "___" + index,
383
383
  price: selectedDiscount2.tag === "good_pass" ? 0 : product.price,
384
384
  quantity: isNeedSplit ? 1 : product.quantity,
385
385
  total: targetProductTotal,
@@ -876,7 +876,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
876
876
  }
877
877
  this.store.currentOrder = updatedOrder;
878
878
  }
879
- await this.updateStateAmountToRemaining();
879
+ await this.updateStateAmountToRemaining(false);
880
880
  await this.core.effects.emit(import_types.CheckoutHooks.OnPaymentStarted, {
881
881
  orderUuid: this.store.currentOrder.uuid,
882
882
  paymentMethodCode: paymentItem.code,
@@ -1754,7 +1754,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1754
1754
  /**
1755
1755
  * 更新 stateAmount 为当前剩余未支付金额
1756
1756
  */
1757
- async updateStateAmountToRemaining() {
1757
+ async updateStateAmountToRemaining(checkOrder = true) {
1758
1758
  try {
1759
1759
  const remainingAmount = await this.calculateRemainingAmountAsync();
1760
1760
  const currentStateAmount = this.store.stateAmount;
@@ -1776,6 +1776,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1776
1776
  });
1777
1777
  }
1778
1778
  await this.updateBalanceDueAmount();
1779
+ if (!checkOrder) {
1780
+ this.logInfo("外部传入无需 checkOrder,不执行订单支付完成检测和同步");
1781
+ return;
1782
+ }
1779
1783
  await this.checkOrderPaymentCompletion();
1780
1784
  } catch (error) {
1781
1785
  this.logError("更新 stateAmount 为剩余金额失败:", error);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.287",
4
+ "version": "0.0.289",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",