index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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="reg_date">
  13. <a-date-picker class="w-full" v-model="searchForm.reg_date" :show-time="false" mode="date" />
  14. </a-form-item>
  15. </a-col>
  16. </template>
  17. <!-- Table 自定义渲染 -->
  18. </sa-table>
  19. </div>
  20. </template>
  21. <script setup>
  22. import { onMounted, ref, reactive } from 'vue'
  23. import api from '../../api/gameLog/analyse'
  24. import dayjs from 'dayjs'
  25. import GameSelect from '@/components/game-select/index.vue'
  26. import MediaSelect from '@/components/media-select/index.vue'
  27. import AuthSelect from '@/components/auth-select/index.vue'
  28. // 引用定义
  29. const crudRef = ref()
  30. const gameList = ref([])
  31. // 搜索表单
  32. const searchForm = ref({
  33. game_id: '',
  34. reg_date: '',
  35. })
  36. // SaTable 基础配置
  37. const options = reactive({
  38. api: api.getIncomeAnalysis,
  39. pk: 'date',
  40. showSort: false,
  41. showSummary: true,
  42. operationColumn: false,
  43. summary: [
  44. {
  45. action: 'totalRow',
  46. dataIndex: 'tdate',
  47. },
  48. {
  49. action: 'totalRow',
  50. dataIndex: 'game_id',
  51. },
  52. {
  53. action: 'totalRow',
  54. dataIndex: 'login_total',
  55. },
  56. {
  57. action: 'totalRow',
  58. dataIndex: 'pay_total',
  59. },
  60. {
  61. action: 'totalRow',
  62. dataIndex: 'pay_num',
  63. },
  64. {
  65. action: 'totalRow',
  66. dataIndex: 'pay_arpu',
  67. },
  68. {
  69. action: 'totalRow',
  70. dataIndex: 'pay_ratio',
  71. },
  72. {
  73. action: 'totalRow',
  74. dataIndex: 'yestoday_pay_total',
  75. },
  76. {
  77. action: 'totalRow',
  78. dataIndex: 'pay_increase_yestoday',
  79. },
  80. {
  81. action: 'totalRow',
  82. dataIndex: 'pay_increase_week',
  83. },
  84. ],
  85. })
  86. // SaTable 列配置
  87. const columns = reactive([
  88. { title: '游戏ID', dataIndex: 'game_id', width: 70, fixed: 'left' },
  89. { title: '游戏名', dataIndex: 'game_name', width: 140, fixed: 'left' },
  90. {
  91. title: 'DAU',
  92. dataIndex: 'login_total',
  93. width: 90,
  94. },
  95. {
  96. title: '付费人数',
  97. dataIndex: 'pay_num',
  98. width: 90,
  99. },
  100. {
  101. title: '付费金额',
  102. dataIndex: 'pay_total',
  103. width: 90,
  104. },
  105. {
  106. title: 'ARPU',
  107. dataIndex: 'pay_arpu',
  108. width: 90,
  109. },
  110. {
  111. title: '收入比例',
  112. dataIndex: 'pay_ratio',
  113. width: 90,
  114. },
  115. {
  116. title: '昨日充值',
  117. dataIndex: 'yestoday_pay_total',
  118. width: 90,
  119. },
  120. {
  121. title: '昨日增长',
  122. dataIndex: 'pay_increase_yestoday',
  123. width: 90,
  124. },
  125. {
  126. title: '上周增长',
  127. dataIndex: 'pay_increase_week',
  128. width: 90,
  129. },
  130. ])
  131. // 页面数据初始化
  132. const initPage = async () => {
  133. searchForm.value.reg_date = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
  134. }
  135. // SaTable 数据请求
  136. const refresh = async () => {
  137. crudRef.value?.refresh()
  138. }
  139. // 页面加载完成执行
  140. onMounted(async () => {
  141. initPage()
  142. refresh()
  143. })
  144. </script>
  145. <script>
  146. export default { name: 'v1/analyse/pay' }
  147. </script>