| | |
| | | prop="receiptableAmount" |
| | | show-overflow-tooltip |
| | | width="200"> |
| | | <template #default="{ row, column }"> |
| | | <template #default="{ row }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.receiptableAmount) }} |
| | | {{ formatReceivable(row.receiptableAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | prop="receiptableAmount" |
| | | show-overflow-tooltip |
| | | width="200"> |
| | | <template #default="{ row, column }"> |
| | | <template #default="{ row }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.receiptableAmount) }} |
| | | {{ formatReceivable(row.receiptableAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | saveReceiptPayment, |
| | | } from "@/api/salesManagement/indicatorStats.js"; |
| | | import Pagination from "../../../components/PIMTable/Pagination.vue"; |
| | | import { trimZeros } from "@/utils/formatNumber.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const receiptRecord = ref([]); |
| | |
| | | const currentRow = ref({}); |
| | | const receiptFormRef = ref(null); |
| | | const receiptForm = reactive({ paymentDate:"", paymentAmount:undefined, paymentMethod:"", remark:"" }); |
| | | const validatePaymentAmount = (_,v,cb) => { if(!v) return cb(new Error("请输入回款金额")); const m=Math.max(0,(Number(currentRow.value.receiptableAmount)||0)-(Number(currentRow.value.receiptPaymentAmount)||0)); if(v>m) return cb(new Error(`回款金额不能超过可回款余额 ${m.toFixed(6)} 元`)); cb(); }; |
| | | const validatePaymentAmount = (_,v,cb) => { if(!v) return cb(new Error("请输入回款金额")); const m=Math.max(0,(Number(currentRow.value.receiptableAmount)||0)-(Number(currentRow.value.receiptPaymentAmount)||0)); if(v>m) return cb(new Error(`回款金额不能超过可回款余额 ${trimZeros(m, 6)} 元`)); cb(); }; |
| | | const receiptRules = { paymentDate:[{required:true,message:"请选择回款日期",trigger:"change"}], paymentAmount:[{required:true,validator:validatePaymentAmount,trigger:"blur"}], paymentMethod:[{required:true,message:"请选择回款方式",trigger:"change"}] }; |
| | | const openReceiptDialog = r => { currentRow.value=r; receiptForm.paymentDate=""; receiptForm.paymentAmount=undefined; receiptForm.paymentMethod=""; receiptForm.remark=""; receiptDialogVisible.value=true; }; |
| | | const closeReceiptDialog = () => { receiptFormRef.value?.resetFields(); receiptDialogVisible.value=false; }; |
| | |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return cellValue ? parseFloat(cellValue).toFixed(6) : "0.000000"; |
| | | return trimZeros(cellValue, 6); |
| | | }; |
| | | // 应收金额 = 已出库金额 − 已退货款 − 已回款金额。 |
| | | // 出库金额由 6 位小数的含税单价累加而来,会残留「分」以下的零头(如 0.0045、0.004), |
| | | // 而回款是按分录入的整数金额,相减后就会出现这些无意义的尾差。 |
| | | // 应收金额本身只精确到分,分以下的尾差不计入,统一按 0 展示(后端 SQL 也做了同样处理)。 |
| | | const formatReceivable = value => { |
| | | const num = Number(value); |
| | | if (!Number.isFinite(num) || Math.abs(num) < 0.01) { |
| | | return "0"; |
| | | } |
| | | return trimZeros(num, 6); |
| | | }; |
| | | // 主表合计方法 |
| | | const summarizeMainTable = param => { |
| | |
| | | param, |
| | | ["invoiceTotal", "receiptPaymentAmount", "unReceiptPaymentAmount"], |
| | | { |
| | | invoiceTotal: { decimalPlaces: 6 }, |
| | | receiptPaymentAmount: { decimalPlaces: 6 }, |
| | | unReceiptPaymentAmount: { decimalPlaces: 6 }, |
| | | invoiceTotal: { decimalPlaces: 6, trimZeros: true }, |
| | | receiptPaymentAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | unReceiptPaymentAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |
| | |
| | | param, |
| | | ["contractAmount", "receiptPaymentAmount", "receiptableAmount"], |
| | | { |
| | | contractAmount: { decimalPlaces: 6 }, |
| | | receiptPaymentAmount: { decimalPlaces: 6 }, |
| | | receiptableAmount: { decimalPlaces: 6 }, |
| | | contractAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | receiptPaymentAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | receiptableAmount: { formatter: formatReceivable }, |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |