百度web应用诉讼费计算器

以前百度推开放平台的时候,利用jquery+jqueryUI做了一个诉讼费计算器,托管在BAE上。闲来无事,把代码和大家共享一下。

在百度搜索“诉讼费”相关的关键词就能看到:

image

 

image

 

计算方法主要依据:《诉讼费用交纳办法》

计算完全是基于jquery,通过js进行:

$(function () {

    //界面

    $("#tabs").tabs({

        select: function (event, ui) {

            if (ui.index == 0) {

                baidu.app.setHeight(520);

            }

            else {

                baidu.app.setHeight(580);

            }

        }

    });

    $("#btnCal").button();

    $("#btnReset").button();

    $("#btnCal").bind("mouseout", function () {

        $("#btnCal").addClass("ui-state-hover");

    });



    $("#btnCalsq").button();

    $("#btnResetsq").button();

    $("#btnCalsq").bind("mouseout", function () {

        $("#btnCalsq").addClass("ui-state-hover");

    });



    $(":text").bind("mouseout", function () {

        $(":text").attr("class", "blueboder textkg");

    });

    $(":text").bind("mouseover", function () {

        $(":text").attr("class", "yellowboder textkg");

    });

    //-----

    //受理费

    $("#btnCal").bind("click", function () {

        var valMoney1 = 0;

        var slid = $(":radio[name='sl']:checked").attr("id");

        switch (slid) {

            case "caichan":

                var money = getMoney();

                setShouli(getCaichan(money));

                break;

            case "lihun":

                var money = getMoney();

                if (money > 0 && money <= 200000) {

                    valMoney1 = 50;

                    valMoney2 = 300;

                }

                if (money > 200000) {

                    valMoney1 = (money - 200000) * 0.005 + 50;

                    valMoney2 = (money - 200000) * 0.005 + 300;

                }

                setShouli(valMoney1, valMoney2);

                break;

            case "rengequan":

                var money = getMoney();

                if (money > 0 && money <= 50000) {

                    valMoney1 = 100;

                    valMoney2 = 500;

                }

                if (money > 50000 && money <= 100000) {

                    valMoney1 = money * 0.01 - 400;

                    valMoney2 = money * 0.01;

                }

                if (money > 100000) {

                    valMoney1 = money * 0.005 + 100;

                    valMoney2 = money * 0.005 + 500;

                }

                setShouli(valMoney1, valMoney2);

                break;

            case "qita":

                setShouli(50, 100);

                break;

            case "zhishichanpin":

                var money = getMoney();

                setShouli(getCaichan(money));

                break;

            case "laodong":

                setShouli(10);

                break;

            case "xingzheng":

                setShouli(100);

                break;

            case "qitaxingzheng":

                setShouli(50);

                break;

            case "guanxiaquan":

                setShouli(50, 100);

                break;

            default:

                alert("请选择案件类型。");

                return;

                break;

        }

    });

    //----

    //申请费

    $("#btnCalsq").bind("click", function () {

        var valMoney1 = 0;

        var slid = $(":radio[name='sq']:checked").attr("id");

        switch (slid) {

            case "zhixing":

                var money = getShenqingMoney();

                if (money > 0 && money <= 10000) {

                    valMoney1 = 50;

                }

                if (money > 10000 && money <= 500000) {

                    valMoney1 = money * 0.015 - 100;

                }

                if (money > 500000 && money <= 5000000) {

                    valMoney1 = money * 0.01 + 2400;

                }

                if (money > 5000000 && money <= 10000000) {

                    valMoney1 = money * 0.005 + 27400;

                }

                if (money > 10000000) {

                    valMoney1 = money * 0.001 + 67400;

                }

                setShenqing(valMoney1);

                break;

            case "baoquan":

                var money = getShenqingMoney();

                if (money > 0 && money <= 1000) {

                    valMoney1 = 30;

                }

                if (money > 1000 && money <= 100000) {

                    valMoney1 = money * 0.01 + 20;

                }

                if (money > 100000) {

                    valMoney1 = money * 0.005 + 520;

                    if (valMoney1 > 5000) { //保全费用最大不能超过5000

                        valMoney1 = 5000;

                    }

                }

                setShenqing(valMoney1);

                break;

            case "zhifuling":

                var money = getShenqingMoney();

                setShenqing(getCaichan(money) / 3);

                break;

            case "cuigao":

                setShenqing(100);

                break;

            case "chexiao":

                setShenqing(400);

                break;

            case "pochan":

                var money = getShenqingMoney();

                money = getCaichan(money) / 2;

                if (money > 300000) {

                    money = 300000;

                }

                setShenqing(money);

                break;

            case "jijin":

                setShenqing(1000, 10000);

                break;

            case "qiangzhiling":

                setShenqing(1000, 5000);

                break;

            case "youxianquan":

                setShenqing(1000, 5000);

                break;

            case "zhaiquan":

                setShenqing(1000);

                break;

            case "haisun":

                setShenqing(1000);

                break;

            default:

                alert("请选择申请类型。");

                return;

                break;

        }

    });

    //------

});

