123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import React, { useEffect, useState } from "react"
- import TableData from "../../components/TableData"
- import columns12 from './tableConfig'
- import { useAjax } from "@/Hook/useAjax"
- import { PromoteTotalProps, getPromoteTotalListApi } from "@/services/gameData/extensionData"
- import QueryForm from "@/components/QueryForm"
- import moment from "moment"
- import { getGameChoiceParentListType1Api } from "@/services/gameData"
- const Total: React.FC = () => {
- /************************************/
- const [queryForm, setQueryForm] = useState<PromoteTotalProps>({
- pageNum: 1,
- pageSize: 20,
- costBeginDay: moment().subtract(30, 'd').format('YYYY-MM-DD'),
- costEndDay: moment().format('YYYY-MM-DD'),
- rechargeBeginDay: moment().subtract(30, 'd').format('YYYY-MM-DD'),
- rechargeEndDay: moment().format('YYYY-MM-DD'),
- })
- const [gameType, setGameType] = useState<any>({})
- const getPromoteTotalList = useAjax((params) => getPromoteTotalListApi(params))
- const getGameChoiceParentListType1 = useAjax(() => getGameChoiceParentListType1Api())
- /************************************/
- useEffect(() => {
- getPromoteTotalList.run(queryForm)
- }, [queryForm])
- useEffect(() => {
- getGameChoiceParentListType1.run().then(res => {
- let newType: any = {}
- res.forEach((item: { id: number, name: string }) => {
- newType[item.id] = item.name
- })
- setGameType(newType)
- })
- }, [])
- return <div>
- <TableData
- leftChild={<QueryForm
- initialValues={{ consumeDay: [moment().subtract(30, 'd'), moment()], rechargeDay: [moment().subtract(30, 'd'), moment()] }}
- onChange={(data: any) => {
- const { pitcherId, rechargeDay, ...params } = data
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
- newQueryForm.pageNum = 1
- if (rechargeDay && rechargeDay?.length === 2) {
- newQueryForm['rechargeBeginDay'] = moment(rechargeDay[0]).format('YYYY-MM-DD')
- newQueryForm['rechargeEndDay'] = moment(rechargeDay[1]).format('YYYY-MM-DD')
- } else {
- delete newQueryForm['rechargeBeginDay']
- delete newQueryForm['rechargeEndDay']
- }
- newQueryForm.sysUserId = pitcherId
- setQueryForm({ ...newQueryForm, ...params })
- }}
- isSource
- isAccountId
- isAgentId
- isConsumeDay
- isCpName
- isGameName
- isGameType
- rechargeDay={{}}
- isSysUserId
- />}
- scroll={{ x: 1000, y: 600 }}
- ajax={getPromoteTotalList}
- dataSource={getPromoteTotalList?.data?.records}
- total={getPromoteTotalList?.data?.total}
- page={queryForm.pageNum}
- pageSize={queryForm.pageSize}
- fixed={{ left: 5, right: 0 }}
- title='推广总数据'
- onChange={(props: any) => {
- console.log('props--->', props)
- let { pagination, sortData } = props
- let { current, pageSize } = pagination
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
- if (sortData && sortData?.order) {
- newQueryForm['sortType'] = sortData?.order === 'ascend' ? 'asc' : 'desc'
- newQueryForm['sortFiled'] = sortData?.field
- } else {
- delete newQueryForm['sortType']
- delete newQueryForm['sortFiled']
- }
- newQueryForm.pageNum = current
- newQueryForm.pageSize = pageSize
- setQueryForm({ ...newQueryForm })
- }}
- config={columns12(gameType)}
- configName={'推广总数据'}
- />
- </div>
- }
- export default Total
|