index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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="24" :md="8" :lg="8" :xl="6" :xxl="4" :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="24" :md="8" :lg="8" :xl="6" :xxl="5" :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="24" :md="8" :lg="8" :xl="6" :xxl="4" :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="24" :md="8" :lg="8" :xl="6" :xxl="4" :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="24" :md="8" :lg="8" :xl="6" :xxl="4" :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="24" :md="8" :lg="8" :xl="6" :xxl="3" :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="24" :md="8" :lg="8" :xl="6" :xxl="4" :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="24" :md="8" :lg="8" :xl="6" :xxl="5" :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="24" :md="8" :lg="8" :xl="6" :xxl="4" :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. tdate: [],
  85. data_type: 'recovery',
  86. })
  87. // SaTable 基础配置
  88. const options = reactive({
  89. api: api.getLtvDataList,
  90. pk: 'tdate',
  91. rowSelection: { showCheckedAll: true },
  92. showSummary: true,
  93. summary: [
  94. {
  95. action: 'totalRow',
  96. dataIndex: 'tdate',
  97. },
  98. {
  99. suffixText: '元',
  100. action: 'totalRow',
  101. dataIndex: 'cost',
  102. },
  103. {
  104. action: 'totalRow',
  105. dataIndex: 'reg_total',
  106. },
  107. {
  108. action: 'totalRow',
  109. dataIndex: 'reg_cost',
  110. },
  111. {
  112. action: 'totalRow',
  113. dataIndex: 'd0',
  114. },
  115. {
  116. action: 'totalRow',
  117. dataIndex: 'd1',
  118. },
  119. {
  120. action: 'totalRow',
  121. dataIndex: 'd2',
  122. },
  123. {
  124. action: 'totalRow',
  125. dataIndex: 'd3',
  126. },
  127. {
  128. action: 'totalRow',
  129. dataIndex: 'd4',
  130. },
  131. {
  132. action: 'totalRow',
  133. dataIndex: 'd5',
  134. },
  135. {
  136. action: 'totalRow',
  137. dataIndex: 'd6',
  138. },
  139. {
  140. action: 'totalRow',
  141. dataIndex: 'd7',
  142. },
  143. {
  144. action: 'totalRow',
  145. dataIndex: 'd8',
  146. },
  147. {
  148. action: 'totalRow',
  149. dataIndex: 'd9',
  150. },
  151. {
  152. action: 'totalRow',
  153. dataIndex: 'd10',
  154. },
  155. {
  156. action: 'totalRow',
  157. dataIndex: 'd11',
  158. },
  159. {
  160. action: 'totalRow',
  161. dataIndex: 'd12',
  162. },
  163. {
  164. action: 'totalRow',
  165. dataIndex: 'd13',
  166. },
  167. {
  168. action: 'totalRow',
  169. dataIndex: 'd14',
  170. },
  171. {
  172. action: 'totalRow',
  173. dataIndex: 'd15',
  174. },
  175. {
  176. action: 'totalRow',
  177. dataIndex: 'd16',
  178. },
  179. {
  180. action: 'totalRow',
  181. dataIndex: 'd17',
  182. },
  183. {
  184. action: 'totalRow',
  185. dataIndex: 'd18',
  186. },
  187. {
  188. action: 'totalRow',
  189. dataIndex: 'd19',
  190. },
  191. {
  192. action: 'totalRow',
  193. dataIndex: 'd20',
  194. },
  195. {
  196. action: 'totalRow',
  197. dataIndex: 'd21',
  198. },
  199. {
  200. action: 'totalRow',
  201. dataIndex: 'd22',
  202. },
  203. {
  204. action: 'totalRow',
  205. dataIndex: 'd23',
  206. },
  207. {
  208. action: 'totalRow',
  209. dataIndex: 'd24',
  210. },
  211. {
  212. action: 'totalRow',
  213. dataIndex: 'd25',
  214. },
  215. {
  216. action: 'totalRow',
  217. dataIndex: 'd26',
  218. },
  219. {
  220. action: 'totalRow',
  221. dataIndex: 'd27',
  222. },
  223. {
  224. action: 'totalRow',
  225. dataIndex: 'd28',
  226. },
  227. {
  228. action: 'totalRow',
  229. dataIndex: 'd29',
  230. },
  231. {
  232. action: 'totalRow',
  233. dataIndex: 'd30',
  234. },
  235. {
  236. action: 'totalRow',
  237. dataIndex: 'd35',
  238. },
  239. {
  240. action: 'totalRow',
  241. dataIndex: 'd40',
  242. },
  243. {
  244. action: 'totalRow',
  245. dataIndex: 'd45',
  246. },
  247. {
  248. action: 'totalRow',
  249. dataIndex: 'd50',
  250. },
  251. {
  252. action: 'totalRow',
  253. dataIndex: 'd55',
  254. },
  255. {
  256. action: 'totalRow',
  257. dataIndex: 'd60',
  258. },
  259. {
  260. action: 'totalRow',
  261. dataIndex: 'd65',
  262. },
  263. {
  264. action: 'totalRow',
  265. dataIndex: 'd70',
  266. },
  267. {
  268. action: 'totalRow',
  269. dataIndex: 'd75',
  270. },
  271. {
  272. action: 'totalRow',
  273. dataIndex: 'd80',
  274. },
  275. {
  276. action: 'totalRow',
  277. dataIndex: 'd85',
  278. },
  279. {
  280. action: 'totalRow',
  281. dataIndex: 'd90',
  282. },
  283. {
  284. action: 'totalRow',
  285. dataIndex: 'd95',
  286. },
  287. {
  288. action: 'totalRow',
  289. dataIndex: 'd100',
  290. },
  291. {
  292. action: 'totalRow',
  293. dataIndex: 'd105',
  294. },
  295. {
  296. action: 'totalRow',
  297. dataIndex: 'd110',
  298. },
  299. {
  300. action: 'totalRow',
  301. dataIndex: 'd115',
  302. },
  303. {
  304. action: 'totalRow',
  305. dataIndex: 'd120',
  306. },
  307. ],
  308. operationColumn: false,
  309. })
  310. // SaTable 列配置
  311. const columns = reactive([
  312. { title: '日期', dataIndex: 'tdate', width: 130, fixed: 'left' },
  313. { title: '消耗金额', dataIndex: 'cost', width: 100 },
  314. { title: '注册数', dataIndex: 'reg_total', width: 80 },
  315. { title: '注册成本', dataIndex: 'reg_cost', width: 100 },
  316. { title: '累计', dataIndex: 'd0', width: 80 },
  317. { title: '1', dataIndex: 'd1', width: 80 },
  318. { title: '2', dataIndex: 'd2', width: 80 },
  319. { title: '3', dataIndex: 'd3', width: 80 },
  320. { title: '4', dataIndex: 'd4', width: 80 },
  321. { title: '5', dataIndex: 'd5', width: 80 },
  322. { title: '6', dataIndex: 'd6', width: 80 },
  323. { title: '7', dataIndex: 'd7', width: 80 },
  324. { title: '8', dataIndex: 'd8', width: 80 },
  325. { title: '9', dataIndex: 'd9', width: 80 },
  326. { title: '10', dataIndex: 'd10', width: 80 },
  327. { title: '11', dataIndex: 'd11', width: 80 },
  328. { title: '12', dataIndex: 'd12', width: 80 },
  329. { title: '13', dataIndex: 'd13', width: 80 },
  330. { title: '14', dataIndex: 'd14', width: 80 },
  331. { title: '15', dataIndex: 'd15', width: 80 },
  332. { title: '16', dataIndex: 'd16', width: 80 },
  333. { title: '17', dataIndex: 'd17', width: 80 },
  334. { title: '18', dataIndex: 'd18', width: 80 },
  335. { title: '19', dataIndex: 'd19', width: 80 },
  336. { title: '20', dataIndex: 'd20', width: 80 },
  337. { title: '21', dataIndex: 'd21', width: 80 },
  338. { title: '22', dataIndex: 'd22', width: 80 },
  339. { title: '23', dataIndex: 'd23', width: 80 },
  340. { title: '24', dataIndex: 'd24', width: 80 },
  341. { title: '25', dataIndex: 'd25', width: 80 },
  342. { title: '26', dataIndex: 'd26', width: 80 },
  343. { title: '27', dataIndex: 'd27', width: 80 },
  344. { title: '28', dataIndex: 'd28', width: 80 },
  345. { title: '29', dataIndex: 'd29', width: 80 },
  346. { title: '30', dataIndex: 'd30', width: 80 },
  347. { title: '35', dataIndex: 'd35', width: 80 },
  348. { title: '40', dataIndex: 'd40', width: 80 },
  349. { title: '45', dataIndex: 'd45', width: 80 },
  350. { title: '50', dataIndex: 'd50', width: 80 },
  351. { title: '55', dataIndex: 'd55', width: 80 },
  352. { title: '60', dataIndex: 'd60', width: 80 },
  353. { title: '65', dataIndex: 'd65', width: 80 },
  354. { title: '70', dataIndex: 'd70', width: 80 },
  355. { title: '75', dataIndex: 'd75', width: 80 },
  356. { title: '80', dataIndex: 'd80', width: 80 },
  357. { title: '85', dataIndex: 'd85', width: 80 },
  358. { title: '90', dataIndex: 'd90', width: 80 },
  359. { title: '95', dataIndex: 'd95', width: 80 },
  360. { title: '100', dataIndex: 'd100', width: 80 },
  361. { title: '105', dataIndex: 'd105', width: 80 },
  362. { title: '110', dataIndex: 'd110', width: 80 },
  363. { title: '115', dataIndex: 'd115', width: 80 },
  364. { title: '120', dataIndex: 'd120', width: 80 },
  365. ])
  366. // 页面数据初始化
  367. const initPage = () => {
  368. searchForm.value.tdate = [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
  369. }
  370. // SaTable 数据请求
  371. const refresh = async () => {
  372. crudRef.value?.refresh()
  373. }
  374. // 页面加载完成执行
  375. onMounted(async () => {
  376. initPage()
  377. refresh()
  378. })
  379. </script>
  380. <script>
  381. export default { name: 'v1/channelAnalysis/ltvd' }
  382. </script>