Index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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" @click="showComponent('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.createtime, '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 { dialog } from '@/utils/vant'
  59. import moment from 'moment'
  60. import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
  61. const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
  62. run()
  63. })
  64. const componentMap = new Map<string, unknown>([
  65. ['apply', defineAsyncComponent(() => import('./components/apply/Index.vue'))],
  66. ])
  67. const error = shallowRef(false)
  68. const pullRefreshRef = shallowRef()
  69. const signStatus = shallowRef(SignStatus.Unsigned)
  70. // 是否显示日期选择器
  71. const showCalendar = shallowRef(false)
  72. // 日期范围
  73. const dateRange = ref<string[]>([])
  74. // 查询已经入金代扣申请签约
  75. useRequest(queryGetGtwithholdsigninfo, {
  76. onSuccess: (res) => {
  77. /// 签约状态
  78. if (res.data.length != 0) {
  79. signStatus.value = res.data[0].accountsignstatus
  80. }
  81. }
  82. })
  83. const showComponent = (componentName: string) => {
  84. if (signStatus.value != SignStatus.Signed) {
  85. dialog('未进行入金代扣签约')
  86. return
  87. }
  88. openComponent(componentName)
  89. }
  90. const { loading, pageIndex, pageCount, run, dataList } = useRequest(queryGtwithholddepositapply)
  91. // 选择日期
  92. const onConfirm = ([start, end]: Date[]) => {
  93. showCalendar.value = false
  94. dateRange.value = [formatDate(start.toISOString(), 'YYYY/MM/DD'), formatDate(end.toISOString(), 'YYYY/MM/DD')]
  95. pageIndex.value = 1
  96. pullRefreshRef.value?.refresh()
  97. }
  98. const onRefresh = () => {
  99. if (dateRange.value.length != 0) {
  100. const [begindate, enddate] = dateRange.value
  101. run({
  102. begindate: formatDate(begindate, 'YYYYMMDD'),
  103. enddate: formatDate(enddate, 'YYYYMMDD')
  104. })
  105. } else {
  106. run()
  107. }
  108. }
  109. </script>
  110. <style lang="less">
  111. @import './index.less';
  112. </style>