@pisell/pisellos 2.2.53 → 2.2.54

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.
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -760,6 +760,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
760
760
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
761
761
  while (1) switch (_context10.prev = _context10.next) {
762
762
  case 0:
763
+ this.payment.wallet.clearAllCache();
763
764
  this.logInfo('updateLocalOrderAsync called', {
764
765
  orderId: params.orderId,
765
766
  orderDataType: (_params$orderData6 = params.orderData) === null || _params$orderData6 === void 0 ? void 0 : _params$orderData6.type,
@@ -771,11 +772,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
771
772
  // 基础校验
772
773
  validation = validateLocalOrderData(params.orderData);
773
774
  if (validation.valid) {
774
- _context10.next = 4;
775
+ _context10.next = 5;
775
776
  break;
776
777
  }
777
778
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u8BA2\u5355\u6570\u636E\u9A8C\u8BC1\u5931\u8D25: ".concat(validation.errors.join(', ')));
778
- case 4:
779
+ case 5:
779
780
  // 计算金额
780
781
  amountInfo = extractAmountFromCartSummary(params.cartSummary); // 规范化补充字段
781
782
  params.orderData.created_at = formatDateTime(new Date());
@@ -801,19 +802,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
801
802
  }
802
803
 
803
804
  // 保留原有支付项:通过 orderId 找到现有订单(按 id 或 order_id 匹配)
804
- _context10.next = 17;
805
+ _context10.next = 18;
805
806
  return this.payment.getOrderListAsync();
806
- case 17:
807
+ case 18:
807
808
  allOrders = _context10.sent;
808
809
  existingOrder = allOrders.find(function (o) {
809
810
  return String(o.id) === String(params.orderId) || String(o.order_id) === String(params.orderId);
810
811
  });
811
812
  if (!existingOrder) {
812
- _context10.next = 71;
813
+ _context10.next = 72;
813
814
  break;
814
815
  }
815
816
  if (!(params.existPayment && params.existPayment.length > 0)) {
816
- _context10.next = 47;
817
+ _context10.next = 48;
817
818
  break;
818
819
  }
819
820
  this.logInfo('检测到云端支付项,将替换本地订单的支付项列表', {
@@ -837,7 +838,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
837
838
  });
838
839
  }); // 计算是否需要支付定金
839
840
  _isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 更新订单,替换支付项列表
840
- _context10.next = 28;
841
+ _context10.next = 29;
841
842
  return this.payment.updateOrderAsync(existingOrder.uuid, {
842
843
  total_amount: amountInfo.totalAmount,
843
844
  is_deposit: _isNeedDeposit.hasDeposit ? 1 : 0,
@@ -855,21 +856,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
855
856
  amount_breakdown: amountInfo
856
857
  }
857
858
  });
858
- case 28:
859
- _context10.next = 30;
859
+ case 29:
860
+ _context10.next = 31;
860
861
  return this.payment.getPaymentOrderByUuidAsync(existingOrder.uuid);
861
- case 30:
862
+ case 31:
862
863
  _updated = _context10.sent;
863
864
  if (_updated) {
864
- _context10.next = 33;
865
+ _context10.next = 34;
865
866
  break;
866
867
  }
867
868
  throw createCheckoutError(CheckoutErrorType.UnknownError, '订单更新失败');
868
- case 33:
869
+ case 34:
869
870
  this.store.currentOrder = _updated;
870
- _context10.next = 36;
871
+ _context10.next = 37;
871
872
  return this.updateStateAmountToRemaining(false);
872
- case 36:
873
+ case 37:
873
874
  this.logInfo('本地订单更新成功(已替换云端支付项):', {
874
875
  orderId: params.orderId,
875
876
  uuid: _updated.uuid,
@@ -880,12 +881,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
880
881
  });
881
882
 
882
883
  // 事件通知
883
- _context10.next = 39;
884
+ _context10.next = 40;
884
885
  return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
885
886
  order: _updated,
886
887
  timestamp: Date.now()
887
888
  });
888
- case 39:
889
+ case 40:
889
890
  // 计算已同步的支付金额
890
891
  syncedPayments = _updated.payment.filter(function (p) {
891
892
  return p.isSynced && p.status !== 'voided';
@@ -908,7 +909,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
908
909
  order_wait_pay_amount: Number(_depositDiffAmount) > 0 ? Number(_depositDiffAmount) : Number(_remainingExpectAmount)
909
910
  });
