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.

239 lines
5.7 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. import { title } from 'process'
  2. import MyTable from '../../../components/MyTable'
  3. import '../../../styles/home.scss'
  4. import { observer } from 'mobx-react'
  5. import store from '../../../store'
  6. import { useMemo } from 'react'
  7. import { ConfigProvider, Tabs } from 'antd'
  8. import { http_account_assetsRecords, http_cash } from '../../../http/api'
  9. import { getTime } from '../../../utils'
  10. const AssetsRecords = () => {
  11. const { screenWidth } = store.state
  12. const containerWidth = useMemo(() => {
  13. if (screenWidth > 1420) {
  14. return 1420 - 310
  15. }
  16. if (screenWidth > 1000) {
  17. return screenWidth - 320
  18. }
  19. return screenWidth - 30
  20. }, [screenWidth])
  21. const AccountRecord = () => (
  22. <div className="container p-2" style={{ '--screen': `${containerWidth}px` } as React.CSSProperties}>
  23. <MyTable
  24. apiFun={http_account_assetsRecords}
  25. columns={[
  26. {
  27. title: '状态',
  28. dataIndex: 'status',
  29. width: 150
  30. },
  31. {
  32. title: '时间',
  33. dataIndex: 'time',
  34. width: 200,
  35. render: (time: number) => (
  36. <span>{getTime(time * 1000)}</span>
  37. )
  38. },
  39. {
  40. title: '事件',
  41. dataIndex: 'event',
  42. width: 150
  43. },
  44. {
  45. title: '订单',
  46. dataIndex: 'order',
  47. width: 120
  48. },
  49. {
  50. title: '账户',
  51. dataIndex: 'account'
  52. },
  53. {
  54. title: '金额',
  55. dataIndex: 'amount',
  56. render: (val: string) => (
  57. <span>${val}</span>
  58. )
  59. },
  60. {
  61. title: '描述',
  62. dataIndex: 'describe'
  63. },
  64. ]}
  65. />
  66. </div>
  67. )
  68. const WalletToAsseetRecord = () => (
  69. <div className="container p-2" style={{ '--screen': `${containerWidth}px` } as React.CSSProperties}>
  70. <MyTable
  71. apiFun={http_cash}
  72. extraProps={{ type: 1 }}
  73. columns={[
  74. {
  75. title: '时间',
  76. dataIndex: 'time',
  77. width: 200,
  78. render: (time: number) => (
  79. <span>{getTime(time * 1000)}</span>
  80. )
  81. },
  82. {
  83. title: '订单',
  84. dataIndex: 'order',
  85. },
  86. {
  87. title: '描述',
  88. dataIndex: 'describe',
  89. },
  90. {
  91. title: '金额',
  92. dataIndex: 'amount'
  93. },
  94. {
  95. title: '剩余',
  96. dataIndex: 'balance',
  97. render: (val: string) => (
  98. <span>${val}</span>
  99. )
  100. },
  101. {
  102. title: '状态',
  103. dataIndex: 'status'
  104. },
  105. ]}
  106. />
  107. </div>
  108. )
  109. const AssetToVipRecords = () => (
  110. <div className="container p-2" style={{ '--screen': `${containerWidth}px` } as React.CSSProperties}>
  111. <MyTable
  112. apiFun={http_cash}
  113. extraProps={{ type: 2 }}
  114. columns={[
  115. {
  116. title: '时间',
  117. dataIndex: 'time',
  118. width: 200,
  119. render: (time: number) => (
  120. <span>{getTime(time * 1000)}</span>
  121. )
  122. },
  123. {
  124. title: '订单',
  125. dataIndex: 'order',
  126. },
  127. {
  128. title: '描述',
  129. dataIndex: 'describe',
  130. },
  131. {
  132. title: '金额',
  133. dataIndex: 'amount'
  134. },
  135. {
  136. title: '剩余',
  137. dataIndex: 'balance',
  138. render: (val: string) => (
  139. <span>${val}</span>
  140. )
  141. },
  142. {
  143. title: '状态',
  144. dataIndex: 'status'
  145. },
  146. ]}
  147. />
  148. </div>
  149. )
  150. const AssetToWalletRecords = () => (
  151. <div className="container p-2" style={{ '--screen': `${containerWidth}px` } as React.CSSProperties}>
  152. <MyTable
  153. apiFun={http_cash}
  154. extraProps={{ type: 3 }}
  155. columns={[
  156. {
  157. title: '时间',
  158. dataIndex: 'time',
  159. width: 200,
  160. render: (time: number) => (
  161. <span>{getTime(time * 1000)}</span>
  162. )
  163. },
  164. {
  165. title: '订单',
  166. dataIndex: 'order',
  167. },
  168. {
  169. title: '描述',
  170. dataIndex: 'describe',
  171. },
  172. {
  173. title: '金额',
  174. dataIndex: 'amount'
  175. },
  176. {
  177. title: '剩余',
  178. dataIndex: 'balance',
  179. render: (val: string) => (
  180. <span>${val}</span>
  181. )
  182. },
  183. {
  184. title: '状态',
  185. dataIndex: 'status'
  186. },
  187. ]}
  188. />
  189. </div>
  190. )
  191. return (
  192. <div className="records" >
  193. <div className='text-white fz-22'></div>
  194. <ConfigProvider theme={{
  195. components: {
  196. Tabs: {
  197. itemColor: '#fff',
  198. itemSelectedColor: '#f7b93f',
  199. inkBarColor: '#f7b93f'
  200. }
  201. }
  202. }}>
  203. <Tabs defaultActiveKey='1' tabPosition="top" items={[
  204. {
  205. key: '1',
  206. label: '资金账户记录',
  207. children: AccountRecord(),
  208. },
  209. {
  210. key: '2',
  211. label: '现金钱包->资金账户',
  212. children: WalletToAsseetRecord(),
  213. },
  214. {
  215. key: '3',
  216. label: '现金钱包->其他会员',
  217. children: AssetToVipRecords(),
  218. },
  219. {
  220. key: '4',
  221. label: '资产账户->现金钱包',
  222. children: AssetToWalletRecords(),
  223. }
  224. ]} />
  225. </ConfigProvider>
  226. </div >
  227. )
  228. }
  229. export default observer(AssetsRecords)