tableConfig.tsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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. { title: '首日创角人数', dataIndex: 'firstRoleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  183. { title: '新用户累计创角人数', dataIndex: 'newUserTotalRoleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  184. { title: '创角人数', dataIndex: 'roleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  185. ]
  186. },
  187. {
  188. label: '付费数据',
  189. data: [
  190. { title: '首日新用户充值次数', dataIndex: 'firstUserRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  191. { title: '首日新用户充值人数', dataIndex: 'firstUserRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  192. { title: '首日新用户充值金额', dataIndex: 'firstUserRechargeMoney', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  193. { title: '老用户充值次数', dataIndex: 'oldUserRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  194. { title: '老用户充值人数', dataIndex: 'oldUserRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  195. { title: '老用户充值金额', dataIndex: 'oldUserRechargeMoney', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  196. { title: '账面充值次数', dataIndex: 'showRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  197. { title: '账面充值人数', dataIndex: 'showRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  198. { title: '账面充值金额', dataIndex: 'showRechargeMoney', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  199. { title: '新用户累计充值次数', dataIndex: 'newUserRechargeCount', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  200. { title: '新用户累计充值人数', dataIndex: 'newUserRechargeUser', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  201. { title: '新用户累计充值金额', dataIndex: 'newUserRechargeMoney', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  202. {
  203. title: '首日回收率', dataIndex: 'firstRecoveryRate', label: '付费数据', align: 'center', width: 95, sorter: true,
  204. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  205. },
  206. {
  207. title: '至今回收率', tips: '至今回收率=新用户累计充值金额/实际消耗', dataIndex: 'buyRecoveryRate', label: '付费数据', align: 'center', width: 80, sorter: true,
  208. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  209. },
  210. { title: '毛利额', dataIndex: 'grossMargin', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  211. ...roiC,
  212. {
  213. title: '60日ROI', dataIndex: 'roiDay60', label: '付费数据', align: 'center', width: 70, sorter: true,
  214. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  215. },
  216. {
  217. title: '90日ROI', dataIndex: 'roiDay90', label: '付费数据', align: 'center', width: 70, sorter: true,
  218. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  219. },
  220. {
  221. title: '180日ROI', dataIndex: 'roiDay180', label: '付费数据', align: 'center', width: 70, sorter: true,
  222. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  223. },
  224. {
  225. title: '1年ROI', dataIndex: 'roiYear1', label: '付费数据', align: 'center', width: 70, sorter: true,
  226. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  227. },
  228. {
  229. title: '总ROI', dataIndex: 'roiTotal', label: '付费数据', align: 'center', width: 70, sorter: true,
  230. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  231. },
  232. {
  233. title: '首日付费率', dataIndex: 'firstRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
  234. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  235. },
  236. {
  237. title: '买量用户付费率', dataIndex: 'buyUserRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
  238. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  239. },
  240. { title: '新用户付费比', dataIndex: 'newUserRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  241. { title: '首日客单价', dataIndex: 'avgFirstUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  242. { title: '买量客单价', dataIndex: 'avgBuyUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  243. { title: '账面客单价', dataIndex: 'avgShowUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  244. { title: '首日充值成本', dataIndex: 'firstRechargeCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  245. { title: '买量充值成本', dataIndex: 'buyUserRechargeCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  246. { title: '首日充值次数成本', dataIndex: 'firstRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  247. { title: '老用户充值次数成本', dataIndex: 'oldUserRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  248. { title: '账面充值次数成本', dataIndex: 'showRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  249. { title: '新用户累计充值次数成本', dataIndex: 'newUserRechargeCountCost', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
  250. {
  251. title: '复充率', dataIndex: 'repeatRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
  252. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  253. },
  254. { title: '新增注册ARPPU', dataIndex: 'newRegArpu', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  255. { title: '首日付费ARPPU', dataIndex: 'firstRechargeArpu', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  256. { title: '至今付费ARPPU', tips: '至今付费ARPPU=新用户累计充值金额/新用户累计充值人数', dataIndex: 'todayRechargeArpu', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
  257. { title: '账面ARPPU', dataIndex: 'showRechargeArpu', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> }
  258. ]
  259. },
  260. {
  261. fieldSHow: {
  262. label: '日期区间字段展示',
  263. saveField: 'date_field',
  264. defaultValue,
  265. data: [
  266. {
  267. label: '付费趋势',
  268. data: [
  269. { label: '充值人数', key: 'rechargeCount', type: '付费趋势' },
  270. { label: '充值金额', key: 'rechargeMoney', type: '付费趋势' },
  271. { label: '增', key: 'addPayBack', type: '付费趋势' },
  272. { label: '回', key: 'payBack', type: '付费趋势' },
  273. { label: '倍', key: 'newUserRechargeRate', type: '付费趋势' },
  274. ]
  275. },
  276. ]
  277. },
  278. label: '时间区间跨度',
  279. data: [
  280. ...zC,
  281. {
  282. title: "D30",
  283. dataIndex: "D30",
  284. label: "时间区间跨度",
  285. width: 110,
  286. render: (a: any, b: any) => {
  287. let date1 = moment()
  288. if (b?.dt === '总计') {
  289. if (b?.beginDay) {
  290. date1 = moment(b.beginDay)
  291. } else {
  292. date1 = moment()
  293. }
  294. } else {
  295. date1 = moment(b.dt)
  296. }
  297. let dt = moment()
  298. let day = dt.diff(date1, 'day');
  299. let fieldData = getFieldDta()
  300. if (fieldData?.length > 0 && 30 <= day) {
  301. let data: any = {}
  302. let keyS: string[] = fieldData?.map((item: any) => item.key)
  303. switch (fieldData[0].type) {
  304. case '付费趋势':
  305. if (b?.rechargeTrendMonth1) {
  306. data = b?.rechargeTrendMonth1
  307. return <div className={style.dbox}>
  308. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  309. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  310. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  311. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  312. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  313. </div>
  314. }
  315. return '--'
  316. }
  317. }
  318. return '--'
  319. },
  320. }, {
  321. title: "M2",
  322. dataIndex: "M2",
  323. label: "时间区间跨度",
  324. width: 110,
  325. render: (a: any, b: any) => {
  326. let date1 = moment()
  327. if (b?.dt === '总计') {
  328. if (b?.beginDay) {
  329. date1 = moment(b.beginDay)
  330. } else {
  331. date1 = moment()
  332. }
  333. } else {
  334. date1 = moment(b.dt)
  335. }
  336. let dt = moment()
  337. let day = dt.diff(date1, 'day');
  338. let fieldData = getFieldDta()
  339. if (fieldData?.length > 0 && 60 <= day) {
  340. let data: any = {}
  341. let keyS: string[] = fieldData?.map((item: any) => item.key)
  342. switch (fieldData[0].type) {
  343. case '付费趋势':
  344. if (b?.rechargeTrendMonth2) {
  345. data = b?.rechargeTrendMonth2
  346. return <div className={style.dbox}>
  347. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  348. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  349. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  350. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  351. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  352. </div>
  353. }
  354. return '--'
  355. }
  356. }
  357. return '--'
  358. },
  359. }, {
  360. title: "M3",
  361. dataIndex: "M3",
  362. label: "时间区间跨度",
  363. width: 110,
  364. render: (a: any, b: any) => {
  365. let date1 = moment()
  366. if (b?.dt === '总计') {
  367. if (b?.beginDay) {
  368. date1 = moment(b.beginDay)
  369. } else {
  370. date1 = moment()
  371. }
  372. } else {
  373. date1 = moment(b.dt)
  374. }
  375. let dt = moment()
  376. let day = dt.diff(date1, 'day');
  377. let fieldData = getFieldDta()
  378. if (fieldData?.length > 0 && 90 <= day) {
  379. let data: any = {}
  380. let keyS: string[] = fieldData?.map((item: any) => item.key)
  381. switch (fieldData[0].type) {
  382. case '付费趋势':
  383. if (b?.rechargeTrendMonth3) {
  384. data = b?.rechargeTrendMonth3
  385. return <div className={style.dbox}>
  386. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  387. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  388. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  389. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  390. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  391. </div>
  392. }
  393. return '--'
  394. }
  395. }
  396. return '--'
  397. },
  398. }, {
  399. title: "M6",
  400. dataIndex: "M6",
  401. label: "时间区间跨度",
  402. width: 110,
  403. render: (a: any, b: any) => {
  404. let date1 = moment()
  405. if (b?.dt === '总计') {
  406. if (b?.beginDay) {
  407. date1 = moment(b.beginDay)
  408. } else {
  409. date1 = moment()
  410. }
  411. } else {
  412. date1 = moment(b.dt)
  413. }
  414. let dt = moment()
  415. let day = dt.diff(date1, 'day');
  416. let fieldData = getFieldDta()
  417. if (fieldData?.length > 0 && 180 <= day) {
  418. let data: any = {}
  419. let keyS: string[] = fieldData?.map((item: any) => item.key)
  420. switch (fieldData[0].type) {
  421. case '付费趋势':
  422. if (b?.rechargeTrendMonth6) {
  423. data = b?.rechargeTrendMonth6
  424. return <div className={style.dbox}>
  425. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  426. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  427. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  428. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  429. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  430. </div>
  431. }
  432. return '--'
  433. }
  434. }
  435. return '--'
  436. },
  437. }, {
  438. title: "1年",
  439. dataIndex: "Y1",
  440. label: "时间区间跨度",
  441. width: 110,
  442. render: (a: any, b: any) => {
  443. let date1 = moment()
  444. if (b?.dt === '总计') {
  445. if (b?.beginDay) {
  446. date1 = moment(b.beginDay)
  447. } else {
  448. date1 = moment()
  449. }
  450. } else {
  451. date1 = moment(b.dt)
  452. }
  453. let dt = moment()
  454. let day = dt.diff(date1, 'day');
  455. let fieldData = getFieldDta()
  456. if (fieldData?.length > 0 && 365 <= day) {
  457. let data: any = {}
  458. let keyS: string[] = fieldData?.map((item: any) => item.key)
  459. switch (fieldData[0].type) {
  460. case '付费趋势':
  461. if (b?.rechargeTrendYear1) {
  462. data = b?.rechargeTrendYear1
  463. return <div className={style.dbox}>
  464. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  465. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  466. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  467. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  468. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  469. </div>
  470. }
  471. return '--'
  472. }
  473. }
  474. return '--'
  475. },
  476. }, {
  477. title: "总",
  478. default: 29,
  479. dataIndex: "total",
  480. label: "时间区间跨度",
  481. align: "center",
  482. width: 110,
  483. render: (a: any, b: any) => {
  484. let fieldData = getFieldDta()
  485. if (fieldData?.length > 0) {
  486. let data: any = {}
  487. let keyS: string[] = fieldData?.map((item: any) => item.key)
  488. switch (fieldData[0].type) {
  489. case '付费趋势':
  490. if (b?.rechargeTrendTotal) {
  491. data = b?.rechargeTrendTotal
  492. return <div className={style.dbox}>
  493. {keyS?.includes('rechargeCount') && <span style={{ color: '#d81b60', fontWeight: 600 }}>充人:<span>{data?.rechargeUserCount}</span></span>}
  494. {keyS?.includes('rechargeMoney') && <span style={{ color: '#0f538a', fontWeight: 600 }}>充金:<span><Statistic value={data?.rechargeMoney || 0} valueStyle={{ color: '#0f538a', fontWeight: 600 }} /></span></span>}
  495. {keyS?.includes('addPayBack') && <span style={{ color: 'rgb(12,130,16)', fontWeight: 600 }}>增:<span>{(data?.increase * 100)?.toFixed(2)}%</span></span>}
  496. {keyS?.includes('payBack') && <span style={{ color: '#ff5722', fontWeight: 600 }}>回:<span>{(data?.back * 100)?.toFixed(2)}%</span></span>}
  497. {keyS?.includes('payBack') && <span style={{ color: '#d81b60', fontWeight: 600 }}>倍:<span>{data?.multiples?.toFixed(2)}</span></span>}
  498. </div>
  499. }
  500. return '--'
  501. }
  502. }
  503. return '--'
  504. },
  505. }]
  506. },
  507. {
  508. label: '操作',
  509. data: [
  510. {
  511. default: 30,
  512. title: '操作', dataIndex: 'cz', label: '操作', align: 'center', width: 70, render: (a: string, b: any) => {
  513. if (b?.dt === '总计') {
  514. return <span>--</span>
  515. }
  516. return <a onClick={() => rechargeTrendHandle(b)}>复充趋势</a>
  517. }
  518. },
  519. ]
  520. },
  521. ]
  522. }
  523. export default columns12