Index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <app-view class="bank-sign g-form">
  3. <template #header>
  4. <app-navbar title="代扣申请查询" >
  5. <template #right>
  6. <div class="button-more" v-if="signStatus === SignStatus.Signed" @click="openComponent('apply')">
  7. <span>新增</span>
  8. </div>
  9. </template>
  10. </app-navbar>
  11. <Cell title="查询日期" :value="dateRange.join('-')" @click="showCalendar = true" is-link />
  12. </template>
  13. <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error"
  14. v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
  15. <div class="g-order-list">
  16. <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
  17. <div class="g-order-list__titlebar">
  18. <div class="left">
  19. <h5>{{ formatDecimal(item.billamount) }}</h5>
  20. </div>
  21. <div class="right">
  22. <span>{{ getBillResultName(Number(item.billresult)) }}</span>
  23. </div>
  24. </div>
  25. <div class="g-order-list__content">
  26. <ul>
  27. <li>
  28. <span>申请时间</span>
  29. <span>{{ formatDate(item.updatetime, 'YYYYMMDD HH:mm') }}</span>
  30. </li>
  31. <li>
  32. <span>备注</span>
  33. <span>{{ handleNoneValue(item.billresultremark) }}</span>
  34. </li>
  35. <li>
  36. <span>扣费账号</span>
  37. <span>{{ handleNoneValue(item.dgjfhm) }}</span>
  38. </li>
  39. </ul>
  40. </div>
  41. </div>
  42. </div>
  43. </app-pull-refresh>
  44. <Calendar v-model:show="showCalendar" type="range" :allow-same-day="true" :max-date="new Date()" :min-date="moment().subtract(1, 'years').toDate()" @confirm="onConfirm" />
  45. <component ref="componentRef" :is="componentMap.get(componentId)" @closed="closeComponent"
  46. v-if="componentId" />
  47. </app-view>
  48. </template>
  49. <script lang="ts" setup>
  50. import { defineAsyncComponent, shallowRef, ref } from 'vue'
  51. import { formatDate, formatDecimal, handleNoneValue } from '@/filters'
  52. import { useComponent } from '@/hooks/component'
  53. import { useRequest } from '@/hooks/request'
  54. import { SignStatus } from '@/constants/bank'
  55. import { Calendar, Cell } from 'vant'
  56. import { queryGtwithholddepositapply, queryGetGtwithholdsigninfo } from '@/services/api/bank'
  57. import { getBillResultName } from '@/constants/order'
  58. import moment from 'moment'
  59. import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
  60. const { componentRef, componentId, openComponent, closeComponent } = useComponent()
  61. const componentMap = new Map<string, unknown>([
  62. ['apply', defineAsyncComponent(() => import('./components/apply/Index.vue'))],
  63. ])
  64. const error = shallowRef(false)
  65. const pullRefreshRef = shallowRef()
  66. const signStatus = shallowRef(SignStatus.Unsigned)
  67. // 是否显示日期选择器
  68. const showCalendar = shallowRef(false)
  69. // 日期范围
  70. const dateRange = ref<string[]>([])
  71. // 查询已经入金代扣申请签约
  72. useRequest(queryGetGtwithholdsigninfo, {
  73. onSuccess: (res) => {
  74. /// 签约状态
  75. if (res.data.length != 0) {
  76. signStatus.value = res.data[0].accountsignstatus
  77. }
  78. }
  79. })
  80. const { loading, pageIndex, pageCount, run, dataList } = useRequest(queryGtwithholddepositapply)
  81. // 选择日期
  82. const onConfirm = ([start, end]: Date[]) => {
  83. showCalendar.value = false
  84. dateRange.value = [formatDate(start.toISOString(), 'YYYY/MM/DD'), formatDate(end.toISOString(), 'YYYY/MM/DD')]
  85. pageIndex.value = 1
  86. pullRefreshRef.value?.refresh()
  87. }
  88. const onRefresh = () => {
  89. if (dateRange.value.length != 0) {
  90. const [begindate, enddate] = dateRange.value
  91. run({
  92. begindate: formatDate(begindate, 'YYYYMMDD'),
  93. enddate: formatDate(enddate, 'YYYYMMDD')
  94. })
  95. } else {
  96. run()
  97. }
  98. }
  99. </script>
  100. <style lang="less">
  101. @import './index.less';
  102. </style>