From 6f48d42f83836c91beeaaf4ad4b1c1beef60724b Mon Sep 17 00:00:00 2001 From: yyy9608 Date: Thu, 14 Mar 2024 11:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=87=E6=B3=A8=EF=BC=8C?= =?UTF-8?q?=E5=81=9C=E7=94=A8=EF=BC=8C=E5=8C=BA=E5=88=86AB=E4=BB=93?= =?UTF-8?q?=E7=9B=88=E5=88=A9=E4=BA=8F=E6=8D=9F=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 - src/components/MyTable/index.tsx | 1 + src/config/index.ts | 4 +- src/package/SimpleTrade/api/client.ts | 12 ++ src/package/SimpleTrade/api/index.ts | 10 +- .../SimpleTrade/pages/client/user/index.tsx | 70 +++++++++- src/package/SimpleTrade/pages/home/index.tsx | 127 +++++++++++++++--- 7 files changed, 195 insertions(+), 31 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 731d086..0000000 --- a/.env +++ /dev/null @@ -1,2 +0,0 @@ -REACT_APP_BASE_URL= -REACT_APP_WALLET_BASE_URL = 'test' \ No newline at end of file diff --git a/src/components/MyTable/index.tsx b/src/components/MyTable/index.tsx index 69f18ae..6bb9b17 100644 --- a/src/components/MyTable/index.tsx +++ b/src/components/MyTable/index.tsx @@ -250,6 +250,7 @@ const MyTable: FC = forwardRef( onChange={onTableChange} size={tableSize} showHeader={showHeader} + scroll={{ x: 1800 }} pagination={{ size: pagationSize, total, diff --git a/src/config/index.ts b/src/config/index.ts index 328b30e..f85cb83 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,10 +1,10 @@ export const httpIp = { simpleTradeKey: { - dev: 'http://14.29.101.215:30303/api/v1', + dev: 'http://125.94.244.254:30303/api/v1', prod: 'https://simpletrade.site/api/v1' } } export const getBaseURL = () => { - return httpIp.simpleTradeKey.prod + return httpIp.simpleTradeKey.dev } diff --git a/src/package/SimpleTrade/api/client.ts b/src/package/SimpleTrade/api/client.ts index b50c1ed..828350b 100644 --- a/src/package/SimpleTrade/api/client.ts +++ b/src/package/SimpleTrade/api/client.ts @@ -89,5 +89,17 @@ export default { */ close_order(params: object): Promise> { return $axios.post('/admin/forex/orderClose', params); + }, + /** + * @description 修改昵称 + */ + user_rename(params: object): Promise> { + return $axios.post('/admin/user/upRemark', params); + }, + /** + * @description 修改昵称 + */ + user_deactivate(params: object): Promise> { + return $axios.post('/admin/user/upDeactivate', params); } } \ No newline at end of file diff --git a/src/package/SimpleTrade/api/index.ts b/src/package/SimpleTrade/api/index.ts index e634679..9388bda 100644 --- a/src/package/SimpleTrade/api/index.ts +++ b/src/package/SimpleTrade/api/index.ts @@ -18,7 +18,14 @@ export default { // 首页充值提现统计 recharge_withdraw_statistics(): Promise> { - return $axios.post('/admin/depositWithdrawal') + return $axios.post('/admin/depositWithdrawal', { type: 1 }) + }, + + // 首页周期充值提现统计 + week_recharge_withdraw_statistics( + params: object + ): Promise> { + return $axios.post('/admin/depositWithdrawal', params) }, /** @@ -30,5 +37,4 @@ export default { transaction_statistics(params?: object): Promise> { return $axios.post('/admin/prodruct', params) } - } diff --git a/src/package/SimpleTrade/pages/client/user/index.tsx b/src/package/SimpleTrade/pages/client/user/index.tsx index 209faef..e01e502 100644 --- a/src/package/SimpleTrade/pages/client/user/index.tsx +++ b/src/package/SimpleTrade/pages/client/user/index.tsx @@ -1,7 +1,7 @@ import React, { FC, useEffect, useMemo, useRef, useState } from "react"; import clientApi from "@/package/SimpleTrade/api/client"; import MyTable from "@/components/MyTable"; -import { Button, Input, Modal, notification, Select } from "antd"; +import { Button, Input, Modal, notification, Popconfirm, Select } from "antd"; import { copy, splitAddress } from "@/utils"; import { CopyOutlined } from "@ant-design/icons"; @@ -25,6 +25,10 @@ const UserList: FC = () => { title: '邮箱', dataIndex: 'email' }, + { + title: '备注昵称', + dataIndex: 'remark' + }, { title: '地址', dataIndex: 'address', @@ -91,15 +95,25 @@ const UserList: FC = () => { title: '操作', dataIndex: 'operations', align: 'center', + fixed: 'right', key: Date.now(), + width: 180, render: (text, record) => { return (
- +
+ + +
+
+ deactivateAccount(record.invite_code,record.deactivate)}> + + +
) } @@ -113,6 +127,50 @@ const UserList: FC = () => { initialValue: '' } ] + const nicknameRefs = useRef(null) + + const deactivateAccount = async (code:string,status:boolean)=>{ + const res:any = await clientApi.user_deactivate({ + invite_code:code, + deactivate:!status + }) + if(res.code === 0){ + notification.success({ + message: !status ? '停用成功' : '启用成功' + }) + tableRefs.current?.update() + } + } + + const rename = async (name: string, code: string) => { + Modal.confirm({ + title: '修改昵称', + content: ( + + ), + onOk: async () => { + let _name = nicknameRefs.current.state.value + const res: any = await clientApi.user_rename({ + invite_code: code, + remark: _name + }) + if (res.code === 0) { + notification.success({ + message: '设置成功' + }) + tableRefs.current?.update() + } + }, + onCancel: () => { + nicknameRefs.current && nicknameRefs.current.setValue('') + }, + + }) + setTimeout(() => { + nicknameRefs.current && nicknameRefs.current.setValue(name) + }, 100) + + } const setLevel = async () => { if (currentItem.level === lv) { diff --git a/src/package/SimpleTrade/pages/home/index.tsx b/src/package/SimpleTrade/pages/home/index.tsx index 57a5953..1b290f2 100644 --- a/src/package/SimpleTrade/pages/home/index.tsx +++ b/src/package/SimpleTrade/pages/home/index.tsx @@ -23,13 +23,16 @@ const Home: FC = () => { const start_time = dayjs().subtract(7, 'days') const end_time = dayjs() - const [defaultValue, setDefaultValue] = useState([start_time, end_time] as any) + const [defaultValue, setDefaultValue] = useState([start_time, end_time] as any) //周期合约时间 + const [withdrawTime, setWithdrawTime] = useState([start_time, end_time] as any) //周期充值提现时间 const [toDayTx, setToDayTx] = useState([ { title: '今日订单金额', value: '0' }, { title: '今日订单数量', value: '0' }, - { title: '盈利订单数量', value: '0', color: '#3BB900' }, - { title: '亏损订单数量', value: '0', color: '#F4002C' }, + { title: 'A仓盈利订单数量', value: '0', color: '#3BB900' }, + { title: 'B仓盈利订单数量', value: '0', color: '#3BB900' }, + { title: 'A仓亏损订单数量', value: '0', color: '#F4002C' }, + { title: 'B仓亏损订单数量', value: '0', color: '#F4002C' }, { title: '盈利订单金额', value: '0', color: '#3BB900' }, { title: '亏损订单金额', value: '0', color: '#F4002C' }, ]) @@ -37,13 +40,16 @@ const Home: FC = () => { const [weekTx, setWeekTx] = useState([ { title: '订单总金额', value: '0' }, { title: '订单总数量', value: '0' }, - { title: '盈利订单数量', value: '0', color: '#3BB900' }, - { title: '亏损订单数量', value: '0', color: '#F4002C' }, + { title: 'A仓盈利订单数量', value: '0', color: '#3BB900' }, + { title: 'B仓盈利订单数量', value: '0', color: '#3BB900' }, + { title: 'A仓亏损订单数量', value: '0', color: '#F4002C' }, + { title: 'B仓亏损订单数量', value: '0', color: '#F4002C' }, { title: '盈利订单金额', value: '0', color: '#3BB900' }, { title: '亏损订单金额', value: '0', color: '#F4002C' }, ]) const [transaction, setTransaction] = useState([]) + const [weekTransaction, setWeekTransaction] = useState([]) // 用户统计 const getUserData = async () => { @@ -67,28 +73,45 @@ const Home: FC = () => { if (res.code === 0) { weekTx[0].value = res.data.product_amount weekTx[1].value = res.data.product_num - weekTx[2].value = res.data.profit_num - weekTx[3].value = res.data.loss_num - weekTx[4].value = res.data.profit_amount - weekTx[5].value = res.data.loss_amount + weekTx[2].value = res.data.a_profit_num + weekTx[3].value = res.data.b_profit_num + weekTx[4].value = res.data.a_loss_num + weekTx[5].value = res.data.b_loss_num + weekTx[6].value = res.data.profit_amount + weekTx[7].value = res.data.loss_amount setWeekTx([...weekTx]) } } + // 周期充值提现 + const getWeekTransaction = async () => { + const start = Math.floor(withdrawTime[0].valueOf() / 1000) + const end = Math.floor(withdrawTime[1].valueOf() / 1000) + const res: any = await api.week_recharge_withdraw_statistics({ + end_time: end, + start_time: start, + type: 2 + }) + if (res.code === 0 && res.data) { + + setWeekTransaction(res.data) + } + } + // 今日合约交易订单统计 const getDayTxOrderStatic = async () => { const res: any = await api.transaction_statistics({ type: 1 }) - console.log(res); - if (res.code === 0) { - toDayTx[0].value = res.data.product_amount - toDayTx[1].value = res.data.product_num - toDayTx[2].value = res.data.profit_num - toDayTx[3].value = res.data.loss_num - toDayTx[4].value = res.data.profit_amount - toDayTx[5].value = res.data.loss_amount + weekTx[0].value = res.data.product_amount + weekTx[1].value = res.data.product_num + weekTx[2].value = res.data.a_profit_num + weekTx[3].value = res.data.b_profit_num + weekTx[4].value = res.data.a_loss_num + weekTx[5].value = res.data.b_loss_num + weekTx[6].value = res.data.profit_amount + weekTx[7].value = res.data.loss_amount setToDayTx([...toDayTx]) } } @@ -99,7 +122,6 @@ const Home: FC = () => { if (res.code === 0) { setTransaction(res.data) } - console.log(res); } useEffect(() => { @@ -112,6 +134,10 @@ const Home: FC = () => { getWeekTxOrderStatic() }, [defaultValue]) + useEffect(() => { + getWeekTransaction() + }, [withdrawTime]) + return (

Hello, Randy!

@@ -188,7 +214,7 @@ const Home: FC = () => {
-
导出
+ {/*
导出
*/}
@@ -255,6 +281,69 @@ const Home: FC = () => {
} + {/* */} + {weekTransaction[0] && weekTransaction[1] && ( +
+
+ +
+
+
+
{weekTransaction[0].symbol} 周期充值提现
+ {/*
净入金:2131223
+
充值提现比:150%
*/} +
+
+
总充值
+
{Number(weekTransaction[0].deposit_amount).toLocaleString()}
+
+
+
充值笔数
+
{weekTransaction[0].deposit_num}
+
+
+
+
+
总提现
+
{Number(weekTransaction[0].withdrawal_amount).toLocaleString()}
+
+
+
提现笔数
+
{weekTransaction[0].withdrawal_num}
+
+
+
+
+
+
{weekTransaction[1].symbol} 周期充值提现
+
+
+
总充值
+
{Number(weekTransaction[1].deposit_amount).toLocaleString()}
+
+
+
充值笔数
+
{weekTransaction[1].deposit_num}
+
+
+
+
+
总提现
+
{Number(weekTransaction[1].withdrawal_amount).toLocaleString()}
+
+
+
提现笔数
+
{weekTransaction[1].withdrawal_num}
+
+
+
+
+
+ )}
)