@pisell/private-materials 6.6.60 → 6.6.61
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 +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/components/footer/amount.js +3 -4
- package/es/components/booking/components/footer/utils.js +82 -85
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/dashboard/index.d.ts +5 -0
- package/es/components/booking/dashboard/index.js +9 -6
- package/es/components/booking/info/service2/Group/utils.js +30 -1
- package/es/components/booking/info2/service/editService/index.js +6 -49
- package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/es/components/booking/info2/service/editService/utils.js +0 -16
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +23 -15
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
- package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/es/components/pisellCashCounting/hooks.d.ts +21 -0
- package/es/components/pisellCashCounting/hooks.js +193 -0
- package/es/components/pisellCashCounting/index.d.ts +2 -0
- package/es/components/pisellCashCounting/index.js +1 -0
- package/es/components/pisellCashCounting/locales.d.ts +118 -0
- package/es/components/pisellCashCounting/locales.js +117 -0
- package/es/components/pisellCashCounting/types.d.ts +85 -0
- package/es/components/pisellCashCounting/types.js +1 -0
- package/es/components/pisellCashCounting/utils.d.ts +10 -0
- package/es/components/pisellCashCounting/utils.js +40 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +2 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +156 -37
- package/es/components/ticketBooking/index.js +7 -1
- package/es/hooks/useResponsive.d.ts +8 -0
- package/es/hooks/useResponsive.js +43 -0
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/es/pro/NumericStepper/index.d.ts +75 -0
- package/es/pro/NumericStepper/index.js +301 -0
- package/es/pro/NumericStepper/index.less +364 -0
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +38 -0
- package/es/pro/keyboards/locales.js +57 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +523 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +11 -15
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/dashboard/index.d.ts +5 -0
- package/lib/components/booking/dashboard/index.js +6 -5
- package/lib/components/booking/info/service2/Group/utils.js +42 -3
- package/lib/components/booking/info2/service/editService/index.js +5 -39
- package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/lib/components/booking/info2/service/editService/utils.js +0 -16
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +23 -16
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
- package/lib/components/pisellCashCounting/hooks.js +189 -0
- package/lib/components/pisellCashCounting/index.d.ts +2 -0
- package/lib/components/pisellCashCounting/index.js +35 -0
- package/lib/components/pisellCashCounting/locales.d.ts +118 -0
- package/lib/components/pisellCashCounting/locales.js +141 -0
- package/lib/components/pisellCashCounting/types.d.ts +85 -0
- package/lib/components/pisellCashCounting/types.js +17 -0
- package/lib/components/pisellCashCounting/utils.d.ts +10 -0
- package/lib/components/pisellCashCounting/utils.js +59 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +3 -2
- package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/index.js +10 -3
- package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +10 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +114 -14
- package/lib/components/ticketBooking/index.js +11 -1
- package/lib/hooks/useResponsive.d.ts +8 -0
- package/lib/hooks/useResponsive.js +48 -0
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/lib/pro/NumericStepper/index.d.ts +75 -0
- package/lib/pro/NumericStepper/index.js +338 -0
- package/lib/pro/NumericStepper/index.less +364 -0
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +38 -0
- package/lib/pro/keyboards/locales.js +61 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lowcode/pisell-cash-counting/meta.ts +167 -0
- package/lowcode/pisell-cash-counting/snippets.ts +13 -0
- package/package.json +4 -4
|
@@ -0,0 +1,193 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { message } from 'antd';
|
|
15
|
+
import { locales } from '@pisell/utils';
|
|
16
|
+
import { buildEmptyQuantities, getEffectiveDenominationsForCurrency } from "./utils";
|
|
17
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
18
|
+
export function usePisellCashCounting(_ref) {
|
|
19
|
+
var _context$appHelper, _store$getState2, _currencyDenomination3;
|
|
20
|
+
var value = _ref.value,
|
|
21
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
22
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
23
|
+
currencyCode = _ref.currencyCode,
|
|
24
|
+
currencySymbol = _ref.currencySymbol,
|
|
25
|
+
amountPrecision = _ref.amountPrecision,
|
|
26
|
+
_ref$denominations = _ref.denominations,
|
|
27
|
+
denominations = _ref$denominations === void 0 ? [] : _ref$denominations,
|
|
28
|
+
_ref$disabled = _ref.disabled,
|
|
29
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
30
|
+
_ref$countDisabled = _ref.countDisabled,
|
|
31
|
+
countDisabled = _ref$countDisabled === void 0 ? false : _ref$countDisabled,
|
|
32
|
+
onChange = _ref.onChange,
|
|
33
|
+
onCountConfirm = _ref.onCountConfirm,
|
|
34
|
+
onCountCancel = _ref.onCountCancel;
|
|
35
|
+
var context = useEngineContext();
|
|
36
|
+
var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
37
|
+
store = _ref2.store;
|
|
38
|
+
var modalRef = useRef(null);
|
|
39
|
+
var triggerRef = useRef(null);
|
|
40
|
+
var _useState = useState(false),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
keyboardOpen = _useState2[0],
|
|
43
|
+
setKeyboardOpen = _useState2[1];
|
|
44
|
+
var _useState3 = useState(defaultValue),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
internalValue = _useState4[0],
|
|
47
|
+
setInternalValue = _useState4[1];
|
|
48
|
+
var _useState5 = useState({}),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
confirmedQuantities = _useState6[0],
|
|
51
|
+
setConfirmedQuantities = _useState6[1];
|
|
52
|
+
// 数钱结果
|
|
53
|
+
var countedResultRef = useRef(null);
|
|
54
|
+
// 手动输入金额
|
|
55
|
+
var manualInputValueRef = useRef(null);
|
|
56
|
+
// 手动输入金额与数钱总额不一致时弹窗
|
|
57
|
+
var _useState7 = useState(false),
|
|
58
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
59
|
+
manualCountMismatchOpen = _useState8[0],
|
|
60
|
+
setManualCountMismatchOpen = _useState8[1];
|
|
61
|
+
var globalConfig = useMemo(function () {
|
|
62
|
+
var _store$getState;
|
|
63
|
+
var global = (store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 || (_store$getState = _store$getState.call(store)) === null || _store$getState === void 0 ? void 0 : _store$getState.global) || {};
|
|
64
|
+
return {
|
|
65
|
+
symbol: (global === null || global === void 0 ? void 0 : global.symbol) || '$',
|
|
66
|
+
currency_code: (global === null || global === void 0 ? void 0 : global.currency_code) || 'AUD'
|
|
67
|
+
};
|
|
68
|
+
}, [store === null || store === void 0 || (_store$getState2 = store.getState) === null || _store$getState2 === void 0 || (_store$getState2 = _store$getState2.call(store)) === null || _store$getState2 === void 0 ? void 0 : _store$getState2.global]);
|
|
69
|
+
var _currencyCode = useMemo(function () {
|
|
70
|
+
return currencyCode || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.currency_code);
|
|
71
|
+
}, [currencyCode, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.currency_code]);
|
|
72
|
+
var currencyDenominations = useMemo(function () {
|
|
73
|
+
return getEffectiveDenominationsForCurrency(denominations, _currencyCode);
|
|
74
|
+
}, [_currencyCode, denominations]);
|
|
75
|
+
var decimalPlaces = useMemo(function () {
|
|
76
|
+
var _currencyDenomination, _currencyDenomination2;
|
|
77
|
+
if (typeof amountPrecision === 'number') {
|
|
78
|
+
return amountPrecision;
|
|
79
|
+
}
|
|
80
|
+
return (_currencyDenomination = (_currencyDenomination2 = currencyDenominations[0]) === null || _currencyDenomination2 === void 0 ? void 0 : _currencyDenomination2.decimal_places) !== null && _currencyDenomination !== void 0 ? _currencyDenomination : 2;
|
|
81
|
+
}, [amountPrecision, (_currencyDenomination3 = currencyDenominations[0]) === null || _currencyDenomination3 === void 0 ? void 0 : _currencyDenomination3.decimal_places]);
|
|
82
|
+
var symbolValue = useMemo(function () {
|
|
83
|
+
if (currencySymbol) {
|
|
84
|
+
return currencySymbol;
|
|
85
|
+
}
|
|
86
|
+
return globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.symbol;
|
|
87
|
+
}, [currencySymbol, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.symbol]);
|
|
88
|
+
var currentValue = useMemo(function () {
|
|
89
|
+
return String(value !== null && value !== void 0 ? value : internalValue);
|
|
90
|
+
}, [value, internalValue]);
|
|
91
|
+
var updateAmount = useCallback(function (nextValue, source) {
|
|
92
|
+
if (value === undefined) {
|
|
93
|
+
setInternalValue(nextValue);
|
|
94
|
+
}
|
|
95
|
+
if (typeof onChange === 'function') {
|
|
96
|
+
onChange(nextValue, {
|
|
97
|
+
source: source
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [decimalPlaces, onChange, value]);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @description: 价格键盘输入
|
|
104
|
+
* @return {*}
|
|
105
|
+
*/
|
|
106
|
+
var handleAmountChange = useCallback(function (nextValue) {
|
|
107
|
+
manualInputValueRef.current = nextValue;
|
|
108
|
+
updateAmount(String(nextValue), 'manual');
|
|
109
|
+
}, [updateAmount]);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @description: 价格键盘关闭
|
|
113
|
+
* @return {*}
|
|
114
|
+
*/
|
|
115
|
+
var handleKeyboardClose = useCallback(function () {
|
|
116
|
+
var _countedResultRef$cur;
|
|
117
|
+
setKeyboardOpen(false);
|
|
118
|
+
// 手动输入金额与数钱总额不一致时弹窗
|
|
119
|
+
if ((_countedResultRef$cur = countedResultRef.current) !== null && _countedResultRef$cur !== void 0 && _countedResultRef$cur.amount && Number(countedResultRef.current.amount) !== Number(manualInputValueRef.current)) {
|
|
120
|
+
setManualCountMismatchOpen(true);
|
|
121
|
+
}
|
|
122
|
+
}, [setManualCountMismatchOpen]);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @description: 使用数钱金额
|
|
126
|
+
* @param {*} useCallback
|
|
127
|
+
* @return {*}
|
|
128
|
+
*/
|
|
129
|
+
var confirmUseCountedTotal = useCallback(function () {
|
|
130
|
+
var _countedResultRef$cur2, _countedResultRef$cur3;
|
|
131
|
+
updateAmount((_countedResultRef$cur2 = (_countedResultRef$cur3 = countedResultRef.current) === null || _countedResultRef$cur3 === void 0 ? void 0 : _countedResultRef$cur3.amount) !== null && _countedResultRef$cur2 !== void 0 ? _countedResultRef$cur2 : '', 'count');
|
|
132
|
+
setManualCountMismatchOpen(false);
|
|
133
|
+
}, [updateAmount]);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @description: 保留手动金额
|
|
137
|
+
* @param {*} useCallback
|
|
138
|
+
* @return {*}
|
|
139
|
+
*/
|
|
140
|
+
var confirmKeepManualAmount = useCallback(function () {
|
|
141
|
+
var _manualInputValueRef$;
|
|
142
|
+
// 保留手动金额时清空数钱结果与面额数量,避免再次打开数钱仍带回旧数据
|
|
143
|
+
countedResultRef.current = null;
|
|
144
|
+
setConfirmedQuantities({});
|
|
145
|
+
updateAmount((_manualInputValueRef$ = manualInputValueRef.current) !== null && _manualInputValueRef$ !== void 0 ? _manualInputValueRef$ : '', 'manual');
|
|
146
|
+
setManualCountMismatchOpen(false);
|
|
147
|
+
}, [updateAmount]);
|
|
148
|
+
var openCountModal = useCallback(function () {
|
|
149
|
+
var _modalRef$current;
|
|
150
|
+
if (disabled || countDisabled) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (currencyDenominations.length === 0) {
|
|
154
|
+
message.warning(locales.getText('pisell-cash-counting.no-country-config'));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
var initialQuantities = _objectSpread(_objectSpread({}, buildEmptyQuantities(currencyDenominations)), confirmedQuantities);
|
|
158
|
+
setKeyboardOpen(false);
|
|
159
|
+
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 || _modalRef$current.open({
|
|
160
|
+
initialQuantities: initialQuantities
|
|
161
|
+
});
|
|
162
|
+
}, [confirmedQuantities, countDisabled, currencyDenominations, disabled]);
|
|
163
|
+
var handleCountCancel = useCallback(function () {
|
|
164
|
+
onCountCancel === null || onCountCancel === void 0 || onCountCancel();
|
|
165
|
+
}, [onCountCancel]);
|
|
166
|
+
var handleCountConfirm = useCallback(function (payload) {
|
|
167
|
+
countedResultRef.current = payload;
|
|
168
|
+
setConfirmedQuantities(payload.quantities);
|
|
169
|
+
updateAmount(payload.amount, 'count');
|
|
170
|
+
if (typeof onCountConfirm === 'function') {
|
|
171
|
+
onCountConfirm(payload);
|
|
172
|
+
}
|
|
173
|
+
}, [onCountConfirm, updateAmount]);
|
|
174
|
+
return {
|
|
175
|
+
modalRef: modalRef,
|
|
176
|
+
triggerRef: triggerRef,
|
|
177
|
+
keyboardOpen: keyboardOpen,
|
|
178
|
+
setKeyboardOpen: setKeyboardOpen,
|
|
179
|
+
currencyDenominations: currencyDenominations,
|
|
180
|
+
decimalPlaces: decimalPlaces,
|
|
181
|
+
symbol: symbolValue,
|
|
182
|
+
currencyCode: _currencyCode,
|
|
183
|
+
currentValue: currentValue,
|
|
184
|
+
handleAmountChange: handleAmountChange,
|
|
185
|
+
handleKeyboardClose: handleKeyboardClose,
|
|
186
|
+
openCountModal: openCountModal,
|
|
187
|
+
handleCountCancel: handleCountCancel,
|
|
188
|
+
handleCountConfirm: handleCountConfirm,
|
|
189
|
+
manualCountMismatchOpen: manualCountMismatchOpen,
|
|
190
|
+
confirmUseCountedTotal: confirmUseCountedTotal,
|
|
191
|
+
confirmKeepManualAmount: confirmKeepManualAmount
|
|
192
|
+
};
|
|
193
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./PisellCashCounting";
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
en: {
|
|
3
|
+
'pisell-cash-counting.countCash': string;
|
|
4
|
+
'pisell-cash-counting.subtitle': string;
|
|
5
|
+
'pisell-cash-counting.currency': string;
|
|
6
|
+
'pisell-cash-counting.bills': string;
|
|
7
|
+
'pisell-cash-counting.coins': string;
|
|
8
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
9
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
10
|
+
'pisell-cash-counting.subtotal': string;
|
|
11
|
+
'pisell-cash-counting.total': string;
|
|
12
|
+
'pisell-cash-counting.clearAll': string;
|
|
13
|
+
'pisell-cash-counting.cancel': string;
|
|
14
|
+
'pisell-cash-counting.confirm': string;
|
|
15
|
+
'pisell-cash-counting.placeholder': string;
|
|
16
|
+
'pisell-cash-counting.empty': string;
|
|
17
|
+
'pisell-cash-counting.no-country-config': string;
|
|
18
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
19
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
20
|
+
'pisell-cash-counting.use-count-total': string;
|
|
21
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
22
|
+
'pisell2.customise-item.save': string;
|
|
23
|
+
'pisell2.booking.info.text.clear': string;
|
|
24
|
+
};
|
|
25
|
+
'zh-CN': {
|
|
26
|
+
'pisell-cash-counting.countCash': string;
|
|
27
|
+
'pisell-cash-counting.subtitle': string;
|
|
28
|
+
'pisell-cash-counting.currency': string;
|
|
29
|
+
'pisell-cash-counting.bills': string;
|
|
30
|
+
'pisell-cash-counting.coins': string;
|
|
31
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
32
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
33
|
+
'pisell-cash-counting.subtotal': string;
|
|
34
|
+
'pisell-cash-counting.total': string;
|
|
35
|
+
'pisell-cash-counting.clearAll': string;
|
|
36
|
+
'pisell-cash-counting.cancel': string;
|
|
37
|
+
'pisell-cash-counting.confirm': string;
|
|
38
|
+
'pisell-cash-counting.placeholder': string;
|
|
39
|
+
'pisell-cash-counting.empty': string;
|
|
40
|
+
'pisell-cash-counting.no-country-config': string;
|
|
41
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
42
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
43
|
+
'pisell-cash-counting.use-count-total': string;
|
|
44
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
45
|
+
'pisell2.customise-item.save': string;
|
|
46
|
+
'pisell2.booking.info.text.clear': string;
|
|
47
|
+
};
|
|
48
|
+
'zh-HK': {
|
|
49
|
+
'pisell-cash-counting.countCash': string;
|
|
50
|
+
'pisell-cash-counting.subtitle': string;
|
|
51
|
+
'pisell-cash-counting.currency': string;
|
|
52
|
+
'pisell-cash-counting.bills': string;
|
|
53
|
+
'pisell-cash-counting.coins': string;
|
|
54
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
55
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
56
|
+
'pisell-cash-counting.subtotal': string;
|
|
57
|
+
'pisell-cash-counting.total': string;
|
|
58
|
+
'pisell-cash-counting.clearAll': string;
|
|
59
|
+
'pisell-cash-counting.cancel': string;
|
|
60
|
+
'pisell-cash-counting.confirm': string;
|
|
61
|
+
'pisell-cash-counting.placeholder': string;
|
|
62
|
+
'pisell-cash-counting.empty': string;
|
|
63
|
+
'pisell-cash-counting.no-country-config': string;
|
|
64
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
65
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
66
|
+
'pisell-cash-counting.use-count-total': string;
|
|
67
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
68
|
+
'pisell2.customise-item.save': string;
|
|
69
|
+
'pisell2.booking.info.text.clear': string;
|
|
70
|
+
};
|
|
71
|
+
ja: {
|
|
72
|
+
'pisell-cash-counting.countCash': string;
|
|
73
|
+
'pisell-cash-counting.subtitle': string;
|
|
74
|
+
'pisell-cash-counting.currency': string;
|
|
75
|
+
'pisell-cash-counting.bills': string;
|
|
76
|
+
'pisell-cash-counting.coins': string;
|
|
77
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
78
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
79
|
+
'pisell-cash-counting.subtotal': string;
|
|
80
|
+
'pisell-cash-counting.total': string;
|
|
81
|
+
'pisell-cash-counting.clearAll': string;
|
|
82
|
+
'pisell-cash-counting.cancel': string;
|
|
83
|
+
'pisell-cash-counting.confirm': string;
|
|
84
|
+
'pisell-cash-counting.placeholder': string;
|
|
85
|
+
'pisell-cash-counting.empty': string;
|
|
86
|
+
'pisell-cash-counting.no-country-config': string;
|
|
87
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
88
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
89
|
+
'pisell-cash-counting.use-count-total': string;
|
|
90
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
91
|
+
'pisell2.customise-item.save': string;
|
|
92
|
+
'pisell2.booking.info.text.clear': string;
|
|
93
|
+
};
|
|
94
|
+
pt: {
|
|
95
|
+
'pisell-cash-counting.countCash': string;
|
|
96
|
+
'pisell-cash-counting.subtitle': string;
|
|
97
|
+
'pisell-cash-counting.currency': string;
|
|
98
|
+
'pisell-cash-counting.bills': string;
|
|
99
|
+
'pisell-cash-counting.coins': string;
|
|
100
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
101
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
102
|
+
'pisell-cash-counting.subtotal': string;
|
|
103
|
+
'pisell-cash-counting.total': string;
|
|
104
|
+
'pisell-cash-counting.clearAll': string;
|
|
105
|
+
'pisell-cash-counting.cancel': string;
|
|
106
|
+
'pisell-cash-counting.confirm': string;
|
|
107
|
+
'pisell-cash-counting.placeholder': string;
|
|
108
|
+
'pisell-cash-counting.empty': string;
|
|
109
|
+
'pisell-cash-counting.no-country-config': string;
|
|
110
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
111
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
112
|
+
'pisell-cash-counting.use-count-total': string;
|
|
113
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
114
|
+
'pisell2.customise-item.save': string;
|
|
115
|
+
'pisell2.booking.info.text.clear': string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export default _default;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
en: {
|
|
3
|
+
'pisell-cash-counting.countCash': 'Count cash',
|
|
4
|
+
'pisell-cash-counting.subtitle': 'Enter the quantity for each denomination. The total will be calculated automatically.',
|
|
5
|
+
'pisell-cash-counting.currency': 'Currency',
|
|
6
|
+
'pisell-cash-counting.bills': 'Bills',
|
|
7
|
+
'pisell-cash-counting.coins': 'Coins',
|
|
8
|
+
'pisell-cash-counting.billsSubtotal': 'Bills subtotal',
|
|
9
|
+
'pisell-cash-counting.coinsSubtotal': 'Coins subtotal',
|
|
10
|
+
'pisell-cash-counting.subtotal': 'Subtotal',
|
|
11
|
+
'pisell-cash-counting.total': 'Total',
|
|
12
|
+
'pisell-cash-counting.clearAll': 'Clear all',
|
|
13
|
+
'pisell-cash-counting.cancel': 'Cancel',
|
|
14
|
+
'pisell-cash-counting.confirm': 'Confirm',
|
|
15
|
+
'pisell-cash-counting.placeholder': 'Please enter',
|
|
16
|
+
'pisell-cash-counting.empty': 'No denomination config for this currency.',
|
|
17
|
+
'pisell-cash-counting.no-country-config': 'No denomination data is configured for this region. Please contact your system administrator.',
|
|
18
|
+
'pisell-cash-counting.manual-vs-count-message-title': 'Tip',
|
|
19
|
+
'pisell-cash-counting.manual-vs-count-message': 'The actual amount was edited manually and no longer matches the cash count details.',
|
|
20
|
+
'pisell-cash-counting.use-count-total': 'Use counted total',
|
|
21
|
+
'pisell-cash-counting.keep-manual-amount': 'Keep manual amount',
|
|
22
|
+
'pisell2.customise-item.save': 'Save',
|
|
23
|
+
'pisell2.booking.info.text.clear': 'Clear'
|
|
24
|
+
},
|
|
25
|
+
'zh-CN': {
|
|
26
|
+
'pisell-cash-counting.countCash': '数钱',
|
|
27
|
+
'pisell-cash-counting.subtitle': '请输入每个面额的数量,系统将自动计算现金总额。',
|
|
28
|
+
'pisell-cash-counting.currency': '币种',
|
|
29
|
+
'pisell-cash-counting.bills': '纸币',
|
|
30
|
+
'pisell-cash-counting.coins': '硬币',
|
|
31
|
+
'pisell-cash-counting.billsSubtotal': '纸币小计',
|
|
32
|
+
'pisell-cash-counting.coinsSubtotal': '硬币小计',
|
|
33
|
+
'pisell-cash-counting.subtotal': '小计',
|
|
34
|
+
'pisell-cash-counting.total': '合计',
|
|
35
|
+
'pisell-cash-counting.clearAll': '清空',
|
|
36
|
+
'pisell-cash-counting.cancel': '取消',
|
|
37
|
+
'pisell-cash-counting.confirm': '确认',
|
|
38
|
+
'pisell-cash-counting.placeholder': '请输入',
|
|
39
|
+
'pisell-cash-counting.empty': '当前币种暂无面额配置。',
|
|
40
|
+
'pisell-cash-counting.no-country-config': '该国家未配置数据,请联系系统人员',
|
|
41
|
+
'pisell-cash-counting.manual-vs-count-message-title': '提示',
|
|
42
|
+
'pisell-cash-counting.manual-vs-count-message': '实际金额已被手动修改,当前金额与数钱明细不一致。',
|
|
43
|
+
'pisell-cash-counting.use-count-total': '使用数钱金额',
|
|
44
|
+
'pisell-cash-counting.keep-manual-amount': '保留手动金额',
|
|
45
|
+
'pisell2.customise-item.save': '保存',
|
|
46
|
+
'pisell2.booking.info.text.clear': '清空'
|
|
47
|
+
},
|
|
48
|
+
'zh-HK': {
|
|
49
|
+
'pisell-cash-counting.countCash': '數錢',
|
|
50
|
+
'pisell-cash-counting.subtitle': '請輸入每個面額的數量,系統會自動計算現金總額。',
|
|
51
|
+
'pisell-cash-counting.currency': '幣種',
|
|
52
|
+
'pisell-cash-counting.bills': '紙幣',
|
|
53
|
+
'pisell-cash-counting.coins': '硬幣',
|
|
54
|
+
'pisell-cash-counting.billsSubtotal': '紙幣小計',
|
|
55
|
+
'pisell-cash-counting.coinsSubtotal': '硬幣小計',
|
|
56
|
+
'pisell-cash-counting.subtotal': '小計',
|
|
57
|
+
'pisell-cash-counting.total': '合計',
|
|
58
|
+
'pisell-cash-counting.clearAll': '清空',
|
|
59
|
+
'pisell-cash-counting.cancel': '取消',
|
|
60
|
+
'pisell-cash-counting.confirm': '確認',
|
|
61
|
+
'pisell-cash-counting.placeholder': '請輸入',
|
|
62
|
+
'pisell-cash-counting.empty': '目前幣種暫無面額配置。',
|
|
63
|
+
'pisell-cash-counting.no-country-config': '該國家未配置數據,請聯繫系統人員',
|
|
64
|
+
'pisell-cash-counting.manual-vs-count-message-title': '提示',
|
|
65
|
+
'pisell-cash-counting.manual-vs-count-message': '實際金額已被手動修改,當前金額與數錢明細不一致。',
|
|
66
|
+
'pisell-cash-counting.use-count-total': '使用數錢金額',
|
|
67
|
+
'pisell-cash-counting.keep-manual-amount': '保留手動金額',
|
|
68
|
+
'pisell2.customise-item.save': '保存',
|
|
69
|
+
'pisell2.booking.info.text.clear': '清空'
|
|
70
|
+
},
|
|
71
|
+
ja: {
|
|
72
|
+
'pisell-cash-counting.countCash': '現金を数える',
|
|
73
|
+
'pisell-cash-counting.subtitle': '各金種の数量を入力すると、合計金額が自動計算されます。',
|
|
74
|
+
'pisell-cash-counting.currency': '通貨',
|
|
75
|
+
'pisell-cash-counting.bills': '紙幣',
|
|
76
|
+
'pisell-cash-counting.coins': '硬貨',
|
|
77
|
+
'pisell-cash-counting.billsSubtotal': '紙幣小計',
|
|
78
|
+
'pisell-cash-counting.coinsSubtotal': '硬貨小計',
|
|
79
|
+
'pisell-cash-counting.subtotal': '小計',
|
|
80
|
+
'pisell-cash-counting.total': '合計',
|
|
81
|
+
'pisell-cash-counting.clearAll': 'クリア',
|
|
82
|
+
'pisell-cash-counting.cancel': 'キャンセル',
|
|
83
|
+
'pisell-cash-counting.confirm': '確認',
|
|
84
|
+
'pisell-cash-counting.placeholder': '入力してください',
|
|
85
|
+
'pisell-cash-counting.empty': 'この通貨の金種設定がありません。',
|
|
86
|
+
'pisell-cash-counting.no-country-config': 'この国・地域の金種データが設定されていません。システム管理者にお問い合わせください。',
|
|
87
|
+
'pisell-cash-counting.manual-vs-count-message-title': 'ヒント',
|
|
88
|
+
'pisell-cash-counting.manual-vs-count-message': '実際の金額が手入力で変更され、現在の金額が現金集計の内訳と一致しません。',
|
|
89
|
+
'pisell-cash-counting.use-count-total': '集計金額を使う',
|
|
90
|
+
'pisell-cash-counting.keep-manual-amount': '手入力の金額を残す',
|
|
91
|
+
'pisell2.customise-item.save': '保存',
|
|
92
|
+
'pisell2.booking.info.text.clear': '清空'
|
|
93
|
+
},
|
|
94
|
+
pt: {
|
|
95
|
+
'pisell-cash-counting.countCash': 'Contar dinheiro',
|
|
96
|
+
'pisell-cash-counting.subtitle': 'Insira a quantidade de cada denominação. O total será calculado automaticamente.',
|
|
97
|
+
'pisell-cash-counting.currency': 'Moeda',
|
|
98
|
+
'pisell-cash-counting.bills': 'Notas',
|
|
99
|
+
'pisell-cash-counting.coins': 'Moedas',
|
|
100
|
+
'pisell-cash-counting.billsSubtotal': 'Subtotal de notas',
|
|
101
|
+
'pisell-cash-counting.coinsSubtotal': 'Subtotal de moedas',
|
|
102
|
+
'pisell-cash-counting.subtotal': 'Subtotal',
|
|
103
|
+
'pisell-cash-counting.total': 'Total',
|
|
104
|
+
'pisell-cash-counting.clearAll': 'Limpar',
|
|
105
|
+
'pisell-cash-counting.cancel': 'Cancelar',
|
|
106
|
+
'pisell-cash-counting.confirm': 'Confirmar',
|
|
107
|
+
'pisell-cash-counting.placeholder': 'Insira',
|
|
108
|
+
'pisell-cash-counting.empty': 'Nenhuma configuração de denominação para esta moeda.',
|
|
109
|
+
'pisell-cash-counting.no-country-config': 'Não há dados de denominação configurados para esta região. Contacte o administrador do sistema.',
|
|
110
|
+
'pisell-cash-counting.manual-vs-count-message-title': 'Dica',
|
|
111
|
+
'pisell-cash-counting.manual-vs-count-message': 'O valor real foi editado manualmente e já não coincide com os detalhes da contagem de numerário.',
|
|
112
|
+
'pisell-cash-counting.use-count-total': 'Usar total contado',
|
|
113
|
+
'pisell-cash-counting.keep-manual-amount': 'Manter valor manual',
|
|
114
|
+
'pisell2.customise-item.save': 'Salvar',
|
|
115
|
+
'pisell2.booking.info.text.clear': 'Limpar'
|
|
116
|
+
}
|
|
117
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps, InputNumberProps } from 'antd';
|
|
3
|
+
export declare type CashDenominationType = 'bill' | 'coin';
|
|
4
|
+
/** 金额输入与数钱按钮的排列:`vertical` 上下,`horizontal` 左右 */
|
|
5
|
+
export declare type PisellCashCountingLayout = 'vertical' | 'horizontal';
|
|
6
|
+
export interface CurrencyDenominationConfig {
|
|
7
|
+
/** 币种编码,例如 AUD、JPY、USD */
|
|
8
|
+
currency_code: string;
|
|
9
|
+
/** 面额数值 */
|
|
10
|
+
denomination_value: number;
|
|
11
|
+
/** 展示文案,例如 $100、¥10,000、50¢ */
|
|
12
|
+
denomination_label: string;
|
|
13
|
+
/** 面额类型:纸币或硬币 */
|
|
14
|
+
denomination_type: CashDenominationType;
|
|
15
|
+
/** 展示顺序 */
|
|
16
|
+
sort_order: number;
|
|
17
|
+
/** 金额小数位,JPY 为 0,AUD 为 2 */
|
|
18
|
+
decimal_places: number;
|
|
19
|
+
/** 是否启用 */
|
|
20
|
+
is_enabled: boolean;
|
|
21
|
+
/** 国家/地区,可选扩展字段 */
|
|
22
|
+
country_region?: string;
|
|
23
|
+
/** 当前是否生效,可选扩展字段 */
|
|
24
|
+
effective_status?: boolean | 'active' | 'inactive';
|
|
25
|
+
}
|
|
26
|
+
export interface CashCountingDetail {
|
|
27
|
+
denomination: CurrencyDenominationConfig;
|
|
28
|
+
quantity: number;
|
|
29
|
+
amount: number;
|
|
30
|
+
}
|
|
31
|
+
export interface CashCountingConfirmPayload {
|
|
32
|
+
amount: number | string;
|
|
33
|
+
currencyCode: string;
|
|
34
|
+
decimalPlaces: number;
|
|
35
|
+
billSubtotal: number | string;
|
|
36
|
+
coinSubtotal: number | string;
|
|
37
|
+
details: CashCountingDetail[];
|
|
38
|
+
quantities: Record<string, number>;
|
|
39
|
+
}
|
|
40
|
+
export interface PisellCashCountingProps {
|
|
41
|
+
/** 当前金额,受控模式 */
|
|
42
|
+
value?: number;
|
|
43
|
+
/** 默认金额,非受控模式 */
|
|
44
|
+
defaultValue?: number | string;
|
|
45
|
+
/** 币种编码 */
|
|
46
|
+
currencyCode?: string;
|
|
47
|
+
/** 货币符号,不传时按币种默认推断 */
|
|
48
|
+
currencySymbol?: string;
|
|
49
|
+
/** 金额小数位,不传时按面额配置推断 */
|
|
50
|
+
amountPrecision?: number;
|
|
51
|
+
/** 可扩展的币种面额 JSON 配置 */
|
|
52
|
+
denominations?: CurrencyDenominationConfig[];
|
|
53
|
+
/** 禁用整体输入 */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** 禁用数钱按钮 */
|
|
56
|
+
countDisabled?: boolean;
|
|
57
|
+
/** 金额输入占位 */
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/** 输入框与数钱按钮的布局,默认上下排列 */
|
|
60
|
+
layout?: PisellCashCountingLayout;
|
|
61
|
+
/** 数钱按钮文案 */
|
|
62
|
+
countCashButtonText?: React.ReactNode;
|
|
63
|
+
/** 弹窗宽度 */
|
|
64
|
+
modalWidth?: number | string;
|
|
65
|
+
/** 价格键盘是否显示货币符号 */
|
|
66
|
+
showCurrencySymbol?: boolean;
|
|
67
|
+
/** 价格键盘是否使用千分位 */
|
|
68
|
+
useThousandsSeparator?: boolean;
|
|
69
|
+
/** 输入框透传属性 */
|
|
70
|
+
inputNumberProps?: Omit<InputNumberProps, 'value' | 'defaultValue' | 'onChange'>;
|
|
71
|
+
/** 数钱按钮透传属性 */
|
|
72
|
+
buttonProps?: ButtonProps;
|
|
73
|
+
/** 自定义类名 */
|
|
74
|
+
className?: string;
|
|
75
|
+
/** 自定义样式 */
|
|
76
|
+
style?: React.CSSProperties;
|
|
77
|
+
/** 金额变化 */
|
|
78
|
+
onChange?: (value: number | string, meta?: {
|
|
79
|
+
source: 'manual' | 'count';
|
|
80
|
+
}) => void;
|
|
81
|
+
/** 点钞确认 */
|
|
82
|
+
onCountConfirm?: (payload: CashCountingConfirmPayload) => void;
|
|
83
|
+
/** 取消点钞 */
|
|
84
|
+
onCountCancel?: () => void;
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CurrencyDenominationConfig } from './types';
|
|
2
|
+
/** 面额配置唯一键,用于数量映射 */
|
|
3
|
+
export declare const getDenominationId: (item: CurrencyDenominationConfig) => string;
|
|
4
|
+
/** 按小数位规范化金额,避免浮点误差 */
|
|
5
|
+
export declare const normalizeAmount: (value: string | number | null | undefined, precision: number) => number;
|
|
6
|
+
/** 业务规则:是否可作为有效面额参与点钞 */
|
|
7
|
+
export declare const isEffectiveDenomination: (item: CurrencyDenominationConfig) => boolean;
|
|
8
|
+
/** 当前币种下已启用且排序后的面额列表 */
|
|
9
|
+
export declare const getEffectiveDenominationsForCurrency: (denominations: CurrencyDenominationConfig[], currencyCode: string) => CurrencyDenominationConfig[];
|
|
10
|
+
export declare const buildEmptyQuantities: (items: CurrencyDenominationConfig[]) => Record<string, number>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** 面额配置唯一键,用于数量映射 */
|
|
2
|
+
export var getDenominationId = function getDenominationId(item) {
|
|
3
|
+
return "".concat(item.currency_code, "-").concat(item.denomination_type, "-").concat(item.denomination_value);
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/** 按小数位规范化金额,避免浮点误差 */
|
|
7
|
+
export var normalizeAmount = function normalizeAmount(value, precision) {
|
|
8
|
+
var numberValue = Number(String(value !== null && value !== void 0 ? value : 0).replace(/,/g, ''));
|
|
9
|
+
if (!Number.isFinite(numberValue)) {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
var factor = Math.pow(10, precision);
|
|
13
|
+
return Math.round(numberValue * factor) / factor;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** 业务规则:是否可作为有效面额参与点钞 */
|
|
17
|
+
export var isEffectiveDenomination = function isEffectiveDenomination(item) {
|
|
18
|
+
if (item.is_enabled === false) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (item.effective_status === false || item.effective_status === 'inactive') {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** 当前币种下已启用且排序后的面额列表 */
|
|
28
|
+
export var getEffectiveDenominationsForCurrency = function getEffectiveDenominationsForCurrency(denominations, currencyCode) {
|
|
29
|
+
return denominations.filter(function (item) {
|
|
30
|
+
return item.currency_code === currencyCode && isEffectiveDenomination(item);
|
|
31
|
+
}).sort(function (a, b) {
|
|
32
|
+
return a.sort_order - b.sort_order;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export var buildEmptyQuantities = function buildEmptyQuantities(items) {
|
|
36
|
+
return items.reduce(function (acc, item) {
|
|
37
|
+
acc[getDenominationId(item)] = 0;
|
|
38
|
+
return acc;
|
|
39
|
+
}, {});
|
|
40
|
+
};
|
|
@@ -122,7 +122,6 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
122
122
|
var handler = function handler(event) {
|
|
123
123
|
var _event$detail;
|
|
124
124
|
var cacheItem = event === null || event === void 0 || (_event$detail = event.detail) === null || _event$detail === void 0 ? void 0 : _event$detail.cacheItem;
|
|
125
|
-
console.log('Modal closed with result:', event.detail.cacheItem);
|
|
126
125
|
if (!(cacheItem !== null && cacheItem !== void 0 && cacheItem.id)) return;
|
|
127
126
|
addServiceScroll(String(cacheItem.id), cacheItem);
|
|
128
127
|
};
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import './index.less';
|
|
3
3
|
interface BookingDashboardProps {
|
|
4
4
|
bookingTimeStartBetween: string[];
|
|
5
|
+
/** 组件是否可见,不可见时内部会暂停 interval,默认 true */
|
|
6
|
+
isVisible?: boolean;
|
|
5
7
|
}
|
|
6
8
|
declare const BookingDashboard: React.ForwardRefExoticComponent<BookingDashboardProps & React.RefAttributes<unknown>>;
|
|
7
9
|
export default BookingDashboard;
|
|
@@ -4,7 +4,9 @@ import { useImperativeHandle } from 'react';
|
|
|
4
4
|
import BookingDashboardComponent from "../../../../booking/dashboard";
|
|
5
5
|
import "./index.less";
|
|
6
6
|
var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
7
|
-
var bookingTimeStartBetween = props.bookingTimeStartBetween
|
|
7
|
+
var bookingTimeStartBetween = props.bookingTimeStartBetween,
|
|
8
|
+
_props$isVisible = props.isVisible,
|
|
9
|
+
isVisible = _props$isVisible === void 0 ? true : _props$isVisible;
|
|
8
10
|
var bookingDashboardRef = useRef(null);
|
|
9
11
|
var cptProps = useMemo(function () {
|
|
10
12
|
return {
|
|
@@ -14,9 +16,10 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
14
16
|
otherParams: {
|
|
15
17
|
booking_time_start_between: bookingTimeStartBetween
|
|
16
18
|
},
|
|
19
|
+
isVisible: isVisible,
|
|
17
20
|
backgroundColors: ['rgba(224, 79, 22, 0.20)', 'rgba(217, 45, 32, 0.14)', 'rgba(127, 86, 217, 0.22)', 'rgba(7, 148, 85, 0.20)', 'rgba(21, 112, 239, 0.23)', 'rgba(202, 133, 4, 0.20)', 'var(--Gray-800, #1D2939)', 'var(--Gray-true-800, #292929)']
|
|
18
21
|
};
|
|
19
|
-
}, [bookingTimeStartBetween]);
|
|
22
|
+
}, [bookingTimeStartBetween, isVisible]);
|
|
20
23
|
useImperativeHandle(ref, function () {
|
|
21
24
|
return {
|
|
22
25
|
refresh: function refresh() {
|
|
@@ -4,6 +4,8 @@ interface BookingDataPanelProps {
|
|
|
4
4
|
currentDate: string;
|
|
5
5
|
onBookingClick: (booking: any) => void;
|
|
6
6
|
bookingId?: number;
|
|
7
|
+
/** 面板是否可见,透传给内部 Dashboard 控制 interval 是否启动 */
|
|
8
|
+
isVisible?: boolean;
|
|
7
9
|
}
|
|
8
10
|
declare const BookingDataPanel: React.ForwardRefExoticComponent<BookingDataPanelProps & React.RefAttributes<unknown>>;
|
|
9
11
|
export default BookingDataPanel;
|