Commit 69076a08 authored by jiangjiantao's avatar jiangjiantao

价格校验&商品码校验

parent f606d418
...@@ -56,7 +56,9 @@ Component({ ...@@ -56,7 +56,9 @@ Component({
}, add0(e) { }, add0(e) {
this.setData({ result: this.data.result + "0" }); this.setData({ result: this.data.result + "0" });
}, addpoint(e) { }, addpoint(e) {
this.setData({ result: this.data.result + "." }); if (this.data.scenes == 3 || this.data.scenes == 4) {
this.setData({ result: this.data.result + "." });
}
}, delete(e) { }, delete(e) {
if (this.data.result.length > 1) { if (this.data.result.length > 1) {
let cur = this.data.result; let cur = this.data.result;
...@@ -66,7 +68,16 @@ Component({ ...@@ -66,7 +68,16 @@ Component({
this.setData({ result: '' }); this.setData({ result: '' });
} }
}, finish(e) { }, finish(e) {
this.props.onKeyBordFinished(this.data.result); 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){ },closeKeybord(e){
this.props.onKeyBordClose(); this.props.onKeyBordClose();
} }
......
...@@ -443,7 +443,7 @@ Page({ ...@@ -443,7 +443,7 @@ Page({
//键盘完成 //键盘完成
onKeyBordFinished(result) { onKeyBordFinished(result) {
if(this.data.scene == 3){ if(this.data.scene == 3){
this.sendPaymentToFront(result) this.sendPaymentToFront(result)
}else if(this.data.scene == 1){ }else if(this.data.scene == 1){
this.sendGoodsInfoToFront(result) this.sendGoodsInfoToFront(result)
}else if(this.data.scene ==4){ }else if(this.data.scene ==4){
......
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