feat: add currency symbol

This commit is contained in:
Sergey Krylov 2025-01-28 06:26:58 +03:00
parent e25a5d3bfb
commit 2767047ada
5 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@
<div class="flex justify-between mt-5"> <div class="flex justify-between mt-5">
<div class="flex flex-col"> <div class="flex flex-col">
<span class="text-slate-400 uppercase">Цена:</span> <span class="text-slate-400 uppercase">Цена:</span>
<b>{{decimalFormatter.format(price)}} руб.</b> <b>{{decimalFormatter.format(price)}} </b>
</div> </div>
<img @click="onClickAdd" :src="isAdded ? '/checked.svg' : '/plus.svg'" alt="Add"> <img @click="onClickAdd" :src="isAdded ? '/checked.svg' : '/plus.svg'" alt="Add">

View File

@ -18,7 +18,7 @@
<p>{{item.title}}</p> <p>{{item.title}}</p>
<div class="flex justify-between mt-2"> <div class="flex justify-between mt-2">
<b>{{ decimalFormatter.format(item.price) }} руб.</b> <b>{{ decimalFormatter.format(item.price) }}</b>
<img @click="() => $emit('onRemove', item)" src="/close.svg" alt="Close" class="cursor-pointer transition opacity-40 hover:opacity-100"> <img @click="() => $emit('onRemove', item)" src="/close.svg" alt="Close" class="cursor-pointer transition opacity-40 hover:opacity-100">
</div> </div>
</div> </div>

View File

@ -42,19 +42,19 @@
<div class="flex justify-between gap-2"> <div class="flex justify-between gap-2">
<span>Итого:</span> <span>Итого:</span>
<div class="flex-1 border-b border-dashed"></div> <div class="flex-1 border-b border-dashed"></div>
<b>{{ decimalFormatter.format(totalPrice) }} руб.</b> <b>{{ decimalFormatter.format(totalPrice) }} </b>
</div> </div>
<div class="flex justify-between gap-2"> <div class="flex justify-between gap-2">
<span>Налог 5%:</span> <span>Налог 5%:</span>
<div class="flex-1 border-b border-dashed"></div> <div class="flex-1 border-b border-dashed"></div>
<b>{{ decimalFormatter.format(totalPrice * 0.05) }} руб.</b> <b>{{ decimalFormatter.format(totalPrice * 0.05) }} </b>
</div> </div>
<div class="flex justify-between gap-2"> <div class="flex justify-between gap-2">
<span>К оплате:</span> <span>К оплате:</span>
<div class="flex-1 border-b border-dashed"></div> <div class="flex-1 border-b border-dashed"></div>
<b>{{ decimalFormatter.format(totalPrice * 0.95) }} руб.</b> <b>{{ decimalFormatter.format(totalPrice * 0.95) }} </b>
</div> </div>
<button <button

View File

@ -24,7 +24,7 @@
class="flex items-center gap-2 text-gray-500 hover:text-black cursor-pointer" class="flex items-center gap-2 text-gray-500 hover:text-black cursor-pointer"
> >
<img src="/cart.svg" alt="Cart" /> <img src="/cart.svg" alt="Cart" />
<b> {{ decimalFormatter.format(totalPrice)}} руб. </b> <b> {{ decimalFormatter.format(totalPrice)}} </b>
</li> </li>
<li class="flex items-center gap-2 text-gray-500 hover:text-black cursor-pointer"> <li class="flex items-center gap-2 text-gray-500 hover:text-black cursor-pointer">

View File

@ -1 +1 @@
export const decimalFormatter = new Intl.NumberFormat('ru-RU', { style: 'decimal' }); export const decimalFormatter = new Intl.NumberFormat('ru-RU', { style: 'currency', currency: 'RUB' });