910
911
  return _context10.abrupt("return", _updated);
911
- case 47:
912
+ case 48:
912
913
  // 原有逻辑:保留现有支付项
913
914
  totalAmount = new Decimal(amountInfo.totalAmount || '0');
914
915
  activePayments = (existingOrder.payment || []).filter(function (p) {
@@ -921,7 +922,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
921
922
  }, new Decimal(0));
922
923
  remaining = Decimal.max(0, totalAmount.minus(paidAmount)).toFixed(2); // 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
923
924
  _isNeedDeposit2 = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 更新到支付模块(使用 uuid,不修改 payment 列表)
924
- _context10.next = 54;
925
+ _context10.next = 55;
925
926
  return this.payment.updateOrderAsync(existingOrder.uuid, {
926
927
  total_amount: amountInfo.totalAmount,
927
928
  is_deposit: _isNeedDeposit2.hasDeposit ? 1 : 0,
@@ -938,21 +939,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
938
939
  amount_breakdown: amountInfo
939
940
  }
940
941
  });
941
- case 54:
942
- _context10.next = 56;
942
+ case 55:
943
+ _context10.next = 57;
943
944
  return this.payment.getPaymentOrderByUuidAsync(existingOrder.uuid);
944
- case 56:
945
+ case 57:
945
946
  updated = _context10.sent;
946
947
  if (updated) {
947
- _context10.next = 59;
948
+ _context10.next = 60;
948
949
  break;
949
950
  }
950
951
  throw createCheckoutError(CheckoutErrorType.UnknownError, '订单更新失败');
951
- case 59:
952
+ case 60:
952
953
  this.store.currentOrder = updated;
953
- _context10.next = 62;
954
+ _context10.next = 63;
954
955
  return this.updateStateAmountToRemaining(false);
955
- case 62:
956
+ case 63:
956
957
  this.logInfo('本地订单更新成功(保留支付项):', {
957
958
  orderId: params.orderId,
958
959
  uuid: updated.uuid,
@@ -962,12 +963,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
962
963
  });
963
964
 
964
965
  // 事件通知(复用创建事件,便于上层监听刷新)
965
- _context10.next = 65;
966
+ _context10.next = 66;
966
967
  return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
967
968
  order: updated,
968
969
  timestamp: Date.now()
969
970
  });
970
- case 65:
971
+ case 66:
971
972
  // 需要减去已经同步给后端的支付过的钱
972
973
  syncedAmount = activePayments.reduce(function (sum, p) {
973
974
  var amt = new Decimal(p.amount || '0');
@@ -983,10 +984,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
983
984
  order_wait_pay_amount: Number(depositDiffAmount) > 0 ? Number(depositDiffAmount) : Number(remainingExpectAmount)
984
985
  });
985
986
  return _context10.abrupt("return", updated);
986
- case 71:
987
+ case 72:
987
988
  // 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
988
989
  isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 没找到现有订单时,回退为创建逻辑(用于异常兜底)
989
- _context10.next = 74;
990
+ _context10.next = 75;
990
991
  return this.payment.createPaymentOrderAsync({
991
992
  order_id: String(params.orderId),
992
993
  total_amount: amountInfo.totalAmount,
@@ -1005,7 +1006,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1005
1006
  amount_breakdown: amountInfo
1006
1007
  }
1007
1008
  });
1008
- case 74:
1009
+ case 75:
1009
1010
  created = _context10.sent;
1010
1011
  this.store.currentOrder = created;
1011
1012
 
@@ -1041,7 +1042,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1041
1042
  this.initWalletData();
1042
1043
  }
1043
1044
  return _context10.abrupt("return", created);
1044
- case 78:
1045
+ case 79:
1045
1046
  case "end":
1046
1047
  return _context10.stop();
1047
1048
  }
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -507,6 +507,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
507
507
  */
508
508
  async updateLocalOrderAsync(params) {
509
509
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
510
+ this.payment.wallet.clearAllCache();
510
511
  this.logInfo("updateLocalOrderAsync called", {
511
512
  orderId: params.orderId,
512
513
  orderDataType: (_a = params.orderData) == null ? void 0 : _a.type,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.53",
4
+ "version": "2.2.54",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",