|
|
@ -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 > |
|
|
|
) |
|
|
|