index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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-range-picker class="w-full" v-model="searchForm.reg_date" :show-time="false" mode="date" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="6" :xs="24">
  17. <a-form-item label="负责人" field="agent_id">
  18. <auth-select v-model="searchForm.auth_id" multiple />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :sm="6" :xs="24">
  22. <a-form-item label="媒体类型" field="media_id">
  23. <media-select v-model="searchForm.media_id" />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :sm="6" :xs="24">
  27. <a-form-item label="显示方式" field="agent_id">
  28. <a-select v-model="searchForm.show_type" :options="showTypeOptions" />
  29. </a-form-item>
  30. </a-col>
  31. </template>
  32. <!-- Table 自定义渲染 -->
  33. </sa-table>
  34. </div>
  35. </template>
  36. <script setup>
  37. import { onMounted, ref, reactive } from 'vue'
  38. import api from '../../api/gameLog/analyse'
  39. import dayjs from 'dayjs'
  40. import GameSelect from '@/components/game-select/index.vue'
  41. import MediaSelect from '@/components/media-select/index.vue'
  42. import AuthSelect from '@/components/auth-select/index.vue'
  43. // 引用定义
  44. const crudRef = ref()
  45. const showTypeOptions = ref([
  46. {
  47. label: '按比率',
  48. value: 'rate',
  49. },
  50. {
  51. label: '按人数',
  52. value: 'num',
  53. },
  54. ])
  55. // 搜索表单
  56. const searchForm = ref({
  57. game_id: '',
  58. reg_date: [],
  59. auth_id: '',
  60. media_id: '',
  61. show_type: 'rate',
  62. })
  63. // SaTable 基础配置
  64. const options = reactive({
  65. api: api.getPayRetention,
  66. pk: 'date',
  67. showSort: false,
  68. showSummary: true,
  69. operationColumn: false,
  70. summary: [
  71. {
  72. action: 'totalRow',
  73. dataIndex: 'reg_date',
  74. },
  75. {
  76. action: 'totalRow',
  77. dataIndex: 'reg_pay_num',
  78. },
  79. {
  80. action: 'totalRow',
  81. dataIndex: 'remain_2',
  82. },
  83. {
  84. action: 'totalRow',
  85. dataIndex: 'remain_3',
  86. },
  87. {
  88. action: 'totalRow',
  89. dataIndex: 'remain_4',
  90. },
  91. {
  92. action: 'totalRow',
  93. dataIndex: 'remain_5',
  94. },
  95. {
  96. action: 'totalRow',
  97. dataIndex: 'remain_6',
  98. },
  99. {
  100. action: 'totalRow',
  101. dataIndex: 'remain_7',
  102. },
  103. {
  104. action: 'totalRow',
  105. dataIndex: 'remain_15',
  106. },
  107. {
  108. action: 'totalRow',
  109. dataIndex: 'remain_30',
  110. },
  111. {
  112. action: 'totalRow',
  113. dataIndex: 'remain_35',
  114. },
  115. {
  116. action: 'totalRow',
  117. dataIndex: 'remain_40',
  118. },
  119. {
  120. action: 'totalRow',
  121. dataIndex: 'remain_55',
  122. },
  123. {
  124. action: 'totalRow',
  125. dataIndex: 'remain_60',
  126. },
  127. ],
  128. })
  129. // SaTable 列配置
  130. const columns = reactive([
  131. { title: '注册日期', dataIndex: 'reg_date', width: 120, fixed: 'left' },
  132. { title: '付费人数', dataIndex: 'reg_pay_num', width: 120 },
  133. {
  134. title: '次留',
  135. dataIndex: 'remain_2',
  136. width: 90,
  137. },
  138. {
  139. title: '3留',
  140. dataIndex: 'remain_3',
  141. width: 90,
  142. },
  143. {
  144. title: '4留',
  145. dataIndex: 'remain_4',
  146. width: 90,
  147. },
  148. {
  149. title: '5留',
  150. dataIndex: 'remain_5',
  151. width: 90,
  152. },
  153. {
  154. title: '6留',
  155. dataIndex: 'remain_6',
  156. width: 90,
  157. },
  158. {
  159. title: '7留',
  160. dataIndex: 'remain_7',
  161. width: 90,
  162. },
  163. {
  164. title: '15留',
  165. dataIndex: 'remain_15',
  166. width: 90,
  167. },
  168. {
  169. title: '30留',
  170. dataIndex: 'remain_30',
  171. width: 90,
  172. },
  173. {
  174. title: '35留',
  175. dataIndex: 'remain_35',
  176. width: 90,
  177. },
  178. {
  179. title: '40留',
  180. dataIndex: 'remain_40',
  181. width: 90,
  182. },
  183. {
  184. title: '55留',
  185. dataIndex: 'remain_55',
  186. width: 90,
  187. },
  188. {
  189. title: '60留',
  190. dataIndex: 'remain_60',
  191. width: 90,
  192. },
  193. ])
  194. // 页面数据初始化
  195. const initPage = async () => {
  196. searchForm.value.reg_date[0] = dayjs().subtract(8, 'day').format('YYYY-MM-DD')
  197. searchForm.value.reg_date[1] = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
  198. }
  199. // SaTable 数据请求
  200. const refresh = async () => {
  201. crudRef.value?.refresh()
  202. }
  203. // 页面加载完成执行
  204. onMounted(async () => {
  205. initPage()
  206. refresh()
  207. })
  208. </script>
  209. <script>
  210. export default { name: 'v1/analyse/pay_remain' }
  211. </script>