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) {
this.setData({ result: this.data.result + "." });
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,7 +68,16 @@ Component({
this.setData({ result: '' });
}
}, 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){
this.props.onKeyBordClose();
}
......
......@@ -443,7 +443,7 @@ Page({
//键盘完成
onKeyBordFinished(result) {
if(this.data.scene == 3){
this.sendPaymentToFront(result)
this.sendPaymentToFront(result)
}else if(this.data.scene == 1){
this.sendGoodsInfoToFront(result)
}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