Commit 69076a08 authored by jiangjiantao's avatar jiangjiantao

价格校验&商品码校验

parent f606d418
......@@ -56,7 +56,9 @@ Component({
}, add0(e) {
this.setData({ result: this.data.result + "0" });
}, addpoint(e) {
if (this.data.scenes == 3 || this.data.scenes == 4) {
this.setData({ result: this.data.result + "." });
}
}, delete(e) {
if (this.data.result.length > 1) {
let cur = this.data.result;
......@@ -66,6 +68,15 @@ Component({
this.setData({ result: '' });
}
}, finish(e) {
if (this.data.scenes == 3 || this.data.scenes == 4) {
//判断价格是否参数合法
var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
if (!priceReg.test(this.data.result)) {
//错误提示
return
}
}
this.props.onKeyBordFinished(this.data.result);
},closeKeybord(e){
this.props.onKeyBordClose();
......
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