Commit af29af1b by lixiaomin

修改折扣价和原价比较

parent 3a799fc6
...@@ -167,7 +167,9 @@ export default { ...@@ -167,7 +167,9 @@ export default {
}else if(!regular.test(value)){ }else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,最多保留1位小数')); callback(new Error('请输入大于0的正数,最多保留1位小数'));
}else if(this.form.price){ }else if(this.form.price){
if(value > this.form.price){ let discountValue=value-0;
let priceValue=this.form.price-0;
if(discountValue > priceValue){
callback(new Error('折扣价不能大于原价')); callback(new Error('折扣价不能大于原价'));
}else { }else {
callback(); callback();
...@@ -184,7 +186,9 @@ export default { ...@@ -184,7 +186,9 @@ export default {
}else if(!regular.test(value)){ }else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,最多保留1位小数')); callback(new Error('请输入大于0的正数,最多保留1位小数'));
}else if(this.form.discount){ }else if(this.form.discount){
if(value<this.form.discount){ let discountValue=this.form.discount-0;
let priceValue=value-0;
if(priceValue<discountValue){
callback(new Error('原价不能小于折扣价')); callback(new Error('原价不能小于折扣价'));
}else { }else {
callback(); callback();
......
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