From 3c15579876c7b72e93e508a2d45f080a962b10ae Mon Sep 17 00:00:00 2001 From: linyongLynn <15926056+linyonglynn@user.noreply.gitee.com> Date: Sat, 1 Nov 2025 12:39:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=90=8C=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.js | 99 ++- .../detailPaymentRegistration-bk.vue | 410 ++++++++++ .../components/detailPaymentRegistration.vue | 722 +++++++++++++++++- .../components/paymentRegistration.vue | 209 ++--- .../contract/components/printPaymentForm.vue | 63 +- 5 files changed, 1253 insertions(+), 250 deletions(-) create mode 100644 src/views/contract/components/detailPaymentRegistration-bk.vue diff --git a/src/utils/index.js b/src/utils/index.js index 0908660..a4c843f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -130,12 +130,12 @@ export function debounce(fn, delay = 500) { } // 金额分隔 -export function moneyFormatter(money, precision = 2) { - if(!money){ - return 0 - } - if (Number(money) === 0) { - return 0 +export function moneyFormatter(money, precision = 2) { + if(!money){ + return 0 + } + if (Number(money) === 0) { + return 0 } return Number(money).toFixed(precision).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') } @@ -183,7 +183,7 @@ export function deepCopy(data) { } else { // string,number,bool,null,undefined,symbol return data - } + } } export function requestToForm(requestObj, form) { // 获取a对象中属性的顺序和值 @@ -225,4 +225,87 @@ export function buildTree(data, pid = 0) { } } return tree -} +} + +/** + * 数字转中文大写金额 + * @param {number} num - 要转换的数字 + * @returns {string} 中文大写金额 + */ +export function numberToChinese(num) { + if (num === 0) { + return '零元整' + } + + const units = ['', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟', '万'] + const digits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] + const [integer, decimal] = num.toString().split('.') + let result = '' + let intNum = parseInt(integer) + + if (intNum === 0) { + result = '零' + } else { + let i = 0 + let lastDigit = null + let hasZero = false + + while (intNum > 0) { + const digit = intNum % 10 + + if (digit === 0) { + // 只有当后面有非零数字时才添加"零" + if (!hasZero && lastDigit !== 0) { + result = '零' + result + hasZero = true + } + } else { + let unit = units[i] + + // 处理"拾"的特殊情况:当十位是1时,不写"壹拾",只写"拾" + if (i === 1 && digit === 1) { + result = unit + result + } else { + result = digits[digit] + unit + result + } + hasZero = false + } + + lastDigit = digit + intNum = Math.floor(intNum / 10) + i++ + } + + // 清理末尾的零 + result = result.replace(/零+$/, '') + // 清理连续的零 + result = result.replace(/零+/g, '零') + } + + // 先加上"元"单位 + result += '元' + + // 处理小数部分 + if (decimal) { + const decimalNum = parseInt(decimal) + if (decimalNum > 0) { + const jiao = Math.floor(decimalNum / 10) + const fen = decimalNum % 10 + + if (jiao > 0) { + result += digits[jiao] + '角' + } + if (fen > 0) { + result += digits[fen] + '分' + } + return result + } + } + + // 如果没有小数部分,添加"整" + if (!decimal || parseInt(decimal) === 0) { + result += '整' + } + + return result +} \ No newline at end of file diff --git a/src/views/contract/components/detailPaymentRegistration-bk.vue b/src/views/contract/components/detailPaymentRegistration-bk.vue new file mode 100644 index 0000000..7572107 --- /dev/null +++ b/src/views/contract/components/detailPaymentRegistration-bk.vue @@ -0,0 +1,410 @@ + + + + + + 受款单位 + {{ form.contract.supply }} + + + 合同名称 + {{ form.contract.name }} + + + 合同金额 + {{ moneyFormat(form.contract.money) }} (元) + + + + + + + *申请付款金额 + + + + + + + + + 审计金额 + + + + + + + + + + *实际支付金额 + + + + + + + + + + *本期扣款金额 + + + + + + + + + + *款项类型 + + + + + + + + + + + + *是否为最后一笔 + + + e ? form.is_end = 1 : form.is_end = 0" /> + + + + + + + + 备注 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/contract/components/detailPaymentRegistration.vue b/src/views/contract/components/detailPaymentRegistration.vue index 7572107..752b97d 100644 --- a/src/views/contract/components/detailPaymentRegistration.vue +++ b/src/views/contract/components/detailPaymentRegistration.vue @@ -7,7 +7,6 @@ type="form" :form="form" :rules="rules" - @submit="editor" > @@ -22,10 +21,34 @@ 合同金额 {{ moneyFormat(form.contract.money) }} (元) + + + 申请付款金额 + {{ moneyFormat(form.apply_money) }} (元) + + + 实际支付金额 + {{ moneyFormat(form.act_money) }} (元) + + + + + 款项类型 + {{ form.type }} + + + 是否最后一笔 + {{ form.is_end === 1 ? '是' : '否' }} + + + + 备注 + {{ form.remark }} + - + *申请付款金额 @@ -35,7 +58,7 @@ - + 审计金额 @@ -44,7 +67,7 @@ - + *实际支付金额 @@ -54,7 +77,7 @@ - + *本期扣款金额 @@ -64,7 +87,7 @@ - + *款项类型 @@ -83,7 +106,7 @@ - + *是否为最后一笔 @@ -95,7 +118,7 @@ - + 备注 @@ -109,37 +132,90 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + 事后支付表格 + + 放大查看 + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + +