wjx 1 年之前
父節點
當前提交
571b379252
共有 2 個文件被更改,包括 24 次插入4 次删除
  1. 23 3
      src/components/QueryForm/index.tsx
  2. 1 1
      src/pages/gameDataStatistics/stream/recharge/index.tsx

+ 23 - 3
src/components/QueryForm/index.tsx

@@ -2,11 +2,12 @@ import { Button, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row
 import React, { useEffect, useState } from "react"
 import moment from "moment"
 import { useAjax } from "@/Hook/useAjax"
-import { getAllOfOwnerUserApi, getChannelChoiceListApi, getGameChoiceListApi, getCpChoiceListApi, getGameChoiceParentListType1Api, getPayListApi, getSubUserWithSelfListApi, getTtAllUserListApi, getUserSystemTypeChoiceListApi, getUserVipLevelChoiceListApi, getRoleUserListApi, getGameServerListApi, getGameServerUnListApi, getAccountListNewApi, getAgentListNewApi, getPitcherListNewApi, getGameListNewApi, getVipLevelApi, getGameServerNewApi } from "@/services/gameData"
+import { getAllOfOwnerUserApi, getChannelChoiceListApi, getGameChoiceListApi, getCpChoiceListApi, getGameChoiceParentListType1Api, getPayListApi, getSubUserWithSelfListApi, getTtAllUserListApi, getUserSystemTypeChoiceListApi, getRoleUserListApi, getGameServerListApi, getGameServerUnListApi, getAccountListNewApi, getAgentListNewApi, getPitcherListNewApi, getGameListNewApi, getVipLevelApi, getGameServerNewApi } from "@/services/gameData"
 import { ActiveEnum, DeviceType, LoginType, PayStatus, TYPE, gameClassifyEnum } from "./const"
 import { ADSTATUSEnum as ADSTTTATUSEnum } from "@/pages/gameDataStatistics/adlist/monitor/const"
 import { ADSTATUSEnum } from "@/pages/gameDataStatistics/adlist/tencentMonitor/const"
 import IntervalTime from "./intervalTime"
+import { RangePickerProps } from "antd/lib/date-picker"
 
 
 interface Props {
@@ -35,6 +36,10 @@ interface Props {
     isCreateDay?: {
         ranges?: any
     }
+    /** 订单创建日期 根据消耗时间 来限制可选范围 */
+    isCreateDayXz?: {
+        ranges?: any
+    }
     /** 是否开启 角色创建日期 搜索 */
     isCreateRoleDay?: {
         ranges?: any
@@ -244,7 +249,7 @@ const QueryForm: React.FC<Props> = (props) => {
 
     /**************************/
     const {
-        onChange, initialValues, isSource, isAccount, isAccountId, isAccountIds, isCompanyId, isAgentKey, isAgentName, isCpId, isCpName, isCpOrderId, isCpStatus, isCreateDay, isDevice, isGameName, isRechargeGameName, isGameId, isGameIds, isOrderGameId, isGameRoleId,
+        onChange, initialValues, isSource, isAccount, isAccountId, isAccountIds, isCompanyId, isAgentKey, isAgentName, isCpId, isCpName, isCpOrderId, isCpStatus, isCreateDay, isCreateDayXz, isDevice, isGameName, isRechargeGameName, isGameId, isGameIds, isOrderGameId, isGameRoleId,
         isGameRoleName, isFirstRecharge, isSwitch, isMerchantNo, isOrderId, isMerchantOrderNo, isPayStatus, isPayWay, isProductName, isRegAgent, isAgentId, isPutAgent, isRegDay, isOs, isParentId, isParentIds, isProjectId, isProjectName, isPromotionId, isPromotionId1, isPromotionName,
         isSysUserName, isRechargeDate, isBGGameClassify, isGameUserId, isSysUserId, isSysUserIds, isUserName, isUserId, isSelectRanking, isGameType, isConsumeDay, rechargeDay, isBeginDay, isType, isAdTTStatus, isUserEnterType, isServerName, isServerId, isServerDay, isAdTXStatus,
         payTimeDay, placeAnOrderDay, isPayIntervalTime, isActiveTypes, isNickname, isMobile, isRegIp, isIsAuth, isIsBindMobile, isIsRecharge, isUserStatus, isCreateRole, isRoleCount, isVipLevel, isCreateRoleDay, isIsChange, isIsSendMail, isWeChatCompany, isWeChat,
@@ -260,6 +265,7 @@ const QueryForm: React.FC<Props> = (props) => {
     const sourceSystem = Form.useWatch('sourceSystem', form)
     const parentGameIds = Form.useWatch('parentGameIds', form)
     const gameDimension = Form.useWatch('gameDimension', form)
+    const consumeDay = Form.useWatch('consumeDay', form)
     const [accountList, setAccountList] = useState<any[]>([])
     const [userIdList, setUserIdList] = useState<any[]>([])
     const [gsList, setGsList] = useState<any[]>([])
@@ -283,7 +289,6 @@ const QueryForm: React.FC<Props> = (props) => {
     const getVipLevel = useAjax(() => getVipLevelApi())
     const getRoleUserList = useAjax((params) => getRoleUserListApi(params))
     const getGameServerList = useAjax((params) => getGameServerListApi(params))
-    const getGameServerNew = useAjax((params) => getGameServerNewApi(params))
     const getGameServerUnList = useAjax((params) => getGameServerUnListApi(params))
     const getAccountListNew = useAjax((params) => getAccountListNewApi(params))
     const getAgentListNew = useAjax((params) => getAgentListNewApi(params))
@@ -484,6 +489,16 @@ const QueryForm: React.FC<Props> = (props) => {
         onChange && onChange(data)
     }
 
+
+    const disabledDate: RangePickerProps['disabledDate'] = (current) => {
+        // Can not select days before today and today
+        if (consumeDay && consumeDay?.length === 2) {
+            let [d1, d2] = consumeDay
+            return current && (current < moment(d1) || current > moment(d2).endOf('day'));
+        }
+        return current && current > moment().endOf('day');
+    };
+
     return <Form layout="inline" className='queryForm' initialValues={initialValues} name="basic" form={form} onFinish={onFinish}>
         <Row gutter={[0, 6]}>
             {/* 数据源搜索 */}
@@ -1546,6 +1561,11 @@ const QueryForm: React.FC<Props> = (props) => {
             {isCreateDay && <Col><Form.Item name='createDay'>
                 <DatePicker.RangePicker style={{ width: 230 }} placeholder={['订单创建开始日期', '订单创建结束日期']} {...isCreateDay} />
             </Form.Item></Col>}
+
+            {isCreateDayXz && <Col><Form.Item name='createDay'>
+                <DatePicker.RangePicker style={{ width: 230 }} disabledDate={disabledDate} placeholder={['订单创建开始日期', '订单创建结束日期']} {...isCreateDay} />
+            </Form.Item></Col>}
+
             {/* 充值日期搜索 */}
             {rechargeDay && <Col><Form.Item name='rechargeDay'>
                 <DatePicker.RangePicker style={{ width: 230 }} placeholder={['充值开始日期', '充值结束日期']} {...rechargeDay} />

+ 1 - 1
src/pages/gameDataStatistics/stream/recharge/index.tsx

@@ -61,7 +61,7 @@ const Recharge: React.FC = () => {
                 isAccountId
                 isAccountIds
                 isConsumeDay={{ ranges: getPresets() }}
-                isCreateDay={{}}
+                isCreateDayXz={{}}
             />}
             isVirtually={false}
             scroll={{ x: 1000, y: 700 }}