wjx 2 jaren geleden
bovenliggende
commit
fe6bab0e5b

+ 7 - 1
src/pages/launchSystemNew/adq/ad/copy.tsx

@@ -55,6 +55,9 @@ const Copy: React.FC<Props> = (props) => {
             if (newValues?.bidAmount) {
                 newValues.bidAmount = newValues.bidAmount * 100
             }
+            if (newValues?.dailyBudget) {
+                newValues.dailyBudget = newValues.dailyBudget * 100
+            }
             console.log(newValues);
             copyAdAd.run({ ...newValues, adgroupIds: selectedRows.map((item: { adgroupId: number }) => item.adgroupId) }).then(res => {
                 if (res) {
@@ -148,7 +151,10 @@ const Copy: React.FC<Props> = (props) => {
                 </Space>
             </Form.Item>
             <Form.Item label={<strong>广告出价</strong>} name={"bidAmount"}>
-                <InputNumber min={0} placeholder="价格 元" />
+                <InputNumber min={0} placeholder="价格 元" style={{ width: 150 }}/>
+            </Form.Item>
+            <Form.Item label={<strong>广告预算</strong>} name={"dailyBudget"}>
+                <InputNumber min={0} placeholder="价格 元" style={{ width: 150 }}/>
             </Form.Item>
             <Form.Item label={<strong>广告启停</strong>} name={"configuredStatus"} tooltip="默认:沿用选择广告的启停状态,开启or关闭:复制的所有广告设置成开启or关闭">
                 <Select style={{ width: 100 }}>

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

@@ -192,6 +192,17 @@ const Ad: React.FC<Props> = (props) => {
             hide()
         })
     }
+    const handleSaveDaily = (row: any) => {
+        console.log('row--->', row)
+        const hide = message.loading(`广告“${row.adgroupId}”广告预算修改成<${row.dailyBudget}元>,修改中`, 0, () => {
+            message.success('修改成功');
+        });
+        editAdqAdgroups.run({ adgroupIds: [row.adgroupId], dailyBudget: row.dailyBudget * 100 }).then(res => {
+            message.success('修改广告预算成功')
+            listAjax.refresh()
+            hide()
+        })
+    }
 
     const details = (data: any) => {
         setDetailData(data)
@@ -417,7 +428,7 @@ const Ad: React.FC<Props> = (props) => {
         </Row>
         <TableData
             isCard={false}
-            columns={() => tableConfig(onChange, details, handleSave)}
+            columns={() => tableConfig(onChange, details, handleSave, handleSaveDaily)}
             ajax={listAjax}
             syncAjax={sync}
             fixed={{ left: 2, right: 4 }}

+ 18 - 2
src/pages/launchSystemNew/adq/ad/inputUpdate.tsx

@@ -6,9 +6,10 @@ interface Props {
     dataIndex: string
     record: any;
     handleSave: (data: any) => void
+    isNum?: boolean
 }
 
-const InputUpdate: React.FC<Props> = ({ title, dataIndex, record, handleSave }) => {
+const InputUpdate: React.FC<Props> = ({ title, dataIndex, record, handleSave, isNum }) => {
     const [form] = Form.useForm();
     const [editing, setEditing] = useState(false);
     const inputRef = useRef<InputRef>(null);
@@ -39,7 +40,22 @@ const InputUpdate: React.FC<Props> = ({ title, dataIndex, record, handleSave })
     let childNode = editing ? (<Form form={form}><Form.Item
         style={{ margin: 0 }}
         name={dataIndex}
-        rules={[{ required: true, message: `${title} is required.` }]}
+        rules={[
+            { required: true, message: `${title} is required.` },
+            {
+                required: isNum, message: `大于0,并且填写数字`, validator(rule, value, callback) {
+                    let regPos = /^[0-9]+.?[0-9]*/; //判断是否是数字。
+                    if (!regPos.test(value)) {
+                        return Promise.reject()
+                    }
+                    if (value >= 0) {
+                        return Promise.resolve()
+                    } else {
+                        return Promise.reject()
+                    }
+                },
+            }
+        ]}
     >
         <Input ref={inputRef} size="small" onPressEnter={save} onBlur={save} bordered />
     </Form.Item></Form>) : (<span className="editable-cell-value-wrap ellipsisText" onClick={toggleEdit}>

+ 5 - 2
src/pages/launchSystemNew/adq/ad/tableConfig.tsx

@@ -6,13 +6,13 @@ import SwitchStatus from './switchStatus'
 import TimeSeriesLook from './timeSeriesLook'
 import { ReactComponent as RocketSvg } from '@/assets/rocket.svg'
 import '../index.less'
-import { CopyOutlined } from '@ant-design/icons'
 import { copy } from '@/utils/utils'
 import InputUpdate from './inputUpdate'
 function tableConfig(
     onChange: () => void,
     details: (data: any) => void,
     handleSave: (data: any) => void,
+    handleSaveDaily: (data: any) => void,
     tableIdClick?: (props: {
         activeKey: string,
         parma: {
@@ -188,11 +188,14 @@ function tableConfig(
             }
         },
         {
-            title: '广告组日预算()',
+            title: '广告组日预算()',
             dataIndex: 'dailyBudget',
             key: 'dailyBudget',
             align: 'center',
             width: 70,
+            render: (a: string, b: any) => {
+                return <InputUpdate title={a} dataIndex={'dailyBudget'} record={b} handleSave={handleSaveDaily} />
+            }
         },
         {
             title: '是否开启自动版位功能',

+ 24 - 0
src/pages/launchSystemNew/adq/ad/updateAd.tsx

@@ -89,6 +89,9 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
                             adgroupsUpdateBidAmountDTO['bidStrategy'] = newValues.bidStrategy
                             adgroupsUpdateBidAmountDTO['bidAmount'] = newValues.bidAmount * 100
                             break
+                        case 'dailyBudget':
+                            data['dailyBudget'] = newValues.dailyBudget * 100
+                            break
                         case 'adgroupName':
                             data['adgroupName'] = newValues.adgroupName
                             break
@@ -158,6 +161,7 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
                                 </Tooltip>}
                             </Space>
                         </Checkbox>
+                        <Checkbox value="dailyBudget">广告预算</Checkbox>
                         <Checkbox value="adgroupName">广告名称</Checkbox>
                     </Checkbox.Group>
                 </Form.Item>
@@ -223,6 +227,26 @@ const UpdateAd: React.FC<Props> = ({ title = '修改广告', visible, onChange,
                         <Input placeholder={`输入价格 元`} style={{ width: 300 }} />
                     </Form.Item>
                 </>}
+                {field?.includes('dailyBudget') && <>
+                    <Form.Item label={<strong>广告预算</strong>} name='dailyBudget' rules={[
+                        { required: true, message: '请输入广告预算' },
+                        {
+                            required: true, message: `大于0,并且填写数字`, validator(rule, value, callback) {
+                                let regPos = /^[0-9]+.?[0-9]*/; //判断是否是数字。
+                                if (!regPos.test(value)) {
+                                    return Promise.reject()
+                                }
+                                if (value >= 0) {
+                                    return Promise.resolve()
+                                } else {
+                                    return Promise.reject()
+                                }
+                            },
+                        },
+                    ]}>
+                        <Input placeholder={`输入价格 元`} style={{ width: 300 }} />
+                    </Form.Item>
+                </>}
                 {field?.includes('adgroupName') && <>
                     <Form.Item label={<strong>广告名称</strong>} name='adgroupName' rules={[{ required: true, message: '请输入广告名称' }]}>
                         <Input placeholder={`请输入广告名称`} style={{ width: 300 }} />

+ 16 - 0
src/pages/launchSystemNew/launchManage/createAd/tacticsS/tableConfig.tsx

@@ -12,6 +12,12 @@ export function Columns(del: (id: number) => void) {
             width: 60,
             align: 'center'
         },
+        {
+            title: '创建人',
+            dataIndex: 'putUserName',
+            key: 'putUserName',
+            width: 60
+        },
         {
             title: '策略组名称',
             dataIndex: 'strategyKey',
@@ -28,10 +34,20 @@ export function Columns(del: (id: number) => void) {
                 return PromotedObjectType[a]
             }
         },
+        {
+            title: '创建时间',
+            dataIndex: 'createTime',
+            key: 'createTime',
+            ellipsis: true,
+            width: 130
+        },
         {
             title: '操作',
             dataIndex: 'cz',
             key: 'cz',
+            fixed: 'right',
+            width: 55,
+            align: 'center',
             render: (a: any, b: any) => {
                 return <Popconfirm
                     title="是否删除?"