|
@@ -1,11 +1,11 @@
|
|
|
-import { Checkbox, DatePicker, Form, Input, message, Modal, notification, Radio, Space, TimePicker, Tooltip } from "antd"
|
|
|
+import { Checkbox, DatePicker, Form, Input, message, Modal, notification, Radio, Select, Space, TimePicker, Tooltip } from "antd"
|
|
|
import React, { useEffect, useState } from "react"
|
|
|
import TimeInSelect from "../../components/timeInSelect"
|
|
|
import moment from "moment"
|
|
|
import { getTimeSeriesList } from "./const";
|
|
|
import { editAdqAdgroupsDataApi } from "@/services/launchAdq/adq";
|
|
|
import { useAjax } from "@/Hook/useAjax";
|
|
|
-import { BidStrategyEnum } from "@/services/launchAdq/enum";
|
|
|
+import { BidStrategyEnum, GoalRoasEnum } from "@/services/launchAdq/enum";
|
|
|
import { QuestionCircleOutlined } from "@ant-design/icons";
|
|
|
import { RangePickerProps } from "antd/lib/date-picker";
|
|
|
const { RangePicker } = DatePicker;
|
|
@@ -42,47 +42,57 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
|
|
|
|
|
|
const handleOk = () => {
|
|
|
form.validateFields().then(values => {
|
|
|
- // console.log(values);
|
|
|
+ console.log(values);
|
|
|
let newValues = JSON.parse(JSON.stringify(values))
|
|
|
let field = newValues.field
|
|
|
let adgroupsUpdateDatetimeDTO = {} // 排期
|
|
|
let adgroupsUpdateBidAmountDTO = {} // 出价
|
|
|
+ let deepConversionSpec = {} // ROI
|
|
|
if (timeSeriesType === 'allDayLong') {
|
|
|
newValues.timeSeries = getTimeSeriesList()
|
|
|
}
|
|
|
- field.forEach((key: string) => {
|
|
|
- switch (key) {
|
|
|
- case 'dateType':
|
|
|
- if (newValues.dateType === '2') {
|
|
|
- adgroupsUpdateDatetimeDTO['beginDate'] = moment(newValues.date).format('YYYY-MM-DD')
|
|
|
- adgroupsUpdateDatetimeDTO['endDate'] = ''
|
|
|
- } else {
|
|
|
- adgroupsUpdateDatetimeDTO['beginDate'] = moment(newValues.date[0]).format('YYYY-MM-DD')
|
|
|
- adgroupsUpdateDatetimeDTO['endDate'] = moment(newValues.date[1]).format('YYYY-MM-DD')
|
|
|
- }
|
|
|
- break
|
|
|
- case 'timeType':
|
|
|
- // if (timeSeriesType === 'timeInterValS') {
|
|
|
- // if (newValues.firstDayBeginTime && moment(newValues.firstDayBeginTime).format('HH:mm:ss') !== '00:00:00') {
|
|
|
- // message.error('1111')
|
|
|
- // return
|
|
|
- // }
|
|
|
- // }
|
|
|
- if (newValues.timeSeries) {
|
|
|
- adgroupsUpdateDatetimeDTO['timeSeries'] = newValues.timeSeries.join('')
|
|
|
- }
|
|
|
- if (newValues.firstDayBeginTime) {
|
|
|
- adgroupsUpdateDatetimeDTO['firstDayBeginTime'] = moment(newValues.firstDayBeginTime).format('HH:mm:ss')
|
|
|
- }
|
|
|
- break
|
|
|
- case 'bidSType':
|
|
|
- adgroupsUpdateBidAmountDTO['bidStrategy'] = newValues.bidStrategy
|
|
|
- adgroupsUpdateBidAmountDTO['bidAmount'] = newValues.bidAmount * 100
|
|
|
- break
|
|
|
+
|
|
|
+ if (title === '批量修改深度优化') {
|
|
|
+ deepConversionSpec['deepConversionType'] = newValues.deepConversionType
|
|
|
+ deepConversionSpec['deepConversionWorthSpec'] = {
|
|
|
+ expectedRoi: newValues.deepBidAmount,
|
|
|
+ goal: newValues.goal
|
|
|
}
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ field?.forEach((key: string) => {
|
|
|
+ switch (key) {
|
|
|
+ case 'dateType':
|
|
|
+ if (newValues.dateType === '2') {
|
|
|
+ adgroupsUpdateDatetimeDTO['beginDate'] = moment(newValues.date).format('YYYY-MM-DD')
|
|
|
+ adgroupsUpdateDatetimeDTO['endDate'] = ''
|
|
|
+ } else {
|
|
|
+ adgroupsUpdateDatetimeDTO['beginDate'] = moment(newValues.date[0]).format('YYYY-MM-DD')
|
|
|
+ adgroupsUpdateDatetimeDTO['endDate'] = moment(newValues.date[1]).format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'timeType':
|
|
|
+ // if (timeSeriesType === 'timeInterValS') {
|
|
|
+ // if (newValues.firstDayBeginTime && moment(newValues.firstDayBeginTime).format('HH:mm:ss') !== '00:00:00') {
|
|
|
+ // message.error('1111')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ if (newValues.timeSeries) {
|
|
|
+ adgroupsUpdateDatetimeDTO['timeSeries'] = newValues.timeSeries.join('')
|
|
|
+ }
|
|
|
+ if (newValues.firstDayBeginTime) {
|
|
|
+ adgroupsUpdateDatetimeDTO['firstDayBeginTime'] = moment(newValues.firstDayBeginTime).format('HH:mm:ss')
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'bidSType':
|
|
|
+ adgroupsUpdateBidAmountDTO['bidStrategy'] = newValues.bidStrategy
|
|
|
+ adgroupsUpdateBidAmountDTO['bidAmount'] = newValues.bidAmount * 100
|
|
|
+ break
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
// console.log('params--->', adgroupsUpdateDatetimeDTO);
|
|
|
- editAdqAdgroupsData.run({ adgroupIds: selectedRows.map((item: { adgroupId: number }) => item.adgroupId), adgroupsUpdateDatetimeDTO, adgroupsUpdateBidAmountDTO }).then(res => {
|
|
|
+ editAdqAdgroupsData.run({ adgroupIds: selectedRows.map((item: { adgroupId: number }) => item.adgroupId), adgroupsUpdateDatetimeDTO, adgroupsUpdateBidAmountDTO, deepConversionSpec }).then(res => {
|
|
|
if (res) {
|
|
|
message.success(`修改完成.成功: ${res.success},失败: ${res.fail}`)
|
|
|
if (res?.fail) {
|
|
@@ -124,7 +134,10 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
|
|
|
timeSeries: getTimeSeriesList(),
|
|
|
firstDayBeginTime: moment('2023-02-24 00:00:00'),
|
|
|
bidStrategy: 'BID_STRATEGY_TARGET_COST',
|
|
|
- bidAmount: 1000
|
|
|
+ bidAmount: 1000,
|
|
|
+ optimizationMode: 'DEEP_CONVERSION_TARGET',
|
|
|
+ deepConversionType: 'DEEP_CONVERSION_WORTH',
|
|
|
+ goal: 'GOAL_1DAY_PURCHASE_ROAS'
|
|
|
}}
|
|
|
>
|
|
|
|
|
@@ -161,7 +174,7 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
|
|
|
{dateType === '1' ? <Form.Item name='date' rules={[{ required: true, message: '请选择日期' }]}>
|
|
|
<RangePicker style={{ marginLeft: 125 }} disabledDate={disabledDate}></RangePicker>
|
|
|
</Form.Item> : <Form.Item name='date' style={{ marginLeft: 125 }} rules={[{ required: true, message: '请选择日期' }]}>
|
|
|
- <DatePickers disabledDate={disabledDate}/>
|
|
|
+ <DatePickers disabledDate={disabledDate} />
|
|
|
</Form.Item>}
|
|
|
</>}
|
|
|
{field?.includes('timeType') && <>
|
|
@@ -206,7 +219,29 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
|
|
|
</Form.Item>
|
|
|
</>}
|
|
|
</> : <>
|
|
|
-
|
|
|
+ <Form.Item label={<strong>深度优化方式</strong>} name='optimizationMode' rules={[{ required: true, message: '请选择深度优化方式' }]}>
|
|
|
+ <Radio.Group disabled>
|
|
|
+ <Radio.Button value="DEEP_CONVERSION_TARGET">深度目标优化</Radio.Button>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>深度优化类型</strong>} name='deepConversionType' rules={[{ required: true, message: '请选择深度优化类型' }]}>
|
|
|
+ <Radio.Group disabled onChange={() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ goal: undefined,
|
|
|
+ deepBidAmount: undefined
|
|
|
+ })
|
|
|
+ }}>
|
|
|
+ <Radio.Button value="DEEP_CONVERSION_WORTH">优化 ROI</Radio.Button>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>深度优化目标</strong>} name='goal' rules={[{ required: true, message: '请选择深度优化目标' }]}>
|
|
|
+ <Select style={{ width: 380 }} placeholder='请选择'>
|
|
|
+ {Object.keys(GoalRoasEnum).filter(key => ['GOAL_1DAY_PURCHASE_ROAS']?.includes(key)).map(key => <Select.Option value={key} key={key}>{GoalRoasEnum[key]}</Select.Option>)}
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>期望ROI</strong>} name='deepBidAmount' rules={[{ required: true, message: '请输入期望ROI' }]}>
|
|
|
+ <Input style={{ width: 380 }} placeholder={`期望ROI目标范围0.001~1000,输入0.05,表示ROI目标为5%`} />
|
|
|
+ </Form.Item>
|
|
|
</>}
|
|
|
</Form>
|
|
|
</Modal>
|