From 7429e7e5443748d82ea558e08c8ee7c5b1b89cec Mon Sep 17 00:00:00 2001 From: wuzebang Date: Wed, 6 Sep 2023 23:16:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AF=BC=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/fonts/iconfont/iconfont.js | 1 + pages/tools/code/amount.vue | 60 ++++++++++++++++--------------- store/tools.js | 20 ++++++++++- 3 files changed, 51 insertions(+), 30 deletions(-) diff --git a/assets/fonts/iconfont/iconfont.js b/assets/fonts/iconfont/iconfont.js index 4b8646c..6e8e4e0 100644 --- a/assets/fonts/iconfont/iconfont.js +++ b/assets/fonts/iconfont/iconfont.js @@ -80,6 +80,7 @@ '' + '' + '' + + '' + '' + ''; var t, e = (t = document.getElementsByTagName('script'))[t.length - 1].getAttribute('data-injectcss'); diff --git a/pages/tools/code/amount.vue b/pages/tools/code/amount.vue index 7438531..ef82215 100644 --- a/pages/tools/code/amount.vue +++ b/pages/tools/code/amount.vue @@ -12,6 +12,7 @@ - - {{ formatDate(results) }} + +
{{ results }}
@@ -68,20 +69,20 @@ export default { }, data() { return { - amount: '', - day: '', - financing_rate: '', - financing_service_rate: '', - radio: '' + amount: '9,905.62', + day: '141', + financing_rate: '0.025', + financing_service_rate: '0.0008', + radio: '[{"ratio": 95}, {"ratio": 100}]' }; }, computed: { results() { let r = [1]; - if (!this.radio) { + if (!this.radio.trim()) { r = [1]; } else { - const rs = JSON.parse(this.radio); + const rs = JSON.parse(this.radio.trim()); let last = 0; for (let i = 0; i < rs; i++) { r.append(rs[i]['ratio'] - last); @@ -92,10 +93,11 @@ export default { let res = ''; for (let i = 0; i < r; i++) { let tmp = this.calculate_financing_amount( - (this.amount * r[i]) / 100, - this.day, - this.financing_rate, - this.financing_service_rate + (this.amount.trim().replaceAll(',', '') * r[i]) / 100, + this.day.trim(), + this.financing_rate.trim(), + this.financing_service_rate.trim(), + r[i] / 100 ); res += '第' + @@ -114,33 +116,33 @@ export default { amount, day, financing_rate, - financing_service_rate + financing_service_rate, + radio ) { const apply_amount = amount / (1 - - (day * financing_rate) / 360 - - (day * financing_service_rate) / 360); + (day * financing_rate) / 360.0 - + (day * financing_service_rate) / 360.0); const financing_cost = apply_amount - amount; const financing_interest = - (apply_amount * financing_rate * day) / 360; + (apply_amount * financing_rate * day) / 360.0; const service_amount = - (apply_amount * financing_service_rate * day) / 360; - // let ans = { - // apply_amount: Math.round(apply_amount, 2), - // financing_cost: Math.round(financing_cost, 2), - // financing_interest: Math.round(financing_interest, 2), - // service_amount: Math.round(service_amount, 2) - // }; + (apply_amount * financing_service_rate * day) / 360.0; + + // 本期申请支付金额 + const payment_apply_amount = amount * radio + financing_cost return ( '申请金额: ' + - Math.round(apply_amount, 2) + + apply_amount.toFixed(2) + '\n融资成本: ' + - Math.round(financing_cost, 2) + + financing_cost.toFixed(2) + '\n预计融资利息: ' + - Math.round(financing_interest, 2) + + financing_interest.toFixed(2) + '\n预计运维支出: ' + - Math.round(service_amount, 2) + service_amount.toFixed(2) + + '\n本期申请支付金额: ' + + payment_apply_amount.toFixed(2) ); } } diff --git a/store/tools.js b/store/tools.js index 0a445b2..f57a1ba 100644 --- a/store/tools.js +++ b/store/tools.js @@ -295,10 +295,28 @@ export const state = () => { path: '/tools/convert/set', recommend: false, head: { - keywords: ['集合计算', '交集', '并集', '补集', '差集', '全集'], + keywords: [ + '集合计算', + '交集', + '并集', + '补集', + '差集', + '全集' + ], description: '集合操作计算' } }, + { + name: '融资成本计算', + search_keys: 'financing cost calculate', + icon: '#icon-money', + path: '/tools/code/amount', + recommend: true, + head: { + keywords: ['financing', 'cost', '融资', '成本'], + description: '融资成本计算器' + } + }, { name: '亲戚关系计算器', search_keys: 'relative calculate convert',