index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="ma-content-block">
  3. <sa-table
  4. ref="crudRef"
  5. :options="options"
  6. :columns="columns"
  7. :searchForm="searchForm"
  8. >
  9. <!-- 搜索区 tableSearch -->
  10. <template #tableSearch>
  11. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  12. <a-form-item label="游戏" field="game_id">
  13. <game-select v-model="searchForm.game_id" multiple />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="5" :xs="24">
  17. <a-form-item label="注册日期" field="tdate">
  18. <a-range-picker
  19. class="w-full"
  20. v-model="searchForm.tdate"
  21. :show-time="false"
  22. mode="date"
  23. />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  27. <a-form-item label="渠道ID" field="agent_id">
  28. <a-input
  29. v-model="searchForm.agent_id"
  30. placeholder="渠道ID"
  31. allow-clear
  32. />
  33. </a-form-item>
  34. </a-col>
  35. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  36. <a-form-item label="渠道名称" field="agent_name">
  37. <a-input
  38. v-model="searchForm.agent_name"
  39. placeholder="渠道名称"
  40. allow-clear
  41. />
  42. </a-form-item>
  43. </a-col>
  44. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  45. <a-form-item label="广告位ID" field="site_id">
  46. <a-input
  47. v-model="searchForm.site_id"
  48. placeholder="广告位ID"
  49. allow-clear
  50. />
  51. </a-form-item>
  52. </a-col>
  53. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="3" :xs="24">
  54. <a-form-item label="广告名称" field="site_name">
  55. <a-input
  56. v-model="searchForm.site_name"
  57. placeholder="广告名称"
  58. allow-clear
  59. />
  60. </a-form-item>
  61. </a-col>
  62. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  63. <a-form-item label="负责人" field="auth_id">
  64. <auth-select v-model="searchForm.auth_id" multiple />
  65. </a-form-item>
  66. </a-col>
  67. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="5" :xs="24">
  68. <a-form-item label="媒体类型" field="media_id">
  69. <media-select v-model="searchForm.media_id" />
  70. </a-form-item>
  71. </a-col>
  72. </template>
  73. <!-- Table 自定义渲染 -->
  74. </sa-table>
  75. </div>
  76. </template>
  77. <script setup>
  78. import { onMounted, ref, reactive } from "vue";
  79. import api from "../../api/gameLog/channelAnalysis";
  80. import dayjs from "dayjs";
  81. import GameSelect from "@/components/game-select/index.vue";
  82. import MediaSelect from "@/components/media-select/index.vue";
  83. import AuthSelect from "@/components/auth-select/index.vue";
  84. // 引用定义
  85. const crudRef = ref();
  86. const gameList = ref([]);
  87. // 搜索表单
  88. const searchForm = ref({
  89. game_id: "",
  90. media_id: "",
  91. auth_id: "",
  92. agent_id: "",
  93. agent_name: "",
  94. site_name: "",
  95. site_id: "",
  96. tdate: [],
  97. });
  98. // SaTable 基础配置
  99. const options = reactive({
  100. api: api.getAgentDayDataList,
  101. pk: "tdate",
  102. showSummary: true,
  103. showSort: true,
  104. summary: [
  105. {
  106. action: "totalRow",
  107. dataIndex: "tdate",
  108. },
  109. {
  110. suffixText: "元",
  111. action: "totalRow",
  112. dataIndex: "cost",
  113. },
  114. {
  115. action: "totalRow",
  116. dataIndex: "install",
  117. },
  118. {
  119. action: "totalRow",
  120. dataIndex: "reg_dev",
  121. },
  122. {
  123. action: "totalRow",
  124. dataIndex: "reg_total",
  125. },
  126. {
  127. action: "totalRow",
  128. dataIndex: "role_total",
  129. },
  130. {
  131. action: "totalRow",
  132. dataIndex: "role_per",
  133. },
  134. {
  135. action: "totalRow",
  136. dataIndex: "active",
  137. },
  138. {
  139. action: "totalRow",
  140. dataIndex: "a_cost",
  141. },
  142. {
  143. action: "totalRow",
  144. dataIndex: "a_per",
  145. },
  146. {
  147. action: "totalRow",
  148. dataIndex: "reg_pay_num",
  149. },
  150. {
  151. action: "totalRow",
  152. dataIndex: "reg_pay_total",
  153. },
  154. {
  155. action: "totalRow",
  156. dataIndex: "p_per",
  157. },
  158. {
  159. action: "totalRow",
  160. dataIndex: "da_per",
  161. },
  162. {
  163. action: "totalRow",
  164. dataIndex: "re_per",
  165. },
  166. {
  167. action: "totalRow",
  168. dataIndex: "re_amount_per",
  169. },
  170. {
  171. action: "totalRow",
  172. dataIndex: "old_login_total",
  173. },
  174. {
  175. action: "totalRow",
  176. dataIndex: "reg_cost",
  177. },
  178. {
  179. action: "totalRow",
  180. dataIndex: "p_cost",
  181. },
  182. {
  183. action: "totalRow",
  184. dataIndex: "arpu",
  185. },
  186. {
  187. action: "totalRow",
  188. dataIndex: "r_arpu",
  189. },
  190. {
  191. action: "totalRow",
  192. dataIndex: "agent_name",
  193. },
  194. {
  195. action: "totalRow",
  196. dataIndex: "site_name",
  197. },
  198. {
  199. action: "totalRow",
  200. dataIndex: "auth_name",
  201. },
  202. {
  203. action: "totalRow",
  204. dataIndex: "pay_total",
  205. },
  206. {
  207. action: "totalRow",
  208. dataIndex: "pay_amount",
  209. },
  210. {
  211. action: "totalRow",
  212. dataIndex: "pay_cost",
  213. },
  214. ],
  215. operationColumn: false,
  216. });
  217. // SaTable 列配置
  218. const columns = reactive([
  219. { title: "日期", dataIndex: "tdate", width: 130, fixed: "left" },
  220. { title: "支出", dataIndex: "cost", width: 100 },
  221. { title: "展示IP", dataIndex: "show_ip", width: 100 },
  222. { title: "激活", dataIndex: "install", width: 100 },
  223. { title: "激活率", dataIndex: "i_per", width: 100 },
  224. { title: "注册设备", dataIndex: "reg_dev", width: 100 },
  225. { title: "注册数", dataIndex: "reg_total", width: 100 },
  226. { title: "注册率", dataIndex: "r_per", width: 100 },
  227. { title: "注册成本", dataIndex: "reg_cost", width: 100 },
  228. { title: "创角数", dataIndex: "role_total", width: 100 },
  229. { title: "创角率", dataIndex: "role_per", width: 100 },
  230. { title: "次留数", dataIndex: "active", width: 100 },
  231. { title: "次留成本", dataIndex: "a_cost", width: 100 },
  232. { title: "次留率", dataIndex: "a_per", width: 100 },
  233. { title: "总付费人数", dataIndex: "reg_pay_num", width: 100 },
  234. { title: "总付费金额", dataIndex: "reg_pay_total", width: 100 },
  235. { title: "付费率", dataIndex: "p_per", width: 100 },
  236. { title: "付费成本", dataIndex: "p_cost", width: 100 },
  237. { title: "ARPU", dataIndex: "arpu", width: 100 },
  238. { title: "注册ARPU", dataIndex: "r_arpu", width: 100 },
  239. { title: "当天回本率", dataIndex: "da_per", width: 100 },
  240. { title: "累计回本率", dataIndex: "re_per", width: 100 },
  241. { title: "实际回本率", dataIndex: "re_amount_per", width: 100 },
  242. { title: "老用户数", dataIndex: "old_login_total", width: 100 },
  243. { title: "当天收入", dataIndex: "pay_total", width: 100 },
  244. { title: "实际收入", dataIndex: "pay_amount", width: 100 },
  245. { title: "实际收支比", dataIndex: "pay_cost", width: 130 },
  246. ]);
  247. // 页面数据初始化
  248. const initPage = () => {
  249. searchForm.value.tdate[0] = dayjs().subtract(8, "day").format("YYYY-MM-DD");
  250. searchForm.value.tdate[1] = dayjs().subtract(1, "day").format("YYYY-MM-DD");
  251. };
  252. // SaTable 数据请求
  253. const refresh = async () => {
  254. crudRef.value?.refresh();
  255. };
  256. // 页面加载完成执行
  257. onMounted(async () => {
  258. initPage();
  259. refresh();
  260. });
  261. </script>
  262. <script>
  263. export default { name: "v1/channelAnalysis/agentByDay" };
  264. </script>