美文网首页
Layui判断两个值相加等于100

Layui判断两个值相加等于100

作者: 吕保鑫 | 来源:发表于2019-06-05 16:47 被阅读0次

    js

    form.on("submit(editone)", function(data) {
            var one = data.field.nottake;
            var two = data.field.yestake;
            var three = Number(Number(one.replace(/,/g, "")).toFixed(2)*1 +  Number(two.replace(/,/g,"")).toFixed(2)*1);
            console.log(three);
            if(three != 100){
                layer.msg("两个值相加必须是100")
            }
            if(three==100){
                $.ajax($url+'jxgl/S0009F0002',{
                    data:{
                        level:data.field.yestake,
                        notLevel:data.field.nottake
                    },
                    dataType:'json',
                    type:'post',
                    timeout:10000,
                    success:function(data){
                        if (data.result = 200) {
                            layer.msg('修改成功', {
                                icon: 1,
                                time: 2000
                            }, function() {
                                
                            });
                        
                        } else {
                            layer.msg(data.result)
                        }
                    },
                    error:function(xhr,type,errorThrown){
                        
                    }
                });
            }
            return false;
        });
    

    相关文章

      网友评论

          本文标题:Layui判断两个值相加等于100

          本文链接:https://www.haomeiwen.com/subject/nijsxctx.html