From 3dd47ed3053f560dae8a0fd82a7c41c21ae6d4fa Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Wed, 28 Jan 2026 15:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E5=8D=95=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/car_settlement/payment_form.css | 48 +++++++++++++++++++++++++ js/car_settlement/child/payment_form.js | 32 ++++++++++++++++- 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/css/car_settlement/payment_form.css b/css/car_settlement/payment_form.css index 2d396f6..a6b73bd 100644 --- a/css/car_settlement/payment_form.css +++ b/css/car_settlement/payment_form.css @@ -295,4 +295,52 @@ blockquote { -webkit-border-radius: 2em; -moz-border-radius: 2em; border-radius: 2em +} + +/* 表格输入框美化核心样式 */ +.classTable input.form-control { + width: 100%; + min-width: 80px; + max-width: 120px; + height: 30px; + padding: 0 6px; + border: 1px solid #e5e6eb; + border-radius: 3px; + background-color: #fafafa; + font-size: 12px; + color: #333; + box-sizing: border-box; + text-align: right; + transition: all 0.2s ease; +} + +/* 输入框聚焦时的高亮效果 */ +.classTable input.form-control:focus { + outline: none; + border-color: #409eff; + background-color: #fff; + box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); +} + +/* 数字输入框禁用默认箭头 */ +.classTable input[type="number"] { + -moz-appearance: textfield; +} +.classTable input[type="number"]::-webkit-inner-spin-button, +.classTable input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} + +/* 表格单元格优化 */ +.classTable td, .classTable th { + padding: 6px 8px; + vertical-align: middle; + white-space: nowrap; +} + +/* 超出内容自动省略 */ +.classTable input.form-control { + overflow: hidden; + text-overflow: ellipsis; } \ No newline at end of file diff --git a/js/car_settlement/child/payment_form.js b/js/car_settlement/child/payment_form.js index 3c4f177..742d6d9 100644 --- a/js/car_settlement/child/payment_form.js +++ b/js/car_settlement/child/payment_form.js @@ -133,7 +133,7 @@ function submitApply(data) { }) const actualValues = getEditedActualValues(); - data.field.actualValues = actualValues; + $.each(allDataList, function (index, item) { const carActual = actualValues.carActualList.find(v => v.outDetailId == item.id); // 普通车辆 const craneActual = actualValues.craneActualList.find(v => v.outDetailId == item.id); // 吊车 @@ -148,6 +148,9 @@ function submitApply(data) { exeGls: carActual?.exeGls || '', inMoney: carActual?.inMoney || craneActual?.inMoney || '', exeDay: craneActual?.exeDay || '', + outDetailId:item.id, + modelId:item.modelId, + ton:item.ton }; detailsList.push(obj); }) @@ -423,7 +426,34 @@ function getEditedActualValues() { return actualValues; } +// 输入框正则校验(仅正数 + 最多两位小数 + 不超过1亿元) +$(document).on('input', '.classTable input.form-control', function() { + // 1. 只保留数字和小数点,过滤负号、字母、符号等所有非法字符 + this.value = this.value + .replace(/[^0-9.]/g, '') // 过滤除了数字和小数点的所有字符(包括负号) + .replace(/\.{2,}/g, '.') // 多个小数点只保留第一个 + .replace(/^0+(?=\d)/, ''); // 去除开头多余的0(如 000123 → 123) + // 2. 限制小数点后最多两位 + if (this.value.indexOf('.') !== -1) { + const parts = this.value.split('.'); + this.value = parts[0] + '.' + parts[1].substring(0, 2); + } + + // 3. 限制数值上限:不超过1亿元(100000000) + const numValue = Number(this.value || 0); + const maxAmount = 100000000; // 1亿元 + if (numValue > maxAmount) { + this.value = maxAmount.toFixed(2); // 超过上限强制设为1亿元 + } +}); + +// 输入框失焦时格式化(补零 + 统一两位小数) +$(document).on('blur', '.classTable input.form-control', function() { + if (this.value === '') return; // 空值不处理 + // 转数字后格式化,自动补两位小数(如 123 → 123.00,123.4 → 123.40) + this.value = Number(this.value).toFixed(2); +}); // 关闭页面 function closePage(type) {