forked from verdnatura/salix-front
fix: Customerconsumption
This commit is contained in:
parent
20ddabcc01
commit
ca74ad85b4
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onBeforeMount } from 'vue';
|
import { ref, computed, onBeforeMount, onMounted } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDate } from 'src/filters/index';
|
import { toDate } from 'src/filters/index';
|
||||||
|
@ -90,9 +90,12 @@ const columns = computed(() => [
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
campaignList.value = (await axios('Campaigns/latest')).data;
|
campaignList.value = (await axios('Campaigns/latest')).data;
|
||||||
});
|
});
|
||||||
|
// onMounted(() => {
|
||||||
|
// showActionBtns.value = handleQueryParams();
|
||||||
|
// });
|
||||||
|
|
||||||
function getQueryParams() {
|
function getQueryParams() {
|
||||||
return JSON.parse(route.query.consumption);
|
return JSON.parse(route.query.consumption ?? '{}');
|
||||||
}
|
}
|
||||||
function getParams() {
|
function getParams() {
|
||||||
const query = getQueryParams();
|
const query = getQueryParams();
|
||||||
|
@ -103,7 +106,7 @@ function getParams() {
|
||||||
recipientId: arrayData.store.data.id,
|
recipientId: arrayData.store.data.id,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const filter = computed(() => {
|
const userParams = computed(() => {
|
||||||
const minDate = Date.vnNew();
|
const minDate = Date.vnNew();
|
||||||
minDate.setHours(0, 0, 0, 0);
|
minDate.setHours(0, 0, 0, 0);
|
||||||
minDate.setMonth(minDate.getMonth() - 2);
|
minDate.setMonth(minDate.getMonth() - 2);
|
||||||
|
@ -115,11 +118,6 @@ const filter = computed(() => {
|
||||||
campaign: campaignList.value[0]?.id,
|
campaign: campaignList.value[0]?.id,
|
||||||
from: minDate,
|
from: minDate,
|
||||||
to: maxDate,
|
to: maxDate,
|
||||||
filter: {
|
|
||||||
where: {
|
|
||||||
clientFk: route.params.id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const openReportPdf = () => {
|
const openReportPdf = () => {
|
||||||
|
@ -149,7 +147,8 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
search-url="consumption"
|
search-url="consumption"
|
||||||
:user-params="filter"
|
:filter="filter"
|
||||||
|
:user-params="userParams"
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
:default-reset="false"
|
:default-reset="false"
|
||||||
:default-save="false"
|
:default-save="false"
|
||||||
|
@ -157,14 +156,6 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #moreBeforeActions>
|
<template #moreBeforeActions>
|
||||||
<!-- <QBtn
|
|
||||||
color="primary"
|
|
||||||
icon="delete"
|
|
||||||
flat
|
|
||||||
@click="remove(selected)"
|
|
||||||
:disable="!selected?.length"
|
|
||||||
:title="t('globals.remove')"
|
|
||||||
/> -->
|
|
||||||
<QBtn
|
<QBtn
|
||||||
color="primary"
|
color="primary"
|
||||||
flat
|
flat
|
||||||
|
@ -228,15 +219,15 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
v-model="params.to"
|
v-model="params.from"
|
||||||
:label="t('globals.from')"
|
:label="t('globals.from')"
|
||||||
:filled="true"
|
:filled="true"
|
||||||
class="q-px-xs q-pt-none fit"
|
class="q-px-xs q-pt-none fit"
|
||||||
dense
|
dense
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
v-model="params.from"
|
v-model="params.to"
|
||||||
:label="t('globals.from')"
|
:label="t('globals.to')"
|
||||||
:filled="true"
|
:filled="true"
|
||||||
class="q-px-xs q-pt-none fit"
|
class="q-px-xs q-pt-none fit"
|
||||||
dense
|
dense
|
||||||
|
|
Loading…
Reference in New Issue