index.tsx 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import { useAjax } from "@/Hook/useAjax"
  2. import { getRechargeUserListApi, UserRechargeListType } from "@/services/gameData/rankingList"
  3. import React, { useEffect, useState } from "react"
  4. import TableData from "../../components/TableData"
  5. import columns12 from "./tableConfig"
  6. import QueryForm from "@/components/QueryForm"
  7. import moment from "moment"
  8. import { getPresetsRanking } from "@/components/QueryForm/const"
  9. import TablePro from "../../components/TablePro"
  10. const Gamer: React.FC = () => {
  11. /************************/
  12. const [queryForm, setQueryForm] = useState<UserRechargeListType>({ pageNum: 1, pageSize: 50, sourceSystem: 'ZX_ONE', beginDay: moment().format('YYYY-MM-DD'), endDay: moment().format('YYYY-MM-DD') })
  13. const getRechargeUserList = useAjax((params) => getRechargeUserListApi(params))
  14. /************************/
  15. useEffect(() => {
  16. getRechargeUserList.run(queryForm)
  17. }, [queryForm])
  18. return <div>
  19. {/* <TableData
  20. leftChild={<QueryForm
  21. initialValues={{ sourceSystem: 'ZX_ONE', rechargeDay: [moment(), moment()] }}
  22. onChange={(data: any) => {
  23. console.log(data)
  24. const { rechargeDay, beginDay, endDay, regPayIntervalTime, ...par } = data
  25. let newQueryForm = JSON.parse(JSON.stringify(queryForm))
  26. newQueryForm.pageNum = 1
  27. if (rechargeDay && rechargeDay?.length === 2) {
  28. newQueryForm['beginDay'] = moment(rechargeDay[0]).format('YYYY-MM-DD')
  29. newQueryForm['endDay'] = moment(rechargeDay[1]).format('YYYY-MM-DD')
  30. } else {
  31. if (beginDay && endDay) {
  32. newQueryForm['beginDay'] = beginDay
  33. newQueryForm['endDay'] = endDay
  34. } else {
  35. delete newQueryForm['beginDay']
  36. delete newQueryForm['endDay']
  37. }
  38. }
  39. if (regPayIntervalTime?.length > 0 && (regPayIntervalTime[0] || regPayIntervalTime[1])) {
  40. newQueryForm.latestAmountUntilNowTimeMin = regPayIntervalTime[0]
  41. newQueryForm.latestAmountUntilNowTimeMax = regPayIntervalTime[1]
  42. } else {
  43. delete newQueryForm.latestAmountUntilNowTimeMin
  44. delete newQueryForm.latestAmountUntilNowTimeMax
  45. }
  46. setQueryForm({ ...newQueryForm, ...par })
  47. }}
  48. isSource
  49. rechargeDay={{ ranges: getPresetsRanking() }}
  50. isPayIntervalTime={{ tips: '最近充值时间距今的间隔时间(分)' }}
  51. />}
  52. scroll={{ x: 1000, y: 600 }}
  53. ajax={getRechargeUserList}
  54. fixed={{ left: 1, right: 0 }}
  55. dataSource={getRechargeUserList?.data?.records}
  56. page={getRechargeUserList?.data?.current || 1}
  57. pageSize={getRechargeUserList?.data?.size || 20}
  58. total={getRechargeUserList?.data?.total || 0}
  59. title='玩家充值排行榜'
  60. onChange={(props: any) => {
  61. console.log('props--->', props)
  62. let { pagination, sortData } = props
  63. let { current, pageSize } = pagination
  64. let newQueryForm = JSON.parse(JSON.stringify(queryForm))
  65. if (sortData && sortData?.order) {
  66. newQueryForm['sortType'] = sortData?.order === 'ascend' ? 'asc' : 'desc'
  67. newQueryForm['sortFiled'] = sortData?.field
  68. } else {
  69. delete newQueryForm['sortType']
  70. delete newQueryForm['sortFiled']
  71. }
  72. newQueryForm.pageNum = current
  73. newQueryForm.pageSize = pageSize
  74. setQueryForm({ ...newQueryForm })
  75. }}
  76. config={columns12()}
  77. configName={'玩家充值排行榜'}
  78. /> */}
  79. <TablePro
  80. leftChild={<QueryForm
  81. initialValues={{ sourceSystem: 'ZX_ONE', rechargeDay: [moment(), moment()] }}
  82. onChange={(data: any) => {
  83. console.log(data)
  84. const { rechargeDay, beginDay, endDay, regPayIntervalTime, ...par } = data
  85. let newQueryForm = JSON.parse(JSON.stringify(queryForm))
  86. newQueryForm.pageNum = 1
  87. if (rechargeDay && rechargeDay?.length === 2) {
  88. newQueryForm['beginDay'] = moment(rechargeDay[0]).format('YYYY-MM-DD')
  89. newQueryForm['endDay'] = moment(rechargeDay[1]).format('YYYY-MM-DD')
  90. } else {
  91. if (beginDay && endDay) {
  92. newQueryForm['beginDay'] = beginDay
  93. newQueryForm['endDay'] = endDay
  94. } else {
  95. delete newQueryForm['beginDay']
  96. delete newQueryForm['endDay']
  97. }
  98. }
  99. if (regPayIntervalTime?.length > 0 && (regPayIntervalTime[0] || regPayIntervalTime[1])) {
  100. newQueryForm.latestAmountUntilNowTimeMin = regPayIntervalTime[0]
  101. newQueryForm.latestAmountUntilNowTimeMax = regPayIntervalTime[1]
  102. } else {
  103. delete newQueryForm.latestAmountUntilNowTimeMin
  104. delete newQueryForm.latestAmountUntilNowTimeMax
  105. }
  106. setQueryForm({ ...newQueryForm, ...par })
  107. }}
  108. isSource
  109. rechargeDay={{ ranges: getPresetsRanking() }}
  110. isPayIntervalTime={{ tips: '最近充值时间距今的间隔时间(分)' }}
  111. />}
  112. config={columns12()}
  113. configName={'玩家充值排行榜'}
  114. fixed={{ left: 1, right: 0 }}
  115. scroll={{ x: 1000, y: 600 }}
  116. title='玩家充值排行榜'
  117. loading={getRechargeUserList.loading}
  118. ajax={getRechargeUserList}
  119. page={getRechargeUserList?.data?.current || 1}
  120. pageSize={getRechargeUserList?.data?.size || 20}
  121. total={getRechargeUserList?.data?.total || 0}
  122. dataSource={getRechargeUserList?.data?.records}
  123. onChange={(pagination: any, _: any, sortData: any) => {
  124. console.log('props--->', pagination, sortData)
  125. let { current, pageSize } = pagination
  126. let newQueryForm = JSON.parse(JSON.stringify(queryForm))
  127. if (sortData && sortData?.order) {
  128. newQueryForm['sortType'] = sortData?.order === 'ascend' ? 'asc' : 'desc'
  129. newQueryForm['sortFiled'] = sortData?.field
  130. } else {
  131. delete newQueryForm['sortType']
  132. delete newQueryForm['sortFiled']
  133. }
  134. newQueryForm.pageNum = current
  135. newQueryForm.pageSize = pageSize
  136. setQueryForm({ ...newQueryForm })
  137. }}
  138. />
  139. </div>
  140. }
  141. export default Gamer