index.vue 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!-- 收益查询 -->
  2. <template>
  3. <app-view>
  4. <template #header>
  5. <app-filter :options="filterOptons" :loading="loading" />
  6. </template>
  7. <!-- 表格数据 -->
  8. <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading">
  9. <!-- 成交时间 -->
  10. <template #tradetimedisplay="{ value }">
  11. {{ formatDate(value) }}
  12. </template>
  13. <template #footer>
  14. <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"
  15. @change="onRefresh" />
  16. </template>
  17. </app-table>
  18. </app-view>
  19. </template>
  20. <script lang="ts" setup>
  21. import { shallowRef } from 'vue'
  22. import { ElMessage } from 'element-plus'
  23. import { formatDate } from '@/filters'
  24. import { useRequest } from '@/hooks/request'
  25. import { getTHJMarketList } from '@/constants/market'
  26. import { getTHJProfitRoleTypeName } from '@/constants/account'
  27. import { useDataFilter } from '@/hooks/datatable'
  28. import { queryTHJProfits } from '@/services/api/common'
  29. import AppTable from '@pc/components/base/table/index.vue'
  30. import AppFilter from '@pc/components/base/table-filter/index.vue'
  31. import AppPagination from '@pc/components/base/pagination/index.vue'
  32. const { filterOptons, getQueryParams } = useDataFilter<Model.THJProfitsReq>()
  33. const { loading, dataList, total, pageIndex, pageSize, run } = useRequest(queryTHJProfits, {
  34. params: {
  35. pagesize: 20,
  36. },
  37. onError: (err) => {
  38. ElMessage.error(err)
  39. }
  40. })
  41. const tableColumns = shallowRef<Model.TableColumn[]>([
  42. { prop: 'marketname', label: '市场' },
  43. { prop: 'firend', label: '下单好友' },
  44. { prop: 'buyorselldisplay', label: '方向' },
  45. { prop: 'wrstandardname', label: '商品', width: 140 },
  46. { prop: 'tradeqty', label: '成交数量' },
  47. { prop: 'chargeamount', label: '手续费总额' },
  48. { prop: 'profitamount', label: '分润金额' },
  49. { prop: 'profitroletypedisplay', label: '分润角色' },
  50. { prop: 'brokerrate', label: '会员比例' },
  51. { prop: 'brokerprofitrate', label: '会员释出比例' },
  52. { prop: 'levelonevalue', label: '一级比例' },
  53. { prop: 'leveltwovalue', label: '二级比例' },
  54. { prop: 'tradeid', label: '成交单号', width: 200 },
  55. { prop: 'tradetimedisplay', label: '成交时间', width: 180 },
  56. ])
  57. filterOptons.selectList = [
  58. {
  59. label: '市场',
  60. key: 'marketid',
  61. options: getTHJMarketList(),
  62. },
  63. {
  64. label: '角色',
  65. key: 'profitroletype',
  66. options: [
  67. { label: getTHJProfitRoleTypeName(3), value: 3 },
  68. { label: getTHJProfitRoleTypeName(4), value: 4 }
  69. ],
  70. },
  71. ]
  72. filterOptons.inputList = [
  73. { label: '好友', keys: ['accountname'] },
  74. { label: '商品', keys: ['goods'] },
  75. ]
  76. filterOptons.buttonList = [
  77. { lable: '重置', onClick: () => onSearch(true) },
  78. { lable: '查询', className: 'el-button--primary', onClick: () => onSearch() }
  79. ]
  80. const onSearch = (clear = false) => {
  81. getQueryParams((qs) => {
  82. pageIndex.value = 1
  83. run(qs)
  84. }, clear)
  85. }
  86. const onRefresh = () => {
  87. getQueryParams((qs) => run(qs))
  88. }
  89. </script>