tablePlanListConfig.tsx 18 KB

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