Commit 79e88b49 authored by gaodapeng's avatar gaodapeng

增加金额限制,不能为0

parent 54d5e857
Component({
mixins: [],
data: {
showresult:"",
showresult: "",
result: "",
scenes: 2,
errMsg: ""
......@@ -24,7 +24,7 @@ Component({
this.setData({
result: '',
errMsg: '',
showresult:''
showresult: ''
});
}
......@@ -71,7 +71,7 @@ Component({
}
this.setData({ result: cur, showresult: shownewresult });
} else {
this.setData({ result: '',showresult:''});
this.setData({ result: '', showresult: '' });
}
}, finish(e) {
this.setData({ errMsg: "" })
......@@ -83,6 +83,10 @@ Component({
this.setData({ errMsg: "金额格式有误" })
return
}
if (parseInt(this.data.result * 100) <= 0) {
this.setData({ errMsg: "金额格式有误" })
return;
}
} else if (this.data.scenes == 2) {
if (this.data.result == null || this.data.result.length != 11) {
this.setData({ errMsg: "会员号格式有误" })
......@@ -94,13 +98,13 @@ Component({
this.props.onKeyBordClose();
},
//处理输入的内容
addInputContont(content){
addInputContont(content) {
let newresult = this.data.result + content;
let shownewresult = newresult
if(newresult.length > 13){
shownewresult = "..."+ newresult.substring(newresult.length - 11,newresult.length)
if (newresult.length > 13) {
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