index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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="17" :lg="17" :xl="12" :xxl="8" :xs="24">
  17. <a-form-item label="注册日期" field="tdate">
  18. <a-space>
  19. <a-range-picker
  20. class="w-full"
  21. v-model="searchForm.tdate"
  22. :show-time="false"
  23. mode="date"
  24. />
  25. <a-button
  26. size="mini"
  27. type="outline"
  28. @click="refreshDay('yesterday')"
  29. >前一天</a-button
  30. >
  31. <a-button size="mini" type="outline" @click="refreshDay('today')"
  32. >当天</a-button
  33. >
  34. <a-button
  35. size="mini"
  36. type="outline"
  37. @click="refreshDay('tomorrow')"
  38. >后一天</a-button
  39. >
  40. </a-space>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  44. <a-form-item label="媒体类型" field="media_id">
  45. <media-select v-model="searchForm.media_id" />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  49. <a-form-item label="渠道ID" field="agent_id">
  50. <a-input
  51. v-model="searchForm.agent_id"
  52. placeholder="请输入渠道ID"
  53. allow-clear
  54. />
  55. </a-form-item>
  56. </a-col>
  57. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  58. <a-form-item label="广告位ID" field="site_id">
  59. <a-input
  60. v-model="searchForm.site_id"
  61. placeholder="请输入广告位ID"
  62. allow-clear
  63. />
  64. </a-form-item>
  65. </a-col>
  66. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  67. <a-form-item label="负责人" field="auth_id">
  68. <auth-select v-model="searchForm.auth_id" multiple />
  69. </a-form-item>
  70. </a-col>
  71. <a-col :sm="24" :md="8" :lg="8" :xl="6" :xxl="4" :xs="24">
  72. <a-form-item label="分组" field="group">
  73. <a-select
  74. v-model="searchForm.group"
  75. placeholder="请选择分组"
  76. allow-clear
  77. >
  78. <a-option value="">按渠道ID</a-option>
  79. <a-option :value="1">按游戏ID</a-option>
  80. <!-- <a-option :value="4">按游戏组</a-option> -->
  81. <a-option :value="2">按负责人</a-option>
  82. <a-option :value="3">按渠道组</a-option>
  83. </a-select>
  84. </a-form-item>
  85. </a-col>
  86. <a-col :sm="24" :md="8" :lg="8" :xl="8" :xxl="8" :xs="24">
  87. <a-form-item label="其他" field="filter">
  88. <a-space direction="vertical">
  89. <a-checkbox-group v-model="searchForm.filter">
  90. <a-checkbox value="igz">忽略0投入</a-checkbox>
  91. <a-checkbox value="fak">忽略后台录入</a-checkbox>
  92. </a-checkbox-group>
  93. </a-space>
  94. </a-form-item>
  95. </a-col>
  96. </template>
  97. <template #tableSearchExtend>
  98. <div class="text-red-500 font-bold">
  99. <a-space>
  100. 大盘数据:注册成本 {{ total.reg_cost }}, roi {{ total.roi }},
  101. 付费成本 {{ total.p_cost }}, 付费率
  102. {{ total.p_per }}
  103. </a-space>
  104. </div>
  105. </template>
  106. <!-- Table 自定义渲染 -->
  107. </sa-table>
  108. </div>
  109. </template>
  110. <script setup>
  111. import { onMounted, ref, reactive } from "vue";
  112. import api from "../../api/gameLog/channelAnalysis";
  113. import dayjs from "dayjs";
  114. import GameSelect from "@/components/game-select/index.vue";
  115. import MediaSelect from "@/components/media-select/index.vue";
  116. import AuthSelect from "@/components/auth-select/index.vue";
  117. // 引用定义
  118. const crudRef = ref();
  119. const gameList = ref([]);
  120. const total = ref({
  121. reg_cost: 0,
  122. roi: 0,
  123. p_cost: 0,
  124. p_per: 0,
  125. });
  126. // 搜索表单
  127. const searchForm = ref({
  128. game_id: "",
  129. media_id: "",
  130. auth_id: "",
  131. agent_id: "",
  132. site_id: "",
  133. tdate: [],
  134. group: "",
  135. filter: [],
  136. });
  137. // SaTable 基础配置
  138. const options = reactive({
  139. api: api.getAgentDataList,
  140. pk: "akey",
  141. showSort: true,
  142. showSummary: true,
  143. summary: [
  144. {
  145. action: "totalRow",
  146. dataIndex: "akey",
  147. },
  148. {
  149. action: "totalRow",
  150. dataIndex: "cost",
  151. },
  152. {
  153. action: "totalRow",
  154. dataIndex: "install",
  155. },
  156. {
  157. action: "totalRow",
  158. dataIndex: "reg_dev",
  159. },
  160. {
  161. action: "totalRow",
  162. dataIndex: "reg_total",
  163. },
  164. {
  165. action: "totalRow",
  166. dataIndex: "role_total",
  167. },
  168. {
  169. action: "totalRow",
  170. dataIndex: "role_per",
  171. },
  172. {
  173. action: "totalRow",
  174. dataIndex: "active",
  175. },
  176. {
  177. action: "totalRow",
  178. dataIndex: "a_cost",
  179. },
  180. {
  181. action: "totalRow",
  182. dataIndex: "a_per",
  183. },
  184. {
  185. action: "totalRow",
  186. dataIndex: "reg_pay_num",
  187. },
  188. {
  189. action: "totalRow",
  190. dataIndex: "reg_pay_total",
  191. },
  192. {
  193. action: "totalRow",
  194. dataIndex: "p_per",
  195. },
  196. {
  197. action: "totalRow",
  198. dataIndex: "da_per",
  199. },
  200. {
  201. action: "totalRow",
  202. dataIndex: "re_per",
  203. },
  204. {
  205. action: "totalRow",
  206. dataIndex: "re_amount_per",
  207. },
  208. {
  209. action: "totalRow",
  210. dataIndex: "re_amount_per_7",
  211. },
  212. {
  213. action: "totalRow",
  214. dataIndex: "p_cost",
  215. },
  216. {
  217. action: "totalRow",
  218. dataIndex: "arpu",
  219. },
  220. {
  221. action: "totalRow",
  222. dataIndex: "r_arpu",
  223. },
  224. {
  225. action: "totalRow",
  226. dataIndex: "old_login_total",
  227. },
  228. ],
  229. operationColumn: false,
  230. });
  231. // SaTable 列配置
  232. const columns = reactive([
  233. { title: "ID", dataIndex: "akey", width: 100, fixed: "left" },
  234. { title: "支出", dataIndex: "cost", width: 100 },
  235. { title: "激活", dataIndex: "install", width: 100 },
  236. { title: "注册设备", dataIndex: "reg_dev", width: 100 },
  237. { title: "注册数", dataIndex: "reg_total", width: 100 },
  238. { title: "注册成本", dataIndex: "reg_cost", width: 100 },
  239. { title: "创角数", dataIndex: "role_total", width: 100 },
  240. { title: "创角率", dataIndex: "role_per", width: 100 },
  241. { title: "次留数", dataIndex: "active", width: 100 },
  242. { title: "次留成本", dataIndex: "a_cost", width: 100 },
  243. { title: "次留率", dataIndex: "a_per", width: 100 },
  244. { title: "总付费人数", dataIndex: "reg_pay_num", width: 100 },
  245. { title: "总付费金额", dataIndex: "reg_pay_total", width: 100 },
  246. { title: "付费率", dataIndex: "p_per", width: 100 },
  247. { title: "当天回本率", dataIndex: "da_per", width: 100 },
  248. { title: "累计回本率", dataIndex: "re_per", width: 100 },
  249. { title: "实际回本率", dataIndex: "re_amount_per", width: 100 },
  250. { title: "7天实际回本率", dataIndex: "re_amount_per_7", width: 100 },
  251. { title: "付费成本", dataIndex: "p_cost", width: 100 },
  252. { title: "ARPU", dataIndex: "arpu", width: 100 },
  253. { title: "注册ARPU", dataIndex: "r_arpu", width: 100 },
  254. { title: "老用户数", dataIndex: "old_login_total", width: 100 },
  255. { title: "分组名称", dataIndex: "name", width: 100 },
  256. { title: "负责人", dataIndex: "auth_name", width: 100 },
  257. ]);
  258. // 页面数据初始化
  259. const initPage = () => {
  260. searchForm.value.tdate = [
  261. dayjs().format("YYYY-MM-DD"),
  262. dayjs().format("YYYY-MM-DD"),
  263. ];
  264. };
  265. const refreshDay = async (day) => {
  266. switch (day) {
  267. case "yesterday":
  268. searchForm.value.tdate = [
  269. dayjs(searchForm.value.tdate[0])
  270. .subtract(1, "day")
  271. .format("YYYY-MM-DD"),
  272. dayjs(searchForm.value.tdate[1])
  273. .subtract(1, "day")
  274. .format("YYYY-MM-DD"),
  275. ];
  276. break;
  277. case "today":
  278. searchForm.value.tdate = [
  279. dayjs().format("YYYY-MM-DD"),
  280. dayjs().format("YYYY-MM-DD"),
  281. ];
  282. break;
  283. case "tomorrow":
  284. searchForm.value.tdate = [
  285. dayjs(searchForm.value.tdate[0]).add(1, "day").format("YYYY-MM-DD"),
  286. dayjs(searchForm.value.tdate[1]).add(1, "day").format("YYYY-MM-DD"),
  287. ];
  288. break;
  289. default:
  290. break;
  291. }
  292. refresh();
  293. };
  294. // SaTable 数据请求
  295. const refresh = async () => {
  296. crudRef.value?.refresh();
  297. };
  298. // 页面加载完成执行
  299. onMounted(async () => {
  300. initPage();
  301. refresh();
  302. });
  303. </script>
  304. <script>
  305. export default { name: "v1/channelAnalysis/agent" };
  306. </script>