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() {