index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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="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="month" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="8" :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="8" :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="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="site_name">
  33. <a-input v-model="searchForm.site_name" placeholder="请输入广告名称" allow-clear />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :sm="8" :xs="24">
  37. <a-form-item label="负责人" field="auth_id">
  38. <auth-select v-model="searchForm.auth_id" />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :sm="8" :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="8" :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="pay_num">付费人数</a-option>
  53. <a-option value="pay_total">付费总额</a-option>
  54. <a-option value="pay_rate">付费率</a-option>
  55. <a-option value="arpu"> 付费ARPU </a-option>
  56. </a-select>
  57. </a-form-item>
  58. </a-col>
  59. </template>
  60. <!-- Table 自定义渲染 -->
  61. </sa-table>
  62. </div>
  63. </template>
  64. <script setup>
  65. import { onMounted, ref, reactive } from 'vue'
  66. import api from '../../api/gameLog/channelAnalysis'
  67. import dayjs from 'dayjs'
  68. import GameSelect from '@/components/game-select/index.vue'
  69. import MediaSelect from '@/components/media-select/index.vue'
  70. import AuthSelect from '@/components/auth-select/index.vue'
  71. // 引用定义
  72. const crudRef = ref()
  73. const gameList = ref([])
  74. // 搜索表单
  75. const searchForm = ref({
  76. game_id: '',
  77. media_id: '',
  78. auth_id: '',
  79. agent_id: '',
  80. agent_name: '',
  81. site_name: '',
  82. site_id: '',
  83. reg_date: [],
  84. data_type: 'recovery',
  85. })
  86. // SaTable 基础配置
  87. const options = reactive({
  88. api: api.getLtvMDataList,
  89. pk: 'tmonth',
  90. rowSelection: { showCheckedAll: true },
  91. showSort: false,
  92. showSummary: true,
  93. summary: [
  94. {
  95. action: 'totalRow',
  96. dataIndex: 'tmonth',
  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: 'm0',
  114. },
  115. {
  116. action: 'totalRow',
  117. dataIndex: 'm1',
  118. },
  119. {
  120. action: 'totalRow',
  121. dataIndex: 'm2',
  122. },
  123. {
  124. action: 'totalRow',
  125. dataIndex: 'm3',
  126. },
  127. {
  128. action: 'totalRow',
  129. dataIndex: 'm4',
  130. },
  131. {
  132. action: 'totalRow',
  133. dataIndex: 'm5',
  134. },
  135. {
  136. action: 'totalRow',
  137. dataIndex: 'm6',
  138. },
  139. {
  140. action: 'totalRow',
  141. dataIndex: 'm7',
  142. },
  143. {
  144. action: 'totalRow',
  145. dataIndex: 'm8',
  146. },
  147. {
  148. action: 'totalRow',
  149. dataIndex: 'm9',
  150. },
  151. {
  152. action: 'totalRow',
  153. dataIndex: 'm10',
  154. },
  155. {
  156. action: 'totalRow',
  157. dataIndex: 'm11',
  158. },
  159. {
  160. action: 'totalRow',
  161. dataIndex: 'm12',
  162. },
  163. {
  164. action: 'totalRow',
  165. dataIndex: 'm13',
  166. },
  167. {
  168. action: 'totalRow',
  169. dataIndex: 'm14',
  170. },
  171. {
  172. action: 'totalRow',
  173. dataIndex: 'm15',
  174. },
  175. {
  176. action: 'totalRow',
  177. dataIndex: 'm16',
  178. },
  179. {
  180. action: 'totalRow',
  181. dataIndex: 'm17',
  182. },
  183. {
  184. action: 'totalRow',
  185. dataIndex: 'm18',
  186. },
  187. {
  188. action: 'totalRow',
  189. dataIndex: 'm19',
  190. },
  191. {
  192. action: 'totalRow',
  193. dataIndex: 'm20',
  194. },
  195. {
  196. action: 'totalRow',
  197. dataIndex: 'm21',
  198. },
  199. {
  200. action: 'totalRow',
  201. dataIndex: 'm22',
  202. },
  203. {
  204. action: 'totalRow',
  205. dataIndex: 'm23',
  206. },
  207. {
  208. action: 'totalRow',
  209. dataIndex: 'm24',
  210. },
  211. ],
  212. operationColumn: false,
  213. })
  214. // SaTable 列配置
  215. const columns = reactive([
  216. { title: '日期', dataIndex: 'tmonth', width: 130, fixed: 'left' },
  217. { title: '消耗金额', dataIndex: 'cost', width: 100 },
  218. { title: '注册数', dataIndex: 'reg_total', width: 80 },
  219. { title: '注册成本', dataIndex: 'reg_cost', width: 100 },
  220. { title: '累计', dataIndex: 'm0', width: 80 },
  221. { title: '1', dataIndex: 'm1', width: 80 },
  222. { title: '2', dataIndex: 'm2', width: 80 },
  223. { title: '3', dataIndex: 'm3', width: 80 },
  224. { title: '4', dataIndex: 'm4', width: 80 },
  225. { title: '5', dataIndex: 'm5', width: 80 },
  226. { title: '6', dataIndex: 'm6', width: 80 },
  227. { title: '7', dataIndex: 'm7', width: 80 },
  228. { title: '8', dataIndex: 'm8', width: 80 },
  229. { title: '9', dataIndex: 'm9', width: 80 },
  230. { title: '10', dataIndex: 'm10', width: 80 },
  231. { title: '11', dataIndex: 'm11', width: 80 },
  232. { title: '12', dataIndex: 'm12', width: 80 },
  233. { title: '13', dataIndex: 'm13', width: 80 },
  234. { title: '14', dataIndex: 'm14', width: 80 },
  235. { title: '15', dataIndex: 'm15', width: 80 },
  236. { title: '16', dataIndex: 'm16', width: 80 },
  237. { title: '17', dataIndex: 'm17', width: 80 },
  238. { title: '18', dataIndex: 'm18', width: 80 },
  239. { title: '19', dataIndex: 'm19', width: 80 },
  240. { title: '20', dataIndex: 'm20', width: 80 },
  241. { title: '21', dataIndex: 'm21', width: 80 },
  242. { title: '22', dataIndex: 'm22', width: 80 },
  243. { title: '23', dataIndex: 'm23', width: 80 },
  244. { title: '24', dataIndex: 'm24', width: 80 },
  245. ])
  246. // 页面数据初始化
  247. const initPage = () => {
  248. searchForm.value.reg_date = [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
  249. }
  250. // SaTable 数据请求
  251. const refresh = async () => {
  252. crudRef.value?.refresh()
  253. }
  254. // 页面加载完成执行
  255. onMounted(async () => {
  256. initPage()
  257. refresh()
  258. })
  259. </script>