使用方法:将代码复制到文本文档,把文本文档由.txt后缀改为html后缀,就可以用了!!
手机版退税计算器
个人所得税退税计算器
综合所得应纳税
yen0.00
年终奖单独计税
yen0.00
已预缴税款
yen0.00
最终应退/补税额
yen0.00
<script>
const taxBrackets = [
{ max: 36000, rate: 0.03, deduction: 0 },
{ max: 144000, rate: 0.1, deduction: 2520 },
{ max: 300000, rate: 0.2, deduction: 16920 },
{ max: 420000, rate: 0.25, deduction: 31920 },
{ max: 660000, rate: 0.3, deduction: 52920 },
{ max: 960000, rate: 0.35, deduction: 85920 },
{ max: Infinity, rate: 0.45, deduction: 181920 }
];
const separateTaxBrackets = [
{ max: 3000, rate: 0.03, deduction: 0 },
{ max: 12000, rate: 0.1, deduction: 210 },
{ max: 25000, rate: 0.2, deduction: 1410 },
{ max: 35000, rate: 0.25, deduction: 2660 },
{ max: 55000, rate: 0.3, deduction: 4410 },
{ max: 80000, rate: 0.35, deduction: 7160 },
{ max: Infinity, rate: 0.45, deduction: 15160 }
];
function calculateTax() {
// 获取输入值
const getValue = id => parseFloat(document.getElementById(id).value) || 0;
const totalIncome = getValue('totalIncome');
const separateIncome = getValue('separateIncome');
const specialDeduction = getValue('specialDeduction');
const additionalDeduction = getValue('additionalDeduction');
const otherDeduction = getValue('otherDeduction');
const prepaidTax = getValue('prepaidTax');
// 计算扣除总额
const annualDeductions = (specialDeduction + additionalDeduction + otherDeduction) * 12;
// 计算综合所得部分
const comprehensiveIncome = Math.max(totalIncome - separateIncome, 0);
let taxableIncome = comprehensiveIncome - 60000 - annualDeductions;
taxableIncome = Math.max(taxableIncome, 0);
// 计算综合所得税
let comprehensiveTax = 0;
for (const bracket of taxBrackets) {
if (taxableIncome <= bracket.max comprehensivetax='taxableIncome' bracket.rate - bracket.deduction break let separatetax='0;' if separateincome> 0) {
const monthlyIncome = separateIncome / 12;
for (const bracket of separateTaxBrackets) {
if (monthlyIncome <= bracket.max) {
separateTax = separateIncome * bracket.rate - bracket.deduction;
break;
}
}
}
// 计算最终结果
const totalTax = comprehensiveTax + separateTax;
const taxDifference = totalTax - prepaidTax;
// 更新显示
document.getElementById('comprehensiveTax').textContent = `yen${comprehensiveTax.toFixed(2)}`;
document.getElementById('separateTax').textContent = `yen${separateTax.toFixed(2)}`;
document.getElementById('prepaidTaxDisplay').textContent = `yen${prepaidTax.toFixed(2)}`;
const finalResult = document.getElementById('finalResult');
finalResult.querySelector('.result-value').textContent = `yen${Math.abs(taxDifference).toFixed(2)}`;
finalResult.classList.toggle('tax-return', taxDifference < 0 finalresult.classlist.toggletax-pay taxdifference> 0);
}
</script>
退税计算器小程序需要的来取
文章标签:
padding和margin