index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="ma-content-block">
  3. <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
  4. <!-- 搜索区 tableSearch -->
  5. <template #tableSearch>
  6. <a-col :sm="8" :xs="24">
  7. <a-form-item label="游戏" field="game_id">
  8. <game-select v-model="searchForm.game_id" multiple />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :sm="8" :xs="24">
  12. <a-form-item label="注册日期" field="reg_date">
  13. <a-range-picker class="w-full" v-model="searchForm.reg_date" :show-time="false" mode="date" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="8" :xs="24">
  17. <a-form-item label="渠道ID" field="agent_id">
  18. <a-input v-model="searchForm.agent_id" placeholder="请输入渠道ID" allow-clear />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :sm="8" :xs="24">
  22. <a-form-item label="渠道名称" field="agent_name">
  23. <a-input v-model="searchForm.agent_name" placeholder="请输入渠道名称" allow-clear />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :sm="8" :xs="24">
  27. <a-form-item label="广告位ID" field="site_id">
  28. <a-input v-model="searchForm.site_id" placeholder="请输入广告位ID" allow-clear />
  29. </a-form-item>
  30. </a-col>
  31. <a-col :sm="8" :xs="24">
  32. <a-form-item label="广告名称" field="site_name">
  33. <a-input v-model="searchForm.site_name" placeholder="请输入广告名称" allow-clear />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :sm="8" :xs="24">
  37. <a-form-item label="负责人" field="auth_id">
  38. <auth-select v-model="searchForm.auth_id" />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :sm="8" :xs="24">
  42. <a-form-item label="媒体类型" field="media_id">
  43. <media-select v-model="searchForm.media_id" />
  44. </a-form-item>
  45. </a-col>
  46. <a-col :sm="8" :xs="24">
  47. <a-form-item label="展示类型" field="data_type">
  48. <a-select v-model="searchForm.data_type" placeholder="请选择展示类型" :allow-clear="false">
  49. <a-option value="recovery">回本率</a-option>
  50. <a-option value="remount">实际回本率</a-option>
  51. <a-option value="ltv">LTV</a-option>
  52. <a-option value="ltvbs">LTV倍数</a-option>
  53. <a-option value="pay_num">付费人数</a-option>
  54. <a-option value="pay_total">付费总额</a-option>
  55. <a-option value="pay_rate">付费率</a-option>
  56. <a-option value="arpu"> 付费ARPU </a-option>
  57. </a-select>
  58. </a-form-item>
  59. </a-col>
  60. </template>
  61. <!-- Table 自定义渲染 -->
  62. </sa-table>
  63. </div>
  64. </template>
  65. <script setup>
  66. import { onMounted, ref, reactive } from 'vue'
  67. import api from '../../api/gameLog/channelAnalysis'
  68. import dayjs from 'dayjs'
  69. import GameSelect from '@/components/game-select/index.vue'
  70. import MediaSelect from '@/components/media-select/index.vue'
  71. import AuthSelect from '@/components/auth-select/index.vue'
  72. // 引用定义
  73. const crudRef = ref()
  74. const gameList = ref([])
  75. // 搜索表单
  76. const searchForm = ref({
  77. game_id: '',
  78. media_id: '',
  79. auth_id: '',
  80. agent_id: '',
  81. agent_name: '',
  82. site_name: '',
  83. site_id: '',
  84. reg_date: [],
  85. data_type: 'recovery',
  86. })
  87. // SaTable 基础配置
  88. const options = reactive({
  89. api: api.getLtvDataList,
  90. pk: 'tdate',
  91. rowSelection: { showCheckedAll: true },
  92. showSort: false,
  93. showSummary: true,
  94. summary: [
  95. {
  96. action: 'totalRow',
  97. dataIndex: 'tdate',
  98. },
  99. {
  100. suffixText: '元',
  101. action: 'totalRow',
  102. dataIndex: 'cost',
  103. },
  104. {
  105. action: 'totalRow',
  106. dataIndex: 'reg_total',
  107. },
  108. {
  109. action: 'totalRow',
  110. dataIndex: 'reg_cost',
  111. },
  112. {
  113. action: 'totalRow',
  114. dataIndex: 'd0',
  115. },
  116. {
  117. action: 'totalRow',
  118. dataIndex: 'd1',
  119. },
  120. {
  121. action: 'totalRow',
  122. dataIndex: 'd2',
  123. },
  124. {
  125. action: 'totalRow',
  126. dataIndex: 'd3',
  127. },
  128. {
  129. action: 'totalRow',
  130. dataIndex: 'd4',
  131. },
  132. {
  133. action: 'totalRow',
  134. dataIndex: 'd5',
  135. },
  136. {
  137. action: 'totalRow',
  138. dataIndex: 'd6',
  139. },
  140. {
  141. action: 'totalRow',
  142. dataIndex: 'd7',
  143. },
  144. {
  145. action: 'totalRow',
  146. dataIndex: 'd8',
  147. },
  148. {
  149. action: 'totalRow',
  150. dataIndex: 'd9',
  151. },
  152. {
  153. action: 'totalRow',
  154. dataIndex: 'd10',
  155. },
  156. {
  157. action: 'totalRow',
  158. dataIndex: 'd11',
  159. },
  160. {
  161. action: 'totalRow',
  162. dataIndex: 'd12',
  163. },
  164. {
  165. action: 'totalRow',
  166. dataIndex: 'd13',
  167. },
  168. {
  169. action: 'totalRow',
  170. dataIndex: 'd14',
  171. },
  172. {
  173. action: 'totalRow',
  174. dataIndex: 'd15',
  175. },
  176. {
  177. action: 'totalRow',
  178. dataIndex: 'd16',
  179. },
  180. {
  181. action: 'totalRow',
  182. dataIndex: 'd17',
  183. },
  184. {
  185. action: 'totalRow',
  186. dataIndex: 'd18',
  187. },
  188. {
  189. action: 'totalRow',
  190. dataIndex: 'd19',
  191. },
  192. {
  193. action: 'totalRow',
  194. dataIndex: 'd20',
  195. },
  196. {
  197. action: 'totalRow',
  198. dataIndex: 'd21',
  199. },
  200. {
  201. action: 'totalRow',
  202. dataIndex: 'd22',
  203. },
  204. {
  205. action: 'totalRow',
  206. dataIndex: 'd23',
  207. },
  208. {
  209. action: 'totalRow',
  210. dataIndex: 'd24',
  211. },
  212. {
  213. action: 'totalRow',
  214. dataIndex: 'd25',
  215. },
  216. {
  217. action: 'totalRow',
  218. dataIndex: 'd26',
  219. },
  220. {
  221. action: 'totalRow',
  222. dataIndex: 'd27',
  223. },
  224. {
  225. action: 'totalRow',
  226. dataIndex: 'd28',
  227. },
  228. {
  229. action: 'totalRow',
  230. dataIndex: 'd29',
  231. },
  232. {
  233. action: 'totalRow',
  234. dataIndex: 'd30',
  235. },
  236. {
  237. action: 'totalRow',
  238. dataIndex: 'd35',
  239. },
  240. {
  241. action: 'totalRow',
  242. dataIndex: 'd40',
  243. },
  244. {
  245. action: 'totalRow',
  246. dataIndex: 'd45',
  247. },
  248. {
  249. action: 'totalRow',
  250. dataIndex: 'd50',
  251. },
  252. {
  253. action: 'totalRow',
  254. dataIndex: 'd55',
  255. },
  256. {
  257. action: 'totalRow',
  258. dataIndex: 'd60',
  259. },
  260. {
  261. action: 'totalRow',
  262. dataIndex: 'd65',
  263. },
  264. {
  265. action: 'totalRow',
  266. dataIndex: 'd70',
  267. },
  268. {
  269. action: 'totalRow',
  270. dataIndex: 'd75',
  271. },
  272. {
  273. action: 'totalRow',
  274. dataIndex: 'd80',
  275. },
  276. {
  277. action: 'totalRow',
  278. dataIndex: 'd85',
  279. },
  280. {
  281. action: 'totalRow',
  282. dataIndex: 'd90',
  283. },
  284. {
  285. action: 'totalRow',
  286. dataIndex: 'd95',
  287. },
  288. {
  289. action: 'totalRow',
  290. dataIndex: 'd100',
  291. },
  292. {
  293. action: 'totalRow',
  294. dataIndex: 'd105',
  295. },
  296. {
  297. action: 'totalRow',
  298. dataIndex: 'd110',
  299. },
  300. {
  301. action: 'totalRow',
  302. dataIndex: 'd115',
  303. },
  304. {
  305. action: 'totalRow',
  306. dataIndex: 'd120',
  307. },
  308. ],
  309. operationColumn: false,
  310. })
  311. // SaTable 列配置
  312. const columns = reactive([
  313. { title: '日期', dataIndex: 'tdate', width: 130, fixed: 'left' },
  314. { title: '消耗金额', dataIndex: 'cost', width: 100 },
  315. { title: '注册数', dataIndex: 'reg_total', width: 80 },
  316. { title: '注册成本', dataIndex: 'reg_cost', width: 100 },
  317. { title: '累计', dataIndex: 'd0', width: 80 },
  318. { title: '1', dataIndex: 'd1', width: 80 },
  319. { title: '2', dataIndex: 'd2', width: 80 },
  320. { title: '3', dataIndex: 'd3', width: 80 },
  321. { title: '4', dataIndex: 'd4', width: 80 },
  322. { title: '5', dataIndex: 'd5', width: 80 },
  323. { title: '6', dataIndex: 'd6', width: 80 },
  324. { title: '7', dataIndex: 'd7', width: 80 },
  325. { title: '8', dataIndex: 'd8', width: 80 },
  326. { title: '9', dataIndex: 'd9', width: 80 },
  327. { title: '10', dataIndex: 'd10', width: 80 },
  328. { title: '11', dataIndex: 'd11', width: 80 },
  329. { title: '12', dataIndex: 'd12', width: 80 },
  330. { title: '13', dataIndex: 'd13', width: 80 },
  331. { title: '14', dataIndex: 'd14', width: 80 },
  332. { title: '15', dataIndex: 'd15', width: 80 },
  333. { title: '16', dataIndex: 'd16', width: 80 },
  334. { title: '17', dataIndex: 'd17', width: 80 },
  335. { title: '18', dataIndex: 'd18', width: 80 },
  336. { title: '19', dataIndex: 'd19', width: 80 },
  337. { title: '20', dataIndex: 'd20', width: 80 },
  338. { title: '21', dataIndex: 'd21', width: 80 },
  339. { title: '22', dataIndex: 'd22', width: 80 },
  340. { title: '23', dataIndex: 'd23', width: 80 },
  341. { title: '24', dataIndex: 'd24', width: 80 },
  342. { title: '25', dataIndex: 'd25', width: 80 },
  343. { title: '26', dataIndex: 'd26', width: 80 },
  344. { title: '27', dataIndex: 'd27', width: 80 },
  345. { title: '28', dataIndex: 'd28', width: 80 },
  346. { title: '29', dataIndex: 'd29', width: 80 },
  347. { title: '30', dataIndex: 'd30', width: 80 },
  348. { title: '35', dataIndex: 'd35', width: 80 },
  349. { title: '40', dataIndex: 'd40', width: 80 },
  350. { title: '45', dataIndex: 'd45', width: 80 },
  351. { title: '50', dataIndex: 'd50', width: 80 },
  352. { title: '55', dataIndex: 'd55', width: 80 },
  353. { title: '60', dataIndex: 'd60', width: 80 },
  354. { title: '65', dataIndex: 'd65', width: 80 },
  355. { title: '70', dataIndex: 'd70', width: 80 },
  356. { title: '75', dataIndex: 'd75', width: 80 },
  357. { title: '80', dataIndex: 'd80', width: 80 },
  358. { title: '85', dataIndex: 'd85', width: 80 },
  359. { title: '90', dataIndex: 'd90', width: 80 },
  360. { title: '95', dataIndex: 'd95', width: 80 },
  361. { title: '100', dataIndex: 'd100', width: 80 },
  362. { title: '105', dataIndex: 'd105', width: 80 },
  363. { title: '110', dataIndex: 'd110', width: 80 },
  364. { title: '115', dataIndex: 'd115', width: 80 },
  365. { title: '120', dataIndex: 'd120', width: 80 },
  366. ])
  367. // 页面数据初始化
  368. const initPage = () => {
  369. searchForm.value.reg_date = [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
  370. }
  371. // SaTable 数据请求
  372. const refresh = async () => {
  373. crudRef.value?.refresh()
  374. }
  375. // 页面加载完成执行
  376. onMounted(async () => {
  377. initPage()
  378. refresh()
  379. })
  380. </script>