| | |
| | | @pagination="sonPaginationSearch"> |
| | | <template #payableAmountSlot="{ row }"> |
| | | <el-text type="danger"> |
| | | {{ parseFloat(row.payableAmount).toFixed(2) }} |
| | | {{ parseFloat(row.payableAmount).toFixed(6) }} |
| | | </el-text> |
| | | </template> |
| | | <template #paymentActionSlot="{ row }"> |
| | |
| | | <el-date-picker style="width:100%" v-model="paymentForm.paymentDate" value-format="YYYY-MM-DD" type="date" placeholder="请选择付款日期" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="付款金额:" prop="paymentAmount"> |
| | | <el-input-number style="width:100%" v-model="paymentForm.paymentAmount" :precision="2" :min="0" :max="Math.max(0,(Number(currentPaymentRow.payableAmount)||0)-(Number(currentPaymentRow.paymentAmount)||0))" placeholder="请输入付款金额" controls-position="right" /> |
| | | <div style="color:#e6a23c;font-size:12px;margin-top:4px">当前可付款余额:{{ Math.max(0,(Number(currentPaymentRow.payableAmount)||0)-(Number(currentPaymentRow.paymentAmount)||0)).toFixed(2) }} 元</div> |
| | | <el-input-number style="width:100%" v-model="paymentForm.paymentAmount" :min="0" :precision="6" :max="Math.max(0,(Number(currentPaymentRow.payableAmount)||0)-(Number(currentPaymentRow.paymentAmount)||0))" placeholder="请输入付款金额" controls-position="right" /> |
| | | <div style="color:#e6a23c;font-size:12px;margin-top:4px">当前可付款余额:{{ Math.max(0,(Number(currentPaymentRow.payableAmount)||0)-(Number(currentPaymentRow.paymentAmount)||0)).toFixed(6) }} 元</div> |
| | | </el-form-item> |
| | | <el-form-item label="付款方式:" prop="paymentMethod"> |
| | | <el-select v-model="paymentForm.paymentMethod" placeholder="请选择付款方式" style="width:100%" clearable> |
| | |
| | | prop: "contractAmount", |
| | | width: 200, |
| | | formatData: params => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | return params ? parseFloat(params).toFixed(6) : 0; |
| | | }, |
| | | }, |
| | | { |
| | |
| | | prop: "paymentAmount", |
| | | width: 200, |
| | | formatData: params => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | return params ? parseFloat(params).toFixed(6) : 0; |
| | | }, |
| | | }, |
| | | { |
| | |
| | | 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 max = Math.max(0,(Number(currentPaymentRow.value.payableAmount)||0)-(Number(currentPaymentRow.value.paymentAmount)||0)); |
| | | if(v > max) return cb(new Error(`付款金额不能超过可付款余额 ${max.toFixed(2)} 元`)); |
| | | cb(); |
| | | }; |
| | | const paymentRules = { |
| | | paymentDate:[{required:true,message:"请选择付款日期",trigger:"change"}], |
| | | paymentAmount:[{required:true,validator:validatePaymentAmount,trigger:"blur"}], |
| | | paymentMethod:[{required:true,message:"请选择付款方式",trigger:"change"}], |
| | | }; |
| | | const openPaymentDialog = row => { currentPaymentRow.value=row; paymentForm.paymentDate=""; paymentForm.paymentAmount=undefined; paymentForm.paymentMethod=""; paymentForm.remark=""; paymentDialogVisible.value=true; }; |
| | | const validatePaymentAmount = (_,v,cb) => { if(!v) return cb(new Error("请输入付款金额")); const m=Math.max(0,(Number(currentPaymentRow.value.payableAmount)||0)-(Number(currentPaymentRow.value.paymentAmount)||0)); if(v>m) return cb(new Error(`付款金额不能超过可付款余额 ${m.toFixed(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; }; |
| | | const submitPaymentForm = () => { |
| | | paymentFormRef.value?.validate(valid => { |
| | | if(valid){ |
| | | savePayment({ supplierId:currentSupplierId.value, purchaseContractNumber:currentPaymentRow.value.purchaseContractNumber, paymentDate:paymentForm.paymentDate, paymentAmount:paymentForm.paymentAmount, paymentMethod:paymentForm.paymentMethod, remark:paymentForm.remark }).then(res => { |
| | | proxy.$modal.msgSuccess("新增付款成功"); closePaymentDialog(); getPaymenRecordtList(currentSupplierId.value); getList(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | const submitPaymentForm = () => { paymentFormRef.value?.validate(v=>{ if(v){ savePayment({ supplierId:currentSupplierId.value, purchaseContractNumber:currentPaymentRow.value.purchaseContractNumber, paymentDate:paymentForm.paymentDate, paymentAmount:paymentForm.paymentAmount, paymentMethod:paymentForm.paymentMethod, remark:paymentForm.remark }).then(res=>{ proxy.$modal.msgSuccess("新增付款成功"); closePaymentDialog(); getPaymenRecordtList(currentSupplierId.value); getList(); }); } }); }; |
| | | |
| | | // 主表合计方法 |
| | | const summarizeMainTable = param => { |
| | |
| | | param, |
| | | ["contractAmounts", "paymentAmount", "payableAmount"], |
| | | { |
| | | contractAmounts: { decimalPlaces: 6 }, |
| | | paymentAmount: { decimalPlaces: 6 }, |
| | | payableAmount: { decimalPlaces: 6 }, |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |
| | |
| | | param, |
| | | ["contractAmount", "invoiceAmount", "paymentAmount"], |
| | | { |
| | | contractAmount: { decimalPlaces: 6 }, |
| | | invoiceAmount: { decimalPlaces: 6 }, |
| | | paymentAmount: { decimalPlaces: 6 }, |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |
| | |
| | | summarizeTable[summarizeTable.length - 1] = |
| | | originalTableDataSon.value[ |
| | | originalTableDataSon.value.length - 1 |
| | | ].payableAmount.toFixed(2); |
| | | ].payableAmount.toFixed(6); |
| | | } else { |
| | | summarizeTable[summarizeTable.length - 1] = 0.0; |
| | | } |
| | |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (column.property !== "supplierName") { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | return parseFloat(cellValue).toFixed(6); |
| | | } else { |
| | | return cellValue; |
| | | } |