shenwu 2 tahun lalu
induk
melakukan
7a0da0804a

+ 3 - 3
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -94,9 +94,9 @@ function Ad(props: { accountId: string, adAccountId: string ,userId:string}) {
                 </Row>
             </>}
             onChange={(props: any) => {
-                // let { sortData, pagination } = props
-                // let { current, pageSize } = pagination
-                // getList({ pageNum: current, pageSize })
+                let { sortData, pagination } = props
+                let { current, pageSize } = pagination
+                getList({ pageNum: current, pageSize })
             }}
         />
     </div>

+ 23 - 17
src/pages/launchSystemNew/adq/adAccount/index.tsx

@@ -1,21 +1,21 @@
 
 import { useAjax } from '@/Hook/useAjax'
-import { PromotedObjectType } from '@/services/launchAdq/enum'
-import { Col, Row, Input, Select, Button, message } from 'antd'
+import {  Row,  message } from 'antd'
 import React, { useEffect, useState, useCallback } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
-import { putAdqAdgroupsSync, getAdqAdAccountList } from '@/services/launchAdq/adq'
+import { putAdqAdAccountSyncByIds, getAdqAdAccountList } from '@/services/launchAdq/adq'
 
-function AdAccount(props: { accountId: string, adAccountId: string ,userId:string}) {
-    let { accountId, adAccountId,userId } = props
+function AdAccount(props: { accountId: string, adAccountId: string, userId: string }) {
+    let { accountId, adAccountId, userId } = props
+    let [selectedRowKeys,setSelectedRowKeys]=useState<any[]>([])
     // api方法
     const listAjax = useAjax((params) => getAdqAdAccountList(params), { formatResult: true })
-    const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
+    const syncAjax = useAjax((params) => putAdqAdAccountSyncByIds(params))
     console.log('创意=====》')
     useEffect(() => {
         getList({ pageNum: 1, pageSize: 20 })
-    }, [accountId,userId])
+    }, [accountId, userId])
     // 获取列表
     const getList = useCallback((params: {
         pageNum: number;
@@ -25,21 +25,21 @@ function AdAccount(props: { accountId: string, adAccountId: string ,userId:strin
     }) => {
         if (!params.adcreativeName || params.adcreativeName !== listAjax?.params[0]?.adcreativeName) {
             !params.adcreativeName && delete params.adcreativeName
-            listAjax.run({ ...params,userId, accountId })
+            listAjax.run({ ...params, userId, accountIds:accountId?[accountId]:null })
         }
-    }, [accountId,userId,listAjax])
+    }, [accountId, userId, listAjax])
     // 同步 
     const sync = useCallback(() => {
-        if(!adAccountId){
-            message.error('请先选择要同步的广点通账号!')
+        if (selectedRowKeys?.length === 0) {
+            message.error('请勾选要同步的广点通账号!')
             return
         }
-        syncAjax.run({adAccountId}).then(res => {
+        syncAjax.run(selectedRowKeys).then(res => {
             res && listAjax.refresh()
             res ? message.success('同步成功!') : message.error('同步失败!')
 
         })
-    }, [adAccountId, listAjax])
+    }, [adAccountId, listAjax,selectedRowKeys])
     return <div>
         <TableData
             columns={tableConfig}
@@ -47,7 +47,7 @@ function AdAccount(props: { accountId: string, adAccountId: string ,userId:strin
             syncAjax={sync}
             dataSource={listAjax?.data?.data?.records}
             loading={listAjax?.loading || syncAjax?.loading}
-            scroll={{ x: 2500 }}
+            // scroll={{ x: 2500 }}
             total={listAjax?.data?.data?.total}
             page={listAjax?.data?.data?.current}
             pageSize={listAjax?.data?.data?.size}
@@ -56,10 +56,16 @@ function AdAccount(props: { accountId: string, adAccountId: string ,userId:strin
                 <Row gutter={[10, 10]}>
                 </Row>
             </>}
+            rowSelection={{
+                onChange: (selectedRowKeys: React.Key[], selectedRows: any[]) => {
+                    // setSelectedRowKeys(selectedRows?.map(item=>item.accountId))
+                    setSelectedRowKeys(selectedRowKeys)
+                }
+            }}
             onChange={(props: any) => {
-                // let { sortData, pagination } = props
-                // let { current, pageSize } = pagination
-                // getList({ pageNum: current, pageSize })
+                let { sortData, pagination } = props
+                let { current, pageSize } = pagination
+                getList({ pageNum: current, pageSize })
             }}
         />
     </div>

+ 20 - 112
src/pages/launchSystemNew/adq/adAccount/tableConfig.tsx

@@ -1,145 +1,53 @@
-import { AdStatusEnum, ConfiguredStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
+import {  FundStatusEnum, } from '@/services/launchAdq/enum'
 import React from 'react'
 import { Badge, Switch } from 'antd'
 function tableConfig():any{
     return [
         {
-            title: '所属账号',
-            dataIndex: 'accountId',
-            key: 'accountId',
-            align: 'center',
-            width:90,
-            fixed:'left',
-            render:(a:string)=>{
-                return <a>{a}</a>
-            }
-        },
-        {
-            title: '广告ID',
-            dataIndex: 'adgroupId',
-            key: 'adgroupId',
+            title: 'ID',
+            dataIndex: 'id',
+            key: 'id',
             align: 'center',
             width:100,
-            fixed:'left',
             render:(a:string)=>{
                 return <a>{a}</a>
             }
         },
         {
-            title: '所属计划ID',
-            dataIndex: 'campaignId',
-            key: 'campaignId',
+            title: '账号ID',
+            dataIndex: 'accountId',
+            key: 'accountId',
             align: 'center',
-            width:100,
-            fixed:'left',
+            width:90,
             render:(a:string)=>{
                 return <a>{a}</a>
             }
         },
         {
-            title: '广告名称',
-            dataIndex: 'adgroupName',
-            key: 'adgroupName',
+            title: '账户余额(分)',
+            dataIndex: 'balance',
+            key: 'balance',
             align: 'center',
-            width:300,
-        },
-        {
-            title: '推广目标类型',
-            dataIndex: 'promotedObjectType',
-            key: 'promotedObjectType',
-            align: 'center',
-            width:130,
-           render:(a: string | number)=>{
-            return PromotedObjectType[a]
-           } 
+            width:150,
         },
         {
-            title: '广告优化目标类型',
-            dataIndex: 'optimizationGoal',
-            key: 'optimizationGoal',
+            title: '资金状态',
+            dataIndex: 'fundStatus',
+            key: 'fundStatus',
             align: 'center',
             width:130,
            render:(a: string | number)=>{
-            return OptimizationGoalEnum[a]
+            return FundStatusEnum[a]
            } 
         },
         {
-            title: '投放日期',
-            dataIndex: 'beginDate',
-            key: 'beginDate',
+            title: '是否启用',
+            dataIndex: 'enabled',
+            key: 'enabled',
             align: 'center',
-            width:160,
-            render:(a: string,b: { endDate: string })=>{
-                return b?.endDate ? a+'~'+b.endDate : a+'~'+'长期投放'
-            }
-        },
-        {
-            title: '首日开始投放时间',
-            dataIndex: 'firstDayBeginTime',
-            key: 'firstDayBeginTime',
-            align: 'center',
-            width:130,
-        },
-        {
-            title: '广告出价(分)',
-            dataIndex: 'bidAmount',
-            key: 'bidAmount',
-            align: 'center',  
             width:130,
-        },
-        {
-            title: '广告组日预算(分)',
-            dataIndex: 'dailyBudget',
-            key: 'dailyBudget',
-            align: 'center',  
-            width:130,
-        },
-        {
-            title: '是否开启自动版位功能',
-            dataIndex: 'automaticSiteEnabled',
-            key: 'automaticSiteEnabled',
-            align: 'center', 
-            width:150,
             render: (a: any, b: any) => {
-                return a? '开' : '关'
-            }
-        },
-        {
-            title: '是否已删除',
-            dataIndex: 'isDeleted',
-            key: 'isDeleted',
-            align: 'center',
-            width:100,
-            render: (a: any, b: any) => {
-                return  <Badge status={!a ? "processing" :"error" } text={a? '是' : '否'} />
-            }
-        },
-        {
-            title: '创建时间',
-            dataIndex: 'createdTime',
-            key: 'createdTime',
-            align: 'center',
-            width:160,
-        },
-        {
-            title: '客户设置的状态',
-            dataIndex: 'configuredStatus',
-            key: 'configuredStatus',
-            align: 'center',
-            width:130,
-            render:(a:string)=>{
-                return  <Badge status={a==='AD_STATUS_NORMAL' ? "processing" :"error" } text={ConfiguredStatusEnum[a]} />
-            }
-        },
-        {
-            title: '广告状态',
-            dataIndex: 'status',
-            key: 'status',
-            align: 'center',
-            width:70,
-            fixed:'right',
-            render:(a:string)=>{
-                return AdStatusEnum[a]
+                return  <Badge status={a ? "processing" :"error" } text={a? '是' : '否'} />
             }
         },
     ]

+ 3 - 3
src/pages/launchSystemNew/adq/campaign/index.tsx

@@ -128,9 +128,9 @@ function Campaign(props: { accountId: string, adAccountId: string, userId: strin
                 </Row>
             </>}
             onChange={(props: any) => {
-                // let { sortData, pagination } = props
-                // let { current, pageSize } = pagination
-                // getList({ pageNum: current, pageSize })
+                let { sortData, pagination } = props
+                let { current, pageSize } = pagination
+                getList({ pageNum: current, pageSize })
             }}
         />
     </div>

+ 3 - 3
src/pages/launchSystemNew/adq/creative/index.tsx

@@ -95,9 +95,9 @@ function Creative(props: { accountId: string, adAccountId: string ,userId:string
                 </Row>
             </>}
             onChange={(props: any) => {
-                // let { sortData, pagination } = props
-                // let { current, pageSize } = pagination
-                // getList({ pageNum: current, pageSize })
+                let { sortData, pagination } = props
+                let { current, pageSize } = pagination
+                getList({ pageNum: current, pageSize })
             }}
         />
     </div>

+ 10 - 1
src/services/launchAdq/adq.ts

@@ -34,7 +34,16 @@ export async function getAdAccountAllOfMember() {
     data: params,
   });
 }
-
+/**
+ * 按账号同步计划
+ * @param adAccountId 本地ID
+ */
+ export async function putAdqAdAccountSyncByIds(data:any) {
+  return request(api + `/adq/adAccount/syncByIds`, {
+    method: 'PUT',
+    data
+  });
+}
 /**
  * 获取ADQ计划列表
  * @param adgroupName 广告名称

+ 7 - 0
src/services/launchAdq/enum.ts

@@ -447,3 +447,10 @@ export enum AdStatusEnum {
   STATUS_PART_READY = '部分待投放',
   STATUS_PART_ACTIVE = '部分投放中',
 }
+/**资金状态*/
+export enum FundStatusEnum {
+  FUND_STATUS_NORMAL = '有效',
+  FUND_STATUS_NOT_ENOUGH = '余额不足',
+  FUND_STATUS_CLOSED = '资金账户已销户',
+  FUND_STATUS_FROZEN = '资金冻结',
+}