tablePlanListConfig.tsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. import { Statistic, Tooltip } from 'antd'
  2. import React from 'react'
  3. import './index.less'
  4. import { ReactComponent as RocketSvg } from '@/assets/rocket.svg'
  5. import { GOUMAILEIXING, GUANGGAOZHUANGTAI, TUIGUANGMUBIAO, CHUANGYIZHUANGTAI, YOUHUAMUBIAO, CHUJIAFANGSHI } from './enum'
  6. import Box from './components/box'
  7. import { GGStateData } from './data'
  8. import { copy } from '@/utils/utils'
  9. function columnsMonitor(details: (id: number) => void) {
  10. return function columns() {
  11. let newArr: any = [
  12. {
  13. title: '数据日期',
  14. dataIndex: 'beginToEnd',
  15. key: 'beginToEnd',
  16. align: 'center',
  17. width: 100,
  18. fixed: 'left'
  19. },
  20. {
  21. title: '广告名称/ID',
  22. dataIndex: 'adgroupName',
  23. key: 'adgroupName',
  24. align: 'left',
  25. width: 210,
  26. ellipsis: true,
  27. render: (str: any, b: any) => {
  28. return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
  29. <div style={{ color: '#459ae9', fontSize: 10 }} className='oneText' onClick={() => copy(b.adgroupName)}>{b.adgroupName}</div>
  30. <div style={{ color: '#888' }}>广告ID:{b?.adgroupId}</div>
  31. </div>
  32. }
  33. },
  34. {
  35. title: '投放计划名称/ID',
  36. dataIndex: 'campaignName/campaignId',
  37. key: 'campaignName/campaignId',
  38. align: 'left',
  39. width: 180,
  40. ellipsis: true,
  41. render: (str: any, b: any) => {
  42. return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
  43. <div style={{ color: '#459ae9', fontSize: 10 }} className='oneText' onClick={() => copy(b.campaignName)}>{b.campaignName}</div>
  44. <div style={{ color: '#888' }}>计划ID:{b?.campaignId}</div>
  45. </div>
  46. }
  47. },
  48. {
  49. title: '创意名称/ID',
  50. dataIndex: 'creativeName/creativeId',
  51. key: 'creativeName/creativeId',
  52. align: 'left',
  53. width: 210,
  54. render: (str: any, b: any) => {
  55. return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
  56. <div style={{ color: '#459ae9', fontSize: 10 }} className='oneText' onClick={() => copy(b.creativeName)}>{b.creativeName}</div>
  57. <div style={{ color: '#888' }}>创意ID:{b?.creativeId}</div>
  58. </div>
  59. }
  60. },
  61. {
  62. title: '创意预览',
  63. dataIndex: 'creativePreview',
  64. key: 'creativePreview',
  65. width: 110,
  66. align: 'center',
  67. render: (a: any, b: any) => {
  68. // return a && a?.length > 0 ? <a href={a[0]} target='_blank'>预览</a> : '--'
  69. return <Box b={b} />
  70. }
  71. },
  72. {
  73. title: '广告账户',
  74. dataIndex: 'accountId',
  75. key: 'accountId',
  76. width: 70,
  77. align: 'center'
  78. },
  79. {
  80. title: '投手',
  81. dataIndex: 'putUserName',
  82. key: 'putUserName',
  83. width: 70,
  84. align: 'center',
  85. render: (a: any) => {
  86. return a || '--'
  87. }
  88. },
  89. {
  90. title: '创建日期',
  91. dataIndex: 'adCreateTime',
  92. key: 'adCreateTime',
  93. align: 'center',
  94. width: 110
  95. },
  96. {
  97. title: '广告状态',
  98. dataIndex: 'adStatus',
  99. key: 'adStatus',
  100. align: 'center',
  101. width: 105,
  102. ellipsis: true,
  103. render: (a: any) => {
  104. return GGStateData[a] || '--'
  105. }
  106. },
  107. // {
  108. // title: '创意状态',
  109. // dataIndex: "adCreativeStatus",
  110. // key: "adCreativeStatus",
  111. // align: 'center',
  112. // width: 105,
  113. // render: (a: any) => {
  114. // return CHUANGYIZHUANGTAI[a] || '--'
  115. // }
  116. // },
  117. // {
  118. // title: '购买类型',
  119. // dataIndex: 'adBuyType',
  120. // key: 'adBuyType',
  121. // align: 'center',
  122. // width: 110,
  123. // render: (a: any) => {
  124. // return GOUMAILEIXING[a] || '--'
  125. // }
  126. // },
  127. // {
  128. // title: '自动扩量',
  129. // dataIndex: 'autoExpand',
  130. // key: 'autoExpand',
  131. // width: 110,
  132. // align: 'center',
  133. // render: (a: any) => {
  134. // return a
  135. // }
  136. // },
  137. // {
  138. // title: '曝光评估',
  139. // dataIndex: 'impressionAppraise',
  140. // key: 'impressionAppraise',
  141. // align: 'center',
  142. // width: 115,
  143. // render: (a: any) => {
  144. // return a || '--'
  145. // }
  146. // },
  147. {
  148. title: '投放时间',
  149. dataIndex: 'adBeginTime',
  150. key: 'adBeginTime',
  151. align: 'center',
  152. width: 120,
  153. render: (a: any, b: any) => {
  154. return a ? <div style={{ display: 'flex', flexFlow: 'column nowrap' }}>
  155. <span>{a}</span>
  156. {/* <span>{b?.adEndDate}</span> */}
  157. </div> : '--'
  158. }
  159. },
  160. // {
  161. // title: '当日成本偏差',
  162. // dataIndex: 'dayCostOffset',
  163. // key: 'dayCostOffset',
  164. // align: 'center',
  165. // width: 90,
  166. // render: (a: any) => {
  167. // return a || '--'
  168. // }
  169. // },
  170. {
  171. title: '推广目标',
  172. dataIndex: 'promotedObjectType',
  173. key: 'promotedObjectType',
  174. align: 'center',
  175. width: 80,
  176. ellipsis: true,
  177. render: (a: any) => {
  178. return TUIGUANGMUBIAO[a] || '推广公众号'
  179. }
  180. },
  181. // {
  182. // title: '深度优化目标',
  183. // dataIndex: 'depthOptimizeTarget',
  184. // key: 'depthOptimizeTarget',
  185. // width: 110,
  186. // align: 'center',
  187. // render: (a: any) => {
  188. // return a
  189. // }
  190. // },
  191. {
  192. title: '广告预算',
  193. dataIndex: 'adBudget',
  194. key: 'adBudget',
  195. align: 'center',
  196. width: 110,
  197. render: (a: any) => {
  198. return a ? <Statistic value={a | 0} /> : '--'
  199. }
  200. },
  201. {
  202. title: '出价方式',
  203. dataIndex: 'bidMode',
  204. key: 'bidMode',
  205. align: 'center',
  206. width: 80,
  207. render: (a: any) => {
  208. return CHUJIAFANGSHI[a] || '--'
  209. }
  210. },
  211. {
  212. title: '当前出价',
  213. dataIndex: 'bidAmount',
  214. key: 'bidAmount',
  215. align: 'center',
  216. width: 80,
  217. render: (a: any) => {
  218. return a ? <Statistic value={a | 0} /> : '--'
  219. }
  220. },
  221. // {
  222. // title: '计划预算',
  223. // dataIndex: 'planBudget',
  224. // key: 'planBudget',
  225. // align: 'center',
  226. // width: 80,
  227. // render: (a: any) => {
  228. // return a ? <Statistic value={a | 0} /> : '--'
  229. // }
  230. // },
  231. {
  232. title: '广告总消耗',
  233. dataIndex: 'cost',
  234. key: 'cost',
  235. align: 'center',
  236. width: 100,
  237. sorter: true,
  238. render: (a: any) => {
  239. return <Statistic value={a || 0} />
  240. }
  241. },
  242. // {
  243. // title: '今日消耗',
  244. // dataIndex: 'todayCostTotal',
  245. // key: 'todayCostTotal',
  246. // align: 'center',
  247. // width: 105,
  248. // render: (a: any) => {
  249. // return <Statistic value={a || 0} />
  250. // }
  251. // },
  252. {
  253. title: '单位时间消耗速度',
  254. dataIndex: 'costSpeed',
  255. key: 'costSpeed',
  256. align: 'center',
  257. width: 120,
  258. render: (a: any, b: any) => {
  259. return <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
  260. {/* <div>当前:<span></span></div>
  261. <div>前第一小时:<span></span></div> */}
  262. <RocketSvg /> <a onClick={() => details(b)} style={{ marginLeft: 10 }}>详情</a>
  263. </div>
  264. }
  265. },
  266. {
  267. title: '曝光量',
  268. dataIndex: 'viewCount',
  269. key: 'viewCount',
  270. align: 'center',
  271. width: 70,
  272. sorter: true,
  273. render: (a: number) => {
  274. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'}</span >
  275. },
  276. },
  277. {
  278. title: '千次曝光成本',
  279. dataIndex: 'thousandDisplayPrice',
  280. key: 'thousandDisplayPrice',
  281. align: 'center',
  282. width: 115,
  283. // sorter: true,
  284. render: (a: any) => {
  285. return <Statistic value={a ? a?.toFixed(2) : 0} />
  286. }
  287. },
  288. {
  289. title: '点击量',
  290. dataIndex: 'clickCount',
  291. key: 'clickCount',
  292. align: 'center',
  293. width: 70,
  294. sorter: true,
  295. render: (a: number) => {
  296. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'}</span >
  297. },
  298. },
  299. {
  300. title: '点击均价',
  301. dataIndex: 'avgClickAmount',
  302. key: 'avgClickAmount',
  303. align: 'center',
  304. width: 115,
  305. // sorter: true,
  306. render: (a: any) => {
  307. return <Statistic value={a ? a?.toFixed(2) : 0} />
  308. }
  309. },
  310. {
  311. title: '点击率',
  312. dataIndex: 'clickRate',
  313. key: 'clickRate',
  314. align: 'center',
  315. width: 115,
  316. // sorter: true,
  317. render: (a: any) => {
  318. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  319. return a + '%'
  320. }
  321. },
  322. {
  323. title: '不感兴趣点击次数',
  324. dataIndex: 'noInterestCount',
  325. key: 'noInterestCount',
  326. align: 'center',
  327. width: 70,
  328. sorter: true,
  329. render: (a: number) => {
  330. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'}</span >
  331. },
  332. },
  333. {
  334. title: '优化目标',
  335. dataIndex: 'optimizationGoal',
  336. key: 'optimizationGoal',
  337. align: 'center',
  338. width: 115,
  339. render: (a: any) => {
  340. return <Tooltip title={YOUHUAMUBIAO[a]}>
  341. <div className='oneText'>{YOUHUAMUBIAO[a] || '--'}</div>
  342. </Tooltip>
  343. }
  344. },
  345. {
  346. title: '转化目标量',
  347. dataIndex: 'conversionsCount',
  348. key: 'conversionsCount',
  349. align: 'center',
  350. width: 115,
  351. sorter: true,
  352. render: (a: any) => {
  353. return <Statistic value={a || 0} />
  354. }
  355. },
  356. {
  357. title: '转化目标成本',
  358. dataIndex: 'conversionsCost',
  359. key: 'conversionsCost',
  360. align: 'center',
  361. width: 115,
  362. // sorter: true,
  363. render: (a: any) => {
  364. return <Statistic value={a ? a?.toFixed(2) : 0} />
  365. }
  366. },
  367. {
  368. title: '目标转化率',
  369. dataIndex: 'conversionsRate',
  370. key: 'conversionsRate',
  371. align: 'center',
  372. width: 115,
  373. // sorter: true,
  374. render: (a: any) => {
  375. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  376. return a + '%'
  377. }
  378. },
  379. {
  380. title: '深度转化量',
  381. dataIndex: 'deepConversionsCount',
  382. key: 'deepConversionsCount',
  383. align: 'center',
  384. width: 115,
  385. sorter: true,
  386. render: (a: any) => {
  387. return <Statistic value={a || 0} />
  388. }
  389. },
  390. {
  391. title: '下单量',
  392. dataIndex: 'orderCount',
  393. key: 'orderCount',
  394. align: 'center',
  395. width: 115,
  396. sorter: true,
  397. render: (a: any) => {
  398. return <Statistic value={a || 0} />
  399. }
  400. },
  401. {
  402. title: '首日新增下单量',
  403. dataIndex: 'firstDayOrderCount',
  404. key: 'firstDayOrderCount',
  405. align: 'center',
  406. width: 115,
  407. sorter: true,
  408. render: (a: any) => {
  409. return <Statistic value={a || 0} />
  410. }
  411. },
  412. {
  413. title: '下单成本',
  414. dataIndex: 'orderCost',
  415. key: 'orderCost',
  416. align: 'center',
  417. width: 115,
  418. // sorter: true,
  419. render: (a: any) => {
  420. return <Statistic value={a ? a?.toFixed(2) : 0} />
  421. }
  422. },
  423. {
  424. title: '下单率',
  425. dataIndex: 'orderRate',
  426. key: 'orderRate',
  427. align: 'center',
  428. width: 115,
  429. // sorter: true,
  430. render: (a: any) => {
  431. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  432. return a + '%'
  433. }
  434. },
  435. {
  436. title: '下单金额',
  437. dataIndex: 'orderAmount',
  438. key: 'orderAmount',
  439. align: 'center',
  440. width: 115,
  441. sorter: true,
  442. render: (a: any) => {
  443. return <Statistic value={a || 0} />
  444. }
  445. },
  446. {
  447. title: '首日新增下单金额',
  448. dataIndex: 'firstDayOrderAmount',
  449. key: 'firstDayOrderAmount',
  450. align: 'center',
  451. width: 115,
  452. sorter: true,
  453. render: (a: any) => {
  454. return <Statistic value={a || 0} />
  455. }
  456. },
  457. {
  458. title: '下单客单价',
  459. dataIndex: 'atvAmount',
  460. key: 'atvAmount',
  461. align: 'center',
  462. width: 115,
  463. // sorter: true,
  464. render: (a: any) => {
  465. return <Statistic value={a ? a?.toFixed(2) : 0} />
  466. }
  467. },
  468. {
  469. title: '下单ROI',
  470. dataIndex: 'orderROI',
  471. key: 'orderROI',
  472. align: 'center',
  473. width: 115,
  474. // sorter: true,
  475. render: (a: any) => {
  476. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  477. return a + '%'
  478. }
  479. },
  480. {
  481. title: '首日新增下单ROI',
  482. dataIndex: 'firstDayOrderRoi',
  483. key: 'firstDayOrderRoi',
  484. align: 'center',
  485. width: 115,
  486. // sorter: true,
  487. render: (a: any) => {
  488. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  489. return a + '%'
  490. }
  491. },
  492. {
  493. title: '公众号关注人数',
  494. dataIndex: 'mpFollowUser',
  495. key: 'mpFollowUser',
  496. align: 'center',
  497. width: 115,
  498. sorter: true,
  499. render: (a: any) => {
  500. return a || '--'
  501. }
  502. },
  503. {
  504. title: '公众号关注率',
  505. dataIndex: 'mpFollowRate',
  506. key: 'mpFollowRate',
  507. align: 'center',
  508. width: 115,
  509. // sorter: true,
  510. render: (a: any) => {
  511. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  512. return a + '%'
  513. }
  514. },
  515. {
  516. title: '公众号关注成本',
  517. dataIndex: 'mpFollowCost',
  518. key: 'mpFollowCost',
  519. align: 'center',
  520. width: 115,
  521. // sorter: true,
  522. render: (a: any) => {
  523. return <Statistic value={a ? a?.toFixed(2) : 0} />
  524. }
  525. },
  526. {
  527. title: '操作',
  528. dataIndex: 'event',
  529. key: 'event',
  530. align: 'center',
  531. width: 90,
  532. render: (a: any, b: any) => {
  533. return <a style={{ color: '#1890ff' }} onClick={() => window.open(`https://ad.qq.com/atlas/${b?.accountId}/admanage/adcreative?adgroupid=${b?.adgroupId}&query={%22configured_status%22:[%22AD_STATUS_EXCLUDE_DELETED%22],%22status%22:[]}`)} target="_blank">腾讯广告</a>
  534. }
  535. }
  536. ]
  537. return newArr
  538. }
  539. }
  540. export default columnsMonitor