index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <app-view>
  3. <!-- 表格数据 -->
  4. <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading">
  5. <!-- 比例 -->
  6. <template #depositrate="{ value }">
  7. {{ parsePercent(value) }}
  8. </template>
  9. <!-- 操作 -->
  10. <template #operate="{ row }">
  11. <app-auth-operation :options="{ selectedRow: row }" />
  12. </template>
  13. </app-table>
  14. </app-view>
  15. </template>
  16. <script lang="ts" setup>
  17. import { shallowRef } from 'vue'
  18. import { ElMessage } from 'element-plus'
  19. import { parsePercent } from '@/filters'
  20. import { useDataTable } from '@/hooks/datatable'
  21. import { queryMyDeposit } from '@/services/api/common'
  22. import { loginStore } from '@/stores'
  23. import AppTable from '@pc/components/base/table/index.vue'
  24. import AppAuthOperation from '@pc/components/modules/auth-operation/index.vue'
  25. const { userId } = loginStore.$mapGetters()
  26. const { dataList } = useDataTable<Model.MyDepositRsp>()
  27. const loading = shallowRef(false)
  28. const tableColumns = shallowRef<Model.TableColumn[]>([
  29. { prop: 'depositrate', label: '比例' },
  30. { prop: 'depositqty', label: '剩余量' },
  31. { prop: 'operate', label: '操作', width: 160, fixed: 'right' }
  32. ])
  33. const getMyDeposit = () => {
  34. loading.value = true
  35. return queryMyDeposit({
  36. data: {
  37. userid: userId.value,
  38. },
  39. success: (res) => {
  40. dataList.value = res.data
  41. },
  42. complete: () => {
  43. loading.value = false
  44. }
  45. })
  46. }
  47. getMyDeposit().catch((err) => ElMessage.error(err))
  48. </script>