@pisell/private-materials 6.5.4 → 6.5.6
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +160 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/actionButtons/index.js +37 -42
- package/es/components/booking/components/actionButtons/index.less +0 -28
- package/es/components/booking/components/footer/amount.d.ts +3 -3
- package/es/components/booking/components/footer/amount.js +51 -31
- package/es/components/booking/components/footer/index.js +177 -68
- package/es/components/booking/components/footer/utils.js +62 -33
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/model.js +5 -0
- package/es/components/booking/info/service/addService/index.js +2 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/index.js +42 -2
- package/es/components/booking/info2/service/addService/index.js +2 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/editService/index.js +12 -4
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.js +10 -5
- package/es/components/checkout/PaymentModal.d.ts +2 -0
- package/es/components/checkout/PaymentModal.js +462 -263
- package/es/components/checkout/components/AdditionalModule/index.less +1 -1
- package/es/components/checkout/components/AmountSummary/index.js +176 -65
- package/es/components/checkout/components/AmountSummary/index.less +13 -0
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/es/components/checkout/components/CashPaymentModule/index.js +110 -132
- package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +214 -0
- package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
- package/es/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/es/components/checkout/components/PaymentResultToast/index.js +38 -8
- package/es/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
- package/es/components/checkout/components/WalletPassModule/index.js +4 -3
- package/es/components/checkout/components/WalletPassModule/utils.js +10 -4
- package/es/components/checkout/hooks/useWalletPass.js +11 -4
- package/es/components/checkout/index.less +1 -1
- package/es/components/checkout/locales.d.ts +36 -0
- package/es/components/checkout/locales.js +43 -4
- package/es/components/checkout/types.d.ts +1 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/shoppingCart/components/Cart/Product.js +143 -71
- package/es/components/shoppingCart/components/Cart/index.js +1 -1
- package/es/components/shoppingCart/components/Cart/index.less +31 -0
- package/es/components/shoppingCart/locales.d.ts +3 -0
- package/es/components/shoppingCart/locales.js +12 -3
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +9 -12
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/es/components/ticketBooking/components/menuBar/index.js +3 -1
- package/es/components/ticketBooking/components/menuBar/index.less +7 -0
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/components/ticketBooking/utils/index.js +2 -1
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +331 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.js +465 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
- package/es/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
- package/es/pro/priceKeyboard/index.d.ts +3 -0
- package/es/pro/priceKeyboard/index.js +3 -0
- package/es/pro/priceKeyboard/index.less +215 -0
- package/es/pro/priceKeyboard/utils.d.ts +31 -0
- package/es/pro/priceKeyboard/utils.js +51 -0
- package/es/pro/skuDetailModal/index.js +19 -16
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/actionButtons/index.js +31 -28
- package/lib/components/booking/components/actionButtons/index.less +0 -28
- package/lib/components/booking/components/footer/amount.d.ts +3 -3
- package/lib/components/booking/components/footer/amount.js +49 -34
- package/lib/components/booking/components/footer/index.js +114 -40
- package/lib/components/booking/components/footer/utils.js +35 -7
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/service/addService/index.js +2 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/index.js +18 -1
- package/lib/components/booking/info2/service/addService/index.js +2 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/editService/index.js +12 -4
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.js +10 -5
- package/lib/components/checkout/PaymentModal.d.ts +2 -0
- package/lib/components/checkout/PaymentModal.js +208 -91
- package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
- package/lib/components/checkout/components/AmountSummary/index.js +120 -50
- package/lib/components/checkout/components/AmountSummary/index.less +13 -0
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/lib/components/checkout/components/CashPaymentModule/index.js +101 -134
- package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +163 -0
- package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
- package/lib/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/lib/components/checkout/components/PaymentResultToast/index.js +26 -1
- package/lib/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
- package/lib/components/checkout/components/WalletPassModule/index.js +4 -3
- package/lib/components/checkout/components/WalletPassModule/utils.js +8 -4
- package/lib/components/checkout/hooks/useWalletPass.js +11 -6
- package/lib/components/checkout/index.less +1 -1
- package/lib/components/checkout/locales.d.ts +36 -0
- package/lib/components/checkout/locales.js +43 -4
- package/lib/components/checkout/types.d.ts +1 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
- package/lib/components/shoppingCart/components/Cart/index.js +1 -1
- package/lib/components/shoppingCart/components/Cart/index.less +31 -0
- package/lib/components/shoppingCart/locales.d.ts +3 -0
- package/lib/components/shoppingCart/locales.js +6 -3
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -4
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/menuBar/index.js +1 -1
- package/lib/components/ticketBooking/components/menuBar/index.less +7 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/components/ticketBooking/utils/index.js +2 -1
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +360 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +504 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
- package/lib/pro/priceKeyboard/index.d.ts +3 -0
- package/lib/pro/priceKeyboard/index.js +45 -0
- package/lib/pro/priceKeyboard/index.less +215 -0
- package/lib/pro/priceKeyboard/utils.d.ts +31 -0
- package/lib/pro/priceKeyboard/utils.js +75 -0
- package/lib/pro/skuDetailModal/index.js +18 -22
- package/package.json +12 -12
@@ -8,8 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
|
-
import { useState, useEffect } from 'react';
|
12
|
-
import { Button, Dropdown } from 'antd';
|
11
|
+
import { useState, useEffect, useMemo } from 'react';
|
12
|
+
import { Button, Dropdown, Popover } from 'antd';
|
13
13
|
import { CheckCircleOutlined, PieChartOutlined } from '@ant-design/icons';
|
14
14
|
import { Edit05 } from '@pisell/icon';
|
15
15
|
import { PisellModal } from '@pisell/materials';
|
@@ -17,7 +17,8 @@ import { locales, formatAmountWithOptions } from '@pisell/utils';
|
|
17
17
|
import Decimal from 'decimal.js';
|
18
18
|
import checkoutLocales from "../../locales";
|
19
19
|
import PaymentDetailModal from "../PaymentDetailModal";
|
20
|
-
import PisellPriceKeyboardPopover from "../../../../pro/
|
20
|
+
import PisellPriceKeyboardPopover from "../../../../pro/pisellSimplePriceKeyboardPopover";
|
21
|
+
import { PaymentKeyboard } from "../../../../pro/priceKeyboard";
|
21
22
|
import "./index.less";
|
22
23
|
import classNames from 'classnames';
|
23
24
|
import useEngineContext from "../../../../hooks/useEngineContext";
|
@@ -112,6 +113,12 @@ function AmountSummary(_ref2) {
|
|
112
113
|
// 获取 checkout 模块
|
113
114
|
var checkoutModule = pisellos.getModule('checkout');
|
114
115
|
|
116
|
+
// 控制键盘弹窗显示状态
|
117
|
+
var _useState9 = useState(false),
|
118
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
119
|
+
isKeyboardVisible = _useState10[0],
|
120
|
+
setIsKeyboardVisible = _useState10[1];
|
121
|
+
|
115
122
|
// 小计标签映射
|
116
123
|
var labelMaps = {
|
117
124
|
deposit: getText('pisell2.subtotal.deposit') || 'Deposit',
|
@@ -127,16 +134,16 @@ function AmountSummary(_ref2) {
|
|
127
134
|
|
128
135
|
// 获取右侧Balance Due的金额
|
129
136
|
var getBalanceDueAmount = function getBalanceDueAmount() {
|
130
|
-
//
|
131
|
-
|
132
|
-
return
|
133
|
-
});
|
134
|
-
if (expectAmountItem) {
|
135
|
-
return expectAmountItem.value;
|
137
|
+
// 如果当前订单是定金,则使用 depositAmount
|
138
|
+
if (paymentType === 'deposit') {
|
139
|
+
return (orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) || '0';
|
136
140
|
}
|
137
|
-
|
138
|
-
|
139
|
-
|
141
|
+
return (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
142
|
+
if (item.isSynced || !item.voucher_id) {
|
143
|
+
return acc;
|
144
|
+
}
|
145
|
+
return acc.plus(item.amount);
|
146
|
+
}, new Decimal(0)).toNumber()) || 0;
|
140
147
|
};
|
141
148
|
|
142
149
|
// 解析格式化金额字符串为数字的工具函数
|
@@ -156,10 +163,10 @@ function AmountSummary(_ref2) {
|
|
156
163
|
}
|
157
164
|
return 0;
|
158
165
|
};
|
159
|
-
var
|
160
|
-
|
161
|
-
currentAmount =
|
162
|
-
setCurrentAmount =
|
166
|
+
var _useState11 = useState(customAmount && customAmount !== '' ? customAmount : parseFormattedAmount(getBalanceDueAmount())),
|
167
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
168
|
+
currentAmount = _useState12[0],
|
169
|
+
setCurrentAmount = _useState12[1];
|
163
170
|
|
164
171
|
// 响应外部 customAmount 变化
|
165
172
|
useEffect(function () {
|
@@ -176,6 +183,7 @@ function AmountSummary(_ref2) {
|
|
176
183
|
if (Array.isArray(summary)) {
|
177
184
|
setSummaryData(summary);
|
178
185
|
}
|
186
|
+
setPaymentType(orderInfo.isDeposit ? 'deposit' : 'regular');
|
179
187
|
} catch (error) {
|
180
188
|
console.warn('Failed to get cart summary:', error);
|
181
189
|
}
|
@@ -257,36 +265,25 @@ function AmountSummary(_ref2) {
|
|
257
265
|
return totalDecimal.toNumber();
|
258
266
|
};
|
259
267
|
|
260
|
-
// 获取订单待支付金额
|
261
|
-
var getOrderDueAmount = function getOrderDueAmount() {
|
262
|
-
var expectAmountItem = summaryData.find(function (item) {
|
263
|
-
return item.key === 'expect_amount';
|
264
|
-
});
|
265
|
-
if (expectAmountItem) {
|
266
|
-
return expectAmountItem.value;
|
267
|
-
}
|
268
|
-
// 降级方案:使用硬编码值
|
269
|
-
return paymentType === 'deposit' ? 15.1 : 130.2;
|
270
|
-
};
|
271
|
-
|
272
268
|
// 计算键盘输入的最小值和最大值
|
273
269
|
var getKeyboardLimits = function getKeyboardLimits() {
|
274
|
-
|
275
|
-
|
270
|
+
// const walletTotal = getWalletTotalAmount();
|
271
|
+
// const orderDue = getBalanceDueAmount();
|
276
272
|
|
277
273
|
// 使用 Decimal.js 进行精确计算,避免浮点数精度问题
|
278
|
-
|
279
|
-
var orderDueDecimal = new Decimal(
|
274
|
+
// const walletTotalDecimal = new Decimal(walletTotal);
|
275
|
+
var orderDueDecimal = new Decimal(Number(balanceDueAmount || 0));
|
280
276
|
var minDecimal = new Decimal(0.01);
|
281
277
|
|
282
278
|
// 计算 orderDue - walletTotal
|
283
|
-
|
279
|
+
// const diffDecimal = orderDueDecimal.minus(walletTotalDecimal);
|
284
280
|
|
285
281
|
// 取最大值:max(0.01, orderDue - walletTotal)
|
286
|
-
|
282
|
+
// const maxAmountDecimal = Decimal.max(minDecimal, diffDecimal);
|
283
|
+
|
287
284
|
return {
|
288
285
|
min: minDecimal.toNumber(),
|
289
|
-
max:
|
286
|
+
max: orderDueDecimal.toNumber()
|
290
287
|
};
|
291
288
|
};
|
292
289
|
|
@@ -314,12 +311,6 @@ function AmountSummary(_ref2) {
|
|
314
311
|
Toast.fail(getText('pisell2.amount-summary.amount-cannot-be-zero', 'The amount cannot be 0'));
|
315
312
|
return;
|
316
313
|
}
|
317
|
-
|
318
|
-
// 兜底策略:如果是空字符串、NaN或0,默认使用待支付金额
|
319
|
-
if (!inputStr || numericValue <= 0) {
|
320
|
-
numericValue = getOrderDueAmount();
|
321
|
-
}
|
322
|
-
|
323
314
|
// 确保输入值在允许范围内
|
324
315
|
var minDecimal = new Decimal(limits.min);
|
325
316
|
var maxDecimal = new Decimal(limits.max);
|
@@ -377,7 +368,7 @@ function AmountSummary(_ref2) {
|
|
377
368
|
|
378
369
|
// 计算含有 voucher_id 的付款项金额合计
|
379
370
|
var voucherPaymentAmount = (paymentItems === null || paymentItems === void 0 || (_paymentItems$reduce2 = paymentItems.reduce(function (acc, item) {
|
380
|
-
if (item.voucher_id) {
|
371
|
+
if (item.voucher_id && !item.isSynced) {
|
381
372
|
try {
|
382
373
|
var _amount = new Decimal(item.amount || '0');
|
383
374
|
var roundingAmount = new Decimal(item.rounding_amount || '0');
|
@@ -390,6 +381,13 @@ function AmountSummary(_ref2) {
|
|
390
381
|
}, new Decimal(0))) === null || _paymentItems$reduce2 === void 0 ? void 0 : _paymentItems$reduce2.toNumber()) || 0;
|
391
382
|
var totalPaidAmount = partialPaidAmountDecimal.plus(voucherPaymentAmount).toNumber();
|
392
383
|
|
384
|
+
// 如果已经有除了voucher 以外的其他支付项 isSynced的,并且还没超过订单总金额,则需要显示
|
385
|
+
var syncedPaymentItems = (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
|
386
|
+
return item.isSynced && !item.voucher_id;
|
387
|
+
})) || [];
|
388
|
+
if ((syncedPaymentItems === null || syncedPaymentItems === void 0 ? void 0 : syncedPaymentItems.length) > 0 && totalPaidAmount < totalAmount) {
|
389
|
+
return true;
|
390
|
+
}
|
393
391
|
// 如果 (部分付款金额 + 含有voucher_id的付款项金额合计) >= 总金额,则不显示
|
394
392
|
if (totalPaidAmount >= totalAmount) {
|
395
393
|
return false;
|
@@ -449,9 +447,13 @@ function AmountSummary(_ref2) {
|
|
449
447
|
var _walletPassData$selec, _walletPassData$selec2;
|
450
448
|
// 检查是否有支付项
|
451
449
|
// if (!paymentItems || paymentItems.length === 0) return false;
|
450
|
+
// 先去除掉已经同步的支付项
|
451
|
+
var unSyncedPaymentItems = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
|
452
|
+
return !item.isSynced;
|
453
|
+
});
|
452
454
|
|
453
455
|
// 检查所有支付项是否都含有voucher_id
|
454
|
-
var allItemsHaveVoucherId =
|
456
|
+
var allItemsHaveVoucherId = unSyncedPaymentItems === null || unSyncedPaymentItems === void 0 ? void 0 : unSyncedPaymentItems.every(function (item) {
|
455
457
|
return item.voucher_id;
|
456
458
|
});
|
457
459
|
return allItemsHaveVoucherId || ((_walletPassData$selec = walletPassData === null || walletPassData === void 0 || (_walletPassData$selec2 = walletPassData.selectedDiscountList) === null || _walletPassData$selec2 === void 0 ? void 0 : _walletPassData$selec2.length) !== null && _walletPassData$selec !== void 0 ? _walletPassData$selec : 0) > 0;
|
@@ -540,7 +542,7 @@ function AmountSummary(_ref2) {
|
|
540
542
|
className: classNames('partial-paid-card')
|
541
543
|
}, /*#__PURE__*/React.createElement("span", {
|
542
544
|
className: classNames('partial-paid-label')
|
543
|
-
}, getText('partial.paid') || 'Partial Paid'), /*#__PURE__*/React.createElement("span", {
|
545
|
+
}, paymentType === 'deposit' ? getText('deposit.partial.paid') || 'Deposit Paid' : getText('partial.paid') || 'Partial Paid'), /*#__PURE__*/React.createElement("span", {
|
544
546
|
className: classNames('partial-paid-amount')
|
545
547
|
}, formatAmountWithOptions(partialPaidAmount, amountSymbol, {
|
546
548
|
precision: 2,
|
@@ -595,11 +597,47 @@ function AmountSummary(_ref2) {
|
|
595
597
|
})));
|
596
598
|
}
|
597
599
|
};
|
600
|
+
var canSwitch = useMemo(function () {
|
601
|
+
if (Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) === 0) {
|
602
|
+
return false;
|
603
|
+
}
|
604
|
+
// 如果当前是普通支付,并且支付项里已经有了type=default 的数据,则不可以再切换到定金支付
|
605
|
+
// 增加一个逻辑,如果当前是普通支付,并且支付项里有定金支付的钱,并且定金支付的钱已经超过了定金总金额,就不可以再切换了
|
606
|
+
if (paymentType === 'regular') {
|
607
|
+
var depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
608
|
+
if (item.order_payment_type === 'deposit') {
|
609
|
+
return acc.plus(item.amount).plus(Math.abs(item.rounding_amount));
|
610
|
+
}
|
611
|
+
return acc;
|
612
|
+
}, new Decimal(0)).toNumber();
|
613
|
+
var depositFlag = depositPaidAmount >= new Decimal((orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) || '0').toNumber() && Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) > 0;
|
614
|
+
return !(paymentItems !== null && paymentItems !== void 0 && paymentItems.some(function (item) {
|
615
|
+
return item.order_payment_type === 'normal';
|
616
|
+
})) && !depositFlag;
|
617
|
+
} else {
|
618
|
+
// 如果是定金支付,且定金已付款金额大于等于订单总金额,则不可以再切换到普通支付
|
619
|
+
var _depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
620
|
+
if (item.order_payment_type === 'deposit') {
|
621
|
+
return acc.plus(item.amount);
|
622
|
+
}
|
623
|
+
return acc;
|
624
|
+
}, new Decimal(0)).toNumber();
|
625
|
+
return _depositPaidAmount < new Decimal(totalAmount).toNumber();
|
626
|
+
}
|
627
|
+
}, [paymentItems, paymentType, totalAmount]);
|
628
|
+
var showCancelSplitPayment = useMemo(function () {
|
629
|
+
// 如果 balanceDueAmount 和 balanceDueAmount 不一样,则展示取消拆分支付按钮
|
630
|
+
return balanceDueAmount !== customAmount;
|
631
|
+
}, [customAmount, balanceDueAmount]);
|
632
|
+
var handleChangeDepositAmount = function handleChangeDepositAmount(value) {
|
633
|
+
console.log('handleChangeDepositAmount', value);
|
634
|
+
checkoutModule === null || checkoutModule === void 0 || checkoutModule.setDepositAmountAsync(value);
|
635
|
+
};
|
598
636
|
return /*#__PURE__*/React.createElement("div", {
|
599
637
|
className: classNames('amount-summary-module', 'amount-summary-container')
|
600
638
|
}, /*#__PURE__*/React.createElement("div", {
|
601
639
|
className: classNames('left-section')
|
602
|
-
}, open_deposit ? /*#__PURE__*/React.createElement(Dropdown, {
|
640
|
+
}, open_deposit && canSwitch ? /*#__PURE__*/React.createElement(Dropdown, {
|
603
641
|
menu: {
|
604
642
|
items: paymentOptions,
|
605
643
|
onClick: function onClick(_ref5) {
|
@@ -644,9 +682,32 @@ function AmountSummary(_ref2) {
|
|
644
682
|
// 如果应该显示确认模式,直接返回确认界面
|
645
683
|
shouldShowConfirmMode() ? renderConfirmMode() : /*#__PURE__*/React.createElement("div", {
|
646
684
|
className: classNames('balance-due-info')
|
647
|
-
}, /*#__PURE__*/React.createElement(
|
685
|
+
}, paymentType === 'deposit' ? /*#__PURE__*/React.createElement(PisellPriceKeyboardPopover, {
|
686
|
+
value: balanceDueAmount || '0'
|
687
|
+
// onChange={handleKeyboardChange}
|
688
|
+
,
|
689
|
+
onConfirm: handleChangeDepositAmount,
|
690
|
+
showCurrencySymbol: true,
|
691
|
+
useThousandsSeparator: true,
|
692
|
+
selectType: "dark",
|
693
|
+
overlayClassName: "cash-payment-keyboard-popover"
|
694
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
695
|
+
className: classNames('balance-due-label')
|
696
|
+
}, getText('deposit.due') || 'Deposit Due'), /*#__PURE__*/React.createElement("div", {
|
697
|
+
className: classNames('balance-due-amount')
|
698
|
+
}, formatAmountWithOptions(balanceDueAmount, amountSymbol, {
|
699
|
+
precision: 2,
|
700
|
+
hideDecimalForWholeNumbers: false,
|
701
|
+
useThousandsSeparator: true,
|
702
|
+
showCurrencySymbol: true
|
703
|
+
}), /*#__PURE__*/React.createElement(Edit05, {
|
704
|
+
className: classNames('edit-icon'),
|
705
|
+
style: {
|
706
|
+
color: '#7F56DA'
|
707
|
+
}
|
708
|
+
})))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
648
709
|
className: classNames('balance-due-label')
|
649
|
-
},
|
710
|
+
}, getText('balance.due') || 'Balance Due'), /*#__PURE__*/React.createElement("div", {
|
650
711
|
className: classNames('balance-due-amount'),
|
651
712
|
onClick: function onClick() {
|
652
713
|
onBalanceDueAmountClick === null || onBalanceDueAmountClick === void 0 || onBalanceDueAmountClick('manual-discount');
|
@@ -661,7 +722,7 @@ function AmountSummary(_ref2) {
|
|
661
722
|
style: {
|
662
723
|
color: '#7F56DA'
|
663
724
|
}
|
664
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
725
|
+
})))), Number(currentAmount) > 0 && /*#__PURE__*/React.createElement("div", {
|
665
726
|
className: classNames('pay-section'),
|
666
727
|
style: {
|
667
728
|
cursor: 'pointer'
|
@@ -682,26 +743,76 @@ function AmountSummary(_ref2) {
|
|
682
743
|
hideDecimalForWholeNumbers: false,
|
683
744
|
useThousandsSeparator: true,
|
684
745
|
showCurrencySymbol: true
|
685
|
-
})))), !shouldShowConfirmMode() && /*#__PURE__*/React.createElement(
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
746
|
+
})))), !shouldShowConfirmMode() && (showCancelSplitPayment ? /*#__PURE__*/React.createElement(Button, {
|
747
|
+
className: classNames('cancel-split-payment-button'),
|
748
|
+
onClick: function onClick() {
|
749
|
+
return onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(balanceDueAmount);
|
750
|
+
}
|
751
|
+
}, getText('split.cancel') || '取消部\n分支付') : /*#__PURE__*/React.createElement(Popover, {
|
752
|
+
content: /*#__PURE__*/React.createElement("div", {
|
753
|
+
onClick: function onClick(e) {
|
754
|
+
return e.stopPropagation();
|
691
755
|
}
|
692
|
-
}(
|
693
|
-
//
|
694
|
-
,
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
756
|
+
}, /*#__PURE__*/React.createElement(PaymentKeyboard
|
757
|
+
// 原始值:此支付阶段的待支付金额,reset时还原为此值
|
758
|
+
, {
|
759
|
+
paymentOriginalValue: balanceDueAmount,
|
760
|
+
paymentDefaultValue: String(customAmount || 0),
|
761
|
+
enableExceedMaxAmount: false,
|
762
|
+
payment: {
|
763
|
+
enable: true
|
764
|
+
},
|
765
|
+
surcharge: {
|
766
|
+
enable: false
|
767
|
+
},
|
768
|
+
surchargeDefaultValue: {
|
769
|
+
percent: '0',
|
770
|
+
fixed: '0'
|
771
|
+
},
|
772
|
+
selectType: "light",
|
773
|
+
onChange: function onChange(value) {
|
774
|
+
console.log(value);
|
775
|
+
},
|
776
|
+
doneText: getText('confirm'),
|
777
|
+
onPay: function onPay(args) {
|
778
|
+
console.log(args);
|
779
|
+
// 处理支付逻辑
|
780
|
+
setIsKeyboardVisible(false);
|
781
|
+
handleKeyboardConfirm(args.amount);
|
782
|
+
}
|
783
|
+
})),
|
784
|
+
trigger: "click",
|
785
|
+
open: isKeyboardVisible,
|
786
|
+
onOpenChange: setIsKeyboardVisible,
|
787
|
+
placement: "bottom",
|
788
|
+
overlayClassName: "payment-keyboard-popover",
|
789
|
+
arrow: true,
|
790
|
+
destroyTooltipOnHide: true
|
702
791
|
}, /*#__PURE__*/React.createElement(Button, {
|
703
792
|
className: classNames('split-payment-button')
|
704
|
-
}, getText('split.payment') || '拆分支付'))
|
793
|
+
}, getText('split.payment') || '拆分支付')))
|
794
|
+
// <PisellPriceKeyboardPopover
|
795
|
+
// value={(() => {
|
796
|
+
// try {
|
797
|
+
// return new Decimal(currentAmount || '0').toNumber();
|
798
|
+
// } catch {
|
799
|
+
// return 0;
|
800
|
+
// }
|
801
|
+
// })()}
|
802
|
+
// // onChange={handleKeyboardConfirm}
|
803
|
+
// onConfirm={handleKeyboardConfirm}
|
804
|
+
// // onCancel={handleKeyboardCancel}
|
805
|
+
// showCurrencySymbol={true}
|
806
|
+
// useThousandsSeparator={false}
|
807
|
+
// selectType="dark"
|
808
|
+
// overlayClassName="amount-summary-keyboard-popover"
|
809
|
+
// >
|
810
|
+
// {/* 右侧: 拆分支付按钮 */}
|
811
|
+
// <Button className={classNames('split-payment-button')}>
|
812
|
+
// {getText('split.payment') || '拆分支付'}
|
813
|
+
// </Button>
|
814
|
+
// </PisellPriceKeyboardPopover>
|
815
|
+
, /*#__PURE__*/React.createElement(PisellModal, {
|
705
816
|
open: isPaymentDetailOpen,
|
706
817
|
onCancel: handlePaymentDetailClose,
|
707
818
|
footer: null,
|
@@ -476,6 +476,7 @@
|
|
476
476
|
}
|
477
477
|
|
478
478
|
.split-payment-button {
|
479
|
+
width: 80px;
|
479
480
|
padding: 0 8px;
|
480
481
|
background: #079455;
|
481
482
|
color: white;
|
@@ -485,4 +486,16 @@
|
|
485
486
|
white-space: pre-line; // 让换行符(\n)生效
|
486
487
|
text-align: left; // 确保文本居中对齐
|
487
488
|
min-width: 68px;
|
489
|
+
}
|
490
|
+
.cancel-split-payment-button {
|
491
|
+
width: 80px;
|
492
|
+
padding: 0 8px;
|
493
|
+
background: #DF5342;
|
494
|
+
color: white;
|
495
|
+
font-size: 14px;
|
496
|
+
border: 1px solid #C3B2E7;
|
497
|
+
height: 80px;
|
498
|
+
white-space: pre-line; // 让换行符(\n)生效
|
499
|
+
text-align: left; // 确保文本居中对齐
|
500
|
+
min-width: 68px;
|
488
501
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import './index.less';
|
3
2
|
import { CurrentOrderInfo } from '../../types';
|
3
|
+
import './index.less';
|
4
4
|
export interface CashPaymentModuleProps {
|
5
5
|
amountSymbol?: string;
|
6
6
|
orderInfo?: CurrentOrderInfo;
|
@@ -13,8 +13,10 @@ export interface CashPaymentModuleProps {
|
|
13
13
|
roundingDifference: number;
|
14
14
|
}>;
|
15
15
|
balanceDueAmount?: string;
|
16
|
+
syncingLock?: boolean;
|
16
17
|
}
|
17
|
-
export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, //
|
18
|
+
export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表,默认5个推荐金额
|
18
19
|
disabled, // 禁用状态
|
19
|
-
roundingFunction, balanceDueAmount,
|
20
|
+
roundingFunction, balanceDueAmount, // 剩余支付金额
|
21
|
+
syncingLock, }: CashPaymentModuleProps): JSX.Element;
|
20
22
|
export default CashPaymentModule;
|