| | |
| | | <el-date-picker style="width:100%" v-model="receiptForm.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="receiptForm.paymentAmount" :precision="2" :min="0" :max="Math.max(0,(Number(currentRow.receiptableAmount)||0)-(Number(currentRow.receiptPaymentAmount)||0))" placeholder="请输入回款金额" controls-position="right" /> |
| | | <div style="color:#e6a23c;font-size:12px;margin-top:4px">当前可回款余额:{{ formattedNumber(null,null,Math.max(0,(Number(currentRow.receiptableAmount)||0)-(Number(currentRow.receiptPaymentAmount)||0))) }} 元</div> |
| | | <el-input-number style="width:100%" v-model="receiptForm.paymentAmount" :precision="2" :min="0" :max="receiptableBalance" placeholder="请输入回款金额" controls-position="right" /> |
| | | <div style="color:#e6a23c;font-size:12px;margin-top:4px">当前可回款余额:{{ receiptableBalance.toFixed(2) }} 元</div> |
| | | </el-form-item> |
| | | <el-form-item label="回款方式:" prop="paymentMethod"> |
| | | <el-select v-model="receiptForm.paymentMethod" placeholder="请选择回款方式" style="width:100%" clearable> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import { onMounted, ref, reactive, toRefs, computed, getCurrentInstance } from "vue"; |
| | | import { |
| | | customewTransactions, |
| | | customewTransactionsDetails, |
| | |
| | | const currentRow = ref({}); |
| | | const receiptFormRef = ref(null); |
| | | const receiptForm = reactive({ paymentDate:"", paymentAmount:undefined, paymentMethod:"", remark:"" }); |
| | | // 应收金额后端已按「合同金额 - 已回款」算好,即为当前可回款余额 |
| | | const receiptableBalance = computed(() => Math.max(0, Number(currentRow.value.receiptableAmount) || 0)); |
| | | const validatePaymentAmount = (_,v,cb) => { |
| | | if(!v) return cb(new Error("请输入回款金额")); |
| | | const max = Math.max(0,(Number(currentRow.value.receiptableAmount)||0)-(Number(currentRow.value.receiptPaymentAmount)||0)); |
| | | const max = receiptableBalance.value; |
| | | if(v > max) return cb(new Error(`回款金额不能超过可回款余额 ${max.toFixed(2)} 元`)); |
| | | cb(); |
| | | }; |
| | |
| | | const summarizeMainTable = param => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceTotal", "receiptPaymentAmount", "unReceiptPaymentAmount"], |
| | | ["contractAmounts", "receiptPaymentAmount", "receiptableAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |