Files
jinniu-daikuan/app/views/interest_calculator.php
T

134 lines
7.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
/** @var array $me */
$ciSegRowTpl = <<<'HTML'
<div class="ci-seg-row" data-ci-seg-row>
<span class="ci-seg-no num" aria-hidden="true"></span>
<div class="ci-seg-f ci-seg-f--amt">
<label>本金(元)</label>
<input data-seg-f="amt" type="text" inputmode="decimal" autocomplete="off" placeholder="如 100000">
</div>
<div class="ci-seg-f ci-seg-f--rate">
<label>利率</label>
<div class="ci-seg-pair">
<input data-seg-f="rate" type="text" inputmode="decimal" autocomplete="off" placeholder="数值">
<select data-seg-f="kind" aria-label="利率种类">
<option value="annual" selected>年利率 %</option>
<option value="monthly">月利率 %</option>
<option value="daily">日利率 %</option>
</select>
</div>
</div>
<div class="ci-seg-f ci-seg-f--mode">
<label>计息方式</label>
<select data-seg-f="daymode" aria-label="计息方式">
<option value="manual" selected>按天数</option>
<option value="range">按起止日期</option>
</select>
</div>
<div class="ci-seg-f ci-seg-f--days" data-seg-cell="manual">
<label>天数</label>
<input data-seg-f="days" type="number" min="0" step="1" placeholder="正整数">
</div>
<div class="ci-seg-f ci-seg-f--days" data-seg-cell="range" hidden>
<label>起止日期</label>
<div class="ci-seg-pair">
<input data-seg-f="d1" type="date" aria-label="起息日">
<span class="ci-seg-sep">至</span>
<input data-seg-f="d2" type="date" aria-label="截止日">
</div>
</div>
<span class="ci-seg-out num" data-seg-out></span>
<button type="button" class="icon-btn ci-seg-del" data-ci-seg-del aria-label="删除该段" title="删除该段">
<svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M3.5 3.5l9 9M12.5 3.5l-9 9"/></svg>
</button>
</div>
HTML;
?>
<div class="page-head">
<div>
<h1 class="page-title">计算工具</h1>
<div class="page-sub">利息计算 · 承兑贴现(与原系统同口径本地试算,结果仅供参考)</div>
</div>
</div>
<div class="seg" role="tablist" aria-label="计算工具" style="margin-bottom:20px;">
<a role="tab" href="index.php?action=interest_calculator" data-active>利息计算器</a>
<a role="tab" href="index.php?action=acceptance_discount_calculator">承兑贴现计算器</a>
</div>
<div class="calc-grid">
<div class="editor-card">
<form data-calc-interest novalidate>
<div class="seg ci-mode" role="tablist" aria-label="利息计算模式">
<button type="button" role="tab" data-ci-mode="single" data-active>单笔计算</button>
<button type="button" role="tab" data-ci-mode="multi">分段累加</button>
</div>
<div data-ci-panel="single">
<div class="cr-group">
<div class="section-title" style="margin-top:0;">金额与利率</div>
<div class="cr"><label for="ci-amt">本金(元)</label><div class="cr-ctl">
<input id="ci-amt" name="amt" type="text" inputmode="decimal" autocomplete="off" placeholder="如 1000000" style="max-width:230px">
<div class="cr-hint"><span data-ci-fmt></span> <span data-ci-cap></span></div>
</div></div>
<div class="cr"><label for="ci-rate">利率数值</label><div class="cr-ctl"><div class="cr-inline">
<input id="ci-rate" name="rate" type="text" inputmode="decimal" autocomplete="off" style="width:110px">
<select id="ci-rate-kind" name="rateKind" aria-label="利率种类" style="width:126px">
<option value="annual" selected>年利率 %</option>
<option value="monthly">月利率 %</option>
<option value="daily">日利率 %</option>
</select>
</div></div></div>
</div>
<div class="cr-group">
<div class="section-title">计息天数</div>
<div class="cr"><span class="cr-label">取值方式</span><div class="cr-ctl"><div class="opt-row">
<label><input type="radio" name="ciDayMode" value="manual" checked> 模式A:直接输入天数</label>
<label><input type="radio" name="ciDayMode" value="range"> 模式B:起止日期</label>
</div></div></div>
<div class="cr" data-ci-row="manual"><label for="ci-days">天数</label><div class="cr-ctl"><div class="cr-inline">
<input id="ci-days" name="days" type="number" min="0" step="1" placeholder="正整数" style="width:110px">
<span class="cr-hint" style="margin:0;">正整数;与起止日期互斥</span>
</div></div></div>
<div class="cr" data-ci-row="range" hidden><span class="cr-label">起止日期</span><div class="cr-ctl"><div class="cr-inline">
<input id="ci-d1" name="d1" type="date">
<span style="color:var(--text-3);">至</span>
<input id="ci-d2" name="d2" type="date">
<span class="cr-hint" style="margin:0;" data-ci-range-label></span>
</div></div></div>
</div>
</div>
<div data-ci-panel="multi" hidden>
<div class="cr-group">
<div class="section-title" style="margin-top:0;">计息分段</div>
<div class="calc-group-note" style="margin:-4px 0 10px;">适用于授信随用随取的多笔支用汇总、逾期分段变利率变本金等场景。每段利率种类可独立选择,各行分别计息后自动汇总。</div>
<template data-ci-seg-tpl><?= $ciSegRowTpl ?></template>
<div class="ci-seg-rows" data-ci-seg-rows></div>
<button type="button" class="btn btn--plain btn--sm" data-ci-seg-add style="margin-top:10px;">+ 添加一段</button>
</div>
</div>
<div class="cr-group">
<div class="section-title">计息口径</div>
<div class="cr"><label for="ci-count">结息方式</label><div class="cr-ctl">
<select id="ci-count" name="countMode" style="max-width:320px">
<option value="exclusive" selected>记首不记尾(算头不算尾)</option>
<option value="inclusive">记首记尾(算头又算尾,天数+1)</option>
</select>
</div></div>
<div class="cr"><label for="ci-basis">计息基准</label><div class="cr-ctl">
<select id="ci-basis" name="basis" style="max-width:320px">
<option value="360" selected>360 天/年(银行常用)</option>
<option value="365">365 天/年</option>
</select>
</div></div>
</div>
<div class="cr-actions">
<button type="button" class="btn btn--primary" data-calc-act="calc">计算</button>
<button type="button" class="btn btn--plain" data-calc-act="copy">一键复制结果</button>
<button type="button" class="btn btn--plain" data-calc-act="reset">重置</button>
</div>
</form>
</div>
<div class="calc-side">
<div class="summary-card" data-ci-result></div>
</div>
</div>