tableConfig.tsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. import { Statistic } from "antd"
  2. import React from "react"
  3. import style from './index.less'
  4. import { gameClassifyEnum } from "@/components/QueryForm/const"
  5. import { version } from "../../components/TableData"
  6. import moment from 'moment';
  7. function columns12(rechargeTrendHandle: (data: any) => void): { label: string, fieldSHow?: { label: string, saveField: string, defaultValue: any[], data: any[] }, data: any[] }[] {
  8. let defaultValue = [ // 默认展示字段
  9. { label: '充值人数', key: 'rechargeCount', type: '付费趋势' },
  10. { label: '充值金额', key: 'rechargeMoney', type: '付费趋势' },
  11. { label: '增', key: 'addPayBack', type: '付费趋势' },
  12. { label: '回', key: 'payBack', type: '付费趋势' },
  13. { label: '倍', key: 'newUserRechargeRate', type: '付费趋势' },
  14. ]
  15. const getFieldDta = () => {
  16. let mySelectFieldData = localStorage.getItem(`myAdFieldConfig${version}_推广每日数据`)
  17. let newSelectFieldData: any = {}
  18. if (mySelectFieldData) {
  19. newSelectFieldData = JSON.parse(mySelectFieldData).date_field
  20. } else {
  21. newSelectFieldData = defaultValue
  22. }
  23. return newSelectFieldData
  24. }
  25. // 总付费趋势
  26. let defaultStart = 20
  27. const zC = Array(29).fill('').map((_item: string, index: number) => {
  28. let field = `rechargeTrendDay${index + 1}`
  29. let data = {
  30. title: `D${index + 1}`,
  31. dataIndex: `D${index + 1}`,
  32. label: "时间区间跨度",
  33. width: 110,
  34. render: (a: any, b: any) => {
  35. let date1 = moment()
  36. if (b?.dt === '总计') {
  37. if (b?.beginDay) {
  38. date1 = moment(b.beginDay)
  39. } else {
  40. date1 = moment()
  41. }
  42. } else {
  43. date1 = moment(b.dt)
  44. }
  45. let dt = moment()
  46. let day = dt.diff(date1, 'day');
  47. let fieldData = getFieldDta()
  48. if (fieldData?.length > 0 && index <= day) {
  49. let data: any = {}
  50. let keyS: string[] = fieldData?.map((item: any) => item.key)
  51. switch (fieldData[0].type) {
  52. case '付费趋势':
  53. if (b?.[field]) {
  54. data = b?.[field]
  55. return <div className={style.dbox}>
  56. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  57. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  58. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  59. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  60. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  61. </div>
  62. }
  63. return '--'
  64. }
  65. }
  66. return '--'
  67. },
  68. }
  69. if (index < 9) {
  70. data['default'] = defaultStart + index
  71. }
  72. return data
  73. })
  74. let index = 1;
  75. const roiC = Array(29).fill('').map((_item: string) => {
  76. let data = {
  77. title: `${index + 1}日ROI`,
  78. dataIndex: `roiDay${index + 1}`,
  79. label: '付费数据',
  80. align: 'center',
  81. width: 70,
  82. sorter: true,
  83. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  84. }
  85. index++;
  86. return data
  87. })
  88. return [
  89. {
  90. label: '时间',
  91. data: [
  92. { title: '日期', dataIndex: 'dt', label: '时间', align: 'center', width: 90, default: 1 },
  93. ]
  94. },
  95. {
  96. label: '推广账号信息',
  97. data: [
  98. {
  99. title: '推广账号', dataIndex: 'accountId', key: 'accountId', label: '推广账号信息', align: 'center', width: 70, default: 2,
  100. render: (a: any) => (<span>{a || '--'}</span>)
  101. },
  102. {
  103. title: '投放渠道', dataIndex: 'agentName', key: 'agentName', label: '推广账号信息', align: 'center', width: 130, default: 3,
  104. render: (a: string, b: any) => (<span>{a || '--'}</span>)
  105. }
  106. ]
  107. },
  108. {
  109. label: '业务人员信息',
  110. data: [
  111. { title: '投手', dataIndex: 'sysUserName', key: 'sysUserName', label: '业务人员信息', align: 'center', width: 70, default: 4, render: (a: any) => (<span>{a || '--'}</span>) }
  112. ]
  113. },
  114. {
  115. label: '推广内容信息',
  116. data: [
  117. { title: '推广游戏CP名称', dataIndex: 'cpName', key: 'cpName', label: '推广内容信息', align: 'center', width: 70, default: 5, render: (a: any) => (<span>{a || '--'}</span>) },
  118. { title: '推广游戏名称', dataIndex: 'gameName', key: 'gameName', label: '推广内容信息', align: 'center', width: 70, default: 6, render: (a: any) => (<span>{a || '--'}</span>) },
  119. {
  120. title: '推广游戏应用类型', dataIndex: 'gameType', key: 'gameType', label: '推广内容信息', align: 'center', width: 80, default: 7,
  121. render: (a: string) => (<span>{gameClassifyEnum[a]}</span>)
  122. },
  123. ]
  124. },
  125. {
  126. label: '消耗',
  127. data: [
  128. { title: '消耗', dataIndex: 'cost', key: 'cost', label: '消耗', align: 'center', width: 100, default: 8, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  129. { title: '推广计划数量', dataIndex: 'adPlanCount', key: 'adPlanCount', label: '消耗', align: 'center', width: 70, default: 9, sorter: true, render: (a: any) => (<span>{a || '--'}</span>) }
  130. ]
  131. },
  132. {
  133. label: '广告曝光数据',
  134. data: [
  135. { title: '曝光量', dataIndex: 'viewCount', label: '广告曝光数据', align: 'center', width: 90, default: 10, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  136. { title: '点击量', dataIndex: 'clickCount', label: '广告曝光数据', align: 'center', width: 80, default: 11, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  137. { title: '转化量', dataIndex: 'convertCount', label: '广告曝光数据', align: 'center', width: 80, default: 12, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  138. {
  139. title: '转化率', dataIndex: 'convertRate', label: '广告曝光数据', align: 'center', width: 70, default: 13, sorter: true,
  140. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  141. },
  142. { title: '平均转化成本', dataIndex: 'avgConvertCost', label: '广告曝光数据', align: 'center', width: 70, default: 14, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  143. { title: '深度转化量', dataIndex: 'deepConvertCount', label: '广告曝光数据', align: 'center', width: 70, default: 15, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  144. { title: '深度转化成本', dataIndex: 'deepConvertCost', label: '广告曝光数据', align: 'center', width: 70, default: 16, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  145. {
  146. title: '深度转化率', dataIndex: 'deepConvertRate', label: '广告曝光数据', align: 'center', width: 70, default: 17, sorter: true,
  147. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  148. },
  149. { title: '千次曝光成本', dataIndex: 'thousandViewCost', label: '广告曝光数据', align: 'center', width: 70, default: 18, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  150. { title: '平均点击均价', dataIndex: 'avgClickCost', label: '广告曝光数据', align: 'center', width: 70, default: 19, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  151. { title: '应用下载开始量', dataIndex: 'appDownloadCount', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  152. { title: '应用下载开始成本', dataIndex: 'appDownloadCost', label: '广告曝光数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  153. {
  154. title: '应用下载开始率', dataIndex: 'appDownloadRate', label: '广告曝光数据', align: 'center', width: 70, sorter: true,
  155. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  156. },
  157. { title: '应用下载完成量', dataIndex: 'downloadFinish', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  158. { title: '应用下载完成成本', dataIndex: 'downloadFinishCost', label: '广告曝光数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  159. {
  160. title: '应用下载完成率', dataIndex: 'downloadFinishRate', label: '广告曝光数据', align: 'center', width: 70, sorter: true,
  161. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  162. },
  163. { title: '应用安装量', dataIndex: 'appInstallCount', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  164. { title: '应用安装成本', dataIndex: 'appInstallCost', label: '广告曝光数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  165. {
  166. title: '应用安装完成率', dataIndex: 'appInstallRate', label: '广告曝光数据', align: 'center', width: 70, sorter: true,
  167. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  168. },
  169. { title: '应用激活量', dataIndex: 'appActiveCount', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  170. { title: '应用激活成本', dataIndex: 'appActiveCost', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  171. {
  172. title: '应用激活率', dataIndex: 'appActiveRate', label: '广告曝光数据', align: 'center', width: 70, sorter: true,
  173. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  174. },
  175. ]
  176. },
  177. {
  178. label: '用户数据',
  179. data: [
  180. { title: '注册成本', dataIndex: 'regCost', label: '用户数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  181. { title: '注册人数', dataIndex: 'regUserCount', label: '用户数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  182. ]
  183. },
  184. {
  185. label: '付费数据',
  186. data: [
  187. { title: '首日新用户充值次数', dataIndex: 'firstUserRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  188. { title: '首日新用户充值人数', dataIndex: 'firstUserRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  189. { title: '首日新用户充值金额', dataIndex: 'firstUserRechargeMoney', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  190. { title: '老用户充值次数', dataIndex: 'oldUserRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  191. { title: '老用户充值人数', dataIndex: 'oldUserRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  192. { title: '老用户充值金额', dataIndex: 'oldUserRechargeMoney', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  193. { title: '账面充值次数', dataIndex: 'showRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  194. { title: '账面充值人数', dataIndex: 'showRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  195. { title: '账面充值金额', dataIndex: 'showRechargeMoney', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  196. { title: '新用户累计充值次数', dataIndex: 'newUserRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  197. { title: '新用户累计充值人数', dataIndex: 'newUserRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  198. { title: '新用户累计充值金额', dataIndex: 'newUserRechargeMoney', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  199. {
  200. title: '首日回收率', dataIndex: 'firstRecoveryRate', label: '付费数据', align: 'center', width: 95, sorter: true,
  201. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  202. },
  203. {
  204. title: '至今回收率', tips: '至今回收率=新用户累计充值金额/实际消耗', dataIndex: 'buyRecoveryRate', label: '付费数据', align: 'center', width: 80, sorter: true,
  205. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  206. },
  207. { title: '毛利额', dataIndex: 'grossMargin', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  208. ...roiC,
  209. {
  210. title: '60日ROI', dataIndex: 'roiDay60', label: '付费数据', align: 'center', width: 70, sorter: true,
  211. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  212. },
  213. {
  214. title: '90日ROI', dataIndex: 'roiDay90', label: '付费数据', align: 'center', width: 70, sorter: true,
  215. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  216. },
  217. {
  218. title: '180日ROI', dataIndex: 'roiDay180', label: '付费数据', align: 'center', width: 70, sorter: true,
  219. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  220. },
  221. {
  222. title: '1年ROI', dataIndex: 'roiYear1', label: '付费数据', align: 'center', width: 70, sorter: true,
  223. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  224. },
  225. {
  226. title: '总ROI', dataIndex: 'roiTotal', label: '付费数据', align: 'center', width: 70, sorter: true,
  227. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  228. },
  229. {
  230. title: '首日付费率', dataIndex: 'firstRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
  231. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  232. },
  233. {
  234. title: '买量用户付费率', dataIndex: 'buyUserRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
  235. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  236. },
  237. { title: '新用户付费比', dataIndex: 'newUserRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  238. { title: '首日客单价', dataIndex: 'avgFirstUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  239. { title: '买量客单价', dataIndex: 'avgBuyUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  240. { title: '账面客单价', dataIndex: 'avgShowUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  241. { title: '首日充值成本', dataIndex: 'firstRechargeCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  242. { title: '买量充值成本', dataIndex: 'buyUserRechargeCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  243. { title: '首日充值次数成本', dataIndex: 'firstRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  244. { title: '老用户充值次数成本', dataIndex: 'oldUserRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  245. { title: '账面充值次数成本', dataIndex: 'showRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  246. { title: '新用户累计充值次数成本', dataIndex: 'newUserRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  247. {
  248. title: '复充率', dataIndex: 'repeatRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
  249. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  250. },
  251. { title: '新增注册ARPPU', dataIndex: 'newRegArpu', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  252. { title: '首日付费ARPPU', dataIndex: 'firstRechargeArpu', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  253. { title: '至今付费ARPPU', tips: '至今付费ARPPU=新用户累计充值金额/新用户累计充值人数', dataIndex: 'todayRechargeArpu', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  254. { title: '账面ARPPU', dataIndex: 'showRechargeArpu', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> }
  255. ]
  256. },
  257. {
  258. fieldSHow: {
  259. label: '日期区间字段展示',
  260. saveField: 'date_field',
  261. defaultValue,
  262. data: [
  263. {
  264. label: '付费趋势',
  265. data: [
  266. { label: '充值人数', key: 'rechargeCount', type: '付费趋势' },
  267. { label: '充值金额', key: 'rechargeMoney', type: '付费趋势' },
  268. { label: '增', key: 'addPayBack', type: '付费趋势' },
  269. { label: '回', key: 'payBack', type: '付费趋势' },
  270. { label: '倍', key: 'newUserRechargeRate', type: '付费趋势' },
  271. ]
  272. },
  273. ]
  274. },
  275. label: '时间区间跨度',
  276. data: [
  277. ...zC,
  278. {
  279. title: "D30",
  280. dataIndex: "D30",
  281. label: "时间区间跨度",
  282. width: 110,
  283. render: (a: any, b: any) => {
  284. let date1 = moment()
  285. if (b?.dt === '总计') {
  286. if (b?.beginDay) {
  287. date1 = moment(b.beginDay)
  288. } else {
  289. date1 = moment()
  290. }
  291. } else {
  292. date1 = moment(b.dt)
  293. }
  294. let dt = moment()
  295. let day = dt.diff(date1, 'day');
  296. let fieldData = getFieldDta()
  297. if (fieldData?.length > 0 && 30 <= day) {
  298. let data: any = {}
  299. let keyS: string[] = fieldData?.map((item: any) => item.key)
  300. switch (fieldData[0].type) {
  301. case '付费趋势':
  302. if (b?.rechargeTrendMonth1) {
  303. data = b?.rechargeTrendMonth1
  304. return <div className={style.dbox}>
  305. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  306. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  307. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  308. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  309. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  310. </div>
  311. }
  312. return '--'
  313. }
  314. }
  315. return '--'
  316. },
  317. }, {
  318. title: "M2",
  319. dataIndex: "M2",
  320. label: "时间区间跨度",
  321. width: 110,
  322. render: (a: any, b: any) => {
  323. let date1 = moment()
  324. if (b?.dt === '总计') {
  325. if (b?.beginDay) {
  326. date1 = moment(b.beginDay)
  327. } else {
  328. date1 = moment()
  329. }
  330. } else {
  331. date1 = moment(b.dt)
  332. }
  333. let dt = moment()
  334. let day = dt.diff(date1, 'day');
  335. let fieldData = getFieldDta()
  336. if (fieldData?.length > 0 && 60 <= day) {
  337. let data: any = {}
  338. let keyS: string[] = fieldData?.map((item: any) => item.key)
  339. switch (fieldData[0].type) {
  340. case '付费趋势':
  341. if (b?.rechargeTrendMonth2) {
  342. data = b?.rechargeTrendMonth2
  343. return <div className={style.dbox}>
  344. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  345. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  346. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  347. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  348. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  349. </div>
  350. }
  351. return '--'
  352. }
  353. }
  354. return '--'
  355. },
  356. }, {
  357. title: "M3",
  358. dataIndex: "M3",
  359. label: "时间区间跨度",
  360. width: 110,
  361. render: (a: any, b: any) => {
  362. let date1 = moment()
  363. if (b?.dt === '总计') {
  364. if (b?.beginDay) {
  365. date1 = moment(b.beginDay)
  366. } else {
  367. date1 = moment()
  368. }
  369. } else {
  370. date1 = moment(b.dt)
  371. }
  372. let dt = moment()
  373. let day = dt.diff(date1, 'day');
  374. let fieldData = getFieldDta()
  375. if (fieldData?.length > 0 && 90 <= day) {
  376. let data: any = {}
  377. let keyS: string[] = fieldData?.map((item: any) => item.key)
  378. switch (fieldData[0].type) {
  379. case '付费趋势':
  380. if (b?.rechargeTrendMonth3) {
  381. data = b?.rechargeTrendMonth3
  382. return <div className={style.dbox}>
  383. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  384. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  385. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  386. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  387. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  388. </div>
  389. }
  390. return '--'
  391. }
  392. }
  393. return '--'
  394. },
  395. }, {
  396. title: "M6",
  397. dataIndex: "M6",
  398. label: "时间区间跨度",
  399. width: 110,
  400. render: (a: any, b: any) => {
  401. let date1 = moment()
  402. if (b?.dt === '总计') {
  403. if (b?.beginDay) {
  404. date1 = moment(b.beginDay)
  405. } else {
  406. date1 = moment()
  407. }
  408. } else {
  409. date1 = moment(b.dt)
  410. }
  411. let dt = moment()
  412. let day = dt.diff(date1, 'day');
  413. let fieldData = getFieldDta()
  414. if (fieldData?.length > 0 && 180 <= day) {
  415. let data: any = {}
  416. let keyS: string[] = fieldData?.map((item: any) => item.key)
  417. switch (fieldData[0].type) {
  418. case '付费趋势':
  419. if (b?.rechargeTrendMonth6) {
  420. data = b?.rechargeTrendMonth6
  421. return <div className={style.dbox}>
  422. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  423. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  424. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  425. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  426. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  427. </div>
  428. }
  429. return '--'
  430. }
  431. }
  432. return '--'
  433. },
  434. }, {
  435. title: "1年",
  436. dataIndex: "Y1",
  437. label: "时间区间跨度",
  438. width: 110,
  439. render: (a: any, b: any) => {
  440. let date1 = moment()
  441. if (b?.dt === '总计') {
  442. if (b?.beginDay) {
  443. date1 = moment(b.beginDay)
  444. } else {
  445. date1 = moment()
  446. }
  447. } else {
  448. date1 = moment(b.dt)
  449. }
  450. let dt = moment()
  451. let day = dt.diff(date1, 'day');
  452. let fieldData = getFieldDta()
  453. if (fieldData?.length > 0 && 365 <= day) {
  454. let data: any = {}
  455. let keyS: string[] = fieldData?.map((item: any) => item.key)
  456. switch (fieldData[0].type) {
  457. case '付费趋势':
  458. if (b?.rechargeTrendYear1) {
  459. data = b?.rechargeTrendYear1
  460. return <div className={style.dbox}>
  461. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  462. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  463. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  464. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  465. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  466. </div>
  467. }
  468. return '--'
  469. }
  470. }
  471. return '--'
  472. },
  473. }, {
  474. title: "总",
  475. default: 29,
  476. dataIndex: "total",
  477. label: "时间区间跨度",
  478. align: "center",
  479. width: 110,
  480. render: (a: any, b: any) => {
  481. let fieldData = getFieldDta()
  482. if (fieldData?.length > 0) {
  483. let data: any = {}
  484. let keyS: string[] = fieldData?.map((item: any) => item.key)
  485. switch (fieldData[0].type) {
  486. case '付费趋势':
  487. if (b?.rechargeTrendTotal) {
  488. data = b?.rechargeTrendTotal
  489. return <div className={style.dbox}>
  490. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  491. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  492. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  493. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  494. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  495. </div>
  496. }
  497. return '--'
  498. }
  499. }
  500. return '--'
  501. },
  502. }]
  503. },
  504. {
  505. label: '操作',
  506. data: [
  507. {
  508. default: 30,
  509. title: '操作', dataIndex: 'cz', label: '操作', align: 'center', width: 70, render: (a: string, b: any) => {
  510. if (b?.dt === '总计') {
  511. return <span>--</span>
  512. }
  513. return <a onClick={() => rechargeTrendHandle(b)}>复充趋势</a>
  514. }
  515. },
  516. ]
  517. },
  518. ]
  519. }
  520. export default columns12