//获取受理标的金额

function getMoney() {

    var rtn = 0;

    var jine = $("#slje").val();

    if (jine == '') {

        $("#slje").focus();

        alert("请输入金额。");

        return;

    }

    var iMoney = jine.match(/^[0-9]+$/);

    if (iMoney == null) {

        $("#slje").focus();

        alert("金额只能输入正整数。");

        return;

    }

    rtn = parseInt(jine);

    return rtn;

}

//获取申请标的金额

function getShenqingMoney() {

    var rtn = 0;

    var jine = $("#sqje").val();

    if (jine == '') {

        $("#sqje").focus();

        alert("请输入金额。");

        return;

    }

    var iMoney = jine.match(/^[0-9]+$/);

    if (iMoney == null) {

        $("#sqje").focus();

        alert("金额只能输入正整数。");

        return;

    }

    rtn = parseInt(jine);

    return rtn;

}

function setShouli(jine1, jine2) {

    var jbID = $(":radio[name='jb']:checked").attr("id");

    if (jbID == 'shi') {

        jine1 = jine1 / 2;

        if (jine2 != undefined) {

            jine2 = jine2 / 2;

        }

    }

    var result = '';

    if (jine2 == undefined) {

        jine1 = Math.round(jine1 * 100) / 100;

        result = jine1;

    }

    else {

        jine1 = Math.round(jine1 * 100) / 100;

        jine2 = Math.round(jine2 * 100) / 100;

        result = jine1 + ' - ' + jine2;

    }

    $("#shoulifei").text(result);

}

function setShenqing(jine1, jine2) {

    var jbID = $(":radio[name='sqjb']:checked").attr("id");

    if (jbID == 'sqshi') {

        jine1 = jine1 / 2;

        if (jine2 != undefined) {

            jine2 = jine2 / 2;

        }

    }

    var result = '';

    if (jine2 == undefined) {

        jine1 = Math.round(jine1 * 100) / 100;

        result = jine1;

    }

    else {

        result = jine1 + ' - ' + jine2;

        jine1 = Math.round(jine1 * 100) / 100;

        jine2 = Math.round(jine2 * 100) / 100;

    }

    $("#shenqingfei").text(result);

}

function getCaichan(jine) {

    var money = parseInt(jine);

    var rtn = 0;

    if (money > 0 && money <= 10000) {

        rtn = 50;

    }

    if (money > 10000 && money <= 100000) {

        rtn = money * 0.025 - 200;

    }

    if (money > 100000 && money <= 200000) {

        rtn = money * 0.02 + 300;

    }

    if (money > 200000 && money <= 500000) {

        rtn = money * 0.015 + 1300;

    }

    if (money > 500000 && money <= 1000000) {

        rtn = money * 0.01 + 3800;

    }

    if (money > 1000000 && money <= 2000000) {

        rtn = money * 0.009 + 4800;

    }

    if (money > 2000000 && money <= 5000000) {

        rtn = money * 0.008 + 6800;

    }

    if (money > 5000000 && money <= 10000000) {

        rtn = money * 0.007 + 11800;

    }

    if (money > 10000000 && money <= 20000000) {

        rtn = money * 0.006 + 21800;

    }

    if (money > 20000000) {

        rtn = money * 0.005 + 41800;

    }

    return rtn;

}

你可能感兴趣的:(Web应用)