百度web應用訴訟費計算器

之前百度推開放平臺的時候,利用jquery+jqueryUI作了一個訴訟費計算器,託管在BAE上。閒來無事,把代碼和你們共享一下。jquery

在百度搜索「訴訟費」相關的關鍵詞就能看到:app

image

 

image

 

計算方法主要依據:《訴訟費用交納辦法》ui

計算徹底是基於jquery,經過js進行:spa

$(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;
}
相關文章
相關標籤/搜索