index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="ma-content-block">
  3. <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm" @search="handleRequestData">
  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="媒体类型" field="media_id">
  18. <media-select v-model="searchForm.media_id" />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :sm="8" :xs="24">
  22. <a-form-item label="渠道ID" field="agent_id">
  23. <a-input v-model="searchForm.agent_id" placeholder="请输入渠道ID" 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="auth_id">
  33. <auth-select v-model="searchForm.auth_id" multiple />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :sm="8" :xs="24">
  37. <a-form-item label="分组" field="group">
  38. <a-select v-model="searchForm.group" placeholder="请选择分组" allow-clear>
  39. <a-option value="">按渠道ID</a-option>
  40. <a-option :value="1">按游戏ID</a-option>
  41. <!-- <a-option :value="4">按游戏组</a-option> -->
  42. <a-option :value="2">按负责人</a-option>
  43. <a-option :value="3">按渠道组</a-option>
  44. </a-select>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :sm="8" :xs="24">
  48. <a-form-item label="忽略" field="filter">
  49. <a-checkbox-group v-model="searchForm.filter">
  50. <a-checkbox value="igz">忽略0投入</a-checkbox>
  51. <a-checkbox value="fak">忽略后台录入</a-checkbox>
  52. </a-checkbox-group>
  53. </a-form-item>
  54. </a-col>
  55. </template>
  56. <template #tableSearchExtend>
  57. <div>
  58. 大盘数据:注册成本 {{ total.reg_cost }}, roi {{ total.roi }}, 付费成本 {{ total.p_cost }}, 付费率
  59. {{ total.p_per }}
  60. </div>
  61. </template>
  62. <!-- Table 自定义渲染 -->
  63. </sa-table>
  64. </div>
  65. </template>
  66. <script setup>
  67. import { onMounted, ref, reactive } from 'vue'
  68. import api from '../../api/gameLog/channelAnalysis'
  69. import dayjs from 'dayjs'
  70. import GameSelect from '@/components/game-select/index.vue'
  71. import MediaSelect from '@/components/media-select/index.vue'
  72. import AuthSelect from '@/components/auth-select/index.vue'
  73. // 引用定义
  74. const crudRef = ref()
  75. const gameList = ref([])
  76. const total = ref({
  77. reg_cost: 0,
  78. roi: 0,
  79. p_cost: 0,
  80. p_per: 0,
  81. })
  82. // 搜索表单
  83. const searchForm = ref({
  84. game_id: '',
  85. media_id: '',
  86. auth_id: '',
  87. agent_id: '',
  88. site_id: '',
  89. reg_date: [],
  90. group: '',
  91. filter: [],
  92. })
  93. // SaTable 基础配置
  94. const options = reactive({
  95. api: api.getAgentDataList,
  96. pk: 'id',
  97. rowSelection: { showCheckedAll: true },
  98. showSort: false,
  99. operationColumn: false,
  100. })
  101. // SaTable 列配置
  102. const columns = reactive([
  103. { title: 'ID', dataIndex: 'akey', width: 100, fixed: 'left' },
  104. { title: '支出', dataIndex: 'cost', width: 100 },
  105. { title: '激活', dataIndex: 'install', width: 100 },
  106. { title: '注册设备', dataIndex: 'reg_dev', width: 100 },
  107. { title: '注册数', dataIndex: 'reg_total', width: 100 },
  108. { title: '注册成本', dataIndex: 'reg_cost', width: 100 },
  109. { title: '创角数', dataIndex: 'role_total', width: 100 },
  110. { title: '创角率', dataIndex: 'role_per', width: 100 },
  111. { title: '次留数', dataIndex: 'active', width: 100 },
  112. { title: '次留成本', dataIndex: 'a_cost', width: 100 },
  113. { title: '次留率', dataIndex: 'a_per', width: 100 },
  114. { title: '总付费人数', dataIndex: 'reg_pay_num', width: 100 },
  115. { title: '总付费金额', dataIndex: 'reg_pay_total', width: 100 },
  116. { title: '付费率', dataIndex: 'p_per', width: 100 },
  117. { title: '当天回本率', dataIndex: 'da_per', width: 100 },
  118. { title: '累计回本率', dataIndex: 're_per', width: 100 },
  119. { title: '实际回本率', dataIndex: 're_amount_per', width: 100 },
  120. { title: '7天实际回本率', dataIndex: 're_amount_per_7', width: 100 },
  121. { title: '付费成本', dataIndex: 'p_cost', width: 100 },
  122. { title: 'ARPU', dataIndex: 'arpu', width: 100 },
  123. { title: '注册ARPU', dataIndex: 'r_arpu', width: 100 },
  124. { title: '老用户数', dataIndex: 'old_login_total', width: 100 },
  125. { title: '分组名称', dataIndex: 'name', width: 100 },
  126. { title: '负责人', dataIndex: 'auth_name', width: 100 },
  127. ])
  128. // 页面数据初始化
  129. const initPage = () => {
  130. searchForm.value.reg_date = [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
  131. }
  132. // SaTable 数据请求
  133. const refresh = async () => {
  134. crudRef.value?.refresh()
  135. }
  136. // 页面加载完成执行
  137. onMounted(async () => {
  138. initPage()
  139. refresh()
  140. })
  141. const handleRequestData = () => {
  142. const res = crudRef.value.getResponseData()
  143. console.log('res====>', res)
  144. total.value = res.totalData
  145. }
  146. </script>
  147. <script>
  148. export default { name: 'v1/channelAnalysis/agent' }
  149. </script>