Browse Source

添加备注,停用,区分AB仓盈利亏损数量

master
yyy9608 6 months ago
parent
commit
6f48d42f83
  1. 2
      .env
  2. 1
      src/components/MyTable/index.tsx
  3. 4
      src/config/index.ts
  4. 12
      src/package/SimpleTrade/api/client.ts
  5. 10
      src/package/SimpleTrade/api/index.ts
  6. 70
      src/package/SimpleTrade/pages/client/user/index.tsx
  7. 127
      src/package/SimpleTrade/pages/home/index.tsx

2
.env

@ -1,2 +0,0 @@
REACT_APP_BASE_URL=
REACT_APP_WALLET_BASE_URL = 'test'

1
src/components/MyTable/index.tsx

@ -250,6 +250,7 @@ const MyTable: FC<TableProps> = forwardRef(
onChange={onTableChange}
size={tableSize}
showHeader={showHeader}
scroll={{ x: 1800 }}
pagination={{
size: pagationSize,
total,

4
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
}

12
src/package/SimpleTrade/api/client.ts

@ -89,5 +89,17 @@ export default {
*/
close_order(params: object): Promise<CommonObjectType<string>> {
return $axios.post('/admin/forex/orderClose', params);
},
/**
* @description
*/
user_rename(params: object): Promise<CommonObjectType<string>> {
return $axios.post('/admin/user/upRemark', params);
},
/**
* @description
*/
user_deactivate(params: object): Promise<CommonObjectType<string>> {
return $axios.post('/admin/user/upDeactivate', params);
}
}

10
src/package/SimpleTrade/api/index.ts

@ -18,7 +18,14 @@ export default {
// 首页充值提现统计
recharge_withdraw_statistics(): Promise<CommonObjectType<string>> {
return $axios.post('/admin/depositWithdrawal')
return $axios.post('/admin/depositWithdrawal', { type: 1 })
},
// 首页周期充值提现统计
week_recharge_withdraw_statistics(
params: object
): Promise<CommonObjectType<string>> {
return $axios.post('/admin/depositWithdrawal', params)
},
/**
@ -30,5 +37,4 @@ export default {
transaction_statistics(params?: object): Promise<CommonObjectType<string>> {
return $axios.post('/admin/prodruct', params)
}
}

70
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 (
<div>
<Button type="primary" className="btn" size="small" onClick={() => {
setCurrentItem(record)
setIsModalOpen(true)
setLv(record.level)
}}></Button>
<div>
<Button type="primary" className="btn" size="small" onClick={() => {
setCurrentItem(record)
setIsModalOpen(true)
setLv(record.level)
}}></Button>
<Button style={{ marginLeft: 10 }} type="primary" className="btn" size="small" onClick={() => rename(record.remark, record.invite_code)}></Button>
</div>
<div style={{ marginTop: 10 }}>
<Popconfirm title={`确认${!record.deactivate?'停用':'启用'}账号?`} onConfirm={()=>deactivateAccount(record.invite_code,record.deactivate)}>
<Button type="primary" className="btn" size="small" danger={!record.deactivate}>{!record.deactivate ? '停用账号' :'启用账号'}</Button>
</Popconfirm>
</div>
</div>
)
}
@ -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: (
<Input ref={nicknameRefs} placeholder="请输入昵称" />
),
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) {

127
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 (
<div className='home' style={{ minHeight: '80vh', backgroundColor: theme && '#fff' }}>
<h3>Hello, Randy!</h3>
@ -188,7 +214,7 @@ const Home: FC = () => {
</div>
</div>
<div className='row-items'>
<div></div>
{/* <div>导出</div> */}
</div>
</div>
<div style={{ marginTop: 20, textAlign: 'center', flexWrap: 'wrap' }} className='row-items'>
@ -255,6 +281,69 @@ const Home: FC = () => {
</div>
</div>
</div>}
{/* */}
{weekTransaction[0] && weekTransaction[1] && (
<div className='box' style={{ marginTop: 30, backgroundColor: theme ? '#f5f5f5' : '#333' }}>
<div>
<RangePicker
defaultValue={withdrawTime}
onChange={setWithdrawTime}
format={dateFormat}
/>
</div>
<div className='row' style={{ marginTop: 20 }}>
<div style={{ flex: 4 }}>
<div style={{ fontWeight: 'bold', fontSize: 14 }}>{weekTransaction[0].symbol} </div>
{/* <div style={{ fontSize: 14, marginTop: 30 }}><span style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>2131223</span></div>
<div style={{ fontSize: 14, marginTop: 30 }}><span style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>150%</span></div> */}
<div className='row' style={{ textAlign: 'center', marginTop: 30 }}>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{Number(weekTransaction[0].deposit_amount).toLocaleString()}</div>
</div>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{weekTransaction[0].deposit_num}</div>
</div>
</div>
<div className='row' style={{ textAlign: 'center', marginTop: 20 }}>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{Number(weekTransaction[0].withdrawal_amount).toLocaleString()}</div>
</div>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{weekTransaction[0].withdrawal_num}</div>
</div>
</div>
</div>
<div className='solid' style={{ backgroundColor: theme ? '#e8e8e8' : '#555', margin: '0 20px' }}></div>
<div style={{ flex: 4 }}>
<div style={{ fontWeight: 'bold', fontSize: 14 }}>{weekTransaction[1].symbol} </div>
<div className='row' style={{ textAlign: 'center', marginTop: 30 }}>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{Number(weekTransaction[1].deposit_amount).toLocaleString()}</div>
</div>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{weekTransaction[1].deposit_num}</div>
</div>
</div>
<div className='row' style={{ textAlign: 'center', marginTop: 20 }}>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{Number(weekTransaction[1].withdrawal_amount).toLocaleString()}</div>
</div>
<div style={{ flex: 1 }}>
<div></div>
<div style={{ fontSize: 20, color: '#3BB900', fontWeight: 'bold' }}>{weekTransaction[1].withdrawal_num}</div>
</div>
</div>
</div>
</div>
</div>
)}
<div style={{ display: 'block', height: 30 }}></div>
</div >
)

Loading…
Cancel
Save