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