fuckShebao: function (req, res, next) {
//每个月1800的社保
var day = (1800 / 30);
//交15年交满
var full_days = 365 * 15;
//到65岁退休
var old_days= 365*35;
var i = 0;
var p = 0;
var total = 0;
//时光飞逝
while (i < full_days) {
total = total + day;
i++;
total = total + (total * 1.16 / 10000);
}
//15年后是那么多钱
var year15 = total;
//不再交了,继续放利息(余额宝)
if (i == full_days) {
while (p < (old_days-full_days)) {
total = total + (total * 1.16 / 10000);
p++;
}
}
//结算出来:
var all = (total+"").toMoney();
year15 = (year15 + "").toMoney();
var re = {all: all, year15: year15};
res.json(re);
}
原文:http://my.oschina.net/code33/blog/372015