This commit is contained in:
parent
9b1554b123
commit
342b80032b
|
@ -26,7 +26,8 @@ const router = useRouter();
|
|||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
|
||||
const amount = ref();
|
||||
const amountClaimed = ref();
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -47,7 +48,24 @@ const claimDmsFilter = ref({
|
|||
},
|
||||
],
|
||||
});
|
||||
function onFetch(rows, newRows) {
|
||||
console.log('rows: ', rows);
|
||||
console.log('newRows: ', newRows);
|
||||
if (newRows) rows = newRows;
|
||||
amount.value = 0;
|
||||
console.log('amount.value: ', amount.value);
|
||||
amountClaimed.value = 0;
|
||||
console.log('amountClaimed.value: ', amountClaimed.value);
|
||||
if (!rows || !rows.length) return;
|
||||
|
||||
for (const row of rows) {
|
||||
const { sale } = row;
|
||||
amount.value = amount.value + totalRow(sale);
|
||||
const price = row.quantity * sale.price;
|
||||
const discount = (sale.discount * price) / 100;
|
||||
amountClaimed.value = amountClaimed.value + (price - discount);
|
||||
}
|
||||
}
|
||||
const detailsColumns = ref([
|
||||
{
|
||||
name: 'item',
|
||||
|
@ -100,7 +118,11 @@ const detailsColumns = ref([
|
|||
sortable: true,
|
||||
},
|
||||
]);
|
||||
|
||||
function totalRow({ price, quantity, discount }) {
|
||||
const amount = price * quantity;
|
||||
const appliedDiscount = (discount * amount) / 100;
|
||||
return amount - appliedDiscount;
|
||||
}
|
||||
const markerLabels = [
|
||||
{ value: 1, label: t('claim.company') },
|
||||
{ value: 5, label: t('claim.person') },
|
||||
|
@ -326,8 +348,10 @@ function claimUrl(section) {
|
|||
</div>
|
||||
</div>
|
||||
</QCard>
|
||||
<QCard class="vn-max" v-if="salesClaimed.length > 0">
|
||||
<QCard class="vn-max" v-if="salesClaimed.length > 0" @on-fetch="onFetch">
|
||||
<VnTitle :url="claimUrl('lines')" :text="t('claim.details')" />
|
||||
{{ salesClaimed }}
|
||||
|
||||
<QTable
|
||||
:columns="detailsColumns"
|
||||
:rows="salesClaimed"
|
||||
|
|
Loading…
Reference in New Issue