OrderTotalsCard
DomainSipariş özet kartı: ara toplam, indirim, vergi, kargo ve kalın Total satırı. Sıfır değerli satırlar gizlenir.
Subtotal
$89.99
Total
$89.99
<%- include('modules/domain/common/money/OrderTotalsCard', {
totals: { subtotal: 89.99, total: 89.99, currency: 'USD' },
locale: 'en-US'
}) %>
Subtotal
$149.99
Discount
−$20.00
Tax
$11.99
Shipping
$9.99
Total
$153.96
<%- include('modules/domain/common/money/OrderTotalsCard', {
totals: { subtotal: 149.99, discountTotal: 20, taxTotal: 11.99, shippingTotal: 9.99, total: 153.96, currency: 'USD' },
locale: 'en-US'
}) %>
<%
var _totals = locals.totals || {};
var _locale = locals.locale || 'tr-TR';
var _currency = _totals.currency || locals.currency || 'TRY';
function fmt(amount) {
return Math.abs(amount).toLocaleString(_locale, { style: 'currency', currency: _currency, minimumFractionDigits: 2, maximumFractionDigits: 2 });
}
var lines = [];
lines.push({ label: 'Subtotal', amount: _totals.subtotal || 0 });
if (_totals.discountTotal && _totals.discountTotal > 0) lines.push({ label: 'Discount', amount: -_totals.discountTotal, isDiscount: true });
if (_totals.taxTotal && _totals.taxTotal > 0) lines.push({ label: 'Tax', amount: _totals.taxTotal });
if (_totals.serviceFee && _totals.serviceFee > 0) lines.push({ label: 'Service Fee', amount: _totals.serviceFee });
if (_totals.shippingTotal && _totals.shippingTotal > 0) lines.push({ label: 'Shipping', amount: _totals.shippingTotal });
%>
<% lines.forEach(function(line) { %>
<%= line.label %>
<%= line.isDiscount ? '−' : '' %><%= fmt(line.amount) %>
<% }); %>
Total
<%= fmt(_totals.total || 0) %>