@pisell/pisellos 0.0.246 → 0.0.247
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.
- package/dist/modules/Payment/index.js +8 -3
- package/dist/modules/Payment/types.d.ts +4 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +80 -85
- package/lib/modules/Payment/index.js +8 -3
- package/lib/modules/Payment/types.d.ts +4 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +32 -13
- package/package.json +1 -1
|
@@ -1037,7 +1037,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1037
1037
|
this.logInfo('Starting addPaymentItemAsync', {
|
|
1038
1038
|
orderUuid: orderUuid,
|
|
1039
1039
|
paymentAmount: paymentItem.amount,
|
|
1040
|
-
paymentCode: paymentItem.code
|
|
1040
|
+
paymentCode: paymentItem.code,
|
|
1041
|
+
orderPaymentType: paymentItem.order_payment_type
|
|
1041
1042
|
});
|
|
1042
1043
|
_context13.prev = 1;
|
|
1043
1044
|
_context13.next = 4;
|
|
@@ -1063,6 +1064,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1063
1064
|
service_charge: paymentItem.service_charge,
|
|
1064
1065
|
status: 'active',
|
|
1065
1066
|
// 新支付项默认为活跃状态
|
|
1067
|
+
order_payment_type: paymentItem.order_payment_type || 'normal',
|
|
1068
|
+
// 默认为正常支付
|
|
1066
1069
|
metadata: {
|
|
1067
1070
|
unique_payment_number: paymentUuid // 设置唯一支付号为支付项的 uuid
|
|
1068
1071
|
}
|
|
@@ -1230,7 +1233,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1230
1233
|
return {
|
|
1231
1234
|
code: item.code,
|
|
1232
1235
|
amount: item.amount,
|
|
1233
|
-
voucher_id: item.voucher_id
|
|
1236
|
+
voucher_id: item.voucher_id,
|
|
1237
|
+
order_payment_type: item.order_payment_type
|
|
1234
1238
|
};
|
|
1235
1239
|
})
|
|
1236
1240
|
});
|
|
@@ -1313,7 +1317,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1313
1317
|
console.log("[PaymentModule] \u6DFB\u52A0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", {
|
|
1314
1318
|
code: _voucherItem.code,
|
|
1315
1319
|
amount: _voucherItem.amount,
|
|
1316
|
-
voucher_id: _voucherItem.voucher_id
|
|
1320
|
+
voucher_id: _voucherItem.voucher_id,
|
|
1321
|
+
order_payment_type: _voucherItem.order_payment_type
|
|
1317
1322
|
});
|
|
1318
1323
|
_context15.next = 38;
|
|
1319
1324
|
return this.addPaymentItemAsync(orderUuid, _voucherItem);
|
|
@@ -123,6 +123,8 @@ export interface PaymentItem {
|
|
|
123
123
|
status?: 'active' | 'voided';
|
|
124
124
|
/** 原始金额(用于记录撤销前的金额) */
|
|
125
125
|
origin_amount?: string;
|
|
126
|
+
/** 订单支付类型 */
|
|
127
|
+
order_payment_type?: 'normal' | 'deposit';
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
128
130
|
* 订单信息
|
|
@@ -218,6 +220,8 @@ export interface PaymentItemInput {
|
|
|
218
220
|
};
|
|
219
221
|
/** 舍入金额 */
|
|
220
222
|
rounding_amount?: string;
|
|
223
|
+
/** 订单支付类型 */
|
|
224
|
+
order_payment_type?: 'normal' | 'deposit';
|
|
221
225
|
}
|
|
222
226
|
/**
|
|
223
227
|
* 推送支付项参数
|
|
@@ -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, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -1661,7 +1660,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1661
1660
|
key: "addPaymentItemAsync",
|
|
1662
1661
|
value: (function () {
|
|
1663
1662
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(paymentItem) {
|
|
1664
|
-
var _paymentItem$type, _paymentItem$code, isEftposPayment;
|
|
1663
|
+
var _paymentItem$type, _paymentItem$code, orderPaymentType, paymentItemWithType, isEftposPayment;
|
|
1665
1664
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1666
1665
|
while (1) switch (_context25.prev = _context25.next) {
|
|
1667
1666
|
case 0:
|
|
@@ -1672,23 +1671,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1672
1671
|
}
|
|
1673
1672
|
throw createCheckoutError(CheckoutErrorType.ValidationFailed, '未找到当前订单,无法添加支付项');
|
|
1674
1673
|
case 3:
|
|
1674
|
+
// 根据当前订单的定金状态设置订单支付类型
|
|
1675
|
+
orderPaymentType = this.store.currentOrder.is_deposit === 1 ? 'deposit' : 'normal'; // 设置支付项的订单支付类型
|
|
1676
|
+
paymentItemWithType = _objectSpread(_objectSpread({}, paymentItem), {}, {
|
|
1677
|
+
order_payment_type: orderPaymentType
|
|
1678
|
+
});
|
|
1675
1679
|
console.log('[Checkout] 为当前订单添加支付项:', {
|
|
1676
1680
|
orderUuid: this.store.currentOrder.uuid,
|
|
1677
1681
|
paymentItem: {
|
|
1678
|
-
code:
|
|
1679
|
-
name:
|
|
1680
|
-
type:
|
|
1681
|
-
amount:
|
|
1682
|
-
service_charge:
|
|
1683
|
-
rounding_amount:
|
|
1684
|
-
voucher_id:
|
|
1685
|
-
|
|
1682
|
+
code: paymentItemWithType.code,
|
|
1683
|
+
name: paymentItemWithType.name,
|
|
1684
|
+
type: paymentItemWithType.type,
|
|
1685
|
+
amount: paymentItemWithType.amount,
|
|
1686
|
+
service_charge: paymentItemWithType.service_charge,
|
|
1687
|
+
rounding_amount: paymentItemWithType.rounding_amount,
|
|
1688
|
+
voucher_id: paymentItemWithType.voucher_id,
|
|
1689
|
+
order_payment_type: paymentItemWithType.order_payment_type
|
|
1690
|
+
},
|
|
1691
|
+
orderDepositStatus: this.store.currentOrder.is_deposit,
|
|
1692
|
+
calculatedOrderPaymentType: orderPaymentType
|
|
1686
1693
|
});
|
|
1687
1694
|
|
|
1688
1695
|
// 添加支付项到订单
|
|
1689
|
-
_context25.next =
|
|
1690
|
-
return this.payment.addPaymentItemAsync(this.store.currentOrder.uuid,
|
|
1691
|
-
case
|
|
1696
|
+
_context25.next = 8;
|
|
1697
|
+
return this.payment.addPaymentItemAsync(this.store.currentOrder.uuid, paymentItemWithType);
|
|
1698
|
+
case 8:
|
|
1692
1699
|
console.log('[Checkout] 支付项添加成功');
|
|
1693
1700
|
|
|
1694
1701
|
// 检查是否是 EFTPOS 支付,如果是则立即同步订单
|
|
@@ -1700,54 +1707,54 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1700
1707
|
currentOrderSynced: this.store.isOrderSynced
|
|
1701
1708
|
});
|
|
1702
1709
|
if (!isEftposPayment) {
|
|
1703
|
-
_context25.next =
|
|
1710
|
+
_context25.next = 24;
|
|
1704
1711
|
break;
|
|
1705
1712
|
}
|
|
1706
1713
|
console.log('[Checkout] 检测到 EFTPOS 支付,立即同步订单到后端...');
|
|
1707
|
-
_context25.prev =
|
|
1708
|
-
_context25.next =
|
|
1714
|
+
_context25.prev = 13;
|
|
1715
|
+
_context25.next = 16;
|
|
1709
1716
|
return this.syncOrderToBackendWithReturn(true);
|
|
1710
|
-
case
|
|
1717
|
+
case 16:
|
|
1711
1718
|
console.log('[Checkout] EFTPOS 支付后订单同步完成 (已标记为手动同步):', {
|
|
1712
1719
|
订单ID: this.store.currentOrder.order_id,
|
|
1713
1720
|
是否已同步: this.store.isOrderSynced
|
|
1714
1721
|
});
|
|
1715
|
-
_context25.next =
|
|
1722
|
+
_context25.next = 24;
|
|
1716
1723
|
break;
|
|
1717
|
-
case
|
|
1718
|
-
_context25.prev =
|
|
1719
|
-
_context25.t0 = _context25["catch"](
|
|
1724
|
+
case 19:
|
|
1725
|
+
_context25.prev = 19;
|
|
1726
|
+
_context25.t0 = _context25["catch"](13);
|
|
1720
1727
|
console.error('[Checkout] EFTPOS 支付后订单同步失败:', _context25.t0);
|
|
1721
1728
|
// 不抛出错误,避免影响支付流程,但记录错误
|
|
1722
|
-
_context25.next = 22;
|
|
1723
|
-
return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0))), CheckoutErrorType.OrderCreationFailed);
|
|
1724
|
-
case 22:
|
|
1725
1729
|
_context25.next = 24;
|
|
1726
|
-
return this.
|
|
1730
|
+
return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0))), CheckoutErrorType.OrderCreationFailed);
|
|
1727
1731
|
case 24:
|
|
1728
1732
|
_context25.next = 26;
|
|
1733
|
+
return this.updateStateAmountToRemaining();
|
|
1734
|
+
case 26:
|
|
1735
|
+
_context25.next = 28;
|
|
1729
1736
|
return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
|
|
1730
1737
|
orderUuid: this.store.currentOrder.uuid,
|
|
1731
1738
|
paymentMethodCode: paymentItem.code,
|
|
1732
1739
|
amount: String(paymentItem.amount),
|
|
1733
1740
|
timestamp: Date.now()
|
|
1734
1741
|
});
|
|
1735
|
-
case 26:
|
|
1736
|
-
_context25.next = 34;
|
|
1737
|
-
break;
|
|
1738
1742
|
case 28:
|
|
1739
|
-
_context25.
|
|
1743
|
+
_context25.next = 36;
|
|
1744
|
+
break;
|
|
1745
|
+
case 30:
|
|
1746
|
+
_context25.prev = 30;
|
|
1740
1747
|
_context25.t1 = _context25["catch"](0);
|
|
1741
1748
|
console.error('[Checkout] 添加支付项失败:', _context25.t1);
|
|
1742
|
-
_context25.next =
|
|
1749
|
+
_context25.next = 35;
|
|
1743
1750
|
return this.handleError(_context25.t1, CheckoutErrorType.PaymentFailed);
|
|
1744
|
-
case
|
|
1751
|
+
case 35:
|
|
1745
1752
|
throw _context25.t1;
|
|
1746
|
-
case
|
|
1753
|
+
case 36:
|
|
1747
1754
|
case "end":
|
|
1748
1755
|
return _context25.stop();
|
|
1749
1756
|
}
|
|
1750
|
-
}, _callee25, this, [[0,
|
|
1757
|
+
}, _callee25, this, [[0, 30], [13, 19]]);
|
|
1751
1758
|
}));
|
|
1752
1759
|
function addPaymentItemAsync(_x16) {
|
|
1753
1760
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -1882,7 +1889,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1882
1889
|
key: "updateVoucherPaymentItemsAsync",
|
|
1883
1890
|
value: (function () {
|
|
1884
1891
|
var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(voucherPaymentItems) {
|
|
1885
|
-
var
|
|
1892
|
+
var orderPaymentType, voucherPaymentItemsWithType, currentOrderId, isCurrentOrderReal, updatedOrder, voucherItems;
|
|
1886
1893
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1887
1894
|
while (1) switch (_context27.prev = _context27.next) {
|
|
1888
1895
|
case 0:
|
|
@@ -1899,47 +1906,34 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1899
1906
|
voucherPaymentItems: voucherPaymentItems
|
|
1900
1907
|
});
|
|
1901
1908
|
|
|
1902
|
-
//
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
break;
|
|
1923
|
-
case 15:
|
|
1924
|
-
_context27.prev = 15;
|
|
1925
|
-
_context27.t0 = _context27["catch"](5);
|
|
1926
|
-
_iterator.e(_context27.t0);
|
|
1927
|
-
case 18:
|
|
1928
|
-
_context27.prev = 18;
|
|
1929
|
-
_iterator.f();
|
|
1930
|
-
return _context27.finish(18);
|
|
1931
|
-
case 21:
|
|
1932
|
-
_context27.next = 23;
|
|
1933
|
-
return this.payment.updateVoucherPaymentItemsAsync(this.store.currentOrder.uuid, voucherPaymentItems);
|
|
1934
|
-
case 23:
|
|
1909
|
+
// 根据当前订单的定金状态设置订单支付类型
|
|
1910
|
+
orderPaymentType = this.store.currentOrder.is_deposit === 1 ? 'deposit' : 'normal'; // 验证所有支付项都包含 voucher_id,并设置 order_payment_type
|
|
1911
|
+
voucherPaymentItemsWithType = voucherPaymentItems.map(function (item) {
|
|
1912
|
+
if (!item.voucher_id) {
|
|
1913
|
+
throw createCheckoutError(CheckoutErrorType.ValidationFailed, "\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u7F3A\u5C11 voucher_id: ".concat(JSON.stringify(item)));
|
|
1914
|
+
}
|
|
1915
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1916
|
+
order_payment_type: orderPaymentType
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1919
|
+
console.log('[Checkout] 代金券支付项订单支付类型设置:', {
|
|
1920
|
+
orderDepositStatus: this.store.currentOrder.is_deposit,
|
|
1921
|
+
calculatedOrderPaymentType: orderPaymentType,
|
|
1922
|
+
itemsCount: voucherPaymentItemsWithType.length
|
|
1923
|
+
});
|
|
1924
|
+
|
|
1925
|
+
// 调用 Payment 模块的批量更新方法
|
|
1926
|
+
_context27.next = 9;
|
|
1927
|
+
return this.payment.updateVoucherPaymentItemsAsync(this.store.currentOrder.uuid, voucherPaymentItemsWithType);
|
|
1928
|
+
case 9:
|
|
1935
1929
|
console.log('[Checkout] Payment模块批量更新完成');
|
|
1936
1930
|
|
|
1937
1931
|
// 重新从Payment模块获取最新的订单数据,确保支付项同步
|
|
1938
1932
|
currentOrderId = this.store.currentOrder.order_id; // 保存当前的订单ID
|
|
1939
1933
|
isCurrentOrderReal = currentOrderId && !this.isVirtualOrderId(currentOrderId);
|
|
1940
|
-
_context27.next =
|
|
1934
|
+
_context27.next = 14;
|
|
1941
1935
|
return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
|
|
1942
|
-
case
|
|
1936
|
+
case 14:
|
|
1943
1937
|
updatedOrder = _context27.sent;
|
|
1944
1938
|
if (updatedOrder) {
|
|
1945
1939
|
// 如果当前订单ID是真实ID,但获取到的订单ID是虚拟ID,需要保护真实ID
|
|
@@ -1971,10 +1965,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1971
1965
|
}
|
|
1972
1966
|
|
|
1973
1967
|
// 更新 stateAmount 为剩余未支付金额
|
|
1974
|
-
_context27.next =
|
|
1968
|
+
_context27.next = 18;
|
|
1975
1969
|
return this.updateStateAmountToRemaining();
|
|
1976
|
-
case
|
|
1977
|
-
_context27.next =
|
|
1970
|
+
case 18:
|
|
1971
|
+
_context27.next = 20;
|
|
1978
1972
|
return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
|
|
1979
1973
|
orderUuid: this.store.currentOrder.uuid,
|
|
1980
1974
|
paymentMethodCode: 'VOUCHER_BATCH',
|
|
@@ -1983,23 +1977,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1983
1977
|
}, 0).toFixed(2),
|
|
1984
1978
|
timestamp: Date.now()
|
|
1985
1979
|
});
|
|
1986
|
-
case
|
|
1980
|
+
case 20:
|
|
1987
1981
|
console.log('[Checkout] 代金券支付项批量更新成功');
|
|
1988
|
-
_context27.next =
|
|
1982
|
+
_context27.next = 29;
|
|
1989
1983
|
break;
|
|
1990
|
-
case
|
|
1991
|
-
_context27.prev =
|
|
1992
|
-
_context27.
|
|
1993
|
-
console.error('[Checkout] 批量更新代金券支付项失败:', _context27.
|
|
1994
|
-
_context27.next =
|
|
1995
|
-
return this.handleError(_context27.
|
|
1996
|
-
case
|
|
1997
|
-
throw _context27.
|
|
1998
|
-
case
|
|
1984
|
+
case 23:
|
|
1985
|
+
_context27.prev = 23;
|
|
1986
|
+
_context27.t0 = _context27["catch"](0);
|
|
1987
|
+
console.error('[Checkout] 批量更新代金券支付项失败:', _context27.t0);
|
|
1988
|
+
_context27.next = 28;
|
|
1989
|
+
return this.handleError(_context27.t0, CheckoutErrorType.PaymentFailed);
|
|
1990
|
+
case 28:
|
|
1991
|
+
throw _context27.t0;
|
|
1992
|
+
case 29:
|
|
1999
1993
|
case "end":
|
|
2000
1994
|
return _context27.stop();
|
|
2001
1995
|
}
|
|
2002
|
-
}, _callee27, this, [[0,
|
|
1996
|
+
}, _callee27, this, [[0, 23]]);
|
|
2003
1997
|
}));
|
|
2004
1998
|
function updateVoucherPaymentItemsAsync(_x18) {
|
|
2005
1999
|
return _updateVoucherPaymentItemsAsync.apply(this, arguments);
|
|
@@ -3764,7 +3758,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3764
3758
|
code: p.code,
|
|
3765
3759
|
amount: p.amount,
|
|
3766
3760
|
uniquePaymentNumber: (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.unique_payment_number,
|
|
3767
|
-
voucherId: p.voucher_id
|
|
3761
|
+
voucherId: p.voucher_id,
|
|
3762
|
+
orderPaymentType: p.order_payment_type
|
|
3768
3763
|
};
|
|
3769
3764
|
})
|
|
3770
3765
|
});
|
|
@@ -508,7 +508,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
508
508
|
this.logInfo("Starting addPaymentItemAsync", {
|
|
509
509
|
orderUuid,
|
|
510
510
|
paymentAmount: paymentItem.amount,
|
|
511
|
-
paymentCode: paymentItem.code
|
|
511
|
+
paymentCode: paymentItem.code,
|
|
512
|
+
orderPaymentType: paymentItem.order_payment_type
|
|
512
513
|
});
|
|
513
514
|
try {
|
|
514
515
|
const order = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
@@ -528,6 +529,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
528
529
|
service_charge: paymentItem.service_charge,
|
|
529
530
|
status: "active",
|
|
530
531
|
// 新支付项默认为活跃状态
|
|
532
|
+
order_payment_type: paymentItem.order_payment_type || "normal",
|
|
533
|
+
// 默认为正常支付
|
|
531
534
|
metadata: {
|
|
532
535
|
unique_payment_number: paymentUuid
|
|
533
536
|
// 设置唯一支付号为支付项的 uuid
|
|
@@ -622,7 +625,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
622
625
|
voucherItems: voucherPaymentItems.map((item) => ({
|
|
623
626
|
code: item.code,
|
|
624
627
|
amount: item.amount,
|
|
625
|
-
voucher_id: item.voucher_id
|
|
628
|
+
voucher_id: item.voucher_id,
|
|
629
|
+
order_payment_type: item.order_payment_type
|
|
626
630
|
}))
|
|
627
631
|
});
|
|
628
632
|
try {
|
|
@@ -658,7 +662,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
658
662
|
console.log(`[PaymentModule] 添加代金券支付项:`, {
|
|
659
663
|
code: voucherItem.code,
|
|
660
664
|
amount: voucherItem.amount,
|
|
661
|
-
voucher_id: voucherItem.voucher_id
|
|
665
|
+
voucher_id: voucherItem.voucher_id,
|
|
666
|
+
order_payment_type: voucherItem.order_payment_type
|
|
662
667
|
});
|
|
663
668
|
await this.addPaymentItemAsync(orderUuid, voucherItem);
|
|
664
669
|
}
|
|
@@ -123,6 +123,8 @@ export interface PaymentItem {
|
|
|
123
123
|
status?: 'active' | 'voided';
|
|
124
124
|
/** 原始金额(用于记录撤销前的金额) */
|
|
125
125
|
origin_amount?: string;
|
|
126
|
+
/** 订单支付类型 */
|
|
127
|
+
order_payment_type?: 'normal' | 'deposit';
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
128
130
|
* 订单信息
|
|
@@ -218,6 +220,8 @@ export interface PaymentItemInput {
|
|
|
218
220
|
};
|
|
219
221
|
/** 舍入金额 */
|
|
220
222
|
rounding_amount?: string;
|
|
223
|
+
/** 订单支付类型 */
|
|
224
|
+
order_payment_type?: 'normal' | 'deposit';
|
|
221
225
|
}
|
|
222
226
|
/**
|
|
223
227
|
* 推送支付项参数
|
|
@@ -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, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -939,21 +939,29 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
939
939
|
"未找到当前订单,无法添加支付项"
|
|
940
940
|
);
|
|
941
941
|
}
|
|
942
|
+
const orderPaymentType = this.store.currentOrder.is_deposit === 1 ? "deposit" : "normal";
|
|
943
|
+
const paymentItemWithType = {
|
|
944
|
+
...paymentItem,
|
|
945
|
+
order_payment_type: orderPaymentType
|
|
946
|
+
};
|
|
942
947
|
console.log("[Checkout] 为当前订单添加支付项:", {
|
|
943
948
|
orderUuid: this.store.currentOrder.uuid,
|
|
944
949
|
paymentItem: {
|
|
945
|
-
code:
|
|
946
|
-
name:
|
|
947
|
-
type:
|
|
948
|
-
amount:
|
|
949
|
-
service_charge:
|
|
950
|
-
rounding_amount:
|
|
951
|
-
voucher_id:
|
|
952
|
-
|
|
950
|
+
code: paymentItemWithType.code,
|
|
951
|
+
name: paymentItemWithType.name,
|
|
952
|
+
type: paymentItemWithType.type,
|
|
953
|
+
amount: paymentItemWithType.amount,
|
|
954
|
+
service_charge: paymentItemWithType.service_charge,
|
|
955
|
+
rounding_amount: paymentItemWithType.rounding_amount,
|
|
956
|
+
voucher_id: paymentItemWithType.voucher_id,
|
|
957
|
+
order_payment_type: paymentItemWithType.order_payment_type
|
|
958
|
+
},
|
|
959
|
+
orderDepositStatus: this.store.currentOrder.is_deposit,
|
|
960
|
+
calculatedOrderPaymentType: orderPaymentType
|
|
953
961
|
});
|
|
954
962
|
await this.payment.addPaymentItemAsync(
|
|
955
963
|
this.store.currentOrder.uuid,
|
|
956
|
-
|
|
964
|
+
paymentItemWithType
|
|
957
965
|
);
|
|
958
966
|
console.log("[Checkout] 支付项添加成功");
|
|
959
967
|
const isEftposPayment = ((_a = paymentItem.type) == null ? void 0 : _a.toLowerCase()) === "eftpos" || ((_b = paymentItem.code) == null ? void 0 : _b.toUpperCase().includes("EFTPOS"));
|
|
@@ -1096,17 +1104,27 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1096
1104
|
newVoucherCount: voucherPaymentItems.length,
|
|
1097
1105
|
voucherPaymentItems
|
|
1098
1106
|
});
|
|
1099
|
-
|
|
1107
|
+
const orderPaymentType = this.store.currentOrder.is_deposit === 1 ? "deposit" : "normal";
|
|
1108
|
+
const voucherPaymentItemsWithType = voucherPaymentItems.map((item) => {
|
|
1100
1109
|
if (!item.voucher_id) {
|
|
1101
1110
|
throw (0, import_utils.createCheckoutError)(
|
|
1102
1111
|
import_types.CheckoutErrorType.ValidationFailed,
|
|
1103
1112
|
`代金券支付项缺少 voucher_id: ${JSON.stringify(item)}`
|
|
1104
1113
|
);
|
|
1105
1114
|
}
|
|
1106
|
-
|
|
1115
|
+
return {
|
|
1116
|
+
...item,
|
|
1117
|
+
order_payment_type: orderPaymentType
|
|
1118
|
+
};
|
|
1119
|
+
});
|
|
1120
|
+
console.log("[Checkout] 代金券支付项订单支付类型设置:", {
|
|
1121
|
+
orderDepositStatus: this.store.currentOrder.is_deposit,
|
|
1122
|
+
calculatedOrderPaymentType: orderPaymentType,
|
|
1123
|
+
itemsCount: voucherPaymentItemsWithType.length
|
|
1124
|
+
});
|
|
1107
1125
|
await this.payment.updateVoucherPaymentItemsAsync(
|
|
1108
1126
|
this.store.currentOrder.uuid,
|
|
1109
|
-
|
|
1127
|
+
voucherPaymentItemsWithType
|
|
1110
1128
|
);
|
|
1111
1129
|
console.log("[Checkout] Payment模块批量更新完成");
|
|
1112
1130
|
const currentOrderId = this.store.currentOrder.order_id;
|
|
@@ -2242,7 +2260,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2242
2260
|
code: p.code,
|
|
2243
2261
|
amount: p.amount,
|
|
2244
2262
|
uniquePaymentNumber: (_a2 = p.metadata) == null ? void 0 : _a2.unique_payment_number,
|
|
2245
|
-
voucherId: p.voucher_id
|
|
2263
|
+
voucherId: p.voucher_id,
|
|
2264
|
+
orderPaymentType: p.order_payment_type
|
|
2246
2265
|
};
|
|
2247
2266
|
})
|
|
2248
2267
|
});
|