@pisell/pisellos 0.0.294 → 0.0.295

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.
@@ -812,35 +812,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
812
812
  case 3:
813
813
  order = _context9.sent;
814
814
  if (!order) {
815
- _context9.next = 12;
815
+ _context9.next = 13;
816
816
  break;
817
817
  }
818
818
  updatedOrder = _objectSpread(_objectSpread({}, order), params);
819
- _context9.next = 8;
819
+ this.recalculateOrderAmount(updatedOrder);
820
+ _context9.next = 9;
820
821
  return this.dbManager.update('order', updatedOrder);
821
- case 8:
822
- _context9.next = 10;
822
+ case 9:
823
+ _context9.next = 11;
823
824
  return this.core.effects.emit(PaymentHooks.OnOrderUpdated, updatedOrder);
824
- case 10:
825
- _context9.next = 12;
825
+ case 11:
826
+ _context9.next = 13;
826
827
  return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
827
828
  action: 'update',
828
829
  order: updatedOrder,
829
830
  originalOrder: order
830
831
  });
831
- case 12:
832
- _context9.next = 18;
832
+ case 13:
833
+ _context9.next = 19;
833
834
  break;
834
- case 14:
835
- _context9.prev = 14;
835
+ case 15:
836
+ _context9.prev = 15;
836
837
  _context9.t0 = _context9["catch"](0);
837
838
  console.error('[PaymentModule] 更新订单失败', _context9.t0);
838
839
  throw _context9.t0;
839
- case 18:
840
+ case 19:
840
841
  case "end":
841
842
  return _context9.stop();
842
843
  }
843
- }, _callee9, this, [[0, 14]]);
844
+ }, _callee9, this, [[0, 15]]);
844
845
  }));
845
846
  function updateOrderAsync(_x8, _x9) {
846
847
  return _updateOrderAsync.apply(this, arguments);
@@ -1065,7 +1066,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1065
1066
  throw new Error("Order not found: ".concat(orderUuid));
1066
1067
  case 7:
1067
1068
  // 🔒 支付锁检查:如果订单待付金额已经为0,不允许继续添加支付项
1068
- expectAmount = new Decimal(order.expect_amount);
1069
+ expectAmount = new Decimal(order.expect_amount); // const expecDepositAmount = new Decimal(order.deposit_amount);
1069
1070
  if (!expectAmount.lte(0)) {
1070
1071
  _context13.next = 13;
1071
1072
  break;
@@ -1807,7 +1808,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1807
1808
  return sum;
1808
1809
  }
1809
1810
  }, new Decimal(0));
1810
- var remainingAmount = totalAmount.minus(paidAmount);
1811
+ // 如果是定金模式,则使用deposit_amount 去减已付款金额
1812
+ var remainingAmount = order.is_deposit === 1 ? new Decimal(order.deposit_amount).minus(paidAmount) : totalAmount.minus(paidAmount);
1811
1813
  order.expect_amount = Decimal.max(0, remainingAmount).toFixed(2);
1812
1814
  console.log("[PaymentModule] \u91CD\u65B0\u8BA1\u7B97\u8BA2\u5355\u91D1\u989D:", {
1813
1815
  orderUuid: order.uuid,
@@ -637,6 +637,10 @@ export interface WalletInitBusinessData {
637
637
  amountInfo: {
638
638
  totalAmount: string;
639
639
  subTotal: string;
640
+ /** 是否是定金订单 */
641
+ isDeposit?: number;
642
+ /** 定金金额 */
643
+ depositAmount?: string;
640
644
  };
641
645
  /** 商品列表 */
642
646
  products: {
@@ -73,7 +73,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
73
73
  // 订单小计金额
74
74
  order_product_amount: subTotal,
75
75
  // 订单待支付金额
76
- order_wait_pay_amount: order_wait_pay_amount || totalAmount,
76
+ order_wait_pay_amount: order_wait_pay_amount || (amountInfo !== null && amountInfo !== void 0 && amountInfo.isDeposit ? Number(amountInfo === null || amountInfo === void 0 ? void 0 : amountInfo.depositAmount) : totalAmount),
77
77
  // order_behavior_count_customer_id: 1,
78
78
  products: products,
79
79
  prepare_payments: [],
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
111
111
  * 获取当前的客户搜索条件
112
112
  * @returns 当前搜索条件
113
113
  */
114
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
114
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
115
115
  /**
116
116
  * 获取客户列表状态(包含滚动加载相关状态)
117
117
  * @returns 客户状态
@@ -56,6 +56,14 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
56
56
  initWalletData(params?: {
57
57
  order_wait_pay_amount: number;
58
58
  }): Promise<void>;
59
+ checkIsNeedDepositAsync(bookings: any[], relationProducts: any[]): {
60
+ total: number;
61
+ protocols: {
62
+ id: number;
63
+ title: string;
64
+ }[];
65
+ hasDeposit: boolean;
66
+ };
59
67
  /**
60
68
  * 创建本地订单 (前端模拟下单流程)
61
69
  *