ReceivablePlanList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <!-- 操作栏 -->
  3. <el-row justify="end">
  4. <el-button @click="openForm">
  5. <Icon class="mr-5px" icon="icon-park:income" />
  6. 创建回款计划
  7. </el-button>
  8. </el-row>
  9. <!-- 列表 -->
  10. <ContentWrap class="mt-10px">
  11. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  12. <el-table-column label="期数" fixed="left" align="center" prop="no">
  13. <template #default="scope">
  14. <el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
  15. {{ scope.row.period }}
  16. </el-link>
  17. </template>
  18. </el-table-column>
  19. <el-table-column label="客户名称" align="center" prop="customerName" />
  20. <el-table-column label="合同编号" align="center" prop="contractNo" />
  21. <el-table-column
  22. label="计划还款金额(元)"
  23. align="center"
  24. prop="price"
  25. :formatter="fenToYuanFormat"
  26. />
  27. <el-table-column
  28. label="计划还款日期"
  29. align="center"
  30. prop="returnTime"
  31. :formatter="dateFormatter"
  32. width="180px"
  33. />
  34. <el-table-column align="center" label="计划还款方式" prop="auditStatus">
  35. <template #default="scope">
  36. <dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="提前几日提醒" align="center" prop="remindDays" />
  40. <el-table-column label="备注" align="center" prop="remark" />
  41. <!-- TODO 非繁人:新建回款、编辑、删除 -->
  42. </el-table>
  43. <!-- 分页 -->
  44. <Pagination
  45. :total="total"
  46. v-model:page="queryParams.pageNo"
  47. v-model:limit="queryParams.pageSize"
  48. @pagination="getList"
  49. />
  50. </ContentWrap>
  51. <!-- 表单弹窗:添加 -->
  52. <ReceivableForm ref="formRef" @success="getList" />
  53. </template>
  54. <script setup lang="ts">
  55. import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
  56. import ReceivableForm from './../ReceivablePlanForm.vue'
  57. import { BizTypeEnum } from '@/api/crm/permission'
  58. import { dateFormatter } from '@/utils/formatTime'
  59. import { fenToYuanFormat } from '@/utils/formatter'
  60. import { DICT_TYPE } from '@/utils/dict'
  61. defineOptions({ name: 'CrmReceivablePlanList' })
  62. const props = defineProps<{
  63. bizType: number // 业务类型
  64. bizId: number // 业务编号
  65. }>()
  66. const loading = ref(true) // 列表的加载中
  67. const total = ref(0) // 列表的总页数
  68. const list = ref([]) // 列表的数据
  69. const queryParams = reactive({
  70. pageNo: 1,
  71. pageSize: 10,
  72. customerId: undefined as unknown // 允许 undefined + number
  73. })
  74. /** 查询列表 */
  75. const getList = async () => {
  76. loading.value = true
  77. try {
  78. // 置空参数
  79. queryParams.customerId = undefined
  80. // 执行查询
  81. let data = { list: [], total: 0 }
  82. switch (props.bizType) {
  83. case BizTypeEnum.CRM_CUSTOMER:
  84. queryParams.customerId = props.bizId
  85. data = await ReceivablePlanApi.getReceivablePlanPageByCustomer(queryParams)
  86. break
  87. default:
  88. return
  89. }
  90. list.value = data.list
  91. total.value = data.total
  92. } finally {
  93. loading.value = false
  94. }
  95. }
  96. /** 搜索按钮操作 */
  97. const handleQuery = () => {
  98. queryParams.pageNo = 1
  99. getList()
  100. }
  101. /** 添加 */
  102. const formRef = ref()
  103. const openForm = () => {
  104. formRef.value.open('create')
  105. }
  106. /** 打开合同详情 */
  107. const { push } = useRouter()
  108. const openDetail = (id: number) => {
  109. push({ name: 'CrmReceivablePlanDetail', params: { id } })
  110. }
  111. /** 监听打开的 bizId + bizType,从而加载最新的列表 */
  112. watch(
  113. () => [props.bizId, props.bizType],
  114. () => {
  115. handleQuery()
  116. },
  117. { immediate: true, deep: true }
  118. )
  119. </script>