You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.6 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
7 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. import api from "@/api"
  2. import MyTable from "@/components/MyTable"
  3. import { getTime } from "@/utils"
  4. import { EditOutlined } from "@ant-design/icons"
  5. import { Button, Form, Input, Modal, Switch, notification } from "antd"
  6. import React, { useRef, useState } from "react"
  7. const WithdrawReview = () => {
  8. const [visible, setVisible] = useState(false)
  9. const [currentItem, setCurrentItem] = useState({} as any)
  10. const tableRef = useRef(null)
  11. const currentType = useRef(1)
  12. const [form] = Form.useForm()
  13. const columns = [
  14. {
  15. title: '操作',
  16. width: 100,
  17. render: (row) => {
  18. return row.status_code === 0 ? (
  19. <div style={{ display: "flex", alignItems: 'center' }}>
  20. <EditOutlined onClick={() => {
  21. setCurrentItem(() => row)
  22. setVisible(true)
  23. }} />
  24. </div>
  25. ) : <></>
  26. }
  27. },
  28. { "dataIndex": "Withdraw_method", "title": "取款方式" },
  29. { "dataIndex": "withdraw_source", "title": "取款来自" },
  30. { "dataIndex": "account", "title": "MT账户" },
  31. { "dataIndex": "address", "title": "钱包地址" },
  32. { "dataIndex": "amount", "title": "取款金额" },
  33. { "dataIndex": "time", "title": "时间", render: (time) => (<div>{getTime(time * 1000)}</div>) },
  34. { "dataIndex": "name", "title": "姓名" },
  35. { "dataIndex": "email", "title": "用户" },
  36. { "dataIndex": "fee", "title": "取款手续费" },
  37. { "dataIndex": "order", "title": "订单号" },
  38. { "dataIndex": "status", "title": "状态" },
  39. { "dataIndex": "status_code", "title": "状态码" },
  40. { "dataIndex": "symbol", "title": "币种" },
  41. { "dataIndex": "type", "title": "钱包类型" },
  42. ]
  43. const onFinish = async (values) => {
  44. setVisible(false)
  45. const res: any = await api.review_withdrawReview({
  46. ...values,
  47. id: currentItem.id,
  48. status_code: currentType.current
  49. })
  50. if (res.code === 0) {
  51. tableRef.current.update()
  52. form.resetFields()
  53. notification.success({
  54. message: currentType.current === 1 ? '已拒绝' : '已同意'
  55. })
  56. }
  57. }
  58. return (
  59. <div>
  60. <MyTable
  61. apiFun={api.get_withdrawReviewList}
  62. columns={columns}
  63. ref={tableRef}
  64. />
  65. <Modal
  66. visible={visible}
  67. onCancel={() => setVisible(false)}
  68. footer={() => null}
  69. title={`取款审核:${currentItem.email}`}
  70. >
  71. <Form form={form} onFinish={onFinish}>
  72. <div style={{ display: 'flex' }}>
  73. <Form.Item label="用户" style={{ flex: 1 }}>
  74. <div>{currentItem.email}</div>
  75. </Form.Item>
  76. </div>
  77. <div style={{ display: 'flex' }}>
  78. <Form.Item label="钱包地址" style={{ flex: 1 }}>
  79. <div>{currentItem.address}</div>
  80. </Form.Item>
  81. </div>
  82. <div style={{ display: 'flex' }}>
  83. <Form.Item label="取款方式" style={{ flex: 1 }}>
  84. <div>{currentItem.Withdraw_method}</div>
  85. </Form.Item>
  86. <Form.Item label="取款来自" style={{ flex: 1 }}>
  87. <div>{currentItem.withdraw_source}</div>
  88. </Form.Item>
  89. </div>
  90. <div style={{ display: 'flex' }}>
  91. <Form.Item label="取款金额" style={{ flex: 1 }}>
  92. <div>{currentItem.amount}</div>
  93. </Form.Item>
  94. <Form.Item label="取款手续费" style={{ flex: 1 }}>
  95. <div>{currentItem.fee}</div>
  96. </Form.Item>
  97. </div>
  98. <div style={{ display: 'flex' }}>
  99. <Form.Item label="取款币种" style={{ flex: 1 }}>
  100. <div>{currentItem.symbol}</div>
  101. </Form.Item>
  102. <Form.Item label="时间" style={{ flex: 1 }}>
  103. <div>{getTime(currentItem.time * 1000)}</div>
  104. </Form.Item>
  105. </div>
  106. <Form.Item name="reason" label="原因" initialValue="">
  107. <Input placeholder="请输入原因" />
  108. </Form.Item>
  109. <Form.Item label="邮箱通知" name="email_flag" initialValue={false} valuePropName="checked">
  110. <Switch />
  111. </Form.Item>
  112. <Form.Item>
  113. <Button onClick={() => setVisible(false)}></Button>
  114. <Button style={{ margin: '0 10px', backgroundColor: "#FF8C00", borderColor: '#FF8C00' }} type="primary" htmlType="submit" onClick={() => currentType.current = 1}></Button>
  115. <Button type="primary" htmlType="submit" onClick={() => currentType.current = 2}></Button>
  116. </Form.Item>
  117. </Form>
  118. </Modal>
  119. </div>
  120. )
  121. }
  122. export default WithdrawReview