手机版

税务计算器/微信小程序开发

时间:2021-12-04 来源:互联网 编辑:宝哥软件园 浏览:

2019年1月1日即将到来,码农不仅关心自己的技能,还关心自己能否拿到更多的工资。每次计算都要通过百度查个人所得税,但是很多都是老的税率计算,找新的还是比较麻烦,所以我开发了一个最新税率的小程序。解决和我一样痛苦的代码农民的问题。根据最新税制改革计算个人所得税的计算器。目前支持南京,以后开放杭州、上海、北京等城市。有疑问可以加底层开发者微信。

首先在微信官网下载微信小程序开发工具https://mp.weixin.qq.com,在https://mp.weixin.qq.com注册小程序账号,完成个人实名认证。在小程序的后台获取appid,然后就可以开发了。示例查看二维码:

个税计算器 / 微信小程序开发(图1)

只需使用weui小程序ui框架进行页面布局。

个税计算器 / 微信小程序开发(图2) 个税计算器 / 微信小程序开发(图3)

按钮类型='深色' bindtap=' calculationbindtap '计算/按钮下一步编写JS代码(计算按钮逻辑代码)

从“”导入数据。/data ' const app=GetApp;page({ data : { options 1: data,value: '1 ',checked: true,standard: 1,marking: 5000,before tax count : 0 0,specific count : 0 0 },calculationbintap : function(){//开始计算并将计算结果放入结果对象var beforetaxcount=this。data . before tax count;var specialtemcount=this . data . specialtemcount;var marking=this . data . marking;if(before tax count==null | | | before tax count==0 | | before tax count==' '){ wx . show toast({ title : '输入正确的薪资',mask: true,icon3360' loading'})返回;} if(specialtemcount==null | | specialtemcount==' '){ specialtemcount=0;}//开始计算var oldNum=0.08var medNum=0.02var unemNum=0.005var WorkNum=0;var give num=0;var providentfundNum=0.08var insuranceBase=19935var providentfundBase=25300var old count=0;var med count=0;var unem count=0;var workcount=0;var give count=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(insuranceBase) * parseFloat(medNum); unemcount = parseFloat(insuranceBase) * parseFloat(unemNum); workcount = parseFloat(insuranceBase) * parseFloat(workNum); givecount = parseFloat(insuranceBase) * parseFloat(giveNum); } else { oldcount = parseFloat(beforetaxCount) * parseFloat(oldNum); medcount = parseFloat(beforetaxCount) * parseFloat(medNum); unemcount = parseFloat(beforetaxCount) * parseFloat(unemNum); workcount = parseFloat(beforetaxCount) * parseFloat(workNum); givecount = parseFloat(beforetaxCount) * parseFloat(giveNum); } if (parseFloat(beforetaxCount) > parseFloat(providentfundBase)) { providentfundcount = parseFloat(providentfundBase) * parseFloat(providentfundNum); } else { providentfundcount = parseFloat(beforetaxCount) * 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 (parseFloat(otherFee) <= 12000 && parseFloat(otherFee) > 3000) { privateFee = parseFloat(otherFee) * 0.1; plusFee = 210; } if (parseFloat(otherFee) <= 25000 && parseFloat(otherFee) > 12000) { privateFee = parseFloat(otherFee) * 0.2; plusFee = 1410; } if (parseFloat(otherFee) <= 35000 && parseFloat(otherFee) > 25000) { privateFee = parseFloat(otherFee) * 0.25; plusFee = 2660; } if (parseFloat(otherFee) <= 55000 && parseFloat(otherFee) > 35000) { privateFee = parseFloat(otherFee) * 0.3; plusFee = 4410; } if (parseFloat(otherFee) <= 80000 && parseFloat(otherFee) > 55000) { privateFee = parseFloat(otherFee) * 0.35; plusFee = 7160; } if ( parseFloat(otherFee) > 80000) { privateFee = parseFloat(otherFee) * 0.45; plusFee = 15160; } var result = {}; result.insuranceCount = totalInsuranceFee; result.providentfundCount = totalProvidentfundFee; result.providentfundNum = parseFloat(providentfundNum) * 100; result.money = parseFloat(beforetaxCount) - parseFloat(totalInsuranceFee) - parseFloat(totalProvidentfundFee) - 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放在缓存中,传到下一个页面。最后展示出来。

版权声明:税务计算器/微信小程序开发是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。