From 29b21d9e5319f5a15f9a2a28f500ce17c8a10d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Thu, 7 Aug 2025 18:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AC=E5=9C=B0=E7=94=9F?= =?UTF-8?q?=E6=B4=BB=20=E4=BB=98=E6=AC=BE=E5=8F=AA=E8=83=BD=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=A4=A7=E4=BA=8E0=E7=9A=84=E6=95=B0=E5=AD=97,?= =?UTF-8?q?=E4=B8=94=E4=BF=9D=E7=95=99=E4=B8=A4=E4=BD=8D=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/localLife/pay/index.vue | 34 +++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/packages/localLife/pay/index.vue b/packages/localLife/pay/index.vue index 987920ca..611c04c2 100644 --- a/packages/localLife/pay/index.vue +++ b/packages/localLife/pay/index.vue @@ -18,8 +18,8 @@
- ¥ -
+ ¥
@@ -62,7 +62,8 @@
首页
- + 本页二维码
@@ -135,6 +136,29 @@ export default { methods: { + handleMoneyInput() { + // 清除非数字和非小数点的字符 + let value = this.Money.toString().replace(/[^\d.]/g, ''); + + // 限制只能有一个小数点 + value = value.replace(/\.{2,}/g, '.'); + + // 确保小数点后最多两位 + value = value.replace(/^(\d+)\.(\d{2}).*$/, '$1.$2'); + + // 处理开头是小数点的情况 + if (value.startsWith('.')) { + value = '0' + value; + } + + // 处理大于0的验证 + const num = parseFloat(value); + if (isNaN(num) || num <= 0) { + value = ''; + } + + this.Money = value; + }, createQrcode() { uni.showLoading({ @@ -157,7 +181,7 @@ export default { }); }, createQrcode2(e) { - let that= this + let that = this uni.request({ url: `https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=${e}`, method: 'post', @@ -182,7 +206,7 @@ export default { } }); }, - changeBoxshadow2(){ + changeBoxshadow2() { this.boxShow = !this.boxShow }, changeBoxshadow() {