index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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="6" :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="6" :xs="24">
  12. <a-form-item label="注册日期" field="tdate">
  13. <a-range-picker class="w-full" v-model="searchForm.tdate" :show-time="false" mode="date" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="6" :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="6" :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="6" :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="6" :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="6" :xs="24">
  37. <a-form-item label="负责人" field="auth_id">
  38. <auth-select v-model="searchForm.auth_id" multiple />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :sm="6" :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="6" :xs="24">
  47. <a-form-item label="忽略" field="filter">
  48. <a-checkbox-group v-model="searchForm.filter">
  49. <a-checkbox value="igz">忽略0投入</a-checkbox>
  50. </a-checkbox-group>
  51. </a-form-item>
  52. </a-col>
  53. </template>
  54. <template #tableSearchExtend>
  55. <a-space>
  56. <a-button type="primary" @click="refreshDay('yesterday')">前一天</a-button>
  57. <a-button type="primary" @click="refreshDay('today')">当天</a-button>
  58. <a-button type="primary" @click="refreshDay('tomorrow')">后一天</a-button>
  59. </a-space>
  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. site_id: '',
  82. tdate: [],
  83. group: '',
  84. filter: [],
  85. })
  86. // SaTable 基础配置
  87. const options = reactive({
  88. api: api.getAdSiteDataList,
  89. pk: 'id',
  90. rowSelection: { showCheckedAll: true },
  91. showSort: false,
  92. showSummary: true,
  93. summary: [
  94. {
  95. action: 'totalRow',
  96. dataIndex: 'site_id',
  97. },
  98. {
  99. action: 'totalRow',
  100. dataIndex: 'agent_id',
  101. },
  102. {
  103. suffixText: '元',
  104. action: 'totalRow',
  105. dataIndex: 'cost',
  106. },
  107. {
  108. action: 'totalRow',
  109. dataIndex: 'install',
  110. },
  111. {
  112. action: 'totalRow',
  113. dataIndex: 'reg_dev',
  114. },
  115. {
  116. action: 'totalRow',
  117. dataIndex: 'reg_total',
  118. },
  119. {
  120. action: 'totalRow',
  121. dataIndex: 'role_total',
  122. },
  123. {
  124. action: 'totalRow',
  125. dataIndex: 'role_per',
  126. },
  127. {
  128. action: 'totalRow',
  129. dataIndex: 'active',
  130. },
  131. {
  132. action: 'totalRow',
  133. dataIndex: 'a_cost',
  134. },
  135. {
  136. action: 'totalRow',
  137. dataIndex: 'a_per',
  138. },
  139. {
  140. action: 'totalRow',
  141. dataIndex: 'reg_pay_num',
  142. },
  143. {
  144. action: 'totalRow',
  145. dataIndex: 'reg_pay_total',
  146. },
  147. {
  148. action: 'totalRow',
  149. dataIndex: 'p_per',
  150. },
  151. {
  152. action: 'totalRow',
  153. dataIndex: 'da_per',
  154. },
  155. {
  156. action: 'totalRow',
  157. dataIndex: 're_per',
  158. },
  159. {
  160. action: 'totalRow',
  161. dataIndex: 're_amount_per',
  162. },
  163. {
  164. action: 'totalRow',
  165. dataIndex: 'old_login_total',
  166. },
  167. {
  168. action: 'totalRow',
  169. dataIndex: 'reg_cost',
  170. },
  171. {
  172. action: 'totalRow',
  173. dataIndex: 'p_cost',
  174. },
  175. {
  176. action: 'totalRow',
  177. dataIndex: 'arpu',
  178. },
  179. {
  180. action: 'totalRow',
  181. dataIndex: 'r_arpu',
  182. },
  183. {
  184. action: 'totalRow',
  185. dataIndex: 'agent_name',
  186. },
  187. {
  188. action: 'totalRow',
  189. dataIndex: 'site_name',
  190. },
  191. {
  192. action: 'totalRow',
  193. dataIndex: 'auth_name',
  194. },
  195. ],
  196. showSort: true,
  197. operationColumn: false,
  198. })
  199. // SaTable 列配置
  200. const columns = reactive([
  201. { title: '广告位ID', dataIndex: 'site_id', width: 100, fixed: 'left' },
  202. { title: '渠道ID', dataIndex: 'agent_id', width: 100, fixed: 'left' },
  203. { title: '支出', dataIndex: 'cost', width: 100 },
  204. { title: '激活', dataIndex: 'install', width: 100 },
  205. { title: '注册设备', dataIndex: 'reg_dev', width: 100 },
  206. { title: '注册数', dataIndex: 'reg_total', width: 100 },
  207. { title: '注册成本', dataIndex: 'reg_cost', width: 100 },
  208. { title: '创角数', dataIndex: 'role_total', width: 100 },
  209. { title: '创角率', dataIndex: 'role_per', width: 100 },
  210. { title: '次留数', dataIndex: 'active', width: 100 },
  211. { title: '次留成本', dataIndex: 'a_cost', width: 100 },
  212. { title: '次留率', dataIndex: 'a_per', width: 100 },
  213. { title: '总付费人数', dataIndex: 'reg_pay_num', width: 100 },
  214. { title: '总付费金额', dataIndex: 'reg_pay_total', width: 100 },
  215. { title: '付费率', dataIndex: 'p_per', width: 100 },
  216. { title: '当天回本率', dataIndex: 'da_per', width: 100 },
  217. { title: '累计回本率', dataIndex: 're_per', width: 100 },
  218. { title: '实际回本率', dataIndex: 're_amount_per', width: 100 },
  219. { title: '付费成本', dataIndex: 'p_cost', width: 100 },
  220. { title: 'ARPU', dataIndex: 'arpu', width: 100 },
  221. { title: '注册ARPU', dataIndex: 'r_arpu', width: 100 },
  222. { title: '老用户数', dataIndex: 'old_login_total', width: 100 },
  223. { title: '渠道名称', dataIndex: 'agent_name', width: 100 },
  224. { title: '广告名称', dataIndex: 'site_name', width: 100 },
  225. { title: '负责人', dataIndex: 'auth_name', width: 100 },
  226. ])
  227. // 页面数据初始化
  228. const initPage = () => {
  229. searchForm.value.tdate = [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
  230. }
  231. // SaTable 数据请求
  232. const refresh = async () => {
  233. crudRef.value?.refresh()
  234. }
  235. const refreshDay = async (day) => {
  236. console.log(day)
  237. switch (day) {
  238. case 'yesterday':
  239. searchForm.value.tdate = [
  240. dayjs(searchForm.value.tdate[0]).subtract(1, 'day').format('YYYY-MM-DD'),
  241. dayjs(searchForm.value.tdate[1]).subtract(1, 'day').format('YYYY-MM-DD'),
  242. ]
  243. break
  244. case 'today':
  245. searchForm.value.tdate = [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
  246. break
  247. case 'tomorrow':
  248. searchForm.value.tdate = [
  249. dayjs(searchForm.value.tdate[0]).add(1, 'day').format('YYYY-MM-DD'),
  250. dayjs(searchForm.value.tdate[1]).add(1, 'day').format('YYYY-MM-DD'),
  251. ]
  252. break
  253. default:
  254. break
  255. }
  256. refresh()
  257. }
  258. // 页面加载完成执行
  259. onMounted(async () => {
  260. initPage()
  261. refresh()
  262. })
  263. </script>
  264. <script>
  265. export default { name: 'v1/channelAnalysis/site' }
  266. </script>