index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <app-view class="bank-statement">
  3. <template #header>
  4. <app-navbar title="资金流水">
  5. <template #right>
  6. <div class="button-more" @click="routerTo('bank-hisstatement')" style="padding:.2rem;">
  7. <span>更多</span>
  8. </div>
  9. </template>
  10. </app-navbar>
  11. </template>
  12. <app-pull-refresh v-model:error="error" v-model:pageIndex="pageIndex" :page-count="pageCount"
  13. @refresh="onRefresh">
  14. <app-list class="bank-statement__table" :columns="columns" :data-list="dataList">
  15. <template #createtime="{ value }">
  16. <span>{{ formatDate(value, 'YYYY-MM-DD') }}</span>
  17. <span>{{ formatDate(value, 'HH:mm:ss') }}</span>
  18. </template>
  19. <template #businesscode="{ value }">
  20. {{ getAccountBusinessCodeName(value) }}
  21. </template>
  22. </app-list>
  23. </app-pull-refresh>
  24. </app-view>
  25. </template>
  26. <script lang="ts" setup>
  27. import { shallowRef } from 'vue'
  28. import { formatDate } from '@/filters'
  29. import { useNavigation } from '@/hooks/navigation'
  30. import { getAccountBusinessCodeName } from '@/constants/bank'
  31. import { useAmountStatementList } from '@/business/bank'
  32. import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
  33. import AppList from '@mobile/components/base/list/index.vue'
  34. const { routerTo } = useNavigation()
  35. const { pageIndex, pageCount, getAmountStatementList } = useAmountStatementList()
  36. const dataList = shallowRef<Model.AmountLogRsp[]>([])
  37. const error = shallowRef(false)
  38. const columns: Model.TableColumn[] = [
  39. { prop: 'createtime', label: '时间' },
  40. { prop: 'businesscode', label: '操作类型' },
  41. { prop: 'amount', label: '金额' },
  42. ]
  43. const onRefresh = (finish: () => void) => {
  44. getAmountStatementList().then((res) => {
  45. if (pageIndex.value === 1) {
  46. dataList.value = []
  47. }
  48. dataList.value.push(...res)
  49. }).catch(() => {
  50. error.value = true
  51. }).finally(() => {
  52. finish()
  53. })
  54. }
  55. </script>
  56. <style lang="less">
  57. .bank-statement {
  58. &__table {
  59. td.app-list__column {
  60. &:first-child {
  61. span:last-child {
  62. color: #999;
  63. font-size: .24rem;
  64. }
  65. }
  66. &:not(:first-child) {
  67. font-size: .32rem;
  68. }
  69. }
  70. }
  71. }
  72. </style>