019年1月1日即将到来,码农们除了关心自己的技能之外,还有薪资是不是可以多拿点。 每次算的时候 都要百度一下个人所得税,但是很多都是老的税率计算,找一个新的出来还是比较麻烦,所以个人开发了一个最新税率的小程序。解决和我有着一样痛苦的码农们的问题。根据最新税改后计算个人所得税的计算器。目前支持南京,后续开放 杭州 上海 北京等城市。 如果有疑问的可以加最下方 开发者微信。
- 首先在微信官网下载微信小程序开发工具 https://mp.weixin.qq.com
- 在https://mp.weixin.qq.com 注册小程序账号,完成个人实名认证。
- 在小程序后台拿到appid,下面就可以开发了。
实例查看二维码:
<button block type="dark" bindtap='calculationBindtap'>计算</button>
import data from './data'
const app = getApp;
Page({
data: {
options1: data,value: '1',checked: true,standard: 1,marking: 5000,beforetaxCount: 0,specialitemCount: 0
},calculationBindtap:function(){
// 开始计算 计算完成把计算结果放在result对象中
var beforetaxCount = this.data.beforetaxCount;
var specialitemCount = this.data.specialitemCount;
var marking = this.data.marking;
if (beforetaxCount == null || beforetaxCount == 0 || beforetaxCount == ''){
wx.showToast({
title: '输入正确薪资',mask: teral" style="Box-sizing: border-Box; color: rgb(0,icon: 'loading'
})
return;
}
if (specialitemCount == null || specialitemCount == ''){
specialitemCount = 0;
}
// 开始计算
var oldNum = 0.08;
var mednum = 0.02;
var unemNum = 0.005;
var workNum = 0;
var giveNum = 0;
var providentfundNum = 0.08;
var insuranceBase = 19935;
var providentfundBase = 25300;
var oldcount = 0;
var medcount = 0;
var unemcount = 0;
var workcount = 0;
var givecount = 0;
var providentfundcount = 0;
var privateFee = 0;
var plusFee = 0;
if(this.data.checked){
if (parseFloat(beforetaxCount) > parseFloat(insuranceBase)) {
oldcount = parseFloat(insuranceBase) * parseFloat(oldNum);
medcount = parseFloat(mednum);
unemcount = parseFloat(unemNum);
workcount = parseFloat(workNum);
givecount = parseFloat(giveNum);
} else {
oldcount = parseFloat(beforetaxCount) * parseFloat(giveNum);
}
if (parseFloat(providentfundBase)) {
providentfundcount = parseFloat(providentfundBase) * parseFloat(providentfundNum);
} else {
providentfundcount = parseFloat(providentfundNum);
}
}
// 保险总费用
var totalInsuranceFee = parseFloat(oldcount) + parseFloat(medcount) + parseFloat(unemcount) + parseFloat(workcount) + parseFloat(givecount);
// 公积金费用
var totalProvidentfundFee = providentfundcount;
// 下面的钱 交税
console.log(this.data.marking);
var otherFee = parseFloat(beforetaxCount) - parseFloat(totalInsuranceFee) - parseFloat(totalProvidentfundFee) - parseFloat(this.data.marking) - parseFloat(specialitemCount);
if (parseFloat(otherFee) <= 3000 && parseFloat(otherFee) > 0) {
privateFee = parseFloat(otherFee) * 0.03;
plusFee = 0;
}
if (12000 && 3000) {
privateFee = 0.1;
plusFee = 210;
}
if (25000 && 12000) {
privateFee = 0.2;
plusFee = 1410;
}
if (35000 && 25000) {
privateFee = 0.25;
plusFee = 2660;
}
if (55000 && 35000) {
privateFee = 0.3;
plusFee = 4410;
}
if (80000 && 55000) {
privateFee = 0.35;
plusFee = 7160;
}
if ( 80000) {
privateFee = 0.45;
plusFee = 15160;
}
var result = {};
result.insuranceCount = totalInsuranceFee;
result.providentfundCount = totalProvidentfundFee;
result.providentfundNum = parseFloat(providentfundNum) * 100;
result.money = parseFloat(privateFee) + parseFloat(plusFee);
result.privateFee = privateFee - parseFloat(plusFee);
result.specialitemCount = specialitemCount;
result.oldNum = parseFloat(oldNum) * 100;
result.mednum = parseFloat(mednum) * 100;
result.unemNum = parseFloat(unemNum) * 100;
result.workNum = parseFloat(workNum) * 100;
result.giveNum = parseFloat(giveNum) * 100;
result.oldcount = parseFloat(oldcount);
result.medcount = parseFloat(medcount);
result.unemcount = parseFloat(unemcount);
result.workcount = parseFloat(workcount);
result.givecount = parseFloat(givecount);
wx.setStorage({
key: 'result',data: result,success:function(){
wx.navigateto({
url: '../calculation/calculationResult',})
}
})
},})
把计算好的结果放在result对象中 通过wx.setStorage
放在缓存中,传到下一个页面。最后展示出来。