From 833cae9bffce33b5ce8729f590df17f474c80445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 22 Feb 2021 17:48:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E5=80=BC=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/view/user_discount/form.html | 4 ++-- public/static/admin.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/data/view/user_discount/form.html b/app/data/view/user_discount/form.html index 883ee079d..69cf7e56c 100644 --- a/app/data/view/user_discount/form.html +++ b/app/data/view/user_discount/form.html @@ -14,7 +14,7 @@ 会员级别 - 原价比例 + 原价比例 ( 0% - 100% ) @@ -26,7 +26,7 @@ diff --git a/public/static/admin.js b/public/static/admin.js index 82b52e23d..2e8157a6a 100644 --- a/public/static/admin.js +++ b/public/static/admin.js @@ -713,14 +713,20 @@ $(function () { /*! 表单元素失去焦点时数字 */ $body.on('blur', '[data-blur-number]', function () { + var min = this.dataset.valueMin; + var max = this.dataset.valueMax; + var value = parseFloat(this.value) || 0; var fiexd = parseInt(this.dataset.blurNumber || 0); - this.value = (parseFloat(this.value) || 0).toFixed(fiexd); + if (typeof min !== 'undefined' && value < min) value = min; + if (typeof max !== 'undefined' && value > max) value = max; + this.value = parseFloat(value).toFixed(fiexd); }); /*! 注册 data-href 事件行为 */ $body.on('click', '[data-href]', function () { - var href = this.dataset.href; - if (href && href.indexOf('#') !== 0) location.href = href; + if (this.dataset.href && this.dataset.href.indexOf('#') !== 0) { + location.href = this.dataset.href; + } }); /*! 注册 data-iframe 事件行为 */