wjx 1 year ago
parent
commit
0f7c6702a0

+ 13 - 0
config/routerConfig.ts

@@ -390,6 +390,19 @@ const gameDataStatistics = {
                 },
             ]
         },
+        {
+            path: '/gameDataStatistics/stream',
+            name: '流水监控',
+            access: 'stream',
+            routes: [
+                {
+                    path: '/gameDataStatistics/stream/recharge',
+                    name: '充值历史',
+                    access: 'recharge',
+                    component: './gameDataStatistics/stream/recharge',
+                }
+            ]
+        },
         {
             path: '/gameDataStatistics/order',
             name: '订单',

+ 13 - 0
src/pages/gameDataStatistics/stream/recharge/index.less

@@ -0,0 +1,13 @@
+
+
+.ringRatio {
+    background-color: #fff2e8;
+}
+
+.ringRoi {
+    background-color: #f9f0ff;
+}
+
+.costCount {
+    background-color: #f6ffed;
+}

+ 108 - 0
src/pages/gameDataStatistics/stream/recharge/index.tsx

@@ -0,0 +1,108 @@
+import { useAjax } from "@/Hook/useAjax"
+import { GameRechargeListProps, getGameRechargeCountApi, getGameRechargeListApi } from "@/services/gameData/stream"
+import React, { useEffect, useState } from "react"
+import TableData from "../../components/TableData"
+import QueryForm from "@/components/QueryForm"
+import columns12 from "./tableConfig"
+import { getPresets } from "@/components/QueryForm/const"
+import moment from "moment"
+import { Statistic, Table } from "antd"
+
+/**
+ * 充值历史
+ * @returns 
+ */
+const Recharge: React.FC = () => {
+
+    /********************************/
+    const [queryForm, setQueryForm] = useState<GameRechargeListProps>({ pageNum: 1, pageSize: 50, sourceSystem: 'ZX_ONE', costBeginDate: moment().format('YYYY-MM-DD'), costEndDate: moment().format('YYYY-MM-DD') })
+    const [totalData, setTotalData] = useState<any>({})
+
+    const getGameRechargeList = useAjax((params) => getGameRechargeListApi(params))
+    const getGameRechargeCount = useAjax((params) => getGameRechargeCountApi(params))
+    /********************************/
+
+    useEffect(() => {
+        getGameRechargeCount.run(queryForm).then((res) => {
+            setTotalData(res)
+        })
+        getGameRechargeList.run(queryForm)
+    }, [queryForm])
+
+    return <div>
+        <TableData
+            leftChild={<QueryForm
+                initialValues={{ sourceSystem: 'ZX_ONE', consumeDay: [moment(), moment()] }}
+                onChange={(data: any) => {
+                    const { costBeginDay, costEndDay, beginOrderTime, endOrderTime, ...params } = data
+                    let newQueryForm = JSON.parse(JSON.stringify(queryForm))
+                    if (costBeginDay && costEndDay) {
+                        newQueryForm.costBeginDate = costBeginDay
+                        newQueryForm.costEndDate = costEndDay
+                    } else {
+                        delete newQueryForm.costBeginDate
+                        delete newQueryForm.costEndDate
+                    }
+                    if (beginOrderTime && endOrderTime) {
+                        newQueryForm.orderBeginDate = beginOrderTime
+                        newQueryForm.orderEndDate = endOrderTime
+                    } else {
+                        delete newQueryForm.orderBeginDate
+                        delete newQueryForm.orderEndDate
+                    }
+                    newQueryForm.pageNum = 1
+                    setQueryForm({ ...newQueryForm, ...params })
+                }}
+                isSource
+                isGameIds
+                isGameDimension
+                isSysUserId
+                isAgentId
+                isAccountId
+                isConsumeDay={{ ranges: getPresets() }}
+                isCreateDay={{}}
+            />}
+            isVirtually={false}
+            scroll={{ x: 1000, y: 600 }}
+            ajax={getGameRechargeList}
+            fixed={{ left: 5, right: 1 }}
+            dataSource={getGameRechargeList?.data?.records?.map((item: any, index: number) => ({ ...item, id: Number(queryForm.pageNum.toString() + index.toString()) }))}
+            total={getGameRechargeList?.data?.total}
+            page={queryForm.pageNum}
+            pageSize={queryForm.pageSize}
+            title='充值历史'
+            onChange={(props: any) => {
+                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()}
+            configName={'充值历史'}
+            summary={() => {
+                return <Table.Summary fixed>
+                    <Table.Summary.Row>
+                        <Table.Summary.Cell index={0}><div style={{ fontSize: 18, fontWeight: 600, textAlign: 'center' }}>总计</div></Table.Summary.Cell>
+                        <Table.Summary.Cell index={1}><div style={{ fontWeight: 600, textAlign: 'center', color: '#000000d9' }}>消耗</div></Table.Summary.Cell>
+                        <Table.Summary.Cell index={2}><div style={{ textAlign: 'center' }}><Statistic value={totalData?.costCount || 0} /></div> </Table.Summary.Cell>
+                        <Table.Summary.Cell index={3}><div style={{ fontWeight: 600, textAlign: 'center', color: '#000000d9' }}>充值</div></Table.Summary.Cell>
+                        <Table.Summary.Cell index={4}><div style={{ textAlign: 'center' }}><Statistic value={totalData?.amountCount || 0} /></div></Table.Summary.Cell>
+                        <Table.Summary.Cell index={5}><div style={{ fontWeight: 600, textAlign: 'center', color: '#000000d9' }}>回收率</div></Table.Summary.Cell>
+                        <Table.Summary.Cell index={6}><div style={{ textAlign: 'center' }}><Statistic precision={2} suffix="%" value={totalData?.recoveryCount || 0} /></div></Table.Summary.Cell>
+                    </Table.Summary.Row>
+                </Table.Summary>
+            }}
+        />
+    </div>
+}
+
+export default Recharge

+ 196 - 0
src/pages/gameDataStatistics/stream/recharge/tableConfig.tsx

@@ -0,0 +1,196 @@
+import WidthEllipsis from "@/components/widthEllipsis"
+import React from "react"
+const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
+import moment from 'moment'
+import { Statistic } from "antd"
+import './index.less'
+
+function columns12(): { label: string, fieldSHow?: { label: string, saveField: string, defaultValue: any[], data: any[] }, data: any[] }[] {
+
+    let newArr: { label: string, data: any[] }[] = [
+        {
+            label: '充值历史',
+            data: [
+                {
+                    title: '消耗时间(监控数据源)', dataIndex: 'costBeginDate', label: '充值历史', align: 'center', width: 160, default: 1,
+                    render: (a: string, b: any) => (<WidthEllipsis value={a + '~' + b?.costEndDate} />)
+                },
+                {
+                    title: '订单日期', dataIndex: 'orderDate', label: '充值历史', align: 'center', width: 90, default: 2,
+                    render: (a: string) => (<WidthEllipsis value={a} />)
+                },
+                {
+                    title: '星期', dataIndex: 'week', label: '充值历史', align: 'center', width: 90, default: 3,
+                    render: (_: any, b: any) => (<WidthEllipsis value={week[moment(b?.orderDate).day()]} />)
+                },
+                {
+                    title: '投手', dataIndex: 'pitcherName', label: '充值历史', align: 'center', width: 90, default: 4,
+                    render: (a: any) => (<WidthEllipsis value={a} />)
+                },
+                {
+                    title: '10:00', dataIndex: 'tenAmount', label: '充值历史', align: 'center', width: 90, default: 5,
+                    children: [
+                        {
+                            title: '充值',
+                            dataIndex: `tenAmount`,
+                            key: `tenAmount`,
+                            align: 'center',
+                            width: 85,
+                            render: (a: any) => {
+                                return <Statistic value={a ? a : '--'} />
+                            }
+                        },
+                        {
+                            title: '环比',
+                            dataIndex: `tenRate`,
+                            key: `tenRate`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRatio',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
+                            }
+                        },
+                        {
+                            title: '回收率',
+                            dataIndex: `tenRecovery`,
+                            key: `tenRecovery`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRoi',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
+                            }
+                        }
+                    ]
+                },
+                {
+                    title: '14:00', dataIndex: 'fourteenAmount', label: '充值历史', align: 'center', width: 90, default: 6,
+                    children: [
+                        {
+                            title: '充值',
+                            dataIndex: `fourteenAmount`,
+                            key: `fourteenAmount`,
+                            align: 'center',
+                            width: 85,
+                            render: (a: any) => {
+                                return <Statistic value={a ? a : '--'} />
+                            }
+                        },
+                        {
+                            title: '环比',
+                            dataIndex: `fourteenRate`,
+                            key: `fourteenRate`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRatio',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
+                            }
+                        },
+                        {
+                            title: '回收率',
+                            dataIndex: `fourteenRecovery`,
+                            key: `fourteenRecovery`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRoi',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
+                            }
+                        }
+                    ]
+                },
+                {
+                    title: '17:00', dataIndex: 'seventeenAmount', label: '充值历史', align: 'center', width: 90, default: 7,
+                    children: [
+                        {
+                            title: '充值',
+                            dataIndex: `seventeenAmount`,
+                            key: `seventeenAmount`,
+                            align: 'center',
+                            width: 85,
+                            render: (a: any) => {
+                                return <Statistic value={a ? a : '--'} />
+                            }
+                        },
+                        {
+                            title: '环比',
+                            dataIndex: `seventeenRate`,
+                            key: `seventeenRate`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRatio',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
+                            }
+                        },
+                        {
+                            title: '回收率',
+                            dataIndex: `seventeenRecovery`,
+                            key: `seventeenRecovery`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRoi',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
+                            }
+                        }
+                    ]
+                },
+                {
+                    title: '24:00', dataIndex: 'twentyfourAmount', label: '充值历史', align: 'center', width: 90, default: 8,
+                    children: [
+                        {
+                            title: '充值',
+                            dataIndex: `twentyfourAmount`,
+                            key: `twentyfourAmount`,
+                            align: 'center',
+                            width: 85,
+                            render: (a: any) => {
+                                return <Statistic value={a ? a : '--'} />
+                            }
+                        },
+                        {
+                            title: '环比',
+                            dataIndex: `twentyfourRate`,
+                            key: `twentyfourRate`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRatio',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
+                            }
+                        },
+                        {
+                            title: '回收率',
+                            dataIndex: `twentyfourRecovery`,
+                            key: `twentyfourRecovery`,
+                            width: 85,
+                            align: 'center',
+                            className: 'ringRoi',
+                            render: (a: any) => {
+                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
+                            }
+                        },
+                        {
+                            title: '消耗',
+                            dataIndex: `costCount`,
+                            key: `costCount`,
+                            align: 'center',
+                            width: 85,
+                            className: 'costCount',
+                            render: (a: any) => {
+                                return <Statistic value={a ? a : '--'} />
+                            }
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+
+    return newArr
+}
+
+export default columns12

+ 44 - 0
src/services/gameData/stream.ts

@@ -0,0 +1,44 @@
+import { request } from 'umi';
+import { api } from '../api';
+import { Paging } from './rankingList';
+let wapi = api + '/gameData'
+
+export interface GameRechargeListProps extends Paging {
+    // 数据归因:1-子游戏维度; 2-父游戏维度
+    gameDimension?: 1 | 2, 
+    gameId?: number,
+    pitcherId?: number, // 投手
+    // 消耗时间
+    costBeginDate?: string,
+    costEndDate?: string,
+    // 订单时间
+    orderBeginDate?: string,
+    orderEndDate?: string,
+    // 渠道
+    agentId?: number
+    // 广告
+    accountId?: string
+}
+/**
+ * 充值历史
+ * @param data 
+ * @returns 
+ */
+export async function getGameRechargeListApi(data: GameRechargeListProps) {
+    return request(wapi + `/gameData/flow/monitor`, {
+        method: 'POST',
+        data
+    });
+}
+
+/**
+ * 充值历史总计
+ * @param data 
+ * @returns 
+ */
+export async function getGameRechargeCountApi(data: GameRechargeListProps) {
+    return request(wapi + `/gameData/flow/monitorCount`, {
+        method: 'POST',
+        data
+    });
+}