@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
@@ -0,0 +1,44 @@
|
|
1
|
+
export default {
|
2
|
+
en: {
|
3
|
+
// Discount Keyboard Module
|
4
|
+
'discount-keyboard-price-override': 'Price Override',
|
5
|
+
'discount-keyboard-discount': 'Discount',
|
6
|
+
'discount-keyboard-amount': 'Amount',
|
7
|
+
'discount-keyboard-percentage': 'Percentage',
|
8
|
+
'discount-keyboard-max-discount': 'Max',
|
9
|
+
'discount-keyboard-discount-amount': 'Discount Amount',
|
10
|
+
'discount-keyboard-total': 'Total',
|
11
|
+
'discount-keyboard-payable': 'Payable',
|
12
|
+
'discount-keyboard-reset': 'Reset',
|
13
|
+
'discount-keyboard-done': 'Done',
|
14
|
+
'discount-keyboard-pay': 'Pay'
|
15
|
+
},
|
16
|
+
'zh-CN': {
|
17
|
+
// 折扣键盘模块
|
18
|
+
'discount-keyboard-price-override': '一口价',
|
19
|
+
'discount-keyboard-discount': '折扣',
|
20
|
+
'discount-keyboard-amount': '金额',
|
21
|
+
'discount-keyboard-percentage': '百分比',
|
22
|
+
'discount-keyboard-max-discount': '最高',
|
23
|
+
'discount-keyboard-discount-amount': '折扣金额',
|
24
|
+
'discount-keyboard-total': '待支付金额',
|
25
|
+
'discount-keyboard-payable': '需支付金额',
|
26
|
+
'discount-keyboard-reset': '重置',
|
27
|
+
'discount-keyboard-done': '确认',
|
28
|
+
'discount-keyboard-pay': '支付'
|
29
|
+
},
|
30
|
+
'zh-HK': {
|
31
|
+
// 折扣鍵盤模組
|
32
|
+
'discount-keyboard-price-override': '一口價',
|
33
|
+
'discount-keyboard-discount': '折扣',
|
34
|
+
'discount-keyboard-amount': '金額',
|
35
|
+
'discount-keyboard-percentage': '百分比',
|
36
|
+
'discount-keyboard-max-discount': '最高',
|
37
|
+
'discount-keyboard-discount-amount': '折扣金額',
|
38
|
+
'discount-keyboard-total': '待支付金額',
|
39
|
+
'discount-keyboard-payable': '需支付金額',
|
40
|
+
'discount-keyboard-reset': '重置',
|
41
|
+
'discount-keyboard-done': '確認',
|
42
|
+
'discount-keyboard-pay': '支付'
|
43
|
+
}
|
44
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export interface DiscountKeyboardBaseProps {
|
2
|
+
/** 金额符 */
|
3
|
+
amountSymbol?: string;
|
4
|
+
/** 初始值,多用于展示及计算,不同于原始值 */
|
5
|
+
defaultValue?: string | number;
|
6
|
+
/** 原始值,多用于重置 */
|
7
|
+
originalValue?: string | number;
|
8
|
+
placeholder?: string;
|
9
|
+
doneText?: string;
|
10
|
+
resetText?: string;
|
11
|
+
/** 键盘主题 */
|
12
|
+
selectType?: 'light' | 'dark';
|
13
|
+
onEnter?: (val: string) => void;
|
14
|
+
onReset?: () => void;
|
15
|
+
onChange?: (val: string) => void;
|
16
|
+
enableExceedMaxAmount?: boolean;
|
17
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { PaymentKeyboardBaseProps } from './types';
|
3
|
+
import './index.less';
|
4
|
+
interface PaymentKeyboardProps extends PaymentKeyboardBaseProps {
|
5
|
+
containerProps?: {
|
6
|
+
renderType: 'modal' | 'popover';
|
7
|
+
open: boolean;
|
8
|
+
[key: string]: any;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
export declare const PaymentKeyboard: (props: PaymentKeyboardProps) => JSX.Element | null;
|
12
|
+
export default PaymentKeyboard;
|
@@ -0,0 +1,444 @@
|
|
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); }
|
2
|
+
var _excluded = ["containerProps", "children"],
|
3
|
+
_excluded2 = ["renderType", "open"];
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
6
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
11
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
15
|
+
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; }
|
16
|
+
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; } }
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
18
|
+
import React, { useCallback, useMemo, useState, useId, useEffect } from 'react';
|
19
|
+
import Decimal from 'decimal.js';
|
20
|
+
//@ts-ignore
|
21
|
+
import { locales } from '@pisell/utils';
|
22
|
+
//@ts-ignore
|
23
|
+
import { pick, merge } from 'lodash';
|
24
|
+
import { Segmented, Popover } from 'antd';
|
25
|
+
import { Keyboard, VirtualInput, PisellText, PisellModal } from '@pisell/materials';
|
26
|
+
import useRightItems from "../../hooks/rightItems";
|
27
|
+
import useKeyActions from "../../hooks/keyActions";
|
28
|
+
import { useControllableValue } from 'ahooks';
|
29
|
+
import localeTexts from "./locales";
|
30
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
31
|
+
import { setKeyboardTheme } from "../../utils";
|
32
|
+
import "./index.less";
|
33
|
+
|
34
|
+
// 常量定义
|
35
|
+
var KEYS = {
|
36
|
+
PAYMENT: 'payment',
|
37
|
+
SURCHARGE: 'surcharge',
|
38
|
+
PERCENT: 'percent',
|
39
|
+
FIXED: 'fixed'
|
40
|
+
};
|
41
|
+
var defaultConfig = {
|
42
|
+
payment: {
|
43
|
+
enable: true
|
44
|
+
},
|
45
|
+
surcharge: {
|
46
|
+
enable: true
|
47
|
+
}
|
48
|
+
};
|
49
|
+
var PaymentKeyboardBase = function PaymentKeyboardBase(props) {
|
50
|
+
var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _mergedConfig$surchar2;
|
51
|
+
var context = useEngineContext();
|
52
|
+
var getData = context.appHelper.utils.getData;
|
53
|
+
var amountSymbol = props.amountSymbol || (getData === null || getData === void 0 ? void 0 : getData('shop_symbol')) || '$';
|
54
|
+
locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get('umi_locale')) || 'en');
|
55
|
+
var _props$enableExceedMa = props.enableExceedMaxAmount,
|
56
|
+
enableExceedMaxAmount = _props$enableExceedMa === void 0 ? false : _props$enableExceedMa,
|
57
|
+
paymentOriginalValue = props.paymentOriginalValue,
|
58
|
+
surchargeDefaultValue = props.surchargeDefaultValue,
|
59
|
+
doneText = props.doneText,
|
60
|
+
resetText = props.resetText,
|
61
|
+
onReset = props.onReset,
|
62
|
+
onPay = props.onPay,
|
63
|
+
_props$selectType = props.selectType,
|
64
|
+
selectType = _props$selectType === void 0 ? 'light' : _props$selectType;
|
65
|
+
var uniqueId = useId();
|
66
|
+
var uniqueKeyboardId = "virtual-keyboard-".concat(uniqueId.replace(/:/g, '-'));
|
67
|
+
// 设置主题
|
68
|
+
useEffect(function () {
|
69
|
+
setKeyboardTheme(selectType);
|
70
|
+
}, [selectType]);
|
71
|
+
var _useState = useState(function () {
|
72
|
+
var _props$payment, _props$surcharge;
|
73
|
+
if ((_props$payment = props.payment) !== null && _props$payment !== void 0 && _props$payment.enable) {
|
74
|
+
return KEYS.PAYMENT;
|
75
|
+
}
|
76
|
+
if ((_props$surcharge = props.surcharge) !== null && _props$surcharge !== void 0 && _props$surcharge.enable) {
|
77
|
+
return KEYS.SURCHARGE;
|
78
|
+
}
|
79
|
+
return KEYS.PAYMENT;
|
80
|
+
}),
|
81
|
+
_useState2 = _slicedToArray(_useState, 2),
|
82
|
+
activeKey = _useState2[0],
|
83
|
+
setActiveKey = _useState2[1];
|
84
|
+
var _useState3 = useState(KEYS.PERCENT),
|
85
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
86
|
+
focusedInput = _useState4[0],
|
87
|
+
setFocusedInput = _useState4[1];
|
88
|
+
var _useControllableValue = useControllableValue(props, {
|
89
|
+
defaultValuePropName: 'paymentDefaultValue',
|
90
|
+
valuePropName: 'paymentValue'
|
91
|
+
}),
|
92
|
+
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
93
|
+
internalPaymentValue = _useControllableValue2[0],
|
94
|
+
setInternalPaymentValue = _useControllableValue2[1];
|
95
|
+
var _useControllableValue3 = useControllableValue(props, {
|
96
|
+
defaultValue: surchargeDefaultValue || {
|
97
|
+
percent: '',
|
98
|
+
fixed: ''
|
99
|
+
},
|
100
|
+
valuePropName: 'surchargeValue'
|
101
|
+
}),
|
102
|
+
_useControllableValue4 = _slicedToArray(_useControllableValue3, 2),
|
103
|
+
internalSurchargeValue = _useControllableValue4[0],
|
104
|
+
setInternalSurchargeValue = _useControllableValue4[1];
|
105
|
+
// 记录是否是第一次输入
|
106
|
+
var _useState5 = useState(_defineProperty(_defineProperty(_defineProperty({}, KEYS.PAYMENT, true), KEYS.PERCENT, true), KEYS.FIXED, true)),
|
107
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
108
|
+
firstInputStatus = _useState6[0],
|
109
|
+
setFirstInputStatus = _useState6[1];
|
110
|
+
var _onReset = useCallback(function () {
|
111
|
+
if (activeKey === KEYS.PAYMENT) {
|
112
|
+
setInternalPaymentValue(paymentOriginalValue || '');
|
113
|
+
setFirstInputStatus(function (prev) {
|
114
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, KEYS.PAYMENT, true));
|
115
|
+
});
|
116
|
+
} else if (activeKey === KEYS.SURCHARGE) {
|
117
|
+
if (focusedInput === KEYS.PERCENT) {
|
118
|
+
setInternalSurchargeValue(_objectSpread(_objectSpread({}, internalSurchargeValue || {}), {}, {
|
119
|
+
percent: (surchargeDefaultValue === null || surchargeDefaultValue === void 0 ? void 0 : surchargeDefaultValue.percent) || ''
|
120
|
+
}));
|
121
|
+
setFirstInputStatus(function (prev) {
|
122
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, KEYS.PERCENT, true));
|
123
|
+
});
|
124
|
+
} else {
|
125
|
+
setInternalSurchargeValue(_objectSpread(_objectSpread({}, internalSurchargeValue || {}), {}, {
|
126
|
+
fixed: (surchargeDefaultValue === null || surchargeDefaultValue === void 0 ? void 0 : surchargeDefaultValue.fixed) || ''
|
127
|
+
}));
|
128
|
+
setFirstInputStatus(function (prev) {
|
129
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, KEYS.FIXED, true));
|
130
|
+
});
|
131
|
+
}
|
132
|
+
}
|
133
|
+
onReset === null || onReset === void 0 || onReset();
|
134
|
+
}, [activeKey, onReset, focusedInput, paymentOriginalValue, surchargeDefaultValue]);
|
135
|
+
var currentValue = useMemo(function () {
|
136
|
+
if (activeKey === KEYS.PAYMENT) {
|
137
|
+
return internalPaymentValue;
|
138
|
+
}
|
139
|
+
if (activeKey === KEYS.SURCHARGE) {
|
140
|
+
if (focusedInput === KEYS.FIXED) {
|
141
|
+
return (internalSurchargeValue || {}).fixed || '';
|
142
|
+
}
|
143
|
+
return (internalSurchargeValue || {}).percent || '';
|
144
|
+
}
|
145
|
+
return '';
|
146
|
+
}, [activeKey, focusedInput, internalPaymentValue, internalSurchargeValue]);
|
147
|
+
var _max = useMemo(function () {
|
148
|
+
if (activeKey === KEYS.SURCHARGE && focusedInput === KEYS.PERCENT) {
|
149
|
+
return 100;
|
150
|
+
}
|
151
|
+
return undefined;
|
152
|
+
}, [activeKey, focusedInput]);
|
153
|
+
var _mode = useMemo(function () {
|
154
|
+
if (activeKey === KEYS.PAYMENT) {
|
155
|
+
return firstInputStatus.payment ? 'replace' : 'append';
|
156
|
+
} else {
|
157
|
+
return firstInputStatus[focusedInput] ? 'replace' : 'append';
|
158
|
+
}
|
159
|
+
}, [firstInputStatus, activeKey, focusedInput]);
|
160
|
+
var _useKeyActions = useKeyActions({
|
161
|
+
onEnter: function onEnter() {
|
162
|
+
if (!enableExceedMaxAmount && new Decimal(internalPaymentValue).greaterThan(maxAmount)) {
|
163
|
+
return;
|
164
|
+
}
|
165
|
+
onPay === null || onPay === void 0 || onPay({
|
166
|
+
surcharge: internalSurchargeValue,
|
167
|
+
amount: internalPaymentValue
|
168
|
+
});
|
169
|
+
},
|
170
|
+
onReset: _onReset,
|
171
|
+
onChange: function onChange(v) {
|
172
|
+
if (activeKey === KEYS.PAYMENT) {
|
173
|
+
setInternalPaymentValue(v);
|
174
|
+
setFirstInputStatus(function (prev) {
|
175
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, KEYS.PAYMENT, false));
|
176
|
+
});
|
177
|
+
} else if (activeKey === KEYS.SURCHARGE) {
|
178
|
+
if (focusedInput === KEYS.FIXED) {
|
179
|
+
setInternalSurchargeValue(_objectSpread(_objectSpread({}, internalSurchargeValue || {}), {}, {
|
180
|
+
fixed: v
|
181
|
+
}));
|
182
|
+
setFirstInputStatus(function (prev) {
|
183
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, KEYS.FIXED, false));
|
184
|
+
});
|
185
|
+
} else {
|
186
|
+
setInternalSurchargeValue(_objectSpread(_objectSpread({}, internalSurchargeValue || {}), {}, {
|
187
|
+
percent: v
|
188
|
+
}));
|
189
|
+
setFirstInputStatus(function (prev) {
|
190
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, KEYS.PERCENT, false));
|
191
|
+
});
|
192
|
+
}
|
193
|
+
}
|
194
|
+
},
|
195
|
+
max: _max,
|
196
|
+
value: currentValue,
|
197
|
+
scale: 2,
|
198
|
+
mode: _mode
|
199
|
+
}),
|
200
|
+
handleChange = _useKeyActions.handleChange;
|
201
|
+
var rightItems = useRightItems({
|
202
|
+
rightItemsStyle: {},
|
203
|
+
doneText: doneText || locales.getText('payment-keyboard-pay'),
|
204
|
+
resetText: resetText || locales.getText('payment-keyboard-reset')
|
205
|
+
});
|
206
|
+
var mergedConfig = useMemo(function () {
|
207
|
+
return merge({}, defaultConfig, pick(props, ['payment', 'surcharge']));
|
208
|
+
}, [props]);
|
209
|
+
var options = useMemo(function () {
|
210
|
+
var _mergedConfig$payment, _mergedConfig$surchar;
|
211
|
+
var opts = [];
|
212
|
+
if ((_mergedConfig$payment = mergedConfig.payment) !== null && _mergedConfig$payment !== void 0 && _mergedConfig$payment.enable) {
|
213
|
+
opts.push({
|
214
|
+
label: locales.getText('payment-keyboard-payment'),
|
215
|
+
value: KEYS.PAYMENT
|
216
|
+
});
|
217
|
+
}
|
218
|
+
if ((_mergedConfig$surchar = mergedConfig.surcharge) !== null && _mergedConfig$surchar !== void 0 && _mergedConfig$surchar.enable) {
|
219
|
+
opts.push({
|
220
|
+
label: locales.getText('payment-keyboard-surcharge'),
|
221
|
+
value: KEYS.SURCHARGE
|
222
|
+
});
|
223
|
+
}
|
224
|
+
return opts;
|
225
|
+
}, [mergedConfig]);
|
226
|
+
var amountFormatter = function amountFormatter(amount) {
|
227
|
+
if (amount === '' || amount === undefined) {
|
228
|
+
return '';
|
229
|
+
}
|
230
|
+
return "".concat(amountSymbol).concat(amount);
|
231
|
+
};
|
232
|
+
|
233
|
+
// 最大支付金额 balanceDueAmount
|
234
|
+
var maxAmount = props.paymentOriginalValue || 0;
|
235
|
+
|
236
|
+
// 手续费 根据当前支付金额计算 (输入框内金额)
|
237
|
+
var surchargeFee = useMemo(function () {
|
238
|
+
return new Decimal(internalPaymentValue || 0).mul(new Decimal((internalSurchargeValue === null || internalSurchargeValue === void 0 ? void 0 : internalSurchargeValue.percent) || 0).div(100)).plus(new Decimal((internalSurchargeValue === null || internalSurchargeValue === void 0 ? void 0 : internalSurchargeValue.fixed) || 0)).toNumber();
|
239
|
+
}, [internalPaymentValue, internalSurchargeValue]);
|
240
|
+
|
241
|
+
// 输入框内金额 加上手续费 (应付总额 )
|
242
|
+
var totalAmountDue = useMemo(function () {
|
243
|
+
return new Decimal(internalPaymentValue || 0).plus(new Decimal(surchargeFee || 0)).toNumber();
|
244
|
+
}, [internalPaymentValue, surchargeFee]);
|
245
|
+
|
246
|
+
// 最大支付金额 减去 输入框内金额 (剩余待支付)
|
247
|
+
var remainingAmount = useMemo(function () {
|
248
|
+
return new Decimal(maxAmount || 0).minus(new Decimal(internalPaymentValue || 0)).toNumber();
|
249
|
+
}, [maxAmount, internalPaymentValue]);
|
250
|
+
var renderBottomContent = function renderBottomContent() {
|
251
|
+
if (enableExceedMaxAmount) {
|
252
|
+
// remainingAmount 为负值了,说明输入的金额大于应付金额,找零
|
253
|
+
if (new Decimal(remainingAmount).lessThan(0)) {
|
254
|
+
return /*#__PURE__*/React.createElement("div", {
|
255
|
+
className: "pisell-pro-price-keyboard-input-tip ellipsis"
|
256
|
+
}, locales.getText('payment-keyboard-change-due'), ":", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
257
|
+
hideDecimalForWholeNumbers: false,
|
258
|
+
precision: 2,
|
259
|
+
value: Math.abs(remainingAmount)
|
260
|
+
}));
|
261
|
+
} else {
|
262
|
+
return /*#__PURE__*/React.createElement("div", {
|
263
|
+
className: "pisell-pro-price-keyboard-input-tip ellipsis"
|
264
|
+
}, locales.getText('payment-keyboard-remaining'), ":", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
265
|
+
hideDecimalForWholeNumbers: false,
|
266
|
+
precision: 2,
|
267
|
+
value: remainingAmount
|
268
|
+
}));
|
269
|
+
}
|
270
|
+
} else {
|
271
|
+
return (
|
272
|
+
/*#__PURE__*/
|
273
|
+
// 不允许输入金额超过最大金额
|
274
|
+
React.createElement("div", {
|
275
|
+
className: "pisell-pro-price-keyboard-input-tip"
|
276
|
+
}, /*#__PURE__*/React.createElement("span", {
|
277
|
+
style: {
|
278
|
+
color: remainingAmount < 0 ? '#F04438' : '#475467'
|
279
|
+
}
|
280
|
+
}, locales.getText('payment-keyboard-max'), ":", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
281
|
+
hideDecimalForWholeNumbers: false,
|
282
|
+
precision: 2,
|
283
|
+
value: maxAmount
|
284
|
+
})), ' ', "( ", locales.getText('payment-keyboard-remaining'), ":", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
285
|
+
hideDecimalForWholeNumbers: false,
|
286
|
+
precision: 2,
|
287
|
+
value: Math.max(remainingAmount, 0)
|
288
|
+
}), ' ', ")")
|
289
|
+
);
|
290
|
+
}
|
291
|
+
};
|
292
|
+
var renderPaymentDisplay = function renderPaymentDisplay() {
|
293
|
+
return /*#__PURE__*/React.createElement(VirtualInput, {
|
294
|
+
focused: true,
|
295
|
+
value: amountFormatter(internalPaymentValue),
|
296
|
+
wrapperStyle: {
|
297
|
+
width: '100%',
|
298
|
+
backgroundColor: '#ffffff',
|
299
|
+
borderRadius: 8,
|
300
|
+
padding: 16
|
301
|
+
},
|
302
|
+
bottomContent: renderBottomContent(),
|
303
|
+
preventBlurElements: [uniqueKeyboardId]
|
304
|
+
});
|
305
|
+
};
|
306
|
+
var renderSurchargeDisplay = function renderSurchargeDisplay() {
|
307
|
+
var _internalSurchargeVal;
|
308
|
+
return /*#__PURE__*/React.createElement("div", {
|
309
|
+
style: {
|
310
|
+
display: 'grid',
|
311
|
+
gridTemplateColumns: '1fr auto 1fr',
|
312
|
+
gap: 8,
|
313
|
+
alignItems: 'center'
|
314
|
+
}
|
315
|
+
}, /*#__PURE__*/React.createElement(VirtualInput, {
|
316
|
+
focused: focusedInput !== KEYS.FIXED,
|
317
|
+
value: internalSurchargeValue !== null && internalSurchargeValue !== void 0 && internalSurchargeValue.percent ? "".concat(internalSurchargeValue === null || internalSurchargeValue === void 0 ? void 0 : internalSurchargeValue.percent, "%") : '',
|
318
|
+
wrapperStyle: {
|
319
|
+
backgroundColor: '#ffffff',
|
320
|
+
borderRadius: 8,
|
321
|
+
padding: 20
|
322
|
+
},
|
323
|
+
placeholder: locales.getText('payment-keyboard-percent'),
|
324
|
+
style: {
|
325
|
+
justifyContent: 'center'
|
326
|
+
},
|
327
|
+
onFocus: function onFocus() {
|
328
|
+
return setFocusedInput(KEYS.PERCENT);
|
329
|
+
},
|
330
|
+
preventBlurElements: [uniqueKeyboardId]
|
331
|
+
}), /*#__PURE__*/React.createElement("div", {
|
332
|
+
style: {
|
333
|
+
color: '#667085',
|
334
|
+
fontSize: 36,
|
335
|
+
fontWeight: 600
|
336
|
+
}
|
337
|
+
}, "+"), /*#__PURE__*/React.createElement(VirtualInput, {
|
338
|
+
focused: focusedInput === KEYS.FIXED,
|
339
|
+
value: amountFormatter((_internalSurchargeVal = internalSurchargeValue === null || internalSurchargeValue === void 0 ? void 0 : internalSurchargeValue.fixed) !== null && _internalSurchargeVal !== void 0 ? _internalSurchargeVal : ''),
|
340
|
+
wrapperStyle: {
|
341
|
+
backgroundColor: '#ffffff',
|
342
|
+
borderRadius: 8,
|
343
|
+
padding: 20
|
344
|
+
},
|
345
|
+
placeholder: locales.getText('payment-keyboard-fixed'),
|
346
|
+
style: {
|
347
|
+
justifyContent: 'center'
|
348
|
+
},
|
349
|
+
onFocus: function onFocus() {
|
350
|
+
return setFocusedInput(KEYS.FIXED);
|
351
|
+
},
|
352
|
+
preventBlurElements: [uniqueKeyboardId]
|
353
|
+
}));
|
354
|
+
};
|
355
|
+
var customDisplay = function customDisplay() {
|
356
|
+
if (activeKey === KEYS.PAYMENT) {
|
357
|
+
return renderPaymentDisplay();
|
358
|
+
}
|
359
|
+
if (activeKey === KEYS.SURCHARGE) {
|
360
|
+
return renderSurchargeDisplay();
|
361
|
+
}
|
362
|
+
return null;
|
363
|
+
};
|
364
|
+
return /*#__PURE__*/React.createElement("div", {
|
365
|
+
className: "pisell-pro-price-keyboard-payment-container"
|
366
|
+
}, (options === null || options === void 0 ? void 0 : options.length) > 1 ? /*#__PURE__*/React.createElement(Segmented, {
|
367
|
+
size: "large",
|
368
|
+
style: {
|
369
|
+
padding: 6
|
370
|
+
},
|
371
|
+
block: true,
|
372
|
+
options: options,
|
373
|
+
value: activeKey,
|
374
|
+
onChange: function onChange(value) {
|
375
|
+
return setActiveKey(value.toString());
|
376
|
+
}
|
377
|
+
}) : null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
378
|
+
className: "pisell-pro-price-keyboard-title ellipsis"
|
379
|
+
}, locales.getText('payment-keyboard-total-amount-due'), ":", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
380
|
+
hideDecimalForWholeNumbers: false,
|
381
|
+
precision: 2,
|
382
|
+
value: totalAmountDue
|
383
|
+
})), (_mergedConfig$surchar2 = mergedConfig.surcharge) !== null && _mergedConfig$surchar2 !== void 0 && _mergedConfig$surchar2.enable ? /*#__PURE__*/React.createElement("div", {
|
384
|
+
className: "pisell-pro-price-keyboard-subtitle ellipsis"
|
385
|
+
}, locales.getText('payment-keyboard-inc-surcharge'), ":", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
386
|
+
hideDecimalForWholeNumbers: false,
|
387
|
+
precision: 2,
|
388
|
+
value: surchargeFee
|
389
|
+
}), ' ', "(", (internalSurchargeValue === null || internalSurchargeValue === void 0 ? void 0 : internalSurchargeValue.percent) || '0', "% +", ' ', /*#__PURE__*/React.createElement(PisellText.Amount, {
|
390
|
+
hideDecimalForWholeNumbers: false,
|
391
|
+
precision: 2,
|
392
|
+
value: (internalSurchargeValue === null || internalSurchargeValue === void 0 ? void 0 : internalSurchargeValue.fixed) || 0
|
393
|
+
}), ")") : null), /*#__PURE__*/React.createElement("div", {
|
394
|
+
className: "pisell-pro-price-keyboard-payment"
|
395
|
+
}, activeKey && customDisplay(), /*#__PURE__*/React.createElement(Keyboard, {
|
396
|
+
rightItems: rightItems,
|
397
|
+
onChange: handleChange,
|
398
|
+
id: uniqueKeyboardId
|
399
|
+
})));
|
400
|
+
};
|
401
|
+
export var PaymentKeyboard = function PaymentKeyboard(props) {
|
402
|
+
var containerProps = props.containerProps,
|
403
|
+
children = props.children,
|
404
|
+
keyboardProps = _objectWithoutProperties(props, _excluded);
|
405
|
+
var _ref = containerProps || {},
|
406
|
+
renderType = _ref.renderType,
|
407
|
+
open = _ref.open,
|
408
|
+
restProps = _objectWithoutProperties(_ref, _excluded2);
|
409
|
+
if (!containerProps) {
|
410
|
+
return /*#__PURE__*/React.createElement(PaymentKeyboardBase, keyboardProps);
|
411
|
+
}
|
412
|
+
|
413
|
+
// 暂时只支持受控模式
|
414
|
+
if (renderType === 'popover') {
|
415
|
+
return /*#__PURE__*/React.createElement(Popover, _extends({
|
416
|
+
key: "".concat(open),
|
417
|
+
open: open,
|
418
|
+
trigger: "click",
|
419
|
+
className: "pisell-payment-keyboard-container pisell-payment-keyboard-popover"
|
420
|
+
}, restProps, {
|
421
|
+
content: /*#__PURE__*/React.createElement(PaymentKeyboardBase, keyboardProps)
|
422
|
+
}), children);
|
423
|
+
}
|
424
|
+
if (renderType === 'modal') {
|
425
|
+
return open ? /*#__PURE__*/React.createElement(PisellModal, _extends({
|
426
|
+
platform: 'pc',
|
427
|
+
open: true,
|
428
|
+
width: "unset",
|
429
|
+
header: null,
|
430
|
+
footer: false,
|
431
|
+
mask: false,
|
432
|
+
maskClosable: true,
|
433
|
+
bodyStyle: {
|
434
|
+
padding: '0px',
|
435
|
+
backgroundColor: 'transparent'
|
436
|
+
},
|
437
|
+
closeIcon: null,
|
438
|
+
className: "pisell-payment-keyboard-container pisell-payment-keyboard-modal",
|
439
|
+
destroyOnHidden: true
|
440
|
+
}, restProps), /*#__PURE__*/React.createElement(PaymentKeyboardBase, keyboardProps)) : null;
|
441
|
+
}
|
442
|
+
return /*#__PURE__*/React.createElement(PaymentKeyboardBase, keyboardProps);
|
443
|
+
};
|
444
|
+
export default PaymentKeyboard;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
.pisell-pro-price-keyboard-payment-container {
|
2
|
+
width: 380px;
|
3
|
+
padding: 10px;
|
4
|
+
border-radius: 10px;
|
5
|
+
display: flex;
|
6
|
+
flex-direction: column;
|
7
|
+
gap: 10px;
|
8
|
+
background-color: var(--pisell-pro-price-keyboard-wrapper-bg-color, #ffffff);
|
9
|
+
|
10
|
+
.ellipsis {
|
11
|
+
overflow: hidden;
|
12
|
+
text-overflow: ellipsis;
|
13
|
+
white-space: nowrap;
|
14
|
+
}
|
15
|
+
|
16
|
+
// 复写Segmented样式
|
17
|
+
.pisell-lowcode-segmented {
|
18
|
+
background-color: var(
|
19
|
+
--pisell-pro-price-keyboard-bg-color-gray-200,
|
20
|
+
#eaecf0
|
21
|
+
);
|
22
|
+
color: var(--pisell-pro-price-keyboard-text-gray-500, #667085);
|
23
|
+
}
|
24
|
+
|
25
|
+
.pisell-pro-price-keyboard-title {
|
26
|
+
font-size: 20px;
|
27
|
+
font-weight: 600;
|
28
|
+
color: var(--pisell-pro-price-keyboard-text-gray-900, #101828);
|
29
|
+
}
|
30
|
+
.pisell-pro-price-keyboard-subtitle {
|
31
|
+
font-size: 16px;
|
32
|
+
font-weight: 400;
|
33
|
+
color: var(--pisell-pro-price-keyboard-text-gray-500, #667085);
|
34
|
+
}
|
35
|
+
|
36
|
+
.pisell-pro-price-keyboard-input-tip {
|
37
|
+
color: #475467;
|
38
|
+
font-size: 14px;
|
39
|
+
font-weight: 400;
|
40
|
+
}
|
41
|
+
|
42
|
+
.pisell-pro-price-keyboard-payment {
|
43
|
+
width: 100%;
|
44
|
+
padding: 10px;
|
45
|
+
border-radius: 10px;
|
46
|
+
display: flex;
|
47
|
+
flex-direction: column;
|
48
|
+
gap: 8px;
|
49
|
+
background-color: var(
|
50
|
+
--pisell-pro-price-keyboard-bg-color-gray-300,
|
51
|
+
#d0d5dd
|
52
|
+
);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
.pisell-payment-keyboard-modal {
|
57
|
+
.pisell-lowcode-modal-content {
|
58
|
+
background-color: transparent;
|
59
|
+
}
|
60
|
+
|
61
|
+
.pisell-lowcode-modal-close {
|
62
|
+
display: none;
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
en: {
|
3
|
+
'payment-keyboard-payment': string;
|
4
|
+
'payment-keyboard-surcharge': string;
|
5
|
+
'payment-keyboard-percent': string;
|
6
|
+
'payment-keyboard-fixed': string;
|
7
|
+
'payment-keyboard-max': string;
|
8
|
+
'payment-keyboard-remaining': string;
|
9
|
+
'payment-keyboard-change-due': string;
|
10
|
+
'payment-keyboard-total-amount-due': string;
|
11
|
+
'payment-keyboard-inc-surcharge': string;
|
12
|
+
'payment-keyboard-reset': string;
|
13
|
+
'payment-keyboard-done': string;
|
14
|
+
'payment-keyboard-pay': string;
|
15
|
+
};
|
16
|
+
'zh-CN': {
|
17
|
+
'payment-keyboard-payment': string;
|
18
|
+
'payment-keyboard-surcharge': string;
|
19
|
+
'payment-keyboard-percent': string;
|
20
|
+
'payment-keyboard-change-due': string;
|
21
|
+
'payment-keyboard-fixed': string;
|
22
|
+
'payment-keyboard-max': string;
|
23
|
+
'payment-keyboard-remaining': string;
|
24
|
+
'payment-keyboard-total-amount-due': string;
|
25
|
+
'payment-keyboard-inc-surcharge': string;
|
26
|
+
'payment-keyboard-reset': string;
|
27
|
+
'payment-keyboard-done': string;
|
28
|
+
'payment-keyboard-pay': string;
|
29
|
+
};
|
30
|
+
'zh-HK': {
|
31
|
+
'payment-keyboard-payment': string;
|
32
|
+
'payment-keyboard-surcharge': string;
|
33
|
+
'payment-keyboard-percent': string;
|
34
|
+
'payment-keyboard-fixed': string;
|
35
|
+
'payment-keyboard-max': string;
|
36
|
+
'payment-keyboard-remaining': string;
|
37
|
+
'payment-keyboard-change-due': string;
|
38
|
+
'payment-keyboard-total-amount-due': string;
|
39
|
+
'payment-keyboard-inc-surcharge': string;
|
40
|
+
'payment-keyboard-reset': string;
|
41
|
+
'payment-keyboard-done': string;
|
42
|
+
'payment-keyboard-pay': string;
|
43
|
+
};
|
44
|
+
};
|
45
|
+
export default _default;
|