| | |
| | | <el-table-column label="应付金额(元)" |
| | | prop="payableAmount" |
| | | show-overflow-tooltip> |
| | | <template #default="{ row, column }"> |
| | | <template #default="{ row }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.payableAmount) }} |
| | | {{ formatPayable(row.payableAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | @pagination="sonPaginationSearch"> |
| | | <template #payableAmountSlot="{ row }"> |
| | | <el-text type="danger"> |
| | | {{ parseFloat(row.payableAmount).toFixed(6) }} |
| | | {{ formatPayable(row.payableAmount) }} |
| | | </el-text> |
| | | </template> |
| | | <template #paymentActionSlot="{ row }"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="付款金额:" prop="paymentAmount"> |
| | | <el-input-number style="width:100%" v-model="paymentForm.paymentAmount" :min="0" :precision="6" :max="Math.max(0,Number(currentPaymentRow.payableAmount)||0)" placeholder="请输入付款金额" controls-position="right" /> |
| | | <div style="color:#e6a23c;font-size:12px;margin-top:4px">当前可付款余额:{{ Math.max(0,Number(currentPaymentRow.payableAmount)||0).toFixed(6) }} 元</div> |
| | | <div style="color:#e6a23c;font-size:12px;margin-top:4px">当前可付款余额:{{ formatPayable(Math.max(0,Number(currentPaymentRow.payableAmount)||0)) }} 元</div> |
| | | </el-form-item> |
| | | <el-form-item label="付款方式:" prop="paymentMethod"> |
| | | <el-select v-model="paymentForm.paymentMethod" placeholder="请选择付款方式" style="width:100%" clearable> |
| | |
| | | savePayment, |
| | | } from "@/api/procurementManagement/paymentLedger.js"; |
| | | import Pagination from "../../../components/PIMTable/Pagination.vue"; |
| | | import { trimZeros, roundHalfUp } from "@/utils/formatNumber.js"; |
| | | |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | |
| | | prop: "contractAmount", |
| | | width: 200, |
| | | formatData: params => { |
| | | return params ? parseFloat(params).toFixed(6) : 0; |
| | | return trimZeros(params, 6); |
| | | }, |
| | | }, |
| | | { |
| | |
| | | prop: "paymentAmount", |
| | | width: 200, |
| | | formatData: params => { |
| | | return params ? parseFloat(params).toFixed(6) : 0; |
| | | return trimZeros(params, 6); |
| | | }, |
| | | }, |
| | | { |
| | |
| | | const currentPaymentRow = ref({}); |
| | | const paymentFormRef = ref(null); |
| | | const paymentForm = reactive({ paymentDate:"", paymentAmount:undefined, paymentMethod:"", remark:"" }); |
| | | const validatePaymentAmount = (_,v,cb) => { if(!v) return cb(new Error("请输入付款金额")); const m=Math.max(0,Number(currentPaymentRow.value.payableAmount)||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(currentPaymentRow.value.payableAmount)||0); if(v>m) return cb(new Error(`付款金额不能超过可付款余额 ${trimZeros(m, 6)} 元`)); cb(); }; |
| | | const paymentRules = { paymentDate:[{required:true,message:"请选择付款日期",trigger:"change"}], paymentAmount:[{required:true,validator:validatePaymentAmount,trigger:"blur"}], paymentMethod:[{required:true,message:"请选择付款方式",trigger:"change"}] }; |
| | | const openPaymentDialog = r => { currentPaymentRow.value=r; paymentForm.paymentDate=""; paymentForm.paymentAmount=undefined; paymentForm.paymentMethod=""; paymentForm.remark=""; paymentDialogVisible.value=true; }; |
| | | const closePaymentDialog = () => { paymentFormRef.value?.resetFields(); paymentDialogVisible.value=false; }; |
| | |
| | | param, |
| | | ["contractAmounts", "paymentAmount", "payableAmount"], |
| | | { |
| | | contractAmounts: { decimalPlaces: 6 }, |
| | | paymentAmount: { decimalPlaces: 6 }, |
| | | payableAmount: { decimalPlaces: 6 }, |
| | | contractAmounts: { decimalPlaces: 6, trimZeros: true }, |
| | | paymentAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | // 应付金额逐行按分取整后再求和,保证合计 = 列内展示值之和 |
| | | payableAmount: { roundEach: 2, formatter: formatPayable }, |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |
| | |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeMainTable1 = param => { |
| | | let summarizeTable = proxy.summarizeTable( |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["contractAmount", "invoiceAmount", "paymentAmount"], |
| | | ["contractAmount", "invoiceAmount", "paymentAmount", "payableAmount"], |
| | | { |
| | | contractAmount: { decimalPlaces: 6 }, |
| | | invoiceAmount: { decimalPlaces: 6 }, |
| | | paymentAmount: { decimalPlaces: 6 }, |
| | | contractAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | invoiceAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | paymentAmount: { decimalPlaces: 6, trimZeros: true }, |
| | | // 应付金额逐行按分取整后再求和,保证合计 = 列内展示值之和 |
| | | payableAmount: { roundEach: 2, formatter: formatPayable }, |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |
| | | ); |
| | | if (originalTableDataSon.value.length > 0) { |
| | | summarizeTable[summarizeTable.length - 1] = |
| | | originalTableDataSon.value[ |
| | | originalTableDataSon.value.length - 1 |
| | | ].payableAmount.toFixed(6); |
| | | } else { |
| | | summarizeTable[summarizeTable.length - 1] = 0.0; |
| | | } |
| | | return summarizeTable; |
| | | }; |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (column.property !== "supplierName") { |
| | | return parseFloat(cellValue).toFixed(6); |
| | | return trimZeros(cellValue, 6); |
| | | } else { |
| | | return cellValue; |
| | | } |
| | | }; |
| | | // 应付金额是金额字段,最多保留 2 位小数(四舍五入到分)。 |
| | | // 应付金额 = 取(入库金额, 合同金额)较小者 − 已付款 − 退货金额,其中入库金额由 6 位小数的含税单价累加而来, |
| | | // 会带出「厘」及以下的小数,页面上统一按分展示。 |
| | | const formatPayable = value => { |
| | | return trimZeros(roundHalfUp(value, 2), 2); |
| | | }; |
| | | getList(); |
| | | </script> |
| | | |