liu
3 天以前 6373c12e97dc5d52ad87271d1adb6743b0052607
feat(erp): 采购来票选单过滤已开完票订单并修正未开票金额口径

- 选单查询传 remainPriceEnable=true,已开完票订单不再展示
- 未开票金额列、表单提示与来票金额上限校验改用 remainInvoicePrice
- 修正此前误把合计税额 totalTaxPrice 当作未开票金额的问题

Co-Authored-By: Claude <noreply@anthropic.com>
已修改4个文件
28 ■■■■ 文件已修改
src/api/erp/purchase/order/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/invoice/data.ts 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/invoice/modules/form.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/invoice/modules/purchase-order-select.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/erp/purchase/order/index.ts
@@ -14,6 +14,7 @@
    totalPrice?: number; // 合计金额,单位:元
    totalProductPrice?: number; // 产品金额,单位:元
    totalTaxPrice?: number; // 合计税额,单位:元
    remainInvoicePrice?: number; // 剩余可开票金额(订单总金额-已来票金额),单位:元
    discountPercent?: number; // 优惠率,百分比
    discountPrice?: number; // 优惠金额,单位:元
    depositPrice?: number; // 定金金额,单位:元
src/views/erp/purchase/invoice/data.ts
@@ -15,7 +15,7 @@
/** 新增/修改的表单 */
export function useFormSchema(
  orderTotalTaxPrice?: Ref<number | undefined>,
  orderRemainInvoicePrice?: Ref<number | undefined>,
): VbenFormSchema[] {
  return [
    {
@@ -48,12 +48,12 @@
        placeholder: '请选择采购订单',
        onChange: (
          order:
            | { supplierName?: string; totalTaxPrice?: number }
            | { supplierName?: string; remainInvoicePrice?: number }
            | undefined,
        ) => {
          form.setFieldValue('supplierName', order?.supplierName);
          if (orderTotalTaxPrice) {
            orderTotalTaxPrice.value = order?.totalTaxPrice;
          if (orderRemainInvoicePrice) {
            orderRemainInvoicePrice.value = order?.remainInvoicePrice;
          }
        },
      }),
@@ -91,8 +91,8 @@
      component: 'InputNumber',
      rules: 'required',
      description: () =>
        orderTotalTaxPrice?.value != null
          ? `采购订单未开票金额:${Number(orderTotalTaxPrice.value).toFixed(2)} 元`
        orderRemainInvoicePrice?.value != null
          ? `采购订单未开票金额:${Number(orderRemainInvoicePrice.value).toFixed(2)} 元`
          : '',
      componentProps: {
        class: '!w-full',
@@ -106,11 +106,11 @@
          class: '!w-full',
          placeholder: '请输入来票金额',
          min: 0,
          max: orderTotalTaxPrice?.value ?? undefined,
          max: orderRemainInvoicePrice?.value ?? undefined,
          precision: 2,
        }),
        rules: () => {
          const max = orderTotalTaxPrice?.value;
          const max = orderRemainInvoicePrice?.value;
          if (max != null) {
            return z
              .number({ message: '请输入来票金额' })
src/views/erp/purchase/invoice/modules/form.vue
@@ -24,7 +24,7 @@
const formData = ref<ErpPurchaseInvoiceApi.PurchaseInvoice>();
const formType = ref<FormType>('create');
const ocrSupplierName = ref('');
const orderTotalTaxPrice = ref<number>(); // 所选采购订单合计税额(未开票金额,用于提示与校验)
const orderRemainInvoicePrice = ref<number>(); // 所选采购订单剩余可开票金额(未开票金额,用于提示与校验)
const getTitle = computed(() => {
  if (formType.value === 'create') {
@@ -45,7 +45,7 @@
  },
  wrapperClass: 'grid-cols-2',
  layout: 'horizontal',
  schema: useFormSchema(orderTotalTaxPrice),
  schema: useFormSchema(orderRemainInvoicePrice),
  showDefaultActions: false,
});
@@ -75,7 +75,7 @@
    if (!isOpen) {
      formData.value = undefined;
      ocrSupplierName.value = '';
      orderTotalTaxPrice.value = undefined;
      orderRemainInvoicePrice.value = undefined;
      return;
    }
    const data = modalApi.getData<{
@@ -85,7 +85,7 @@
    }>();
    formType.value = data.formType;
    formApi.setDisabled(formType.value === 'detail');
    formApi.updateSchema(useFormSchema(orderTotalTaxPrice));
    formApi.updateSchema(useFormSchema(orderRemainInvoicePrice));
    await formApi.resetForm();
    // OCR 识别数据预填(新建场景,编辑/详情不处理)
    const ocr = data?.ocrData;
src/views/erp/purchase/invoice/modules/purchase-order-select.vue
@@ -92,7 +92,7 @@
        minWidth: 120,
      },
      {
        field: 'totalTaxPrice',
        field: 'remainInvoicePrice',
        title: '未开票金额',
        formatter: 'formatAmount2',
        minWidth: 120,
@@ -116,6 +116,7 @@
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            status: 20, // 仅展示已审核通过的采购订单
            remainPriceEnable: true, // 仅展示剩余可开票金额大于 0 的订单(金额已开完的不展示)
            ...formValues,
          });
        },