best-unit 2.0.12 → 2.0.14

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "2.0.12",
4
+ "version": "2.0.14",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
package/src/api/index.ts CHANGED
@@ -46,6 +46,27 @@ export const getAllDicts = async () => {
46
46
  });
47
47
  };
48
48
 
49
+ // 获取所有币种
50
+ export const getAllCurrencies = async () => {
51
+ const fundUnitParams = JSON.parse(
52
+ sessionStorage.getItem("fund_unit_params") || "{}"
53
+ );
54
+ return http()
55
+ .get("/currency", {
56
+ params: {
57
+ biz_type: fundUnitParams.bizType,
58
+ },
59
+ })
60
+ .then((res) => {
61
+ return (
62
+ res.data.currency.map((item: any) => ({
63
+ value: item.value,
64
+ label: item.label,
65
+ })) || []
66
+ );
67
+ });
68
+ };
69
+
49
70
  // 上传文件
50
71
  export const uploadFile = async (
51
72
  file: any,
@@ -1,7 +1,11 @@
1
1
  import { useState, useEffect } from "preact/hooks";
2
2
  import { t } from "@/local";
3
3
  import { getSelectPaymentTheme } from "./theme";
4
- import { getOfflineChannelMap, calculateBusinessExchangeRate } from "@/api";
4
+ import {
5
+ getOfflineChannelMap,
6
+ calculateBusinessExchangeRate,
7
+ getAllCurrencies,
8
+ } from "@/api";
5
9
  import { useRef } from "preact/hooks";
6
10
 
7
11
  interface SelectPaymentProps {
@@ -25,9 +29,8 @@ export function SelectPayment({
25
29
  }: SelectPaymentProps) {
26
30
  const theme = getSelectPaymentTheme();
27
31
 
28
- // 币种从本地字典读取;渠道通过接口获取
29
- const allDicts = JSON.parse(sessionStorage.getItem("all_dicts") || "{}");
30
- const currencyDict = allDicts?.currency || [];
32
+ // 币种通过接口获取;渠道通过接口获取
33
+ const [currencyDict, setCurrencyDict] = useState<any[]>([]);
31
34
  const [onlineChannelDict, setOnlineChannelDict] = useState<any[]>([]);
32
35
  const [bankChannelDict, setBankChannelDict] = useState<any[]>([]);
33
36
 
@@ -72,6 +75,13 @@ export function SelectPayment({
72
75
  }, 300);
73
76
  };
74
77
 
78
+ // 获取币种字典
79
+ useEffect(() => {
80
+ getAllCurrencies().then((res) => {
81
+ setCurrencyDict(res || []);
82
+ });
83
+ }, []);
84
+
75
85
  // 根据币种拉取线上/线下渠道映射,初始化默认选项
76
86
  useEffect(() => {
77
87
  getOfflineChannelMap({ currency: formState.currency }).then((res) => {
@@ -258,7 +258,7 @@ export function DatePicker({
258
258
  style={theme.monthYear}
259
259
  onClick={() => setShowYearPicker(!showYearPicker)}
260
260
  >
261
- {currentMonth.getFullYear()}年
261
+ {currentMonth.getFullYear()} {t("")}{" "}
262
262
  {monthNames[currentMonth.getMonth()]}
263
263
  </span>
264
264
  <button
package/src/local/en.ts CHANGED
@@ -8,6 +8,7 @@ export const en: Record<string, string> = {
8
8
  "Note: Region/currency/card type may affect handling fees, subject to the platform.",
9
9
  确定: "Confirm",
10
10
  提交成功: "Submit Success",
11
+ 年:"Year",
11
12
  // 余额相关
12
13
  余额详情: "Balance Details",
13
14
  真实金额: "Real Balance",
package/src/local/zh.ts CHANGED
@@ -8,6 +8,7 @@ export const zh: Record<string, string> = {
8
8
  "注:地区/币种/卡类型可能影响手续费,最终以平台为准。",
9
9
  确定: "确定",
10
10
  提交成功: "提交成功",
11
+ 年:"年",
11
12
  // 余额相关
12
13
  余额详情: "余额详情",
13
14
  真实金额: "真实金额",