Commit 79e88b49 authored by gaodapeng's avatar gaodapeng

增加金额限制,不能为0

parent 54d5e857
Component({ Component({
mixins: [], mixins: [],
data: { data: {
showresult:"", showresult: "",
result: "", result: "",
scenes: 2, scenes: 2,
errMsg: "" errMsg: ""
...@@ -24,7 +24,7 @@ Component({ ...@@ -24,7 +24,7 @@ Component({
this.setData({ this.setData({
result: '', result: '',
errMsg: '', errMsg: '',
showresult:'' showresult: ''
}); });
} }
...@@ -58,7 +58,7 @@ Component({ ...@@ -58,7 +58,7 @@ Component({
this.addInputContont("0") this.addInputContont("0")
}, addpoint(e) { }, addpoint(e) {
if (this.data.scenes == 3 || this.data.scenes == 4) { if (this.data.scenes == 3 || this.data.scenes == 4) {
this.addInputContont(".") this.addInputContont(".")
} }
}, delete(e) { }, delete(e) {
if (this.data.result.length > 1) { if (this.data.result.length > 1) {
...@@ -71,7 +71,7 @@ Component({ ...@@ -71,7 +71,7 @@ Component({
} }
this.setData({ result: cur, showresult: shownewresult }); this.setData({ result: cur, showresult: shownewresult });
} else { } else {
this.setData({ result: '',showresult:''}); this.setData({ result: '', showresult: '' });
} }
}, finish(e) { }, finish(e) {
this.setData({ errMsg: "" }) this.setData({ errMsg: "" })
...@@ -83,6 +83,10 @@ Component({ ...@@ -83,6 +83,10 @@ Component({
this.setData({ errMsg: "金额格式有误" }) this.setData({ errMsg: "金额格式有误" })
return return
} }
if (parseInt(this.data.result * 100) <= 0) {
this.setData({ errMsg: "金额格式有误" })
return;
}
} else if (this.data.scenes == 2) { } else if (this.data.scenes == 2) {
if (this.data.result == null || this.data.result.length != 11) { if (this.data.result == null || this.data.result.length != 11) {
this.setData({ errMsg: "会员号格式有误" }) this.setData({ errMsg: "会员号格式有误" })
...@@ -93,18 +97,18 @@ Component({ ...@@ -93,18 +97,18 @@ Component({
}, closeKeybord(e) { }, closeKeybord(e) {
this.props.onKeyBordClose(); this.props.onKeyBordClose();
}, },
//处理输入的内容 //处理输入的内容
addInputContont(content){ addInputContont(content) {
let newresult = this.data.result + content; let newresult = this.data.result + content;
let shownewresult = newresult let shownewresult = newresult
if(newresult.length > 13){ if (newresult.length > 13) {
shownewresult = "..."+ newresult.substring(newresult.length - 11,newresult.length) shownewresult = "..." + newresult.substring(newresult.length - 11, newresult.length)
} }
this.setData({ result: newresult,showresult:shownewresult}); this.setData({ result: newresult, showresult: shownewresult });
} }
}, },
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment