import api from "@/api"
import MyTable from "@/components/MyTable"
import { getTime } from "@/utils"
import { EditOutlined } from "@ant-design/icons"
import { Button, Form, Input, Modal, Switch, notification } from "antd"
import React, { useEffect, useRef, useState } from "react"
const AssetsList = () => {
const [visible, setVisible] = useState(false)
const [currentItem, setCurrentItem] = useState({} as any)
const [form] = Form.useForm()
const currentType = useRef(1)
const tableRef = useRef(null)
const columns = [
{
title: '操作',
render: (row) => {
return row.status_code === 0 ? (
{
setCurrentItem(() => row)
setVisible(true)
}} />
) : <>>
}
},
{
title: '状态',
dataIndex: 'status',
width: 150,
},
{
title: '类型',
dataIndex: 'type',
width: 200,
},
{
title: '时间',
width: 200,
dataIndex: 'time',
render: (time) => (
{getTime(time * 1000)}
)
},
{
title: '用户',
dataIndex: 'email',
width: 240,
},
{
title: 'MT账号',
dataIndex: 'account',
width: 200,
},
{
title: '金额',
dataIndex: 'amount',
width: 200
},
{
title: '订单号',
dataIndex: 'order',
width: 200
},
{
title: '审核人',
dataIndex: 'review',
width: 200
},
]
useEffect(() => {
!visible && setCurrentItem({})
}, [visible])
const onFinish = async (values) => {
setVisible(false)
const res: any = await api.assets_review({
...values,
id: currentItem.id,
status_code: currentType.current
})
if (res.code === 0) {
tableRef.current.update()
form.resetFields()
notification.success({
message: currentType.current === 1 ? '已拒绝' : '已同意'
})
}
}
return (
}]}
/>
setVisible(false)}
footer={() => null}
title={`审核用户:${currentItem.email}`}
>
)
}
export default AssetsList