feat(erp): 采购来票选单过滤已开完票订单并修正未开票金额口径
- 选单查询传 remainPriceEnable=true,已开完票订单不再展示
- 未开票金额列、表单提示与来票金额上限校验改用 remainInvoicePrice
- 修正此前误把合计税额 totalTaxPrice 当作未开票金额的问题
Co-Authored-By: Claude <noreply@anthropic.com>
| | |
| | | totalPrice?: number; // 合计金额,单位:元 |
| | | totalProductPrice?: number; // 产品金额,单位:元 |
| | | totalTaxPrice?: number; // 合计税额,单位:元 |
| | | remainInvoicePrice?: number; // 剩余可开票金额(订单总金额-已来票金额),单位:元 |
| | | discountPercent?: number; // 优惠率,百分比 |
| | | discountPrice?: number; // 优惠金额,单位:元 |
| | | depositPrice?: number; // 定金金额,单位:元 |
| | |
| | | |
| | | /** 新增/修改的表单 */ |
| | | export function useFormSchema( |
| | | orderTotalTaxPrice?: Ref<number | undefined>, |
| | | orderRemainInvoicePrice?: Ref<number | undefined>, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | |
| | | 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; |
| | | } |
| | | }, |
| | | }), |
| | |
| | | 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', |
| | |
| | | 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: '请输入来票金额' }) |
| | |
| | | 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') { |
| | |
| | | }, |
| | | wrapperClass: 'grid-cols-2', |
| | | layout: 'horizontal', |
| | | schema: useFormSchema(orderTotalTaxPrice), |
| | | schema: useFormSchema(orderRemainInvoicePrice), |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | ocrSupplierName.value = ''; |
| | | orderTotalTaxPrice.value = undefined; |
| | | orderRemainInvoicePrice.value = undefined; |
| | | return; |
| | | } |
| | | const data = modalApi.getData<{ |
| | |
| | | }>(); |
| | | 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; |
| | |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'totalTaxPrice', |
| | | field: 'remainInvoicePrice', |
| | | title: '未开票金额', |
| | | formatter: 'formatAmount2', |
| | | minWidth: 120, |
| | |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | status: 20, // 仅展示已审核通过的采购订单 |
| | | remainPriceEnable: true, // 仅展示剩余可开票金额大于 0 的订单(金额已开完的不展示) |
| | | ...formValues, |
| | | }); |
| | | }, |