wjx 2 سال پیش
والد
کامیت
3912570c8f

+ 6 - 6
config/routerConfig.ts

@@ -104,12 +104,12 @@ const launchSystem = {
                     access: 'createAd',
                     component: './launchSystemNew/launchManage/createAd',
                 },
-                // {
-                //     path: '/launchSystemNew/launchManage/taskList',
-                //     name: '任务列表',
-                //     access: 'taskList',
-                //     component: './launchSystemNew/launchManage/taskList',
-                // },
+                {
+                    path: '/launchSystemNew/launchManage/taskList',
+                    name: '任务列表',
+                    access: 'taskList',
+                    component: './launchSystemNew/launchManage/taskList',
+                }
             ]
         },
         {

+ 1 - 1
src/pages/launchSystemNew/components/creativeModal/index.tsx

@@ -61,7 +61,7 @@ const CreativeModal: React.FC<Props> = (props) => {
             ajax={sysAdcreativeList}
             dataSource={sysAdcreativeList?.data?.data?.records}
             loading={sysAdcreativeList?.loading}
-            scroll={{ y: 600 }}
+            scroll={{ y: 400 }}
             total={sysAdcreativeList?.data?.data?.total}
             page={sysAdcreativeList?.data?.data?.current}
             pageSize={sysAdcreativeList?.data?.data?.size}

+ 40 - 32
src/pages/launchSystemNew/components/creativeModal/tableConfig.tsx

@@ -1,6 +1,4 @@
-import { PromotedObjectType } from '@/services/launchAdq/enum'
-import React from 'react'
-import { Space } from 'antd'
+import { PageTypeEnum, PromotedObjectType } from '@/services/launchAdq/enum'
 function tableConfig():any{
     return [
         {
@@ -8,54 +6,64 @@ function tableConfig():any{
             dataIndex: 'id',
             key: 'id',
             align: 'center',
-            width:70
+            width: 50
         },
         {
-            title: '广告名称',
-            dataIndex: 'adgroupName',
-            key: 'adgroupName',
-            align: 'center',
+            title: '创意名称',
+            dataIndex: 'adcreativeName',
+            key: 'adcreativeName',
+            width: 160,
+            ellipsis: true
         },
         {
-            title: '广告推广目标类型',
+            title: '推广目标',
             dataIndex: 'promotedObjectType',
             key: 'promotedObjectType',
             align: 'center',
-           render:(a: string | number)=>{
-            return PromotedObjectType[a]
-           } 
+            render: (a: string | number) => {
+                return PromotedObjectType[a]
+            }
         },
         {
-            title: '投放日期',
-            dataIndex: 'beginDate',
-            key: 'beginDate',
+            title: '落地页类型',
+            dataIndex: 'pageType',
+            key: 'pageType',
             align: 'center',
-            render:(a: string,b: { endDate: string })=>{
-                return b?.endDate ? a+'~'+b.endDate : a+'~'+'长期投放'
+            width: 120,
+            render: (a: string) => {
+                return PageTypeEnum[a]
             }
         },
         {
-            title: '广告出价',
-            dataIndex: 'bidAmount',
-            key: 'bidAmount',
-            align: 'center',  
+            title: '创意形式ID',
+            dataIndex: 'adcreativeTemplateId',
+            key: 'adcreativeTemplateId',
+            align: 'center',
         },
         {
-            title: '创建时间',
-            dataIndex: 'createTime',
-            key: 'createTime',
+            title: '数据展示',
+            dataIndex: 'conversionDataType',
+            key: 'conversionDataType',
             align: 'center',
+            render: (a: any, b: any) => {
+                return b.conversionDataType || b.conversionTargetType ? '开' : '关'
+            }
         },
         {
-            title:'操作',
-            dataIndex:'cz',
-            key: 'cz',
-            align: 'center',  
-            render:()=>{
-               return <Space>
-                    <a>详情</a>
-                </Space>
+            title: '行动开关',
+            dataIndex: 'linkNameType',
+            key: 'linkNameType',
+            align: 'center',
+            render: (a: any, b: any) => {
+                return b.linkNameType || b.linkPageType ? '开' : '关'
             }
+        },
+        {
+            title: '创建时间',
+            dataIndex: 'createTime',
+            key: 'createTime',
+            align: 'center',
+            width: 140
         }
     ]
 }

+ 51 - 7
src/pages/launchSystemNew/launchManage/createAd/index.tsx

@@ -70,6 +70,16 @@ const CreateAd: React.FC = () => {
     const createAdBatch = useAjax((params) => createAdBatchApi(params))
     /*************************/
 
+    /**数据回填 */
+    useEffect(() => {
+        let adqAdData = localStorage.getItem('ADQAD')
+        if (adqAdData) {
+            const { queryForm, accountCreateLogs } = JSON.parse(adqAdData)
+            setQueryForm({ ...queryForm })
+            setAccountCreateLogs(accountCreateLogs)
+        }
+    }, [])
+
     // 设置地域
     useEffect(() => {
         tagsList_REGION.run({ type: 'REGION' }).then(res => {
@@ -189,25 +199,57 @@ const CreateAd: React.FC = () => {
             // userActionSetsList 数据源  productList 商品
             let data: any = { adAccountId: item.id }
             if (item?.userActionSetsList?.length > 0) {
-                data.userActionSets = item?.userActionSetsList?.map((item:any) => ({ id: item?.id, type: item?.type }))
+                data.userActionSets = item?.userActionSetsList?.map((item: any) => ({ id: item?.id, type: item?.type }))
             }
             if (item?.productList?.length) {
                 data.productId = item?.productList[0].productOuterId
+                data.productCatalogId = item?.productList[0].productCatalogId
             }
             return data
         })
         params.accountCreateLogs = accountLogs
-        console.log(222222, params)
         createAdBatch.run(params).then(res => {
-
+            if (res) {
+                message.success('创建成功')
+                window.location.href = '/#/launchSystemNew/launchManage/taskList'
+            }
         })
     }
 
+    /** 清除数据 */
     const clearData = () => {
         setTableData([])
         setTableSelect([])
     }
 
+    /** 存为预设 */
+    const severBd = () => {
+        // queryForm accountCreateLogs
+        localStorage.setItem('ADQAD', JSON.stringify({
+            queryForm,
+            accountCreateLogs
+        }))
+        message.success('存储成功')
+    }
+
+    /** 清除 */
+    const delBdPlan = () => {
+        localStorage.removeItem('ADQAD')
+        setAccountCreateLogs([])
+        setQueryForm({
+            campaignName: '',  // 计划名称
+            campaignType: 'CAMPAIGN_TYPE_NORMAL', // 计划类型 CAMPAIGN_TYPE_NORMAL CAMPAIGN_TYPE_SEARCH 
+            promotedObjectType: 'PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT', // 推广目标类型
+            speedMode: 'SPEED_MODE_STANDARD', // 投放速度模式
+            sysAdgroupsId: undefined,  // 广告组内容
+            sysTargetingId: undefined,  // 定向包 id
+            adName: undefined,  // 广告名称
+            configuredStatus: 'AD_STATUS_SUSPEND',  // 广告状态
+            sysAdcreativeId: undefined, // 创意ID
+            sysPageId: undefined, // 落地页Id
+        })
+    }
+
     return <Space direction="vertical" style={{ width: '100%' }}>
         <Card title={<div className={style.cardTitle}>配置区</div>} className={style.createAd} hoverable>
             <Space>
@@ -222,8 +264,10 @@ const CreateAd: React.FC = () => {
                         filterOption={(input: any, option: any) =>
                             (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
                         }
+                        value={accountCreateLogs?.map((item: { id: number }) => item?.id)}
                         onChange={(e, option) => {
                             setAccountCreateLogs(option?.map((item: any) => ({ adAccountId: item?.children, id: item?.value })))
+                            clearData()
                         }}
                     >
                         {getAdAccount?.data?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.accountId}</Select.Option>)}
@@ -236,7 +280,7 @@ const CreateAd: React.FC = () => {
                 <Selector label="推广目标">
                     <Select style={{ width: 200 }} value={queryForm?.promotedObjectType} placeholder="请选择推广目标" bordered={false} showSearch filterOption={(input: any, option: any) =>
                         (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
-                    } onChange={(e) => { setQueryForm({ ...queryForm, promotedObjectType: e }) }}>
+                    } onChange={(e) => { setQueryForm({ ...queryForm, promotedObjectType: e }); clearData() }}>
                         {Object.keys(PromotedObjectType).map(key => {
                             return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
                         })}
@@ -424,9 +468,9 @@ const CreateAd: React.FC = () => {
                 </Row>
                 {/* =============广告底部按钮=========== */}
                 <Space className={style.bts}>
-                    {/* <Button type='primary' onClick={severBd}>暂存到本地</Button> */}
+                    <Button type='primary' onClick={severBd}>存为预设</Button>
                     <Button type='primary' onClick={preview}><SearchOutlined /> 批量预览广告</Button>
-                    {/* <Button onClick={delBdPlan}>清空本地配置</Button> */}
+                    <Button onClick={delBdPlan}>清空配置/预设</Button>
                 </Space>
             </div>
         </Card>
@@ -490,7 +534,7 @@ const CreateAd: React.FC = () => {
         {/* 查看落地页 */}
         {lookVisible && <LookLanding visible={lookVisible} onClose={() => setLookVisible(false)} id={queryForm?.sysPageId as any} />}
         {/* 设置名称 */}
-        {subVisible && <SubmitModal visible={subVisible} onClose={() => setSubVisible(false)} onChange={submit} ajax={createAdBatch}/>}
+        {subVisible && <SubmitModal visible={subVisible} onClose={() => setSubVisible(false)} onChange={submit} ajax={createAdBatch} />}
     </Space>
 }
 

+ 53 - 0
src/pages/launchSystemNew/launchManage/taskList/index.tsx

@@ -0,0 +1,53 @@
+import { useAjax } from "@/Hook/useAjax"
+import { getListByCorpAccount } from "@/services/enterpriseWeChat/userMange"
+import { PromotedObjectType } from "@/services/launchAdq/enum"
+import { getTaskListApi, TaskListProps } from "@/services/launchAdq/taskList"
+import { Card, Input, Select, Space } from "antd"
+import React, { useEffect, useState } from "react"
+
+
+
+
+const TaskList: React.FC = () => {
+
+    /*************************/
+    const [queryForm, setQueryForm] = useState<TaskListProps>({ pageSize: 20, pageNum: 1 })
+
+
+    const getTaskList = useAjax((params) => getTaskListApi(params), { formatResult: true })
+    /*************************/
+
+    useEffect(() => {
+        getList()
+    }, [queryForm])
+
+    const getList = () => {
+        getTaskList.run(queryForm)
+    }
+
+    return <Card>
+        <Space style={{ marginBottom: 20 }} wrap={true}>
+            <Input placeholder="计划名称" value={queryForm?.campaignName} onChange={(e) => setQueryForm({ ...queryForm, campaignName: e.target.value, pageNum: 1 })} />
+            <Select
+                placeholder="计划类型"
+                maxTagCount={1}
+                allowClear
+                value={queryForm?.campaignType}
+                onChange={(e) => { setQueryForm({ ...queryForm, campaignType: e }) }}
+            >
+                <Select.Option value='CAMPAIGN_TYPE_NORMAL'>普通展示广告</Select.Option>
+                <Select.Option value='CAMPAIGN_TYPE_WECHAT_MOMENTS'>微信朋友圈广告</Select.Option>
+            </Select>
+            <Select style={{ width: 200 }} value={queryForm?.promotedObjectType} placeholder="推广目标" showSearch filterOption={(input: any, option: any) =>
+                (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+            } onChange={(e) => { setQueryForm({ ...queryForm, promotedObjectType: e }) }}>
+                {Object.keys(PromotedObjectType).map(key => {
+                    return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
+                })}
+            </Select>
+        </Space>
+        
+    </Card>
+}
+
+export default React.memo(TaskList)

+ 2 - 1
src/services/launchAdq/createAd.ts

@@ -25,7 +25,8 @@ import { api } from '../api';
             type: string
         }[],  // 数据源
         conversionId?: number, // 广告组 转化Id
-        productId?: number,
+        productCatalogId?: number, // 商品库ID
+        productId?: number, // 商品Id
         enterpriseWx?: any[]  // 企业微信客服组
     }[]
 }

+ 1 - 1
src/services/launchAdq/enum.ts

@@ -350,4 +350,4 @@ export enum LinkPageNameTypeEnum {
   GET_618_WELFARE = '领 618 福利',
   CONTACT_CUSTOMER_SERVICE = '联系客服',
   CONTACT_BUSINESS = '联系商家',
-}
+}

+ 40 - 0
src/services/launchAdq/taskList.ts

@@ -0,0 +1,40 @@
+import { request } from 'umi';
+import { api } from '../api'
+
+/**
+ * 获取任务列表
+ * @returns 
+ */
+export interface TaskListProps {
+    pageSize: number,
+    pageNum: number,
+    campaignName?: string, // 计划名称
+    campaignType?: string, // 计划类型
+    promotedObjectType?: string,  // 推广目标类型
+}
+export async function getTaskListApi(data: TaskListProps) {
+    return request(api + '/adq/adCreateTask/list', {
+        method: 'POST',
+        data
+    });
+}
+
+
+
+/**
+ * 任务日志列表
+ * @returns 
+ */
+export interface TaskLogListProps {
+    pageSize: number,
+    pageNum: number,
+    taskId: number,
+    createStatus?: any, // 创建状态  -1:创建失败、0:创建中、100:创建成功
+    accountId?: number, // 账号id
+}
+export async function getTaskLogListApi(data: TaskLogListProps) {
+    return request(api + '/adq/adCreateTask/list', {
+        method: 'POST',
+        data
+    });
+}