best-unit 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/best-unit.cjs +10 -10
- package/dist/best-unit.js +504 -489
- package/package.json +1 -1
- package/src/api/index.ts +2 -0
- package/src/components/business/payment-sdk/offline-payment/index.tsx +9 -1
- package/src/components/business/payment-sdk/select-payment/index.tsx +10 -6
- package/src/local/en.ts +5 -0
- package/src/local/zh.ts +5 -0
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -87,6 +87,8 @@ export const createOfflineRecharge = async (data: any) => {
|
|
|
87
87
|
transfer_date: data.transferDate,
|
|
88
88
|
transfer_channel: data.transferChannel,
|
|
89
89
|
payer_name: data.payerName,
|
|
90
|
+
submit_amount: data.submitAmount,
|
|
91
|
+
submit_currency: data.submitCurrency,
|
|
90
92
|
voucher_urls: data.voucherUrls,
|
|
91
93
|
};
|
|
92
94
|
return http().post("/offline/recharge/create", params, {});
|
|
@@ -26,9 +26,15 @@ export function OfflinePayment({
|
|
|
26
26
|
const theme = getOfflinePaymentTheme();
|
|
27
27
|
const isDark = theme.container.background === "#181A20";
|
|
28
28
|
|
|
29
|
+
// 默认选择当日日期,格式为 YYYY-MM-DD
|
|
30
|
+
const today = new Date();
|
|
31
|
+
const todayStr = `${today.getFullYear()}-${String(
|
|
32
|
+
today.getMonth() + 1
|
|
33
|
+
).padStart(2, "0")}-${String(today.getDate()).padStart(2, "0")}`;
|
|
34
|
+
|
|
29
35
|
const [formState, setFormState] = useState({
|
|
30
36
|
urls: [] as string[],
|
|
31
|
-
transferTime:
|
|
37
|
+
transferTime: todayStr,
|
|
32
38
|
transferAmount: amount,
|
|
33
39
|
transactionId: "",
|
|
34
40
|
payerName: "",
|
|
@@ -88,6 +94,8 @@ export function OfflinePayment({
|
|
|
88
94
|
transferChannel: channel,
|
|
89
95
|
voucherUrls: formState.urls,
|
|
90
96
|
payerName: formState.payerName,
|
|
97
|
+
submitAmount: amount,
|
|
98
|
+
submitCurrency: currency,
|
|
91
99
|
});
|
|
92
100
|
message.success(t("提交成功"));
|
|
93
101
|
onCancel();
|
|
@@ -50,8 +50,12 @@ export function SelectPayment({
|
|
|
50
50
|
// 防抖定时器
|
|
51
51
|
const bizRateTimerRef = useRef<number | null>(null);
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
// 触发业务汇率计算(可传入最新值避免读取到旧状态)
|
|
54
|
+
const triggerBizRate = (nextAmount?: string, nextCurrency?: string) => {
|
|
55
|
+
const amountVal = nextAmount !== undefined ? nextAmount : formState.amount;
|
|
56
|
+
const currencyVal =
|
|
57
|
+
nextCurrency !== undefined ? nextCurrency : formState.currency;
|
|
58
|
+
if (!amountVal || Number(amountVal) <= 0) {
|
|
55
59
|
setBizRate(null);
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
@@ -60,8 +64,8 @@ export function SelectPayment({
|
|
|
60
64
|
}
|
|
61
65
|
bizRateTimerRef.current = window.setTimeout(() => {
|
|
62
66
|
calculateBusinessExchangeRate({
|
|
63
|
-
currency:
|
|
64
|
-
amount:
|
|
67
|
+
currency: currencyVal,
|
|
68
|
+
amount: amountVal,
|
|
65
69
|
})
|
|
66
70
|
.then((res) => setBizRate(res))
|
|
67
71
|
.catch(() => setBizRate(null));
|
|
@@ -108,7 +112,7 @@ export function SelectPayment({
|
|
|
108
112
|
const handleCurrencyChange = (currency: string) => {
|
|
109
113
|
setFormState((s) => ({ ...s, currency }));
|
|
110
114
|
onCurrencyChange(currency);
|
|
111
|
-
triggerBizRate();
|
|
115
|
+
triggerBizRate(undefined, currency);
|
|
112
116
|
};
|
|
113
117
|
|
|
114
118
|
// 处理金额变化
|
|
@@ -117,7 +121,7 @@ export function SelectPayment({
|
|
|
117
121
|
setFormState((s) => ({ ...s, amount: formattedAmount, amountError: "" }));
|
|
118
122
|
onAmountChange(formattedAmount);
|
|
119
123
|
// 输入金额后触发汇率计算
|
|
120
|
-
triggerBizRate();
|
|
124
|
+
triggerBizRate(formattedAmount);
|
|
121
125
|
};
|
|
122
126
|
|
|
123
127
|
// 处理渠道变化
|
package/src/local/en.ts
CHANGED
|
@@ -33,6 +33,11 @@ export const en: Record<string, string> = {
|
|
|
33
33
|
"提交失败,请重试": "Submit failed, please try again",
|
|
34
34
|
"提交中...": "Submitting...",
|
|
35
35
|
去支付: "Go to Pay",
|
|
36
|
+
"您的支付币种与默认币种不一致,将转换为默认币种入账:":
|
|
37
|
+
"Your payment currency is different from the default currency and will be converted to the default currency for deposit",
|
|
38
|
+
"目前汇率为:": "Current exchange rate:",
|
|
39
|
+
钱包预计增加: "Wallet is expected to increase",
|
|
40
|
+
请输入付款人名称: "Please enter the payer name",
|
|
36
41
|
取消: "Cancel",
|
|
37
42
|
关闭: "Close",
|
|
38
43
|
在线支付: "Online Payment",
|
package/src/local/zh.ts
CHANGED
|
@@ -32,6 +32,11 @@ export const zh: Record<string, string> = {
|
|
|
32
32
|
"提交失败,请重试": "提交失败,请重试",
|
|
33
33
|
"提交中...": "提交中...",
|
|
34
34
|
去支付: "去支付",
|
|
35
|
+
"您的支付币种与默认币种不一致,将转换为默认币种入账:":
|
|
36
|
+
"您的支付币种与默认币种不一致,将转换为默认币种入账",
|
|
37
|
+
"目前汇率为:": "目前汇率为:",
|
|
38
|
+
钱包预计增加: "钱包预计增加",
|
|
39
|
+
请输入付款人名称: "请输入付款人名称",
|
|
35
40
|
取消: "取消",
|
|
36
41
|
关闭: "关闭",
|
|
37
42
|
在线支付: "在线支付",
|