gaoluyang
2026-08-12 21a2d6f813f3d58b494fde010f66bd84ce2f1d41
src/views/crm/receivable/modules/form.vue
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { CrmReceivableApi } from '#/api/crm/receivable';
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { useVbenForm, useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { Alert, message } from 'ant-design-vue';
import { getContractSimpleList } from '#/api/crm/contract';
import {
@@ -31,6 +31,7 @@
const emit = defineEmits(['success']);
const formData = ref<Partial<CrmReceivableApi.Receivable>>();
const showInvoiceHint = ref(false);
const getTitle = computed(() => {
  return formData.value?.id
    ? $t('ui.actionTitle.edit', ['回款'])
@@ -48,6 +49,14 @@
  schema: useFormSchema(),
  showDefaultActions: false,
});
/** 监听合同选择,提示先开票后回款 */
watch(
  () => formApi.form?.values?.contractId,
  (val) => {
    showInvoiceHint.value = !!val;
  },
);
/** 构建新增回款的预填表单 */
async function buildCreateFormData(
@@ -135,6 +144,13 @@
<template>
  <Modal :title="getTitle" class="w-2/5">
    <Alert
      v-if="showInvoiceHint"
      type="warning"
      message="请先完成开票并上传发票附件,再进行回款操作"
      show-icon
      class="mb-4"
    />
    <Form class="mx-4" />
  </Modal>
</template>