feat: refs #7984 add currency in sale
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-21 15:09:40 +01:00
parent 3c6a4c1e16
commit f076c62bab
3 changed files with 40 additions and 10 deletions

View File

@ -94,6 +94,7 @@ const filter = {
],
},
},
{ relation: 'currency' },
],
};

View File

@ -25,6 +25,7 @@ import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnCurrency from 'src/components/ui/VnCurrency.vue';
const route = useRoute();
const router = useRouter();
@ -622,7 +623,7 @@ watch(
</QBtnGroup>
</template>
</VnSubToolbar>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted() && store.data">
<div
class="q-pa-md q-mb-md q-ma-md color-vn-text"
style="border: 2px solid black"
@ -631,17 +632,35 @@ watch(
<span class="q-mr-xs color-vn-label"
>{{ t('ticketSale.subtotal') }}:
</span>
<span>{{ toCurrency(store.data?.totalWithoutVat) }}</span>
<VnCurrency
:model="store.data"
:currency-code="store.data.currency.code"
local-field="totalWithoutVat"
foreign-field="foreignTotalWithoutVat"
/>
</QCardSection>
<QCardSection class="justify-end text-subtitle1" horizontal>
<span class="q-mr-xs color-vn-label"> {{ t('ticketSale.tax') }}: </span>
<span>{{
toCurrency(store.data?.totalWithVat - store.data?.totalWithoutVat)
}}</span>
<VnCurrency
:model="{
vat: store.data.totalWithVat - store.data?.totalWithoutVat,
foreignVat:
store.data.foreignTotalWithVat -
store.data?.foreignTotalWithoutVat,
}"
:currency-code="store.data.currency.code"
local-field="vat"
foreign-field="foreignVat"
/>
</QCardSection>
<QCardSection class="justify-end text-weight-bold text-subtitle1" horizontal>
<span class="q-mr-xs color-vn-label"> {{ t('basicData.total') }}: </span>
<span>{{ toCurrency(store.data?.totalWithVat) }}</span>
<VnCurrency
:model="store.data"
:currency-code="store.data.currency.code"
local-field="totalWithVat"
foreign-field="foreignTotalWithVat"
/>
</QCardSection>
</div>
</Teleport>
@ -798,7 +817,7 @@ watch(
<template #column-price="{ row }">
<template v-if="isTicketEditable && row.id">
<QBtn flat class="link" dense @click="onOpenEditPricePopover(row)">
{{ toCurrency(row.price) }}
<VnCurrency :model="row" :currency-code="store.data.currency.code" />
</QBtn>
<TicketEditManaProxy
ref="editPriceProxyRef"
@ -813,7 +832,9 @@ watch(
/>
</TicketEditManaProxy>
</template>
<span v-else>{{ toCurrency(row.price) }}</span>
<span v-else>
<VnCurrency :model="row" :currency-code="store.data.currency.code" />
</span>
</template>
<template #column-discount="{ row }">
<template v-if="!isLocked && row.id">
@ -840,7 +861,15 @@ watch(
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
</template>
<template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }}
<VnCurrency
:model="{
amount: row.quantity * row.price,
foreignAmount: row.quantity * row.foreignPrice,
}"
:currency-code="store.data.currency.code"
local-field="amount"
foreign-field="foreignAmount"
/>
</template>
</VnTable>

View File

@ -9,6 +9,7 @@ const ticketCard = {
menu: [
'TicketBasicData',
'TicketSale',
'TicketService',
'TicketLog',
'TicketExpedition',
'TicketDms',
@ -19,7 +20,6 @@ const ticketCard = {
'TicketVolume',
'TicketComponents',
'TicketPackage',
'TicketService',
'TicketSaleTracking',
'TicketBoxing',
'TicketSms',