tableConfig.tsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. import { Statistic } from 'antd'
  2. import { ColumnsType } from 'antd/lib/table'
  3. import React from 'react'
  4. function columns() {
  5. let newArr: ColumnsType<any> = [
  6. {
  7. title: '时间',
  8. dataIndex: 'date',
  9. key: 'date',
  10. align: 'center',
  11. width: 95,
  12. fixed: 'left',
  13. sorter:true
  14. },
  15. {
  16. title: '公众号',
  17. dataIndex: 'channel',
  18. key: 'channel',
  19. align: 'center',
  20. width: 70,
  21. fixed: 'left',
  22. },
  23. {
  24. title: '投手',
  25. dataIndex: 'pitcher',
  26. key: 'pitcher',
  27. align: 'center',
  28. width: 50,
  29. fixed: 'left',
  30. },
  31. {
  32. title: '期数',
  33. dataIndex: 'stage',
  34. key: 'stage',
  35. align: 'center',
  36. width: 85,
  37. fixed: 'left',
  38. },
  39. {
  40. title: '主投书',
  41. dataIndex: 'book',
  42. key: 'book',
  43. width: 90,
  44. align: 'center',
  45. fixed: 'left',
  46. ellipsis: true
  47. },
  48. {
  49. title: '投放位置',
  50. dataIndex: 'type',
  51. key: 'type',
  52. width: 40,
  53. align: 'center',
  54. fixed: 'left',
  55. },
  56. {
  57. title: '曝光量',
  58. dataIndex: 'view_count',
  59. key: 'view_count',
  60. align: 'center',
  61. width: 110,
  62. sorter:true,
  63. render:(a:any)=>{
  64. return <Statistic value={a || 0} />
  65. }
  66. },
  67. {
  68. title: '点击量',
  69. dataIndex: 'click_count',
  70. key: 'click_count',
  71. align: 'center',
  72. width: 110,
  73. sorter:true,
  74. render:(a:any)=>{
  75. return <Statistic value={a || 0} />
  76. }
  77. },
  78. {
  79. title: '点击率',
  80. dataIndex: 'click_rate',
  81. key: 'click_rate',
  82. align: 'center',
  83. width: 75,
  84. sorter:true,
  85. render: (a: number) => {
  86. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  87. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  88. },
  89. },
  90. {
  91. title: '点击关注率',
  92. dataIndex: 'click_follow_rate',
  93. key: 'click_follow_rate',
  94. align: 'center',
  95. width: 75,
  96. sorter:true,
  97. render: (a: number) => {
  98. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  99. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  100. },
  101. },
  102. {
  103. title: '关注次数',
  104. dataIndex: 'follow_user',
  105. key: 'follow_user',
  106. align: 'center',
  107. width: 100,
  108. sorter:true,
  109. render:(a:any)=>{
  110. return <Statistic value={a || 0} />
  111. }
  112. },
  113. // {
  114. // title: '关注率',
  115. // dataIndex: 'follow_rate',
  116. // key: 'follow_rate',
  117. // align: 'center',
  118. // width: 75,
  119. // sorter:true,
  120. // render: (a: number) => {
  121. // a = a ? parseFloat((a * 100).toFixed(2)) : 0
  122. // return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  123. // },
  124. // },
  125. {
  126. title: '关注充值率',
  127. dataIndex: 'follow_order_rate',
  128. key: 'follow_order_rate',
  129. align: 'center',
  130. width: 75,
  131. sorter:true,
  132. render: (a: number) => {
  133. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  134. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  135. },
  136. },
  137. {
  138. title: '关注成本',
  139. dataIndex: 'follow_per_cost',
  140. key: 'follow_per_cost',
  141. align: 'center',
  142. width: 60,
  143. sorter:true,
  144. render: (a: number) => {
  145. return <Statistic value={a || 0} />
  146. },
  147. },
  148. {
  149. title: '首日新用户充值成本',
  150. dataIndex: 'first_order_user_per_cost',
  151. key: 'first_order_user_per_cost',
  152. align: 'center',
  153. width: 95,
  154. sorter:true,
  155. render: (a: number) => {
  156. return <Statistic value={a || 0} />
  157. },
  158. },
  159. {
  160. title: '客单价',
  161. dataIndex: 'user_per_amount',
  162. key: 'user_per_amount',
  163. align: 'center',
  164. width: 75,
  165. sorter:true,
  166. render: (a: number) => {
  167. return <Statistic value={a || 0} />
  168. },
  169. },
  170. {
  171. title: '下单率',
  172. dataIndex: 'order_rate',
  173. key: 'order_rate',
  174. align: 'center',
  175. width: 75,
  176. sorter:true,
  177. render: (a: number) => {
  178. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  179. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  180. },
  181. },
  182. {
  183. title: '消耗',
  184. dataIndex: 'cost',
  185. key: 'cost',
  186. align: 'center',
  187. width: 110,
  188. sorter:true,
  189. render: (a: number) => {
  190. return <Statistic value={a || 0} />
  191. },
  192. },
  193. {
  194. title: '新用户充值次数',
  195. dataIndex: 'first_order_count',
  196. key: 'first_order_count',
  197. align: 'center',
  198. width: 90,
  199. sorter:true,
  200. render:(a:any)=>{
  201. return <Statistic value={a || 0} />
  202. }
  203. },
  204. {
  205. title: '新用户充值人数',
  206. dataIndex: 'first_order_user',
  207. key: 'first_order_user',
  208. align: 'center',
  209. width: 85,
  210. sorter:true,
  211. render:(a:any)=>{
  212. return <Statistic value={a || 0} />
  213. }
  214. },
  215. {
  216. title: '新用户充值金额',
  217. dataIndex: 'first_order_amount',
  218. key: 'first_order_amount',
  219. align: 'center',
  220. width: 110,
  221. sorter:true,
  222. render: (a: number) => {
  223. return <Statistic value={a || 0} />
  224. },
  225. },
  226. {
  227. title: '充值次数',
  228. dataIndex: 'order_count',
  229. key: 'order_count',
  230. align: 'center',
  231. width: 100,
  232. sorter:true,
  233. render:(a:any)=>{
  234. return <Statistic value={a || 0} />
  235. }
  236. },
  237. {
  238. title: '充值人数',
  239. dataIndex: 'order_user',
  240. key: 'order_user',
  241. align: 'center',
  242. width: 100,
  243. sorter:true,
  244. render:(a:any)=>{
  245. return <Statistic value={a || 0} />
  246. }
  247. },
  248. {
  249. title: '充值金额',
  250. dataIndex: 'order_amount',
  251. key: 'order_amount',
  252. align: 'center',
  253. width: 110,
  254. sorter:true,
  255. render: (a: number) => {
  256. return <Statistic value={a || 0} />
  257. },
  258. },
  259. {
  260. title: '老用户充值金额',
  261. dataIndex: 'old_order_amount',
  262. key: 'old_order_amount',
  263. align: 'center',
  264. width: 110,
  265. sorter:true,
  266. render: (a: number) => {
  267. return <Statistic value={a || 0} />
  268. },
  269. },
  270. {
  271. title: '首日客单价',
  272. dataIndex: 'first_amount_per_user',
  273. key: 'first_amount_per_user',
  274. align: 'center',
  275. width: 75,
  276. sorter:true,
  277. render: (a: number) => {
  278. return <Statistic value={a || 0} />
  279. },
  280. },
  281. {
  282. title: '单位关注收益',
  283. dataIndex: 'amount_per_follow',
  284. key: 'amount_per_follow',
  285. align: 'center',
  286. width: 75,
  287. sorter:true,
  288. render: (a: number) => {
  289. return <Statistic value={a || 0} />
  290. },
  291. },
  292. {
  293. title: '新用户充值成本',
  294. dataIndex: 'first_cost_per_user',
  295. key: 'first_cost_per_user',
  296. align: 'center',
  297. width: 85,
  298. sorter:true,
  299. render: (a: number) => {
  300. return <Statistic value={a || 0} />
  301. },
  302. },
  303. {
  304. title: '新用户累计充值',
  305. dataIndex: 'reg_user_amount',
  306. key: 'reg_user_amount',
  307. align: 'center',
  308. width: 85,
  309. sorter:true,
  310. render: (a: number) => {
  311. return <Statistic value={a || 0} />
  312. },
  313. },
  314. {
  315. title: '新用户充值率',
  316. dataIndex: 'new_user_order_rate',
  317. key: 'new_user_order_rate',
  318. align: 'center',
  319. width: 75,
  320. sorter:true,
  321. render: (a: number) => {
  322. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  323. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  324. },
  325. },
  326. {
  327. title: '首日回收率',
  328. dataIndex: 'day_roi',
  329. key: 'day_roi',
  330. align: 'center',
  331. width: 75,
  332. sorter:true,
  333. render: (a: number) => {
  334. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  335. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  336. },
  337. },
  338. {
  339. title: '当日回收率',
  340. dataIndex: 'roi',
  341. key: 'roi',
  342. align: 'center',
  343. width: 75,
  344. sorter:true,
  345. render: (a: number) => {
  346. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  347. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  348. },
  349. },
  350. {
  351. title: '复充率',
  352. dataIndex: 'old_user_once_order_rate',
  353. key: 'old_user_once_order_rate',
  354. align: 'center',
  355. width: 75,
  356. sorter:true,
  357. render: (a: number) => {
  358. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  359. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
  360. },
  361. },
  362. ]
  363. return newArr
  364. }
  365. export { columns }