fix: sum price, vat, amount info
This commit is contained in:
parent
2292cefacf
commit
328642f6a4
1 changed files with 47 additions and 5 deletions
|
|
@ -7,11 +7,13 @@ import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import { formatNumberDecimal } from 'stores/utils';
|
import { formatNumberDecimal } from 'stores/utils';
|
||||||
|
|
||||||
|
import { useConfigStore } from 'stores/config';
|
||||||
import AppBox from 'components/app/AppBox.vue';
|
import AppBox from 'components/app/AppBox.vue';
|
||||||
import DatePicker from 'src/components/shared/DatePicker.vue';
|
import DatePicker from 'src/components/shared/DatePicker.vue';
|
||||||
import SelectInput from 'src/components/shared/SelectInput.vue';
|
import SelectInput from 'src/components/shared/SelectInput.vue';
|
||||||
|
|
||||||
import useOptionStore from 'src/stores/options';
|
import useOptionStore from 'src/stores/options';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
|
@ -25,6 +27,8 @@ defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const configStore = useConfigStore();
|
||||||
|
const { data: config } = storeToRefs(configStore);
|
||||||
|
|
||||||
const urgent = defineModel<boolean>('urgent', {
|
const urgent = defineModel<boolean>('urgent', {
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -67,6 +71,7 @@ const summaryPrice = defineModel<{
|
||||||
|
|
||||||
const optionStore = useOptionStore();
|
const optionStore = useOptionStore();
|
||||||
|
|
||||||
|
const finalDiscount = ref<number>(0);
|
||||||
const payTypeOpion = ref([
|
const payTypeOpion = ref([
|
||||||
{
|
{
|
||||||
value: 'Full',
|
value: 'Full',
|
||||||
|
|
@ -421,11 +426,21 @@ watch(
|
||||||
<div class="q-pa-sm">
|
<div class="q-pa-sm">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ $t('general.total') }}
|
{{ $t('general.total') }}
|
||||||
<span class="q-ml-auto">{{ data?.total || 0 }} ฿</span>
|
<span class="q-ml-auto">
|
||||||
|
{{
|
||||||
|
formatNumberDecimal(
|
||||||
|
summaryPrice.finalPrice + Number(finalDiscount),
|
||||||
|
2,
|
||||||
|
) || 0
|
||||||
|
}}
|
||||||
|
฿
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ $t('general.discount') }}
|
{{ $t('quotation.discountList') }}
|
||||||
<span class="q-ml-auto">{{ data?.discount || 0 }} ฿</span>
|
<span class="q-ml-auto">
|
||||||
|
{{ formatNumberDecimal(summaryPrice.totalDiscount, 2) || 0 }} ฿
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ $t('general.totalAfterDiscount') }}
|
{{ $t('general.totalAfterDiscount') }}
|
||||||
|
|
@ -436,15 +451,35 @@ watch(
|
||||||
<span class="q-ml-auto">{{ data?.totalVatExcluded || 0 }} ฿</span>
|
<span class="q-ml-auto">{{ data?.totalVatExcluded || 0 }} ฿</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ $t('general.totalVatIncluded') + ' 7%' }}
|
{{ $t('general.totalVatIncluded') }}
|
||||||
<span class="q-ml-auto">{{ data?.totalVatIncluded || 0 }} ฿</span>
|
<span class="q-ml-auto">{{ data?.totalVatIncluded || 0 }} ฿</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{{
|
||||||
|
$t('general.vat', {
|
||||||
|
msg: `${config && Math.round(config.vat * 100)}%`,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
<span class="q-ml-auto">{{ data?.totalVatIncluded || 0 }} ฿</span>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{{ $t('general.discountAfterVat') }}
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
class="q-ml-auto price-tag"
|
||||||
|
input-class="text-right"
|
||||||
|
v-model="finalDiscount"
|
||||||
|
/>
|
||||||
|
<!-- <span class="q-ml-auto">{{ data?.totalVatIncluded || 0 }} ฿</span> -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="q-pa-sm row surface-2 items-center text-weight-bold">
|
<div class="q-pa-sm row surface-2 items-center text-weight-bold">
|
||||||
{{ $t('general.totalAmount') }}
|
{{ $t('general.totalAmount') }}
|
||||||
|
|
||||||
<span class="q-ml-auto" style="color: var(--brand-1)">
|
<span class="q-ml-auto" style="color: var(--brand-1)">
|
||||||
{{ data?.totalVatIncluded || 0 }} ฿
|
{{ formatNumberDecimal(Math.max(summaryPrice.finalPrice, 0), 2) || 0 }}
|
||||||
|
฿
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
|
|
@ -461,6 +496,13 @@ watch(
|
||||||
border-radius: var(--radius-2);
|
border-radius: var(--radius-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.price-tag .q-field__control) {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 90px;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.bg-color-orange {
|
.bg-color-orange {
|
||||||
--_color: var(--yellow-7-hsl);
|
--_color: var(--yellow-7-hsl);
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue