From 2294e72882bb42fb9a774d6039a91202b8f3851e Mon Sep 17 00:00:00 2001 From: zzy <> Date: Mon, 25 Jul 2022 17:29:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC=E7=B3=BB=E7=BB=9F=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- src/components/Table/ConfirmButton/index.less | 13 +++ src/components/Table/ConfirmButton/index.tsx | 24 ++++ src/components/Table/index.tsx | 2 +- src/pages/Login/index.tsx | 2 +- .../List/components/addAddressModal.tsx | 62 +++++++++++ .../List/components/editAddressModal.tsx | 72 ++++++++++++ src/pages/Recharge/Address/List/index.tsx | 102 +++++++++++++++++ .../List/components/addCoinTypeModal.tsx | 68 ++++++++++++ .../List/components/editCoinTypeModal.tsx | 78 +++++++++++++ src/pages/Recharge/CoinType/List/index.tsx | 104 ++++++++++++++++++ src/pages/Recharge/Record/List/index.tsx | 89 +++++++++++++++ src/pages/Recharge/Withdraw/List/index.tsx | 97 ++++++++++++++++ src/routes/index.ts | 32 +++++- src/routes/routePath.ts | 14 +++ src/services/address.ts | 61 ++++++++++ src/services/coinType.ts | 53 +++++++++ src/services/login.ts | 2 +- src/services/record.ts | 20 ++++ src/services/withdraw.ts | 34 ++++++ src/styles/antdGlobal.less | 2 +- src/utils/bigNumber.ts | 6 + src/utils/formatBalance.ts | 6 + 23 files changed, 940 insertions(+), 6 deletions(-) create mode 100644 src/components/Table/ConfirmButton/index.less create mode 100644 src/components/Table/ConfirmButton/index.tsx create mode 100644 src/pages/Recharge/Address/List/components/addAddressModal.tsx create mode 100644 src/pages/Recharge/Address/List/components/editAddressModal.tsx create mode 100644 src/pages/Recharge/Address/List/index.tsx create mode 100644 src/pages/Recharge/CoinType/List/components/addCoinTypeModal.tsx create mode 100644 src/pages/Recharge/CoinType/List/components/editCoinTypeModal.tsx create mode 100644 src/pages/Recharge/CoinType/List/index.tsx create mode 100644 src/pages/Recharge/Record/List/index.tsx create mode 100644 src/pages/Recharge/Withdraw/List/index.tsx create mode 100644 src/services/address.ts create mode 100644 src/services/coinType.ts create mode 100644 src/services/record.ts create mode 100644 src/services/withdraw.ts create mode 100644 src/utils/bigNumber.ts create mode 100644 src/utils/formatBalance.ts diff --git a/package.json b/package.json index 3e4df34..eca941e 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,8 @@ "react-dom": "^17.0.0", "react-helmet-async": "^1.0.4", "umi": "^3.5.0", - "umi-serve": "^1.9.10" + "umi-serve": "^1.9.10", + "bignumber.js": "^9.0.0" }, "devDependencies": { "@ant-design/pro-cli": "^2.0.2", diff --git a/src/components/Table/ConfirmButton/index.less b/src/components/Table/ConfirmButton/index.less new file mode 100644 index 0000000..61897f7 --- /dev/null +++ b/src/components/Table/ConfirmButton/index.less @@ -0,0 +1,13 @@ +.delete-btn { + color: @error-color; + &:hover { + color: @error-color !important; + } +} +.disabled { + color: @disabled-color; + cursor: not-allowed; + &:hover { + color: @disabled-color !important; + } +} diff --git a/src/components/Table/ConfirmButton/index.tsx b/src/components/Table/ConfirmButton/index.tsx new file mode 100644 index 0000000..f1b19ec --- /dev/null +++ b/src/components/Table/ConfirmButton/index.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Popconfirm } from 'antd'; +import styles from './index.less'; +import classNames from 'classnames'; + +interface PropsType { + onConfirm: () => void; + title?: string; + buttonName?: string; + disabled?: boolean; +} +const ConfirmButton: React.FC = ({ + onConfirm, + disabled = false, + title = '', + buttonName = '', +}) => { + return ( + + {buttonName} + + ); +}; +export default ConfirmButton; diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index 1873c46..d4f2fda 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -172,7 +172,7 @@ const Table = >(props: PropsType) => { }} > - {item.text || '新建'} + {item.text || '添加'} , ); } else if (item.type === 'batchDelete') { diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index a06865a..f876e6e 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -35,7 +35,7 @@ const Login: React.FC = () => { }} > , diff --git a/src/pages/Recharge/Address/List/components/addAddressModal.tsx b/src/pages/Recharge/Address/List/components/addAddressModal.tsx new file mode 100644 index 0000000..df62cff --- /dev/null +++ b/src/pages/Recharge/Address/List/components/addAddressModal.tsx @@ -0,0 +1,62 @@ +// 创建收款地址弹窗 +import React, { useRef } from 'react'; +import { createForm } from '@formily/core'; +import { createSchemaField } from '@formily/react'; +import Modal, { ModalProps } from '@/components/Modal'; +import { Form, FormItem, Input, Select } from '@formily/antd'; + +interface AddAddressModalPropsType extends ModalProps { + onOk: (val: any) => void; + onCancel: () => void; +} + +const SchemaField = createSchemaField({ + components: { + FormItem, + Input, + Select, + }, +}); + +const form = createForm({}); + +const AddAddressModal = ({ onOk, onCancel, ...rest }: AddAddressModalPropsType) => { + const handleOk = () => { + const formState = form.getFormState(); + onOk(formState.values); + }; + + const handleCancel = () => { + onCancel(); + }; + + return ( + +
+ + + + +
+
+ ); +}; + +export default AddAddressModal; diff --git a/src/pages/Recharge/Address/List/components/editAddressModal.tsx b/src/pages/Recharge/Address/List/components/editAddressModal.tsx new file mode 100644 index 0000000..aca7318 --- /dev/null +++ b/src/pages/Recharge/Address/List/components/editAddressModal.tsx @@ -0,0 +1,72 @@ +// 修改收款地址弹窗 +import React, { useRef, useEffect } from 'react'; +import { createForm } from '@formily/core'; +import { createSchemaField } from '@formily/react'; +import Modal, { ModalProps } from '@/components/Modal'; +import { Form, FormItem, Input, Select } from '@formily/antd'; + +interface EditAddressModalPropsType extends ModalProps { + editModalData: any; + onOk: (val: any) => void; + onCancel: () => void; +} + +const SchemaField = createSchemaField({ + components: { + FormItem, + Input, + Select, + }, +}); + +const form = createForm({}); + +const EditAddressModal = ({ + onOk, + onCancel, + editModalData, + ...rest +}: EditAddressModalPropsType) => { + useEffect(() => { + form.setInitialValues(editModalData); + }); + + const handleOk = () => { + const formState = form.getFormState(); + onOk(formState.values); + }; + + const handleCancel = () => { + onCancel(); + }; + + return ( + +
+ + + + + +
+
+ ); +}; + +export default EditAddressModal; diff --git a/src/pages/Recharge/Address/List/index.tsx b/src/pages/Recharge/Address/List/index.tsx new file mode 100644 index 0000000..2aaedbb --- /dev/null +++ b/src/pages/Recharge/Address/List/index.tsx @@ -0,0 +1,102 @@ +import React, { useState, useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { getAddressList, deleteAddress, createAddress, modifyAddress } from '@/services/address'; +import { fetchTableData } from '@/utils/table'; +import DeleteButton from '@/components/Table/DeleteButton'; +import AddAddressModal from './components/addAddressModal'; +import EditAddressModal from './components/editAddressModal'; + +const CollectionAddressList = () => { + const [isModalVisible, setIsModalVisible] = useState(false); + const [isEditModalVisible, setIsEditModalVisible] = useState(false); + const [modalData, setModalData] = useState({}); + + const handleEdit = (row: any) => { + setModalData(row); + setIsEditModalVisible(true); + }; + + const handleDelete = async (address: any) => { + await deleteAddress({ address: address }); + }; + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '收款地址', + dataIndex: 'address', + hideInSearch: true, + ellipsis: true, + }, + { + title: '收款游戏币类型', + dataIndex: 'bc_type', + hideInSearch: true, + ellipsis: true, + }, + { + title: '操作', + valueType: 'option', + width: 150, + render: (_, row) => [ + { + handleEdit(row); + }} + > + 编辑 + , + { + handleDelete(row.address); + }} + />, + ], + }, + ]; + return ( +
+ { + setIsModalVisible(true); + }, + }, + ]} + actionRef={tableRef} + request={async (params) => { + const res = await fetchTableData(getAddressList, params); + return res; + }} + /> + { + await createAddress(val); + setIsModalVisible(false); + }} + /> + { + await modifyAddress(val); + setIsEditModalVisible(false); + }} + /> + + ); +}; + +export default CollectionAddressList; diff --git a/src/pages/Recharge/CoinType/List/components/addCoinTypeModal.tsx b/src/pages/Recharge/CoinType/List/components/addCoinTypeModal.tsx new file mode 100644 index 0000000..4430e81 --- /dev/null +++ b/src/pages/Recharge/CoinType/List/components/addCoinTypeModal.tsx @@ -0,0 +1,68 @@ +// 添加代币类型弹窗 +import React, { useRef } from 'react'; +import { createForm } from '@formily/core'; +import { createSchemaField } from '@formily/react'; +import Modal, { ModalProps } from '@/components/Modal'; +import { Form, FormItem, Input, NumberPicker } from '@formily/antd'; + +interface AddCoinTypeModalPropsType extends ModalProps { + onOk: (val: any) => void; + onCancel: () => void; +} + +const SchemaField = createSchemaField({ + components: { + FormItem, + Input, + NumberPicker, + }, +}); + +const form = createForm({}); + +const AddCoinTypeModal = ({ onOk, onCancel, ...rest }: AddCoinTypeModalPropsType) => { + const handleOk = () => { + const formState = form.getFormState(); + onOk(formState.values); + }; + + const handleCancel = () => { + onCancel(); + }; + + return ( + +
+ + + + + + + +
+ ); +}; + +export default AddCoinTypeModal; diff --git a/src/pages/Recharge/CoinType/List/components/editCoinTypeModal.tsx b/src/pages/Recharge/CoinType/List/components/editCoinTypeModal.tsx new file mode 100644 index 0000000..f9b7aa3 --- /dev/null +++ b/src/pages/Recharge/CoinType/List/components/editCoinTypeModal.tsx @@ -0,0 +1,78 @@ +// 修改收款地址弹窗 +import React, { useRef, useEffect } from 'react'; +import { createForm } from '@formily/core'; +import { createSchemaField } from '@formily/react'; +import Modal, { ModalProps } from '@/components/Modal'; +import { Form, FormItem, Input, Select } from '@formily/antd'; + +interface EditCoinTypeModalPropsType extends ModalProps { + editModalData: any; + onOk: (val: any) => void; + onCancel: () => void; +} + +const SchemaField = createSchemaField({ + components: { + FormItem, + Input, + Select, + }, +}); + +const form = createForm({}); + +const EditCoinTypeModal = ({ + onOk, + onCancel, + editModalData, + ...rest +}: EditCoinTypeModalPropsType) => { + useEffect(() => { + form.setInitialValues(editModalData); + }); + + const handleOk = () => { + const formState = form.getFormState(); + onOk(formState.values); + }; + + const handleCancel = () => { + onCancel(); + }; + + return ( + +
+ + + + + + + +
+ ); +}; + +export default EditCoinTypeModal; diff --git a/src/pages/Recharge/CoinType/List/index.tsx b/src/pages/Recharge/CoinType/List/index.tsx new file mode 100644 index 0000000..9dbd9b9 --- /dev/null +++ b/src/pages/Recharge/CoinType/List/index.tsx @@ -0,0 +1,104 @@ +import React, { useState, useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { addCoinType, getCoinTypeList, modifyCoinType } from '@/services/coinType'; +import { fetchTableData } from '@/utils/table'; +import AddCoinTypeModal from './components/addCoinTypeModal'; +import EditCoinTypeModal from './components/editCoinTypeModal'; + +const CoinTypeList = () => { + const [isModalVisible, setIsModalVisible] = useState(false); + const [isEditModalVisible, setIsEditModalVisible] = useState(false); + const [modalData, setModalData] = useState({}); + + const handleEdit = (row: any) => { + setModalData(row); + setIsEditModalVisible(true); + }; + + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '游戏币名称', + dataIndex: 'bc_name', + hideInSearch: true, + ellipsis: true, + }, + { + title: '游戏币类型', + dataIndex: 'bc_type', + width: '10%', + hideInSearch: true, + }, + { + title: 'usdt比例', + dataIndex: 'usdt_price', + hideInSearch: true, + ellipsis: true, + }, + { + title: 'eth比例', + dataIndex: 'eth_price', + hideInSearch: true, + ellipsis: true, + }, + { + title: '操作', + valueType: 'option', + width: 150, + render: (_, row) => [ + { + handleEdit(row); + }} + > + 编辑 + , + ], + }, + ]; + return ( +
+
{ + setIsModalVisible(true); + }, + }, + ]} + actionRef={tableRef} + request={async (params) => { + const res = await fetchTableData(getCoinTypeList, params); + return res; + }} + /> + { + await addCoinType(val); + setIsModalVisible(false); + }} + /> + { + await modifyCoinType(val); + setIsEditModalVisible(false); + }} + /> + + ); +}; + +export default CoinTypeList; diff --git a/src/pages/Recharge/Record/List/index.tsx b/src/pages/Recharge/Record/List/index.tsx new file mode 100644 index 0000000..7a21d08 --- /dev/null +++ b/src/pages/Recharge/Record/List/index.tsx @@ -0,0 +1,89 @@ +import React, { useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { getRecordList } from '@/services/record'; +import { fetchTableData } from '@/utils/table'; +import { getBalanceAmount } from '@/utils/formatBalance'; +import BigNumber from 'bignumber.js'; + +const RecordList = () => { + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '时间', + dataIndex: 'time', + hideInTable: true, + valueType: 'dateRange', + ellipsis: true, + }, + { + title: '交易哈希', + dataIndex: 'tx_hash', + hideInSearch: true, + ellipsis: true, + }, + { + title: '金额', + dataIndex: 'price', + width: '10%', + hideInSearch: true, + }, + { + title: '位数', + dataIndex: 'decimals', + width: '10%', + hideInSearch: true, + }, + { + title: '游戏币类型', + dataIndex: 'bc_type', + width: '10%', + hideInSearch: true, + }, + { + title: '发送地址', + dataIndex: 'form_address', + hideInSearch: true, + ellipsis: true, + }, + { + title: '接受地址', + dataIndex: 'to_address', + hideInSearch: true, + ellipsis: true, + }, + { + title: '充值时间', + dataIndex: 'time', + hideInSearch: true, + ellipsis: true, + }, + ]; + return ( +
+
{ + if ((params.time ?? '') !== '') { + params.start_time = params.time[0]; + params.end_time = params.time[1]; + } + const res = await fetchTableData(getRecordList, params); + for (const key in res.data) { + if (Object.prototype.hasOwnProperty.call(res.data, key)) { + const element = res.data[key]; + element.price = getBalanceAmount( + new BigNumber(element.price), + element.decimals, + ).toNumber(); + } + } + return res; + }} + /> + + ); +}; + +export default RecordList; diff --git a/src/pages/Recharge/Withdraw/List/index.tsx b/src/pages/Recharge/Withdraw/List/index.tsx new file mode 100644 index 0000000..e6e6298 --- /dev/null +++ b/src/pages/Recharge/Withdraw/List/index.tsx @@ -0,0 +1,97 @@ +import React, { useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { getWithdrawList, solveWithdraw } from '@/services/withdraw'; +import { fetchTableData } from '@/utils/table'; +import { getBalanceAmount } from '@/utils/formatBalance'; +import BigNumber from 'bignumber.js'; +import ConfirmButton from '@/components/Table/ConfirmButton'; + +const WithdrawList = () => { + const handleConfirm = async (uuid) => { + await solveWithdraw({ uuid: uuid }); + }; + + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '提现订单号', + dataIndex: 'uuid', + ellipsis: true, + }, + { + title: '金额', + dataIndex: 'price', + width: '10%', + hideInSearch: true, + }, + { + title: '位数', + dataIndex: 'decimals', + width: '10%', + hideInSearch: true, + }, + { + title: '发送地址', + dataIndex: 'form_address', + hideInSearch: true, + ellipsis: true, + }, + { + title: '接受地址', + dataIndex: 'to_address', + hideInSearch: true, + ellipsis: true, + }, + { + title: '游戏币类型', + dataIndex: 'bc_type', + width: '10%', + }, + { + title: '时间', + dataIndex: 'time', + valueType: 'dateRange', + ellipsis: true, + }, + { + title: '操作', + valueType: 'option', + width: 150, + render: (_, row) => [ + { + handleConfirm(row.uuid); + }} + />, + ], + }, + ]; + return ( +
+
{ + console.log('params = ', params); + const res = await fetchTableData(getWithdrawList, params); + for (const key in res.data) { + if (Object.prototype.hasOwnProperty.call(res.data, key)) { + const element = res.data[key]; + element.price = getBalanceAmount( + new BigNumber(element.price), + element.decimals, + ).toNumber(); + } + } + return res; + }} + /> + + ); +}; + +export default WithdrawList; diff --git a/src/routes/index.ts b/src/routes/index.ts index e6d4016..b5847cb 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -10,6 +10,37 @@ export default [ layout: false, component: './Login', }, + { + name: '充值系统', + path: RoutePath.RECHARGE, + routes: [ + { + path: RoutePath.RECHARGE, + redirect: RoutePath.RECORD.LIST, + hideInMenu: true, + }, + { + name: '充值订单', + path: RoutePath.RECORD.LIST, + component: './Recharge/Record/List', + }, + { + name: '收款地址', + path: RoutePath.ADDRESS.LIST, + component: './Recharge/Address/List', + }, + { + name: '代币种类', + path: RoutePath.COIN_TYPE.LIST, + component: './Recharge/CoinType/List', + }, + { + name: '提现管理', + path: RoutePath.WITHDRAW.LIST, + component: './Recharge/Withdraw/List', + }, + ], + }, { name: '设置', path: RoutePath.SETTING, @@ -19,7 +50,6 @@ export default [ redirect: RoutePath.WORK.LIST, hideInMenu: true, }, - { name: '作品', path: RoutePath.WORK.LIST, diff --git a/src/routes/routePath.ts b/src/routes/routePath.ts index 566cd52..38a00ed 100644 --- a/src/routes/routePath.ts +++ b/src/routes/routePath.ts @@ -1,6 +1,20 @@ const SETTING = '/setting'; +const RECHARGE = '/recharge'; const RoutePath = { LOGIN: '/login', + RECHARGE: RECHARGE, + RECORD: { + LIST: `${RECHARGE}/record`, + }, + ADDRESS: { + LIST: `${RECHARGE}/address`, + }, + COIN_TYPE: { + LIST: `${RECHARGE}/coin_type`, + }, + WITHDRAW: { + LIST: `${RECHARGE}/withdraw`, + }, SETTING: SETTING, WORK: { LIST: `${SETTING}/work`, diff --git a/src/services/address.ts b/src/services/address.ts new file mode 100644 index 0000000..4acbba8 --- /dev/null +++ b/src/services/address.ts @@ -0,0 +1,61 @@ +import request from '@/utils/request'; + +/** + * 获取开发商收款地址列表 + * @param {object} params + * @returns {array} data + * bc_type 游戏币类型 + * address 地址 + */ +export const getAddressList = (params) => { + return request.request({ + url: '/api/v1/address/get', + method: 'get', + params, + }); +}; + +/** + * 创建开发商收款地址 + * @param {Object} data + * bc_type 游戏币类型 + * address 地址(不传则后台生成) + * @returns + */ +export const createAddress = (data) => { + return request.request({ + url: '/api/v1/address/make', + method: 'post', + data, + }); +}; + +/** + * 删除开发商收款地址 + * @param {Object} data + * address 地址 + * @returns + */ +export const deleteAddress = (data) => { + return request.request({ + url: '/api/v1/address/del', + method: 'post', + data, + }); +}; + +/** + * 修改开发商收款地址 + * @param {Object} data + * address 旧地址 + * bc_type 游戏币类型 + * new_address 新地址 + * @returns + */ +export const modifyAddress = (data) => { + return request.request({ + url: '/api/v1/address/del', + method: 'post', + data, + }); +}; diff --git a/src/services/coinType.ts b/src/services/coinType.ts new file mode 100644 index 0000000..816e7d1 --- /dev/null +++ b/src/services/coinType.ts @@ -0,0 +1,53 @@ +import request from '@/utils/request'; + +/** + * 获取代币种类列表 + * @param {object} params + * type 代币种类 + * @returns {array} data + * bc_name 游戏币名称 + * bc_type 游戏币类型 + * usdt_price 游戏货币与usdt的比例 + * eth_price 游戏货币与eth的比例 + */ +export const getCoinTypeList = (params) => { + return request.request({ + url: '/api/v1/token/get', + method: 'get', + params, + }); +}; + +/** + * 获取代币种类列表 + * @param {object} params + * bc_name 游戏币名称 + * usdt_price 游戏货币与usdt的比例 + * eth_price 游戏货币与eth的比例 + * num 代币数量 + * @returns {object} data + */ +export const addCoinType = (data) => { + return request.request({ + url: '/api/v1/token/make', + method: 'post', + data, + }); +}; + +/** + * 获取代币种类列表 + * @param {object} params + * bc_name 游戏币名称 + * bc_type 游戏币类型 + * usdt_price 游戏货币与usdt的比例 + * eth_price 游戏货币与eth的比例 + * @returns {object} data + */ +export const modifyCoinType = (data) => { + return request.request({ + url: '/api/v1/token/chg', + method: 'post', + data, + }); +}; diff --git a/src/services/login.ts b/src/services/login.ts index a8a49e8..ae0cf3e 100644 --- a/src/services/login.ts +++ b/src/services/login.ts @@ -2,7 +2,7 @@ import request from '@/utils/request'; export const login = (data) => { return request.request({ - url: '/admin/login', + url: '/tbg/api/v1/admin/login', method: 'post', data, }); diff --git a/src/services/record.ts b/src/services/record.ts new file mode 100644 index 0000000..09ba77b --- /dev/null +++ b/src/services/record.ts @@ -0,0 +1,20 @@ +import request from '@/utils/request'; + +/** + * 获取充值列表 + * @param {object} data + * page 页码 + * pageSize 页码大小 + * start_time 开始时间 + * end_time 结束时间 + * @returns {array} data + * bc_type 游戏币类型 + * address 地址 + */ +export const getRecordList = (data) => { + return request.request({ + url: '/tgb/api/v1/recharge/record', + method: 'post', + data, + }); +}; diff --git a/src/services/withdraw.ts b/src/services/withdraw.ts new file mode 100644 index 0000000..3c5f25b --- /dev/null +++ b/src/services/withdraw.ts @@ -0,0 +1,34 @@ +import request from '@/utils/request'; + +/** + * 获取提现列表 + * @param {object} params + * + * @returns {array} data + * uuid 提现订单id + * to_addrss 接收地址 + * form_address 发送地址 + * time 提现时间 + * price 提现金额 + */ +export const getWithdrawList = (params) => { + return request.request({ + url: '/tgb/api/v1/withdrawal/get', + method: 'get', + params, + }); +}; + +/** + * 获取提现列表 + * @param {object} params + * uuid 提现订单id + * @returns {object} data + */ +export const solveWithdraw = (params) => { + return request.request({ + url: '/tgb/api/v1/withdrawal/solve', + method: 'get', + params, + }); +}; diff --git a/src/styles/antdGlobal.less b/src/styles/antdGlobal.less index 41e95a3..a7596d8 100644 --- a/src/styles/antdGlobal.less +++ b/src/styles/antdGlobal.less @@ -176,7 +176,7 @@ .ant-pro-table-list-toolbar-container { flex-direction: column; justify-content: flex-start; - padding: 0 0 20px 0; + padding: 20px 0 20px 0; .ant-pro-table-list-toolbar-left { .ant-space-item { margin-bottom: 16px; diff --git a/src/utils/bigNumber.ts b/src/utils/bigNumber.ts new file mode 100644 index 0000000..2c96fcf --- /dev/null +++ b/src/utils/bigNumber.ts @@ -0,0 +1,6 @@ +import BigNumber from 'bignumber.js'; + +export const BIG_ZERO = new BigNumber(0); +export const BIG_ONE = new BigNumber(1); +export const BIG_NINE = new BigNumber(9); +export const BIG_TEN = new BigNumber(10); diff --git a/src/utils/formatBalance.ts b/src/utils/formatBalance.ts new file mode 100644 index 0000000..8cbe1b5 --- /dev/null +++ b/src/utils/formatBalance.ts @@ -0,0 +1,6 @@ +import BigNumber from 'bignumber.js'; +import { BIG_TEN } from './bigNumber'; + +export const getBalanceAmount = (amount: BigNumber, decimals = 18) => { + return new BigNumber(amount).dividedBy(BIG_TEN.pow(decimals)); +};