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.

123 lines
3.1 KiB

2 years ago
2 years ago
2 years ago
  1. import React, { FC, useRef } from "react";
  2. import clientApi from "@/package/SimpleTrade/api/client";
  3. import MyTable from "@/components/MyTable";
  4. import { Button, Input, notification, Popconfirm } from "antd";
  5. import { CopyOutlined } from "@ant-design/icons";
  6. import { copy, getTime, splitAddress } from "@/utils";
  7. import { Withdraw_Check } from "@/package/SimpleTrade/types/enum";
  8. const WithdrawRecord: FC = () => {
  9. const tableRefs = useRef(null)
  10. const columns = [
  11. {
  12. title: '账号ID',
  13. dataIndex: 'a_mt4_login'
  14. },
  15. {
  16. title: '交易ID',
  17. dataIndex: 'tx_hash',
  18. render: (tx_hash) => (
  19. <div style={{ display: 'flex', alignItems: 'center' }}>
  20. <div>{splitAddress(tx_hash, 5)}</div>
  21. <div style={{ marginLeft: 5, cursor: 'pointer' }} onClick={() => copy(tx_hash)}>
  22. <CopyOutlined />
  23. </div>
  24. </div>
  25. )
  26. },
  27. {
  28. title: '链ID',
  29. dataIndex: 'chain_id'
  30. },
  31. {
  32. title: '提币地址',
  33. dataIndex: 'to_address',
  34. render: (to_address) => (
  35. <div style={{ display: 'flex', alignItems: 'center' }}>
  36. <div>{splitAddress(to_address, 5)}</div>
  37. <div style={{ marginLeft: 5, cursor: 'pointer' }} onClick={() => copy(to_address)}>
  38. <CopyOutlined />
  39. </div>
  40. </div>
  41. )
  42. },
  43. {
  44. title: '数量',
  45. dataIndex: 'amount'
  46. },
  47. {
  48. title: '币种',
  49. dataIndex: 'symbol'
  50. },
  51. {
  52. title: '提现状态',
  53. dataIndex: 'status'
  54. },
  55. {
  56. title: '处理时间',
  57. dataIndex: 'handle_time',
  58. render: (time) => (
  59. <div>{getTime(time * 1000)}</div>
  60. )
  61. },
  62. {
  63. title: '操作',
  64. dataIndex: 'operations',
  65. align: 'center',
  66. key: Date.now(),
  67. render: (_, item) => {
  68. return item.check_status === 1 ? (<div>
  69. <Popconfirm
  70. title="确认拒绝吗?"
  71. onConfirm={() => handleOrder(item, Withdraw_Check.WithdrawCheckReject)}
  72. >
  73. <Button size="small" type="primary" danger style={{ marginRight: 20 }}></Button>
  74. </Popconfirm>
  75. <Popconfirm
  76. title="确认同意吗?"
  77. onConfirm={() => handleOrder(item, Withdraw_Check.WithdrawCheckAgree)}
  78. >
  79. <Button size="small" type="primary"></Button>
  80. </Popconfirm>
  81. </div>) : (<></>)
  82. }
  83. }
  84. ]
  85. // 搜索栏配置项
  86. const searchConfigList = [
  87. {
  88. key: 'name',
  89. slot: <Input placeholder="用户名" allowClear />,
  90. initialValue: ''
  91. }
  92. ]
  93. const handleOrder = async (item, type: Withdraw_Check) => {
  94. const res: any = await clientApi.withdraw_check({
  95. id: item.id,
  96. status: type
  97. })
  98. if (res.code === 0) {
  99. notification.success({
  100. message: type === Withdraw_Check.WithdrawCheckAgree ? '已同意' : '已拒绝'
  101. })
  102. tableRefs.current?.update()
  103. }
  104. }
  105. return (
  106. <div>
  107. <MyTable
  108. ref={tableRefs}
  109. columns={columns}
  110. apiFun={clientApi.withdraw_list}
  111. searchConfigList={searchConfigList}
  112. rowKey="id"
  113. />
  114. </div>
  115. )
  116. };
  117. export default WithdrawRecord;