- corretto la gestione degli Sconti
- Duplicare un Catalogo
This commit is contained in:
@@ -23,3 +23,33 @@ $heightBtn: 100%;
|
|||||||
color: #d9534f; /* Rosso */
|
color: #d9534f; /* Rosso */
|
||||||
font-weight: bold; /* Testo in grassetto */
|
font-weight: bold; /* Testo in grassetto */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sconto-label{
|
||||||
|
font-weight: bold;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sconto-text{
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
margin: auto;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td {
|
||||||
|
padding: 8px;
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
font-size: 1.2em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export default defineComponent({
|
|||||||
const oldrec = ref(<any[string]>[]);
|
const oldrec = ref(<any[string]>[]);
|
||||||
const note = ref('');
|
const note = ref('');
|
||||||
const codice_sconto = ref('');
|
const codice_sconto = ref('');
|
||||||
|
const descr_sconto = ref('');
|
||||||
const endload = ref(false);
|
const endload = ref(false);
|
||||||
const caricamentodati = ref(false);
|
const caricamentodati = ref(false);
|
||||||
const recOrderCart = ref(<IOrderCart>{});
|
const recOrderCart = ref(<IOrderCart>{});
|
||||||
@@ -82,16 +83,16 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItemsCart() {
|
const getItemsCart = computed(() => {
|
||||||
const cart = getOrdersCart();
|
const cart = getOrdersCart();
|
||||||
return cart.items || null;
|
return cart.items || null;
|
||||||
}
|
});
|
||||||
|
|
||||||
function getNumItems(): number {
|
const getNumItems = computed((): number => {
|
||||||
const cart = getOrdersCart();
|
const cart = getOrdersCart();
|
||||||
if (cart.items) return cart.items.length || 0;
|
if (cart.items) return cart.items.length || 0;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
});
|
||||||
|
|
||||||
function getCart(): ICart {
|
function getCart(): ICart {
|
||||||
return getOrdersCart();
|
return getOrdersCart();
|
||||||
@@ -116,21 +117,37 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function myTotalPrice(): string {
|
const myTotalPrice = computed((): string => {
|
||||||
if (productStore.cart && productStore.cart.totalPrice) {
|
if (productStore.cart && productStore.cart.totalPrice) {
|
||||||
return productStore.cart.totalPrice.toFixed(2);
|
return productStore.cart.totalPrice.toFixed(2);
|
||||||
} else {
|
} else {
|
||||||
return '0';
|
return '0';
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function myTotalQty(): number {
|
const myTotalPriceCalc = computed((): string => {
|
||||||
|
if (productStore.cart && productStore.cart.totalPriceCalc) {
|
||||||
|
return productStore.cart.totalPriceCalc.toFixed(2);
|
||||||
|
} else {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const totalPriceIntero = computed((): string => {
|
||||||
|
if (productStore.cart && productStore.cart.totalPriceIntero) {
|
||||||
|
return productStore.cart.totalPriceIntero.toFixed(2);
|
||||||
|
} else {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const myTotalQty = computed((): number => {
|
||||||
if (productStore.cart) {
|
if (productStore.cart) {
|
||||||
return productStore.cart.totalQty!;
|
return productStore.cart.totalQty!;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
async function aggiornaCarrello() {
|
async function aggiornaCarrello() {
|
||||||
if (mycart.value) {
|
if (mycart.value) {
|
||||||
recOrderCart.value = await productStore.CreateOrdersCart({
|
recOrderCart.value = await productStore.CreateOrdersCart({
|
||||||
@@ -197,7 +214,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
function completeOrder() {
|
function completeOrder() {
|
||||||
$q.dialog({
|
$q.dialog({
|
||||||
message: t('ecomm.conferma_acq', { qty: myTotalQty() }),
|
message: t('ecomm.conferma_acq', { qty: myTotalQty }),
|
||||||
ok: {
|
ok: {
|
||||||
label: t('dialog.yes'),
|
label: t('dialog.yes'),
|
||||||
push: true,
|
push: true,
|
||||||
@@ -294,7 +311,7 @@ export default defineComponent({
|
|||||||
csvRows.push(headers);
|
csvRows.push(headers);
|
||||||
|
|
||||||
let index = 1
|
let index = 1
|
||||||
for (const itemorder of getItemsCart()) {
|
for (const itemorder of getItemsCart.value) {
|
||||||
const productCode = itemorder.order.product?.productInfo.code || '';
|
const productCode = itemorder.order.product?.productInfo.code || '';
|
||||||
const productName = itemorder.order.product?.productInfo.name || '';
|
const productName = itemorder.order.product?.productInfo.name || '';
|
||||||
const quantity = itemorder.order.quantity + itemorder.order.quantitypreordered;
|
const quantity = itemorder.order.quantity + itemorder.order.quantitypreordered;
|
||||||
@@ -306,8 +323,8 @@ export default defineComponent({
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalQuantity = getItemsCart().reduce((sum, itemorder) => sum + itemorder.order.quantity + itemorder.order.quantitypreordered, 0);
|
const totalQuantity = getItemsCart.value.reduce((sum, itemorder) => sum + itemorder.order.quantity + itemorder.order.quantitypreordered, 0);
|
||||||
const totalAmount = getItemsCart().reduce((sum, itemorder) => sum + parseFloat((itemorder.order.price * (itemorder.order.quantity + itemorder.order.quantitypreordered)).toFixed(2)), 0);
|
const totalAmount = getItemsCart.value.reduce((sum, itemorder) => sum + parseFloat((itemorder.order.price * (itemorder.order.quantity + itemorder.order.quantitypreordered)).toFixed(2)), 0);
|
||||||
|
|
||||||
const totalRow = `${sep}${sep}Totale${sep}${totalQuantity}${sep}${sep}${totalAmount.toFixed(2)}\n`;
|
const totalRow = `${sep}${sep}Totale${sep}${totalQuantity}${sep}${sep}${totalAmount.toFixed(2)}\n`;
|
||||||
csvRows.push(totalRow);
|
csvRows.push(totalRow);
|
||||||
@@ -341,12 +358,16 @@ export default defineComponent({
|
|||||||
tools.showNegativeNotif($q, `${rissconto.errmsg}`);
|
tools.showNegativeNotif($q, `${rissconto.errmsg}`);
|
||||||
}
|
}
|
||||||
codice_sconto.value = '';
|
codice_sconto.value = '';
|
||||||
if (rissconto.mycart) recOrderCart.value = rissconto.mycart;
|
descr_sconto.value = '';
|
||||||
|
if (rissconto.mycart) {
|
||||||
|
recOrderCart.value = rissconto.mycart
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error ApplicaSconto', error);
|
console.log('error ApplicaSconto', error);
|
||||||
tools.showNegativeNotif($q, `Sconto Non Applicato! ${error.message}`);
|
tools.showNegativeNotif($q, `Sconto Non Applicato! ${error.message}`);
|
||||||
codice_sconto.value = '';
|
codice_sconto.value = '';
|
||||||
|
descr_sconto.value = '';
|
||||||
} finally {
|
} finally {
|
||||||
caricamentodati.value = false;
|
caricamentodati.value = false;
|
||||||
}
|
}
|
||||||
@@ -381,6 +402,8 @@ export default defineComponent({
|
|||||||
completeOrder,
|
completeOrder,
|
||||||
getNumItems,
|
getNumItems,
|
||||||
myTotalPrice,
|
myTotalPrice,
|
||||||
|
myTotalPriceCalc,
|
||||||
|
totalPriceIntero,
|
||||||
getItemsCart,
|
getItemsCart,
|
||||||
getNote,
|
getNote,
|
||||||
change_field,
|
change_field,
|
||||||
@@ -397,6 +420,7 @@ export default defineComponent({
|
|||||||
isfinishLoading,
|
isfinishLoading,
|
||||||
esportaCsv,
|
esportaCsv,
|
||||||
codice_sconto,
|
codice_sconto,
|
||||||
|
descr_sconto,
|
||||||
confermaCodiceSconto,
|
confermaCodiceSconto,
|
||||||
rimuoviCodiceSconto,
|
rimuoviCodiceSconto,
|
||||||
caricamentodati,
|
caricamentodati,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div
|
<div
|
||||||
class="q-pa-sm col items-start q-gutter-xs"
|
class="q-pa-sm col items-start q-gutter-xs"
|
||||||
v-for="(itemorder, index) in getItemsCart()"
|
v-for="(itemorder, index) in getItemsCart"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<CSingleCart
|
<CSingleCart
|
||||||
@@ -30,44 +30,48 @@
|
|||||||
</div>
|
</div>
|
||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
<div
|
<div
|
||||||
class="col-6 q-mr-sm"
|
v-if="totalPriceIntero"
|
||||||
style="text-align: right"
|
class="q-mr-sm"
|
||||||
>
|
>
|
||||||
<span class="text-grey q-mr-xs">{{ $t('ecomm.totale') }}:</span>
|
<table class="table">
|
||||||
<span class="text-subtitle1 q-mr-sm">€ {{ myTotalPrice() }}</span>
|
<tbody>
|
||||||
</div>
|
<tr>
|
||||||
|
<td class="label">{{ $t('ecomm.prezzointero') }}:</td>
|
||||||
<q-separator />
|
<td
|
||||||
|
class="value text-subtitle1"
|
||||||
<div
|
:class="{ 'text-strike': myTotalPrice !== totalPriceIntero }"
|
||||||
v-if="getNumItems() > 0"
|
|
||||||
style="max-width: 500px"
|
|
||||||
class="row items-center q-gutter-x-xs"
|
|
||||||
>
|
>
|
||||||
<div class="column items-center q-gutter-x-xs">
|
€ {{ totalPriceIntero }}
|
||||||
<div
|
</td>
|
||||||
v-if="recOrderCart.codice_sconto"
|
</tr>
|
||||||
class="row items-center q-gutter-x-xs"
|
<tr v-if="recOrderCart.codice_sconto">
|
||||||
|
<td class="label">{{ $t('ecomm.sconto_appl') }}:</td>
|
||||||
|
<td>
|
||||||
|
<div class="column items-center">
|
||||||
|
<q-chip
|
||||||
|
square
|
||||||
|
color="orange"
|
||||||
|
text-color="white"
|
||||||
|
size="md"
|
||||||
|
icon="fas fa-tag"
|
||||||
>
|
>
|
||||||
<div
|
<span class="sconto-text">{{ recOrderCart.descr_sconto }}</span>
|
||||||
class="text-subtitle1 q-mr-sm q-pa-xs"
|
</q-chip>
|
||||||
style="background-color: #f0f0f0; border-radius: 4px"
|
|
||||||
>
|
|
||||||
{{ $t('ecomm.sconto_appl') }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
icon="fas fa-times"
|
icon="fas fa-times"
|
||||||
color="negative"
|
color="negative"
|
||||||
@click="rimuoviCodiceSconto"
|
@click="rimuoviCodiceSconto"
|
||||||
|
>Rimuovi</q-btn
|
||||||
>
|
>
|
||||||
Rimuovi {{ recOrderCart.codice_sconto }}
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
<div v-if="!recOrderCart.codice_sconto" class="row">
|
</tr>
|
||||||
|
|
||||||
|
<tr v-if="!recOrderCart.codice_sconto">
|
||||||
|
<td class="label">{{ $t('ecomm.codice_sconto') }}:</td>
|
||||||
|
<td>
|
||||||
<q-input
|
<q-input
|
||||||
v-model="codice_sconto"
|
v-model="codice_sconto"
|
||||||
:label="$t('ecomm.codice_sconto')"
|
:label="$t('ecomm.codice_sconto')"
|
||||||
@@ -81,22 +85,22 @@
|
|||||||
:label="$t('ecomm.applica_sconto')"
|
:label="$t('ecomm.applica_sconto')"
|
||||||
icon="fas fa-check-circle"
|
icon="fas fa-check-circle"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="q-mt-sm"
|
class="q-mt-sm self-center"
|
||||||
@click="confermaCodiceSconto"
|
@click="confermaCodiceSconto"
|
||||||
/>
|
/>
|
||||||
</div>
|
</td>
|
||||||
<!--<q-btn
|
</tr>
|
||||||
v-if="recOrderCart.codice_sconto"
|
|
||||||
:label="$t('ecomm.rimuovi_sconto')"
|
<tr>
|
||||||
icon="fas fa-times-circle"
|
<td class="label">{{ $t('ecomm.totale_scontato') }}:</td>
|
||||||
color="negative"
|
<td class="ordine_scontato_nuovo">€ {{ myTotalPrice }}</td>
|
||||||
class="q-mt-sm"
|
</tr>
|
||||||
@click="rimuoviCodiceSconto"
|
</tbody>
|
||||||
/>-->
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
v-if="getNumItems() > 0"
|
v-if="getNumItems > 0"
|
||||||
v-model="note"
|
v-model="note"
|
||||||
style="min-width: 400px"
|
style="min-width: 400px"
|
||||||
class="q-mt-md"
|
class="q-mt-md"
|
||||||
@@ -116,18 +120,6 @@
|
|||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<q-btn
|
|
||||||
v-if="
|
|
||||||
recOrderCart &&
|
|
||||||
recOrderCart.status < shared_consts.OrderStatus.CHECKOUT_SENT
|
|
||||||
"
|
|
||||||
icon="fas fa-file-csv"
|
|
||||||
flat
|
|
||||||
filled
|
|
||||||
:label="$t('ecomm.esporta_csv')"
|
|
||||||
class="q-mb-sm"
|
|
||||||
@click="esportaCsv()"
|
|
||||||
></q-btn>
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="
|
||||||
recOrderCart &&
|
recOrderCart &&
|
||||||
@@ -138,10 +130,11 @@
|
|||||||
color="green"
|
color="green"
|
||||||
:label="$t('ecomm.completa_ord')"
|
:label="$t('ecomm.completa_ord')"
|
||||||
class="q-mb-sm"
|
class="q-mb-sm"
|
||||||
:disabled="myTotalQty() < 1"
|
:disabled="myTotalQty < 1"
|
||||||
@click="completeOrder()"
|
@click="completeOrder()"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
<q-separator />
|
||||||
<div class="center-text">
|
<div class="center-text">
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -152,6 +145,20 @@
|
|||||||
{{ globalStore.site.ecomm.NoteExtraOnCart }}
|
{{ globalStore.site.ecomm.NoteExtraOnCart }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="q-mt-md row justify-center">
|
||||||
|
<q-btn
|
||||||
|
v-if="
|
||||||
|
recOrderCart &&
|
||||||
|
recOrderCart.status < shared_consts.OrderStatus.CHECKOUT_SENT
|
||||||
|
"
|
||||||
|
icon="fas fa-file-csv"
|
||||||
|
flat
|
||||||
|
filled
|
||||||
|
:label="$t('ecomm.esporta_csv')"
|
||||||
|
class="q-mb-sm"
|
||||||
|
@click="esportaCsv()"
|
||||||
|
></q-btn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
|
|||||||
@@ -2506,6 +2506,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
if (cmd === costanti.CMD_CLONE) {
|
if (cmd === costanti.CMD_CLONE) {
|
||||||
const myarr = serverData.value.find((rec: any) => rec._id === id)
|
const myarr = serverData.value.find((rec: any) => rec._id === id)
|
||||||
|
if (myarr) {
|
||||||
|
mycolumns.value.forEach((col: IColGridTable) => {
|
||||||
|
if (col.dont_clone)
|
||||||
|
delete myarr[col.name]
|
||||||
|
})
|
||||||
|
}
|
||||||
newRecord.value = myarr
|
newRecord.value = myarr
|
||||||
newRecord.value._id = 0
|
newRecord.value._id = 0
|
||||||
newRecordBool.value = true
|
newRecordBool.value = true
|
||||||
|
|||||||
@@ -48,8 +48,9 @@
|
|||||||
<q-btn
|
<q-btn
|
||||||
v-if="existsOrders()"
|
v-if="existsOrders()"
|
||||||
rounded
|
rounded
|
||||||
|
outline
|
||||||
icon="fas fa-clipboard-list"
|
icon="fas fa-clipboard-list"
|
||||||
color="positive"
|
style="color: green;"
|
||||||
:label="t('ecomm.btn_ordini')"
|
:label="t('ecomm.btn_ordini')"
|
||||||
class="q-mb-sm"
|
class="q-mb-sm"
|
||||||
@click="globalStore.rightCartOpen = false"
|
@click="globalStore.rightCartOpen = false"
|
||||||
|
|||||||
@@ -207,13 +207,13 @@
|
|||||||
:label="$t('reg.elimina')"
|
:label="$t('reg.elimina')"
|
||||||
icon="fas fa-trash-alt"
|
icon="fas fa-trash-alt"
|
||||||
/>
|
/>
|
||||||
<!--<q-fab-action
|
<q-fab-action
|
||||||
v-if="tools.canModifyThisRec(myrec, table) || tools.isManager() || editOn"
|
v-if="tools.canModifyThisRec(myrec, table) || tools.isManager() || editOn"
|
||||||
@click="cmdExt(costanti.CMD_CLONE, myrec._id, null)"
|
@click="cmdExt(costanti.CMD_CLONE, myrec._id, null)"
|
||||||
color="accent"
|
color="accent"
|
||||||
:label="$t('event.duplicate')"
|
:label="$t('event.duplicate')"
|
||||||
icon="fas fa-copy"
|
icon="fas fa-copy"
|
||||||
/>-->
|
/>
|
||||||
<q-fab-action
|
<q-fab-action
|
||||||
v-if="tools.canModifyThisRec(myrec, table) || editOn"
|
v-if="tools.canModifyThisRec(myrec, table) || editOn"
|
||||||
:disable="!pagina_collegata"
|
:disable="!pagina_collegata"
|
||||||
|
|||||||
@@ -22,15 +22,7 @@
|
|||||||
.barrato {
|
.barrato {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
.ordine_scontato_nuovo{
|
|
||||||
font-size: 1.1rem;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.ordine_scritta_sconto{
|
|
||||||
font-style: italic;
|
|
||||||
color: green;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.gasordine {
|
.gasordine {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: blue;
|
color: blue;
|
||||||
@@ -105,14 +97,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.quantity-display {
|
.quantity-display {
|
||||||
min-width: 60px;
|
width: 80px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.4rem;
|
font-size: 1.2rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1f2937;
|
color: #1f2937;
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 12px 16px;
|
padding: 4px 8px;
|
||||||
|
margin: 4px;
|
||||||
border: 2px solid #e2e8f0;
|
border: 2px solid #e2e8f0;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
@@ -242,3 +235,16 @@
|
|||||||
margin: 16px auto 0;
|
margin: 16px auto 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.myval_sconto{
|
||||||
|
font-size: 1.2em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myperc_sconto{
|
||||||
|
font-size: 1.2em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: green;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { CCopyBtn } from '../CCopyBtn';
|
|||||||
import type { IOrder } from '@src/model';
|
import type { IOrder } from '@src/model';
|
||||||
import { IOperators, IProduct } from '@src/model';
|
import { IOperators, IProduct } from '@src/model';
|
||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import { defineComponent, toRef, ref, watch, onMounted } from 'vue';
|
import { defineComponent, toRef, ref, watch, onMounted, computed } from 'vue';
|
||||||
import { CTitleBanner } from '@src/components/CTitleBanner';
|
import { CTitleBanner } from '@src/components/CTitleBanner';
|
||||||
import { useProducts } from '@store/Products';
|
import { useProducts } from '@store/Products';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@@ -59,6 +59,10 @@ export default defineComponent({
|
|||||||
const enableQtyPreordered = ref(false);
|
const enableQtyPreordered = ref(false);
|
||||||
const enableChangeTotalPrice = ref(false);
|
const enableChangeTotalPrice = ref(false);
|
||||||
|
|
||||||
|
watch(props.order, (newVal: any) => {
|
||||||
|
order.value = { ...newVal };
|
||||||
|
});
|
||||||
|
|
||||||
watch(orderQuantity, (newValue: any) => {
|
watch(orderQuantity, (newValue: any) => {
|
||||||
if (!newValue) order.value.quantity = 0;
|
if (!newValue) order.value.quantity = 0;
|
||||||
else order.value.quantity = parseFloat(newValue);
|
else order.value.quantity = parseFloat(newValue);
|
||||||
@@ -151,15 +155,17 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function isApplicatoSconto() {
|
const isApplicatoSconto = computed(() => {
|
||||||
const totalipotetico =
|
const totalipotetico =
|
||||||
order.value.product!.price *
|
order.value.product!.price *
|
||||||
(order.value.quantity + order.value.quantitypreordered);
|
(order.value.quantity + order.value.quantitypreordered);
|
||||||
if (totalipotetico.toFixed(2) > order.value.TotalPriceProduct.toFixed(2)) {
|
const totalipoteticoNum = parseFloat(totalipotetico.toFixed(2));
|
||||||
|
const totalpriceNum = parseFloat(order.value.TotalPriceProduct.toFixed(2));
|
||||||
|
if (totalipoteticoNum > totalpriceNum) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
});
|
||||||
|
|
||||||
function removeFromCard() {
|
function removeFromCard() {
|
||||||
$q.dialog({
|
$q.dialog({
|
||||||
@@ -197,12 +203,21 @@ export default defineComponent({
|
|||||||
mounted();
|
mounted();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRisparmio(): string {
|
const getRisparmio = computed((): string => {
|
||||||
return (
|
return (
|
||||||
order.value.product!.price * order.value.quantity -
|
order.value.product!.price * order.value.quantity -
|
||||||
order.value.TotalPriceProduct
|
order.value.TotalPriceProduct
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
}
|
});
|
||||||
|
const getRispPerc = computed((): string => {
|
||||||
|
const risparmioPerc = parseFloat(
|
||||||
|
(
|
||||||
|
(getRisparmio.value / (order.value.product!.price * order.value.quantity)) *
|
||||||
|
100
|
||||||
|
).toFixed(2)
|
||||||
|
);
|
||||||
|
return risparmioPerc.toFixed(0);
|
||||||
|
});
|
||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
endload.value = false;
|
endload.value = false;
|
||||||
@@ -248,6 +263,7 @@ export default defineComponent({
|
|||||||
orderTotalPriceProduct,
|
orderTotalPriceProduct,
|
||||||
endload,
|
endload,
|
||||||
qtyInCart,
|
qtyInCart,
|
||||||
|
getRispPerc,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -195,27 +195,12 @@
|
|||||||
{{ order.quantity + order.quantitypreordered }} x €
|
{{ order.quantity + order.quantitypreordered }} x €
|
||||||
{{ order.price ? order.price : 0 }}
|
{{ order.price ? order.price : 0 }}
|
||||||
</span>
|
</span>
|
||||||
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
|
=
|
||||||
= €
|
<span :class="isApplicatoSconto ? 'ordine_scontato_nuovo' : ''">
|
||||||
|
€
|
||||||
{{ order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0 }}
|
{{ order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0 }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span v-if="isApplicatoSconto">
|
||||||
v-if="
|
|
||||||
tools.isManager() &&
|
|
||||||
order.TotalPriceProduct.toFixed(2) !==
|
|
||||||
order.TotalPriceProductCalc.toFixed(2)
|
|
||||||
"
|
|
||||||
:class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"
|
|
||||||
>
|
|
||||||
(Calc: €
|
|
||||||
{{
|
|
||||||
order.TotalPriceProductCalc
|
|
||||||
? order.TotalPriceProductCalc.toFixed(2)
|
|
||||||
: 0
|
|
||||||
}})
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span v-if="isApplicatoSconto()">
|
|
||||||
<span class="ordine_scontato"
|
<span class="ordine_scontato"
|
||||||
>(<span class="barrato"
|
>(<span class="barrato"
|
||||||
>€
|
>€
|
||||||
@@ -228,12 +213,18 @@
|
|||||||
>)</span
|
>)</span
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<div
|
||||||
v-if="isApplicatoSconto() && !editmode"
|
v-if="isApplicatoSconto && !editmode"
|
||||||
class="ordine_scritta_sconto"
|
class="ordine_scritta_sconto"
|
||||||
>{{ $t('ecomm.sconto_applicato', { risparmio: getRisparmio() }) }}</span
|
v-html="
|
||||||
|
$t('ecomm.sconto_applicato', {
|
||||||
|
risparmio: getRisparmio,
|
||||||
|
perc: getRispPerc,
|
||||||
|
})
|
||||||
|
"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<!--<q-item-section side>
|
<!--<q-item-section side>
|
||||||
|
|||||||
@@ -1994,8 +1994,10 @@ h3 {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: 56.25%;
|
padding-top: 56.25%;
|
||||||
max-width: 800px; /* Limita la larghezza massima */
|
max-width: 800px;
|
||||||
margin: 0 auto; /* Centra il video orizzontalmente */
|
/* Limita la larghezza massima */
|
||||||
|
margin: 0 auto;
|
||||||
|
/* Centra il video orizzontalmente */
|
||||||
|
|
||||||
/* 16:9 Aspect Ratio */
|
/* 16:9 Aspect Ratio */
|
||||||
}
|
}
|
||||||
@@ -2006,7 +2008,8 @@ h3 {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: none; /* Rimuovi eventuali bordi */
|
border: none;
|
||||||
|
/* Rimuovi eventuali bordi */
|
||||||
}
|
}
|
||||||
|
|
||||||
.fake-link {
|
.fake-link {
|
||||||
@@ -2604,9 +2607,48 @@ body.body--dark {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: rgba(255, 255, 255, 0.7); /* Sfondo semi-trasparente */
|
background-color: rgba(255, 255, 255, 0.7);
|
||||||
|
/* Sfondo semi-trasparente */
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-strike {
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-price-discount {
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #f60;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ordine_scontato_nuovo {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: green;
|
||||||
|
background-color: #fff5ee; /* seashell color background */
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ordine_scritta_sconto {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color:red;
|
||||||
|
background-color: #fff5ee; /* seashell color background */
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center-button {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
@@ -1049,6 +1049,7 @@ export interface IColGridTable {
|
|||||||
tablesel?: string
|
tablesel?: string
|
||||||
notsave?: boolean
|
notsave?: boolean
|
||||||
isadvanced_field?: boolean
|
isadvanced_field?: boolean
|
||||||
|
dont_clone?: boolean
|
||||||
showWhen?: number
|
showWhen?: number
|
||||||
maxlength?: number
|
maxlength?: number
|
||||||
minlength?: number
|
minlength?: number
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ export interface IOrderCart {
|
|||||||
created_at?: Date
|
created_at?: Date
|
||||||
note: string
|
note: string
|
||||||
codice_sconto?: string
|
codice_sconto?: string
|
||||||
|
descr_sconto?: string
|
||||||
note_per_gestore: string
|
note_per_gestore: string
|
||||||
note_per_admin: string
|
note_per_admin: string
|
||||||
note_ordine_gas: string
|
note_ordine_gas: string
|
||||||
|
|||||||
@@ -1870,6 +1870,8 @@ const msg_it = {
|
|||||||
created: 'Sito Installato [IdApp = {idapp}] !',
|
created: 'Sito Installato [IdApp = {idapp}] !',
|
||||||
},
|
},
|
||||||
ecomm: {
|
ecomm: {
|
||||||
|
totale_scontato: 'Totale scontato',
|
||||||
|
prezzointero: 'Prezzo Intero',
|
||||||
already_in_cart: 'Questo prodotto è stato già aggiunto al Carrello',
|
already_in_cart: 'Questo prodotto è stato già aggiunto al Carrello',
|
||||||
area_personale: 'Per poter fare un Ordine occorre essere Registrati ed accedere con le proprie credenziali (username e password)',
|
area_personale: 'Per poter fare un Ordine occorre essere Registrati ed accedere con le proprie credenziali (username e password)',
|
||||||
codice_sconto: 'Aggiungi il Codice Sconto',
|
codice_sconto: 'Aggiungi il Codice Sconto',
|
||||||
@@ -1907,7 +1909,7 @@ const msg_it = {
|
|||||||
carrello_di: 'Carrello di {user}',
|
carrello_di: 'Carrello di {user}',
|
||||||
settings: 'Impostazioni',
|
settings: 'Impostazioni',
|
||||||
qta_in_attesa: '(Ordinati In attesa {qty})',
|
qta_in_attesa: '(Ordinati In attesa {qty})',
|
||||||
sconto_applicato: 'Risparmi {risparmio} € !',
|
sconto_applicato: 'Risparmi <span class="myval_sconto">{risparmio}</span> € <span class="myperc_sconto">({perc}%)</span> !',
|
||||||
codice: 'Codice',
|
codice: 'Codice',
|
||||||
subcat: 'Cat',
|
subcat: 'Cat',
|
||||||
code_o_text_search: 'Inserisci il codice o il testo da cercare',
|
code_o_text_search: 'Inserisci il codice o il testo da cercare',
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ function AddCol(params: IColGridTable) {
|
|||||||
isadvanced_field: (params.isadvanced_field === undefined) ? false : params.isadvanced_field,
|
isadvanced_field: (params.isadvanced_field === undefined) ? false : params.isadvanced_field,
|
||||||
path: (params.path === undefined) ? '' : params.path,
|
path: (params.path === undefined) ? '' : params.path,
|
||||||
onlyforAdmin: (params.onlyforAdmin === undefined) ? false : params.onlyforAdmin,
|
onlyforAdmin: (params.onlyforAdmin === undefined) ? false : params.onlyforAdmin,
|
||||||
|
dont_clone: (params.dont_clone === undefined) ? false : params.dont_clone,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +171,8 @@ export const colTableRaccoltaCataloghi = [
|
|||||||
AddCol(DeleteRec),
|
AddCol(DeleteRec),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// exclude field with dont_clone: true in the fieldstable colTableCatalogList
|
||||||
|
|
||||||
export const colTableCatalogList = [
|
export const colTableCatalogList = [
|
||||||
AddCol({ name: 'active', label_trans: 'myelems.pubblica_online', fieldtype: costanti.FieldType.boolean }),
|
AddCol({ name: 'active', label_trans: 'myelems.pubblica_online', fieldtype: costanti.FieldType.boolean }),
|
||||||
AddCol({ name: 'title', label_trans: 'gallery.title' }),
|
AddCol({ name: 'title', label_trans: 'gallery.title' }),
|
||||||
@@ -192,6 +195,7 @@ export const colTableCatalogList = [
|
|||||||
label_trans: 'cataloglist.idPageAssigned',
|
label_trans: 'cataloglist.idPageAssigned',
|
||||||
fieldtype: costanti.FieldType.select,
|
fieldtype: costanti.FieldType.select,
|
||||||
jointable: 'mypages_id',
|
jointable: 'mypages_id',
|
||||||
|
dont_clone: true,
|
||||||
}),
|
}),
|
||||||
AddCol({ name: 'isCatalogoGenerale', label_trans: 'cataloglist.isCatalogoGenerale', fieldtype: costanti.FieldType.boolean }),
|
AddCol({ name: 'isCatalogoGenerale', label_trans: 'cataloglist.isCatalogoGenerale', fieldtype: costanti.FieldType.boolean }),
|
||||||
AddCol({
|
AddCol({
|
||||||
@@ -259,11 +263,13 @@ export const colTableCatalogList = [
|
|||||||
AddCol({
|
AddCol({
|
||||||
name: 'pdf_generato',
|
name: 'pdf_generato',
|
||||||
label_trans: 'cataloglist.pdf_generato',
|
label_trans: 'cataloglist.pdf_generato',
|
||||||
|
dont_clone: true,
|
||||||
}),
|
}),
|
||||||
// AddCol({ name: 'data_generato', label_trans: 'dataloglist.data_generato', fieldtype: costanti.FieldType.date }),
|
// AddCol({ name: 'data_generato', label_trans: 'dataloglist.data_generato', fieldtype: costanti.FieldType.date }),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'pdf_online',
|
name: 'pdf_online',
|
||||||
label_trans: 'cataloglist.pdf_online',
|
label_trans: 'cataloglist.pdf_online',
|
||||||
|
dont_clone: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
AddCol({
|
AddCol({
|
||||||
@@ -286,11 +292,13 @@ export const colTableCatalogList = [
|
|||||||
AddCol({
|
AddCol({
|
||||||
name: 'pdf_generato_stampa',
|
name: 'pdf_generato_stampa',
|
||||||
label_trans: 'cataloglist.pdf_generato_stampa',
|
label_trans: 'cataloglist.pdf_generato_stampa',
|
||||||
|
dont_clone: true,
|
||||||
}),
|
}),
|
||||||
// AddCol({ name: 'data_generato', label_trans: 'dataloglist.data_generato', fieldtype: costanti.FieldType.date }),
|
// AddCol({ name: 'data_generato', label_trans: 'dataloglist.data_generato', fieldtype: costanti.FieldType.date }),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'pdf_online_stampa',
|
name: 'pdf_online_stampa',
|
||||||
label_trans: 'cataloglist.pdf_online_stampa',
|
label_trans: 'cataloglist.pdf_online_stampa',
|
||||||
|
dont_clone: true,
|
||||||
}),
|
}),
|
||||||
// AddCol({ name: 'data_online', label_trans: 'dataloglist.data_online', fieldtype: costanti.FieldType.date }),
|
// AddCol({ name: 'data_online', label_trans: 'dataloglist.data_online', fieldtype: costanti.FieldType.date }),
|
||||||
|
|
||||||
@@ -697,6 +705,7 @@ export const getcolorderscart = [
|
|||||||
AddCol({ name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
|
AddCol({ name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
|
||||||
AddCol({ name: 'note', label_trans: 'order.note' }),
|
AddCol({ name: 'note', label_trans: 'order.note' }),
|
||||||
AddCol({ name: 'codice_sconto', label_trans: 'order.codice_sconto' }),
|
AddCol({ name: 'codice_sconto', label_trans: 'order.codice_sconto' }),
|
||||||
|
AddCol({ name: 'descr_sconto', label_trans: 'order.descr_sconto' }),
|
||||||
AddCol({ name: 'confermato', label_trans: 'order.confermato', fieldtype: costanti.FieldType.boolean }),
|
AddCol({ name: 'confermato', label_trans: 'order.confermato', fieldtype: costanti.FieldType.boolean }),
|
||||||
AddCol({ name: 'date_confermato', label_trans: 'order.date_confermato', fieldtype: costanti.FieldType.date }),
|
AddCol({ name: 'date_confermato', label_trans: 'order.date_confermato', fieldtype: costanti.FieldType.date }),
|
||||||
AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }),
|
AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }),
|
||||||
@@ -888,6 +897,7 @@ export const colTableGasordine = [
|
|||||||
AddCol(DuplicateRec),
|
AddCol(DuplicateRec),
|
||||||
]
|
]
|
||||||
export const colTableScontistica = [
|
export const colTableScontistica = [
|
||||||
|
AddCol({ name: 'attivo', label_trans: 'scontistica.attivo', fieldtype: costanti.FieldType.boolean }),
|
||||||
AddCol({ name: 'code', label_trans: 'scontistica.code' }),
|
AddCol({ name: 'code', label_trans: 'scontistica.code' }),
|
||||||
AddCol({ name: 'description', label_trans: 'scontistica.description' }),
|
AddCol({ name: 'description', label_trans: 'scontistica.description' }),
|
||||||
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
|
||||||
@@ -2734,6 +2744,7 @@ export const colTableOrdersCart = [
|
|||||||
AddCol({ name: 'totalQtyPreordered', label_trans: 'orderscart.totalQtyPreordered', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'totalQtyPreordered', label_trans: 'orderscart.totalQtyPreordered', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'totalPrice', label_trans: 'orderscart.totalPrice', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'totalPrice', label_trans: 'orderscart.totalPrice', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'totalPriceCalc', label_trans: 'orderscart.totalPriceCalc', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'totalPriceCalc', label_trans: 'orderscart.totalPriceCalc', fieldtype: costanti.FieldType.number }),
|
||||||
|
AddCol({ name: 'totalPriceIntero', label_trans: 'orderscart.totalPriceIntero', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'status', label_trans: 'orderscart.status', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'status', label_trans: 'orderscart.status', fieldtype: costanti.FieldType.number }),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
|
|||||||
note: '',
|
note: '',
|
||||||
note_per_gestore: '',
|
note_per_gestore: '',
|
||||||
codice_sconto:'',
|
codice_sconto:'',
|
||||||
|
descr_sconto: '',
|
||||||
note_per_admin: '',
|
note_per_admin: '',
|
||||||
note_ordine_gas: '',
|
note_ordine_gas: '',
|
||||||
};
|
};
|
||||||
@@ -611,8 +612,10 @@ export const useProducts = defineStore('Products', {
|
|||||||
state.orders = res.data.orders;
|
state.orders = res.data.orders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res && res.data.mycart) {
|
||||||
|
state.cart = res.data.mycart;
|
||||||
|
}
|
||||||
if (res && res.data.cart) {
|
if (res && res.data.cart) {
|
||||||
// console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
|
|
||||||
state.cart = res.data.cart;
|
state.cart = res.data.cart;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1391,6 +1394,8 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
let ris = null;
|
let ris = null;
|
||||||
|
|
||||||
|
console.log('/cart/' + this.userActive._id + '/createorderscart', cart_id);
|
||||||
|
|
||||||
ris = await Api.SendReq(
|
ris = await Api.SendReq(
|
||||||
'/cart/' + this.userActive._id + '/createorderscart',
|
'/cart/' + this.userActive._id + '/createorderscart',
|
||||||
'POST',
|
'POST',
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ export default defineComponent({
|
|||||||
// Add other properties as needed
|
// Add other properties as needed
|
||||||
totalPrice: orderscart.reduce((total: number, rec: any) => total + rec.totalPrice, 0),
|
totalPrice: orderscart.reduce((total: number, rec: any) => total + rec.totalPrice, 0),
|
||||||
totalPriceCalc: orderscart.reduce((total: number, rec: any) => total + rec.totalPriceCalc, 0),
|
totalPriceCalc: orderscart.reduce((total: number, rec: any) => total + rec.totalPriceCalc, 0),
|
||||||
|
totalPriceIntero: orderscart.reduce((total: number, rec: any) => total + rec.totalPriceIntero, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
let rowsWithTotals: any = [...orderscart];
|
let rowsWithTotals: any = [...orderscart];
|
||||||
|
|||||||
@@ -233,6 +233,11 @@
|
|||||||
caption
|
caption
|
||||||
>{{ props.row.totalPriceCalc }} €</q-item-label
|
>{{ props.row.totalPriceCalc }} €</q-item-label
|
||||||
>
|
>
|
||||||
|
<q-item-label
|
||||||
|
v-else-if="col.name === 'totalPriceIntero'"
|
||||||
|
caption
|
||||||
|
>{{ props.row.totalPriceIntero }} €</q-item-label
|
||||||
|
>
|
||||||
<q-item-label
|
<q-item-label
|
||||||
v-else-if="col.name === 'status'"
|
v-else-if="col.name === 'status'"
|
||||||
caption
|
caption
|
||||||
|
|||||||
Reference in New Issue
Block a user