shenwu 2 年 前
コミット
f6a94d90ac

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

@@ -56,7 +56,7 @@ function Ad(props: { accountId: string, adAccountId: string ,userId:string}) {
                 <Row gutter={[10, 10]}>
                     <Col>
                         <Input
-                            placeholder='创意名称'
+                            placeholder='广告名称'
                             allowClear
                             onBlur={(e) => {
                                 let value = e.target.value

+ 67 - 0
src/pages/launchSystemNew/adq/adAccount/index.tsx

@@ -0,0 +1,67 @@
+
+import { useAjax } from '@/Hook/useAjax'
+import { PromotedObjectType } from '@/services/launchAdq/enum'
+import { Col, Row, Input, Select, Button, 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'
+
+function AdAccount(props: { accountId: string, adAccountId: string ,userId:string}) {
+    let { accountId, adAccountId,userId } = props
+    // api方法
+    const listAjax = useAjax((params) => getAdqAdAccountList(params), { formatResult: true })
+    const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
+    console.log('创意=====》')
+    useEffect(() => {
+        getList({ pageNum: 1, pageSize: 20 })
+    }, [accountId,userId])
+    // 获取列表
+    const getList = useCallback((params: {
+        pageNum: number;
+        pageSize: number;
+        accountId?: string;
+        adcreativeName?: string;
+    }) => {
+        if (!params.adcreativeName || params.adcreativeName !== listAjax?.params[0]?.adcreativeName) {
+            !params.adcreativeName && delete params.adcreativeName
+            listAjax.run({ ...params,userId, accountId })
+        }
+    }, [accountId,userId,listAjax])
+    // 同步 
+    const sync = useCallback(() => {
+        if(!adAccountId){
+            message.error('请先选择要同步的广点通账号!')
+            return
+        }
+        syncAjax.run({adAccountId}).then(res => {
+            res && listAjax.refresh()
+            res ? message.success('同步成功!') : message.error('同步失败!')
+
+        })
+    }, [adAccountId, listAjax])
+    return <div>
+        <TableData
+            columns={tableConfig}
+            ajax={listAjax}
+            syncAjax={sync}
+            dataSource={listAjax?.data?.data?.records}
+            loading={listAjax?.loading || syncAjax?.loading}
+            scroll={{ x: 2500 }}
+            total={listAjax?.data?.data?.total}
+            page={listAjax?.data?.data?.current}
+            pageSize={listAjax?.data?.data?.size}
+            myKey={'adgroupId'}
+            leftChild={<>
+                <Row gutter={[10, 10]}>
+                </Row>
+            </>}
+            onChange={(props: any) => {
+                // let { sortData, pagination } = props
+                // let { current, pageSize } = pagination
+                // getList({ pageNum: current, pageSize })
+            }}
+        />
+    </div>
+}
+export default AdAccount

+ 147 - 0
src/pages/launchSystemNew/adq/adAccount/tableConfig.tsx

@@ -0,0 +1,147 @@
+import { AdStatusEnum, ConfiguredStatusEnum, OptimizationGoalEnum, PromotedObjectType } 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',
+            align: 'center',
+            width:100,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '所属计划ID',
+            dataIndex: 'campaignId',
+            key: 'campaignId',
+            align: 'center',
+            width:100,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '广告名称',
+            dataIndex: 'adgroupName',
+            key: 'adgroupName',
+            align: 'center',
+            width:300,
+        },
+        {
+            title: '推广目标类型',
+            dataIndex: 'promotedObjectType',
+            key: 'promotedObjectType',
+            align: 'center',
+            width:130,
+           render:(a: string | number)=>{
+            return PromotedObjectType[a]
+           } 
+        },
+        {
+            title: '广告优化目标类型',
+            dataIndex: 'optimizationGoal',
+            key: 'optimizationGoal',
+            align: 'center',
+            width:130,
+           render:(a: string | number)=>{
+            return OptimizationGoalEnum[a]
+           } 
+        },
+        {
+            title: '投放日期',
+            dataIndex: 'beginDate',
+            key: 'beginDate',
+            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]
+            }
+        },
+    ]
+}
+export default tableConfig

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

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
 import {  Card, Col, Menu, Row, Select, Tabs } from 'antd';
 // import './index.less'
 import Campaign from './campaign';
+import AdAccount from './adAccount';
 import Ad from './ad';
 import Creative from './creative';
 import LandingPage from './landingPage';
@@ -13,7 +14,7 @@ import { useModel } from 'umi';
 const { TabPane } = Tabs;
 let Menus: any = Menu
 const tabsConfig = [
-    { key: '1', tab: '账户信息', jsx: () => null },
+    { key: '1', tab: '账户信息', jsx:(props: any) => <AdAccount {...props} />},
     { key: '2', tab: '计划', jsx:(props: any) => <Campaign {...props} />},
     { key: '3', tab: '广告', jsx: (props: any) => <Ad {...props} /> },
     { key: '4', tab: '创意', jsx: (props: any) => <Creative {...props} /> },
@@ -24,7 +25,7 @@ function Adq() {
     const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
     const allOfMember = useAjax(() => getAdAccountAllOfMember(), { formatResult: true })
     const [userAll, setUserAll] = useState([])
-    const [activeKey, setActiveKey] = useState('2')
+    const [activeKey, setActiveKey] = useState('1')
     const [userId, setUserId] = useState<any>('1'||userInfo?.userId?.toString())
     const [selectedArr, setSelectedArr] = useState([])
     const [idS, setIds] = useState({//需要用到的accountId,adAccountId

+ 19 - 0
src/services/launchAdq/adq.ts

@@ -16,6 +16,25 @@ export async function getAdAccountAllOfMember() {
 //   }).then(res=>res.json())
 // }
 
+/**
+ * 获取ADQ账号列表
+ * @param adgroupName 广告名称
+ * @param promotedObjectType 广告类型
+ * @param accountId 账户ID
+ * @param adgroupName 广告名称
+ */
+ export async function getAdqAdAccountList(params: {
+  pageNum: number;
+  pageSize: number;
+  userId?:string;//用户ID
+  accountIds?: string[];//账号本地ID
+}) {
+  return request(api + '/adq/adAccount/list', {
+    method: 'POST',
+    data: params,
+  });
+}
+
 /**
  * 获取ADQ计划列表
  * @param adgroupName 广告名称