- Esporta Lista Carrello (Totale)
- Sconto Applicato
This commit is contained in:
467
_LIMBO/esempio.htm
Normal file
467
_LIMBO/esempio.htm
Normal file
@@ -0,0 +1,467 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Carrello Prodotti - Design Moderno</title>
|
||||||
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-container {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: rgba(255, 255, 255, 0.95);
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 32px;
|
||||||
|
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-title {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-subtitle {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card.removing {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(100px);
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-image {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 2rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-info {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-name {
|
||||||
|
font-size: 1.3rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-price {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: #6b7280;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-total {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #059669;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-controls {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
color: white;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn:hover:not(:disabled) {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-display {
|
||||||
|
min-width: 60px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
border: 2px solid #e2e8f0;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-display.updating {
|
||||||
|
transform: scale(1.1);
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn {
|
||||||
|
background: linear-gradient(135deg, #ef4444, #dc2626);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-summary {
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
color: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-top: 32px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 1;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-summary.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-amount {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-items {
|
||||||
|
opacity: 0.9;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkout-btn {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||||
|
color: white;
|
||||||
|
padding: 16px 32px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkout-btn:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-cart {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60px 20px;
|
||||||
|
color: #6b7280;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-cart.show {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-cart i {
|
||||||
|
font-size: 4rem;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% { transform: scale(1); }
|
||||||
|
50% { transform: scale(1.05); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.pulse {
|
||||||
|
animation: pulse 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(30px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-in {
|
||||||
|
animation: fadeInUp 0.5s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.product-content {
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-controls {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn {
|
||||||
|
margin: 16px auto 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="cart-container">
|
||||||
|
<div class="cart-header">
|
||||||
|
<h1 class="cart-title">
|
||||||
|
<i class="fas fa-shopping-cart"></i>
|
||||||
|
Il Tuo Carrello
|
||||||
|
</h1>
|
||||||
|
<p class="cart-subtitle">Gestisci i tuoi prodotti preferiti</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="empty-cart" class="empty-cart">
|
||||||
|
<i class="fas fa-shopping-bag"></i>
|
||||||
|
<h3>Il tuo carrello è vuoto</h3>
|
||||||
|
<p>Aggiungi alcuni prodotti per iniziare!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="cart-items"></div>
|
||||||
|
|
||||||
|
<div id="cart-summary" class="cart-summary">
|
||||||
|
<div class="total-amount" id="total-amount">€0.00</div>
|
||||||
|
<p class="total-items" id="total-items">0 articoli nel carrello</p>
|
||||||
|
<button class="checkout-btn" onclick="checkout()">
|
||||||
|
<i class="fas fa-credit-card"></i>
|
||||||
|
Procedi al Checkout
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Dati del carrello
|
||||||
|
let cartItems = [
|
||||||
|
{ id: 1, name: 'iPhone 15 Pro', price: 1199.99, quantity: 1, emoji: '📱' },
|
||||||
|
{ id: 2, name: 'MacBook Air M3', price: 1299.99, quantity: 2, emoji: '💻' },
|
||||||
|
{ id: 3, name: 'AirPods Pro', price: 279.99, quantity: 1, emoji: '🎧' },
|
||||||
|
{ id: 4, name: 'Apple Watch', price: 399.99, quantity: 1, emoji: '⌚' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// Elementi DOM
|
||||||
|
const cartItemsContainer = document.getElementById('cart-items');
|
||||||
|
const emptyCartDiv = document.getElementById('empty-cart');
|
||||||
|
const cartSummaryDiv = document.getElementById('cart-summary');
|
||||||
|
const totalAmountSpan = document.getElementById('total-amount');
|
||||||
|
const totalItemsSpan = document.getElementById('total-items');
|
||||||
|
|
||||||
|
// Funzioni di calcolo
|
||||||
|
function calculateTotal() {
|
||||||
|
return cartItems.reduce((total, item) => total + (item.price * item.quantity), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateTotalItems() {
|
||||||
|
return cartItems.reduce((total, item) => total + item.quantity, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funzione per creare HTML di un prodotto
|
||||||
|
function createProductHTML(item) {
|
||||||
|
return `
|
||||||
|
<div class="product-card fade-in" data-id="${item.id}">
|
||||||
|
<div class="product-content">
|
||||||
|
<div class="product-image">
|
||||||
|
${item.emoji}
|
||||||
|
</div>
|
||||||
|
<div class="product-info">
|
||||||
|
<h3 class="product-name">${item.name}</h3>
|
||||||
|
<p class="product-price">€${item.price.toFixed(2)} / unità</p>
|
||||||
|
<p class="product-total">Totale: €${(item.price * item.quantity).toFixed(2)}</p>
|
||||||
|
|
||||||
|
<div class="quantity-controls">
|
||||||
|
<button
|
||||||
|
class="quantity-btn"
|
||||||
|
onclick="decreaseQuantity(${item.id})"
|
||||||
|
${item.quantity <= 1 ? 'disabled' : ''}
|
||||||
|
>
|
||||||
|
<i class="fas fa-minus"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="quantity-display" id="qty-${item.id}">
|
||||||
|
${item.quantity}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="quantity-btn"
|
||||||
|
onclick="increaseQuantity(${item.id})"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="remove-btn"
|
||||||
|
onclick="removeItem(${item.id})"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
Rimuovi
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funzione per aggiornare l'interfaccia
|
||||||
|
function updateUI() {
|
||||||
|
// Aggiorna contenuto carrello
|
||||||
|
if (cartItems.length === 0) {
|
||||||
|
cartItemsContainer.innerHTML = '';
|
||||||
|
emptyCartDiv.classList.add('show');
|
||||||
|
cartSummaryDiv.classList.add('hidden');
|
||||||
|
} else {
|
||||||
|
emptyCartDiv.classList.remove('show');
|
||||||
|
cartSummaryDiv.classList.remove('hidden');
|
||||||
|
cartItemsContainer.innerHTML = cartItems.map(createProductHTML).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggiorna totali
|
||||||
|
const total = calculateTotal();
|
||||||
|
const totalItems = calculateTotalItems();
|
||||||
|
|
||||||
|
totalAmountSpan.textContent = `€${total.toFixed(2)}`;
|
||||||
|
totalItemsSpan.textContent = `${totalItems} ${totalItems === 1 ? 'articolo' : 'articoli'} nel carrello`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funzioni per gestire quantità
|
||||||
|
function increaseQuantity(itemId) {
|
||||||
|
const item = cartItems.find(item => item.id === itemId);
|
||||||
|
if (item) {
|
||||||
|
item.quantity++;
|
||||||
|
|
||||||
|
// Animazione feedback
|
||||||
|
const qtyDisplay = document.getElementById(`qty-${itemId}`);
|
||||||
|
qtyDisplay.classList.add('updating');
|
||||||
|
setTimeout(() => qtyDisplay.classList.remove('updating'), 300);
|
||||||
|
|
||||||
|
updateUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function decreaseQuantity(itemId) {
|
||||||
|
const item = cartItems.find(item => item.id === itemId);
|
||||||
|
if (item && item.quantity > 1) {
|
||||||
|
item.quantity--;
|
||||||
|
|
||||||
|
// Animazione feedback
|
||||||
|
const qtyDisplay = document.getElementById(`qty-${itemId}`);
|
||||||
|
qtyDisplay.classList.add('updating');
|
||||||
|
setTimeout(() => qtyDisplay.classList.remove('updating'), 300);
|
||||||
|
|
||||||
|
updateUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funzione per rimuovere prodotto
|
||||||
|
function removeItem(itemId) {
|
||||||
|
const productCard = document.querySelector(`[data-id="${itemId}"]`);
|
||||||
|
productCard.classList.add('removing');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
cartItems = cartItems.filter(item => item.id !== itemId);
|
||||||
|
updateUI();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funzione checkout
|
||||||
|
function checkout() {
|
||||||
|
const total = calculateTotal();
|
||||||
|
const totalItems = calculateTotalItems();
|
||||||
|
alert(`Checkout per €${total.toFixed(2)} - ${totalItems} articoli`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inizializza l'interfaccia
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
updateUI();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -2533,6 +2533,11 @@ export const shared_consts = {
|
|||||||
WEB: 1,
|
WEB: 1,
|
||||||
STAMPA: 2,
|
STAMPA: 2,
|
||||||
},
|
},
|
||||||
PUNTI_PER_POLLICE: 96
|
PUNTI_PER_POLLICE: 96,
|
||||||
|
|
||||||
|
SCONTI_APPLICA: {
|
||||||
|
NESSUNO: 0,
|
||||||
|
A_TUTTI: 1,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { defineComponent, onMounted, ref, computed, watch } from 'vue'
|
import { defineComponent, onMounted, ref, computed, watch } from 'vue';
|
||||||
import { tools } from '@tools'
|
import { tools } from '@tools';
|
||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore';
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router';
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore';
|
||||||
import { useProducts } from '@store/Products'
|
import { useProducts } from '@store/Products';
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toolsext } from '@store/Modules/toolsext'
|
import { toolsext } from '@store/Modules/toolsext';
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar';
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti';
|
||||||
import type { ICart, IOrder, IOrderCart, IProduct } from '@src/model/Products';
|
import type { ICart, IOrder, IOrderCart, IProduct } from '@src/model/Products';
|
||||||
import { IShareWithUs } from '@src/model/Products'
|
import { IShareWithUs } from '@src/model/Products';
|
||||||
|
|
||||||
import { shared_consts } from '@src/common/shared_vuejs'
|
import { shared_consts } from '@src/common/shared_vuejs';
|
||||||
|
|
||||||
import { CSingleCart } from '../CSingleCart'
|
import { CSingleCart } from '../CSingleCart';
|
||||||
import { CTitleBanner } from '@src/components/CTitleBanner'
|
import { CTitleBanner } from '@src/components/CTitleBanner';
|
||||||
import { CSelectUserActive } from '@src/components/CSelectUserActive'
|
import { CSelectUserActive } from '@src/components/CSelectUserActive';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CCart',
|
name: 'CCart',
|
||||||
@@ -30,148 +30,160 @@ export default defineComponent({
|
|||||||
required: false,
|
required: false,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
components: { CSingleCart, CTitleBanner, CSelectUserActive },
|
components: { CSingleCart, CTitleBanner, CSelectUserActive },
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore();
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore();
|
||||||
const productStore = useProducts()
|
const productStore = useProducts();
|
||||||
const $router = useRouter()
|
const $router = useRouter();
|
||||||
const $q = useQuasar()
|
const $q = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const mycart = ref(<ICart>{})
|
const mycart = ref(<ICart>{});
|
||||||
const myrec = ref(<any[string]>[])
|
const myrec = ref(<any[string]>[]);
|
||||||
const oldrec = ref(<any[string]>[])
|
const oldrec = ref(<any[string]>[]);
|
||||||
const note = ref('')
|
const note = ref('');
|
||||||
const endload = ref(false)
|
const codice_sconto = ref('');
|
||||||
const recOrderCart = ref(<IOrderCart>{})
|
const endload = ref(false);
|
||||||
|
const caricamentodati = ref(false);
|
||||||
|
const recOrderCart = ref(<IOrderCart>{});
|
||||||
|
|
||||||
const search = ref('')
|
const search = ref('');
|
||||||
|
|
||||||
const isfinishLoading = computed(() => globalStore.finishLoading)
|
const isfinishLoading = computed(() => globalStore.finishLoading);
|
||||||
|
|
||||||
watch(() => isfinishLoading.value, (newval: boolean, oldval: boolean) => {
|
watch(
|
||||||
if (isfinishLoading.value) {
|
() => isfinishLoading.value,
|
||||||
load()
|
(newval: boolean, oldval: boolean) => {
|
||||||
|
if (isfinishLoading.value) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
);
|
||||||
|
|
||||||
const statusnow = computed(() => (): number => {
|
const statusnow = computed(() => (): number => {
|
||||||
if (recOrderCart.value) {
|
if (recOrderCart.value) {
|
||||||
return recOrderCart.value.status
|
return recOrderCart.value.status;
|
||||||
}
|
}
|
||||||
return 0
|
return 0;
|
||||||
})
|
});
|
||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
// Inizializza
|
// Inizializza
|
||||||
load()
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrdersCart() {
|
function getOrdersCart() {
|
||||||
if (props.iscash) {
|
if (props.iscash) {
|
||||||
return productStore.getOrdersCartById(props.idOrdersCart)
|
return productStore.getOrdersCartById(props.idOrdersCart);
|
||||||
} else {
|
} else {
|
||||||
return productStore.getCart()
|
return productStore.getCart();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItemsCart() {
|
function getItemsCart() {
|
||||||
const cart = getOrdersCart()
|
const cart = getOrdersCart();
|
||||||
return cart.items || null
|
return cart.items || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNumItems(): number {
|
function getNumItems(): number {
|
||||||
const cart = getOrdersCart()
|
const cart = getOrdersCart();
|
||||||
if (cart.items)
|
if (cart.items) return cart.items.length || 0;
|
||||||
return cart.items.length || 0
|
else return 0;
|
||||||
else
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCart(): ICart {
|
function getCart(): ICart {
|
||||||
return getOrdersCart()
|
return getOrdersCart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNote() {
|
function getNote() {
|
||||||
const cart = getOrdersCart()
|
const cart = getOrdersCart();
|
||||||
return cart.note
|
return cart.note;
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_field(fieldname: string) {
|
function change_field(fieldname: string) {
|
||||||
if (myrec.value[fieldname] !== oldrec.value[fieldname]) {
|
if (myrec.value[fieldname] !== oldrec.value[fieldname]) {
|
||||||
myrec.value[fieldname] = oldrec.value[fieldname]
|
myrec.value[fieldname] = oldrec.value[fieldname];
|
||||||
|
|
||||||
const mydata = {
|
const mydata = {
|
||||||
[fieldname]: myrec.value[fieldname]
|
[fieldname]: myrec.value[fieldname],
|
||||||
}
|
};
|
||||||
|
|
||||||
const aggiorna = fieldname !== 'status'
|
const aggiorna = fieldname !== 'status';
|
||||||
tools.saveFieldToServer($q, 'carts', mycart.value._id, mydata, aggiorna)
|
tools.saveFieldToServer($q, 'carts', mycart.value._id, mydata, aggiorna);
|
||||||
oldrec.value[fieldname] = myrec.value[fieldname]
|
oldrec.value[fieldname] = myrec.value[fieldname];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function myTotalPrice(): string {
|
function myTotalPrice(): 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 {
|
function myTotalQty(): number {
|
||||||
if (productStore.cart) {
|
if (productStore.cart) {
|
||||||
return productStore.cart.totalQty!
|
return productStore.cart.totalQty!;
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function aggiornaCarrello() {
|
||||||
|
if (mycart.value) {
|
||||||
|
recOrderCart.value = await productStore.CreateOrdersCart({
|
||||||
|
cart_id: mycart.value._id,
|
||||||
|
status: 0,
|
||||||
|
note: note.value,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
if (isfinishLoading.value) {
|
if (isfinishLoading.value) {
|
||||||
console.log('Load CCART')
|
console.log('Load CCART');
|
||||||
mycart.value = getCart()
|
mycart.value = getCart();
|
||||||
myrec.value = Object.keys(mycart)
|
myrec.value = Object.keys(mycart);
|
||||||
oldrec.value = myrec.value
|
oldrec.value = myrec.value;
|
||||||
note.value = mycart.value.note!
|
note.value = mycart.value.note!;
|
||||||
|
// codice_sconto.value = mycart.value.codice_sconto!;
|
||||||
|
|
||||||
const options = {};
|
const options = {};
|
||||||
|
|
||||||
if (mycart.value) {
|
aggiornaCarrello();
|
||||||
recOrderCart.value = await productStore.CreateOrdersCart({ cart_id: mycart.value._id, status: 0, note: note.value })
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log('myrec', myrec.value)
|
// console.log('myrec', myrec.value)
|
||||||
|
|
||||||
endload.value = true
|
endload.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CanBeShipped() {
|
function CanBeShipped() {
|
||||||
return productStore.cart.items ? productStore.cart.items.filter((rec: any) => rec.order.product.canBeShipped).length : false
|
return productStore.cart.items
|
||||||
|
? productStore.cart.items.filter((rec: any) => rec.order.product.canBeShipped)
|
||||||
|
.length
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CanBeBuyOnline() {
|
function CanBeBuyOnline() {
|
||||||
return productStore.cart.items ? productStore.cart.items.filter((rec: any) => rec.order.product.canBeBuyOnline).length : false
|
return productStore.cart.items
|
||||||
|
? productStore.cart.items.filter((rec: any) => rec.order.product.canBeBuyOnline)
|
||||||
|
.length
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getnumsteps() {
|
function getnumsteps() {
|
||||||
let numsteps = 1
|
let numsteps = 1;
|
||||||
|
|
||||||
if (CanBeShipped())
|
if (CanBeShipped()) numsteps++;
|
||||||
numsteps++
|
if (CanBeBuyOnline()) numsteps++;
|
||||||
if (CanBeBuyOnline())
|
|
||||||
numsteps++
|
|
||||||
|
|
||||||
return numsteps
|
return numsteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
function docheckout() {
|
function docheckout() {
|
||||||
|
|
||||||
// Può essere spedito?
|
// Può essere spedito?
|
||||||
|
|
||||||
if (CanBeShipped()) {
|
if (CanBeShipped()) {
|
||||||
@@ -188,40 +200,53 @@ export default defineComponent({
|
|||||||
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,
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
label: t('dialog.cancel')
|
label: t('dialog.cancel'),
|
||||||
},
|
},
|
||||||
title: t('ecomm.order')
|
title: t('ecomm.order'),
|
||||||
}).onOk(async () => {
|
}).onOk(async () => {
|
||||||
const status = shared_consts.OrderStatus.CHECKOUT_SENT
|
const status = shared_consts.OrderStatus.CHECKOUT_SENT;
|
||||||
|
|
||||||
recOrderCart.value = await productStore.CreateOrdersCart({ cart_id: mycart.value._id, status, note: note.value })
|
try {
|
||||||
|
caricamentodati.value = true;
|
||||||
|
|
||||||
// statusnow.value = myordercart ? myordercart.status : 0
|
recOrderCart.value = await productStore.CreateOrdersCart({
|
||||||
|
cart_id: mycart.value._id,
|
||||||
|
status,
|
||||||
|
note: note.value,
|
||||||
|
codice_sconto: codice_sconto.value,
|
||||||
|
});
|
||||||
|
|
||||||
if (recOrderCart.value.status === status) {
|
// statusnow.value = myordercart ? myordercart.status : 0
|
||||||
tools.showPositiveNotif($q, t('ecomm.ord_confirmed'))
|
|
||||||
setTimeout(() => {
|
if (recOrderCart.value.status === status) {
|
||||||
$router.push('/orderinfo')
|
tools.showPositiveNotif($q, t('ecomm.ord_confirmed'));
|
||||||
}, 2000)
|
setTimeout(() => {
|
||||||
} else {
|
$router.push('/orderinfo');
|
||||||
tools.showNegativeNotif($q, t('ecomm.ord_not_confirmed'))
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
tools.showNegativeNotif($q, t('ecomm.ord_not_confirmed'));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err', e);
|
||||||
|
} finally {
|
||||||
|
caricamentodati.value = false;
|
||||||
}
|
}
|
||||||
// change_field('status')
|
// change_field('status')
|
||||||
// change_field('status')
|
// change_field('status')
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActualIdStorehouse(myprod: IProduct) {
|
function getActualIdStorehouse(myprod: IProduct) {
|
||||||
// Ottieni il negozio attualmente selezionato:
|
// Ottieni il negozio attualmente selezionato:
|
||||||
// Se ce n'è solo 1 allora prendi quello !
|
// Se ce n'è solo 1 allora prendi quello !
|
||||||
if (myprod.storehouses.length === 1) {
|
if (myprod.storehouses.length === 1) {
|
||||||
return myprod.storehouses[0]._id
|
return myprod.storehouses[0]._id;
|
||||||
} else {
|
} else {
|
||||||
// Ottieni il negozio attualmente scelto !
|
// Ottieni il negozio attualmente scelto !
|
||||||
return ''
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,10 +254,10 @@ export default defineComponent({
|
|||||||
// Ottieni il negozio attualmente selezionato:
|
// Ottieni il negozio attualmente selezionato:
|
||||||
// Se ce n'è solo 1 allora prendi quello !
|
// Se ce n'è solo 1 allora prendi quello !
|
||||||
if (myprod.gasordine) {
|
if (myprod.gasordine) {
|
||||||
return myprod.gasordine._id
|
return myprod.gasordine._id;
|
||||||
} else {
|
} else {
|
||||||
// Ottieni il gasordine attualmente scelto !
|
// Ottieni il gasordine attualmente scelto !
|
||||||
return ''
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,18 +267,111 @@ export default defineComponent({
|
|||||||
const myprod = productStore.getProductByCode(lowerSearchText);
|
const myprod = productStore.getProductByCode(lowerSearchText);
|
||||||
if (myprod && myprod.active) {
|
if (myprod && myprod.active) {
|
||||||
const myorder: IOrder = {
|
const myorder: IOrder = {
|
||||||
quantity: 1, quantitypreordered: 0,
|
quantity: 1,
|
||||||
TotalPriceProduct: 0, TotalPriceProductCalc: 0, price: 0,
|
quantitypreordered: 0,
|
||||||
|
TotalPriceProduct: 0,
|
||||||
|
TotalPriceProductCalc: 0,
|
||||||
|
price: 0,
|
||||||
idStorehouse: getActualIdStorehouse(myprod),
|
idStorehouse: getActualIdStorehouse(myprod),
|
||||||
idGasordine: getActualGasordine(myprod),
|
idGasordine: getActualGasordine(myprod),
|
||||||
}
|
};
|
||||||
await productStore.addtoCartBase({ $q, t, id: myprod._id, order: myorder, addqty: true })
|
await productStore.addtoCartBase({
|
||||||
search.value = ''
|
$q,
|
||||||
load()
|
t,
|
||||||
|
id: myprod._id,
|
||||||
|
order: myorder,
|
||||||
|
addqty: true,
|
||||||
|
});
|
||||||
|
search.value = '';
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(mounted)
|
function esportaCsv() {
|
||||||
|
const csvRows: string[] = [];
|
||||||
|
const sep = '|';
|
||||||
|
const headers = `Num${sep}Codice${sep}Titolo${sep}Quantità${sep}Prezzo${sep}Totale\n`;
|
||||||
|
csvRows.push(headers);
|
||||||
|
|
||||||
|
let index = 1
|
||||||
|
for (const itemorder of getItemsCart()) {
|
||||||
|
const productCode = itemorder.order.product?.productInfo.code || '';
|
||||||
|
const productName = itemorder.order.product?.productInfo.name || '';
|
||||||
|
const quantity = itemorder.order.quantity + itemorder.order.quantitypreordered;
|
||||||
|
const price = Number(itemorder.order.price).toFixed(2);
|
||||||
|
const totalPrice = (price * quantity).toFixed(2);
|
||||||
|
|
||||||
|
const row = `${index}${sep}${productCode}${sep}${productName}${sep}${quantity}${sep}${price}${sep}${totalPrice}\n`;
|
||||||
|
csvRows.push(row);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
const totalQuantity = getItemsCart().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 totalRow = `${sep}${sep}Totale${sep}${totalQuantity}${sep}${sep}${totalAmount.toFixed(2)}\n`;
|
||||||
|
csvRows.push(totalRow);
|
||||||
|
|
||||||
|
|
||||||
|
console.log('csvRows', csvRows)
|
||||||
|
|
||||||
|
const csvContent = csvRows.join('').trim();
|
||||||
|
|
||||||
|
const today = new Date();
|
||||||
|
tools.createAndDownloadCSVFromData(
|
||||||
|
csvContent,
|
||||||
|
`ordine_${today.getFullYear()}-${today.getMonth() + 1}-${today.getDate()}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function applicaSconto(codice: string) {
|
||||||
|
try {
|
||||||
|
caricamentodati.value = true;
|
||||||
|
const rissconto = await productStore.ApplicaSconto({
|
||||||
|
cart_id: mycart.value._id,
|
||||||
|
codice_sconto: codice,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (rissconto) {
|
||||||
|
if (rissconto.msg) {
|
||||||
|
tools.showNeutralNotif($q, `${rissconto.msg}`);
|
||||||
|
} else if (rissconto.valido && rissconto.mycart) {
|
||||||
|
tools.showPositiveNotif($q, 'Sconto Applicato!');
|
||||||
|
} else {
|
||||||
|
tools.showNegativeNotif($q, `${rissconto.errmsg}`);
|
||||||
|
}
|
||||||
|
codice_sconto.value = '';
|
||||||
|
if (rissconto.mycart) recOrderCart.value = rissconto.mycart;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('error ApplicaSconto', error);
|
||||||
|
tools.showNegativeNotif($q, `Sconto Non Applicato! ${error.message}`);
|
||||||
|
codice_sconto.value = '';
|
||||||
|
} finally {
|
||||||
|
caricamentodati.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confermaCodiceSconto() {
|
||||||
|
await applicaSconto(codice_sconto.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function rimuoviCodiceSconto() {
|
||||||
|
$q.dialog({
|
||||||
|
message: `Vuoi rimuovere il codice sconto "${recOrderCart.value.codice_sconto}"?`,
|
||||||
|
ok: {
|
||||||
|
label: 'Si',
|
||||||
|
push: true,
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
label: 'No',
|
||||||
|
},
|
||||||
|
}).onOk(async () => {
|
||||||
|
await applicaSconto('RIMUOVI');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(mounted);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userStore,
|
userStore,
|
||||||
@@ -277,6 +395,11 @@ export default defineComponent({
|
|||||||
insertArticolo,
|
insertArticolo,
|
||||||
globalStore,
|
globalStore,
|
||||||
isfinishLoading,
|
isfinishLoading,
|
||||||
}
|
esportaCsv,
|
||||||
}
|
codice_sconto,
|
||||||
})
|
confermaCodiceSconto,
|
||||||
|
rimuoviCodiceSconto,
|
||||||
|
caricamentodati,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,107 +1,204 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
|
<div
|
||||||
<div v-if="isfinishLoading && endload">
|
style="min-height: 100vh; display: flex; justify-content: center; align-items: center"
|
||||||
<CSelectUserActive></CSelectUserActive>
|
>
|
||||||
<div v-if="recOrderCart" class="panel">
|
<q-spinner
|
||||||
<div>
|
v-if="!endload"
|
||||||
<div class="container">
|
color="primary"
|
||||||
|
size="3em"
|
||||||
|
:thickness="2"
|
||||||
|
/>
|
||||||
|
<div v-if="isfinishLoading && endload">
|
||||||
|
<CSelectUserActive></CSelectUserActive>
|
||||||
|
<div
|
||||||
|
v-if="recOrderCart"
|
||||||
|
class="panel"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div class="container">
|
||||||
|
<div
|
||||||
|
class="q-pa-sm col items-start q-gutter-xs"
|
||||||
|
v-for="(itemorder, index) in getItemsCart()"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<CSingleCart
|
||||||
|
:order="itemorder.order"
|
||||||
|
:idOrdersCart="recOrderCart._id"
|
||||||
|
:showall="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<q-separator></q-separator>
|
||||||
<div
|
<div
|
||||||
class="q-pa-sm col items-start q-gutter-xs"
|
class="col-6 q-mr-sm"
|
||||||
v-for="(itemorder, index) in getItemsCart()"
|
style="text-align: right"
|
||||||
:key="index"
|
|
||||||
>
|
>
|
||||||
<CSingleCart
|
<span class="text-grey q-mr-xs">{{ $t('ecomm.totale') }}:</span>
|
||||||
:order="itemorder.order"
|
<span class="text-subtitle1 q-mr-sm">€ {{ myTotalPrice() }}</span>
|
||||||
:idOrdersCart="recOrderCart._id"
|
</div>
|
||||||
:showall="true"
|
|
||||||
/>
|
<q-separator />
|
||||||
|
|
||||||
|
<div
|
||||||
|
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">
|
||||||
|
<div
|
||||||
|
v-if="recOrderCart.codice_sconto"
|
||||||
|
class="row items-center q-gutter-x-xs"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="text-subtitle1 q-mr-sm q-pa-xs"
|
||||||
|
style="background-color: #f0f0f0; border-radius: 4px"
|
||||||
|
>
|
||||||
|
{{ $t('ecomm.sconto_appl') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
icon="fas fa-times"
|
||||||
|
color="negative"
|
||||||
|
@click="rimuoviCodiceSconto"
|
||||||
|
>
|
||||||
|
Rimuovi {{ recOrderCart.codice_sconto }}
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="!recOrderCart.codice_sconto" class="row">
|
||||||
|
<q-input
|
||||||
|
v-model="codice_sconto"
|
||||||
|
:label="$t('ecomm.codice_sconto')"
|
||||||
|
style="width: 200px"
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
@keyup.enter="confermaCodiceSconto"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
:disabled="!codice_sconto || codice_sconto.trim() === ''"
|
||||||
|
:label="$t('ecomm.applica_sconto')"
|
||||||
|
icon="fas fa-check-circle"
|
||||||
|
color="primary"
|
||||||
|
class="q-mt-sm"
|
||||||
|
@click="confermaCodiceSconto"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<!--<q-btn
|
||||||
|
v-if="recOrderCart.codice_sconto"
|
||||||
|
:label="$t('ecomm.rimuovi_sconto')"
|
||||||
|
icon="fas fa-times-circle"
|
||||||
|
color="negative"
|
||||||
|
class="q-mt-sm"
|
||||||
|
@click="rimuoviCodiceSconto"
|
||||||
|
/>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<q-input
|
||||||
|
v-if="getNumItems() > 0"
|
||||||
|
v-model="note"
|
||||||
|
style="min-width: 400px"
|
||||||
|
class="q-mt-md"
|
||||||
|
:label="$t('ecomm.note')"
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
debounce="1000"
|
||||||
|
autogrow
|
||||||
|
@input="change_field('note')"
|
||||||
|
>
|
||||||
|
</q-input>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="recOrderCart.note_ordine_gas"
|
||||||
|
class="note_ordine_gas"
|
||||||
|
v-html="recOrderCart.note_ordine_gas"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
<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
|
||||||
|
v-if="
|
||||||
|
recOrderCart &&
|
||||||
|
recOrderCart.status < shared_consts.OrderStatus.CHECKOUT_SENT
|
||||||
|
"
|
||||||
|
rounded
|
||||||
|
icon="fas fa-shopping-cart"
|
||||||
|
color="green"
|
||||||
|
:label="$t('ecomm.completa_ord')"
|
||||||
|
class="q-mb-sm"
|
||||||
|
:disabled="myTotalQty() < 1"
|
||||||
|
@click="completeOrder()"
|
||||||
|
></q-btn>
|
||||||
|
</div>
|
||||||
|
<div class="center-text">
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="q-ma-sm q-pa-sm text-h8 text-grey"
|
||||||
|
v-if="globalStore && globalStore.site.ecomm.NoteExtraOnCart"
|
||||||
|
>
|
||||||
|
{{ globalStore.site.ecomm.NoteExtraOnCart }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-separator></q-separator>
|
|
||||||
<div class="col-6 q-mr-sm" style="text-align: right">
|
|
||||||
<span class="text-grey q-mr-xs">{{ $t('ecomm.totale') }}:</span>
|
|
||||||
<span class="text-subtitle1 q-mr-sm">€ {{ myTotalPrice() }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<q-input
|
|
||||||
v-if="getNumItems() > 0"
|
|
||||||
v-model="note"
|
|
||||||
style="max-width: 400px"
|
|
||||||
:label="$t('ecomm.note')"
|
|
||||||
filled
|
|
||||||
dense
|
|
||||||
debounce="1000"
|
|
||||||
autogrow
|
|
||||||
@input="change_field('note')"
|
|
||||||
>
|
|
||||||
</q-input>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="recOrderCart.note_ordine_gas"
|
|
||||||
class="note_ordine_gas"
|
|
||||||
v-html="recOrderCart.note_ordine_gas"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div
|
||||||
<q-btn
|
v-else
|
||||||
v-if="
|
style="text-align: center"
|
||||||
recOrderCart &&
|
class="text-grey"
|
||||||
recOrderCart.status < shared_consts.OrderStatus.CHECKOUT_SENT
|
|
||||||
"
|
|
||||||
rounded
|
|
||||||
icon="fas fa-shopping-cart"
|
|
||||||
color="green"
|
|
||||||
:label="$t('ecomm.completa_ord')"
|
|
||||||
class="q-mb-sm"
|
|
||||||
:disabled="myTotalQty() < 1"
|
|
||||||
@click="completeOrder()"
|
|
||||||
></q-btn>
|
|
||||||
</div>
|
|
||||||
<div class="center-text">
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="q-ma-sm q-pa-sm text-h8 text-grey"
|
|
||||||
v-if="globalStore && globalStore.site.ecomm.NoteExtraOnCart"
|
|
||||||
>
|
|
||||||
{{ globalStore.site.ecomm.NoteExtraOnCart }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else style="text-align: center" class="text-grey">
|
|
||||||
{{ $t('ecomm.carrello_vuoto') }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<div
|
|
||||||
class="q-gutter-y-md column text-center q-mx-auto"
|
|
||||||
style="width: 350px; max-width: 100%"
|
|
||||||
>
|
|
||||||
<q-input
|
|
||||||
filled
|
|
||||||
stack-label
|
|
||||||
dense
|
|
||||||
:label="$t('ecomm.code_add_to_cart')"
|
|
||||||
v-model="search"
|
|
||||||
class="q-ml-md"
|
|
||||||
@keyup.enter="insertArticolo()"
|
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
{{ $t('ecomm.carrello_vuoto') }}
|
||||||
<q-icon
|
</div>
|
||||||
class="insert"
|
|
||||||
name="fas fa-shopping-cart"
|
<br />
|
||||||
color="green"
|
<div
|
||||||
@click="insertArticolo()"
|
class="q-gutter-y-md column text-center q-mx-auto"
|
||||||
/>
|
style="width: 350px; max-width: 100%"
|
||||||
</template>
|
>
|
||||||
</q-input>
|
<q-input
|
||||||
|
filled
|
||||||
|
stack-label
|
||||||
|
dense
|
||||||
|
:label="$t('ecomm.code_add_to_cart')"
|
||||||
|
v-model="search"
|
||||||
|
class="q-ml-md"
|
||||||
|
@keyup.enter="insertArticolo()"
|
||||||
|
>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-icon
|
||||||
|
class="insert"
|
||||||
|
name="fas fa-shopping-cart"
|
||||||
|
color="green"
|
||||||
|
@click="insertArticolo()"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="caricamentodati"
|
||||||
|
class="overlay"
|
||||||
|
>
|
||||||
|
<q-spinner-hourglass
|
||||||
|
color="primary"
|
||||||
|
size="50px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" src="./CCart.ts">
|
<script lang="ts" src="./CCart.ts"></script>
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './CCart';
|
@import './CCart';
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export default defineComponent({
|
|||||||
const myrec = ref(<any[string]>[])
|
const myrec = ref(<any[string]>[])
|
||||||
const oldrec = ref(<any[string]>[])
|
const oldrec = ref(<any[string]>[])
|
||||||
const note = ref('')
|
const note = ref('')
|
||||||
|
const codice_sconto = ref('')
|
||||||
const note_per_gestore = ref('')
|
const note_per_gestore = ref('')
|
||||||
const note_per_admin = ref('')
|
const note_per_admin = ref('')
|
||||||
const endload = ref(false)
|
const endload = ref(false)
|
||||||
@@ -129,6 +130,7 @@ export default defineComponent({
|
|||||||
if (recOrderCart.value) {
|
if (recOrderCart.value) {
|
||||||
oldrec.value = recOrderCart.value
|
oldrec.value = recOrderCart.value
|
||||||
myrec.value.note = recOrderCart.value.note!
|
myrec.value.note = recOrderCart.value.note!
|
||||||
|
myrec.value.codice_sconto = recOrderCart.value.codice_sconto!
|
||||||
myrec.value.note_per_gestore = recOrderCart.value.note_per_gestore!
|
myrec.value.note_per_gestore = recOrderCart.value.note_per_gestore!
|
||||||
myrec.value.note_per_admin = recOrderCart.value.note_per_admin!
|
myrec.value.note_per_admin = recOrderCart.value.note_per_admin!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
<div v-else>
|
<div v-else>
|
||||||
<q-field> Note: {{ myrec.note }} </q-field>
|
<q-field> Note: {{ myrec.note }} </q-field>
|
||||||
<q-field color="red"> Note per il Gestore: {{ myrec.note_per_gestore }} </q-field>
|
<q-field color="red"> Note per il Gestore: {{ myrec.note_per_gestore }} </q-field>
|
||||||
|
<q-field color="blue"> Codice Sconto: {{ myrec.codice_sconto }} </q-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
@@ -111,6 +112,18 @@
|
|||||||
@update:model-value="change_field('note_per_gestore')"
|
@update:model-value="change_field('note_per_gestore')"
|
||||||
>
|
>
|
||||||
</q-input>
|
</q-input>
|
||||||
|
<q-input
|
||||||
|
v-if="editOn && tools.isManager() && getNumItems() > 0"
|
||||||
|
v-model="myrec.codice_sconto"
|
||||||
|
style="max-width: 400px"
|
||||||
|
:label="t('ecomm.codice_sconto')"
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
debounce="1000"
|
||||||
|
autogrow
|
||||||
|
@update:model-value="change_field('codice_sconto')"
|
||||||
|
>
|
||||||
|
</q-input>
|
||||||
<q-input
|
<q-input
|
||||||
v-if="editOn && tools.isAdmin() && getNumItems() > 0"
|
v-if="editOn && tools.isAdmin() && getNumItems() > 0"
|
||||||
v-model="myrec.note_per_admin"
|
v-model="myrec.note_per_admin"
|
||||||
|
|||||||
@@ -828,6 +828,7 @@ export default defineComponent({
|
|||||||
: [
|
: [
|
||||||
'pos',
|
'pos',
|
||||||
'image',
|
'image',
|
||||||
|
'addtocart',
|
||||||
'name',
|
'name',
|
||||||
'authors',
|
'authors',
|
||||||
'isbn',
|
'isbn',
|
||||||
@@ -835,7 +836,6 @@ export default defineComponent({
|
|||||||
'stato',
|
'stato',
|
||||||
'date_pub',
|
'date_pub',
|
||||||
'pagine',
|
'pagine',
|
||||||
// 'trafiletto',
|
|
||||||
'quantity',
|
'quantity',
|
||||||
'prezzo',
|
'prezzo',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -47,7 +47,198 @@
|
|||||||
.qta{
|
.qta{
|
||||||
font-size: 1.15rem;
|
font-size: 1.15rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 8px;
|
||||||
}
|
}
|
||||||
.autori{
|
.autori{
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.elimina-btn{
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(135deg, #ff3860, #e61e4d); /*negative gradient */
|
||||||
|
color: white;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(135deg, #34c759, #2ecc71); /*positive gradient */
|
||||||
|
&[data-gradiente="negative"] {
|
||||||
|
background: linear-gradient(135deg, #ff3860, #e61e4d); /*negative gradient */
|
||||||
|
}
|
||||||
|
color: white;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn:hover:not(:disabled) {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-btn:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-display {
|
||||||
|
min-width: 60px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
border: 2px solid #e2e8f0;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-display.updating {
|
||||||
|
transform: scale(1.1);
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn {
|
||||||
|
background: linear-gradient(135deg, #ef4444, #dc2626);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-summary {
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
color: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-top: 32px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 1;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-summary.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-amount {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-items {
|
||||||
|
opacity: 0.9;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkout-btn {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||||
|
color: white;
|
||||||
|
padding: 16px 32px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkout-btn:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-cart {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60px 20px;
|
||||||
|
color: #6b7280;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-cart.show {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-cart i {
|
||||||
|
font-size: 4rem;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% { transform: scale(1); }
|
||||||
|
50% { transform: scale(1.05); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.pulse {
|
||||||
|
animation: pulse 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(30px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-in {
|
||||||
|
animation: fadeInUp 0.5s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.product-content {
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-controls {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn {
|
||||||
|
margin: 16px auto 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import { tools } from '../../store/Modules/tools'
|
import { tools } from '../../store/Modules/tools';
|
||||||
import { CCardState } from '../CCardState'
|
import { CCardState } from '../CCardState';
|
||||||
import { CCopyBtn } from '../CCopyBtn'
|
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 } 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';
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar';
|
||||||
import { loadRouteLocation } from 'vue-router'
|
import { loadRouteLocation } from 'vue-router';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CSingleCart',
|
name: 'CSingleCart',
|
||||||
@@ -42,11 +42,11 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
components: { CTitleBanner, CCardState, CCopyBtn },
|
components: { CTitleBanner, CCardState, CCopyBtn },
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const products = useProducts()
|
const products = useProducts();
|
||||||
const order = toRef(props, 'order')
|
const order = toRef(props, 'order');
|
||||||
const { t } = useI18n()
|
const { t } = useI18n();
|
||||||
|
|
||||||
const $q = useQuasar()
|
const $q = useQuasar();
|
||||||
|
|
||||||
const orderQuantity = ref(<number | undefined>undefined);
|
const orderQuantity = ref(<number | undefined>undefined);
|
||||||
const weight = ref(<number | undefined>undefined);
|
const weight = ref(<number | undefined>undefined);
|
||||||
@@ -54,161 +54,179 @@ export default defineComponent({
|
|||||||
const orderQuantityPreordered = ref(<number | undefined>undefined);
|
const orderQuantityPreordered = ref(<number | undefined>undefined);
|
||||||
const orderTotalPriceProduct = ref(<number | undefined>undefined);
|
const orderTotalPriceProduct = ref(<number | undefined>undefined);
|
||||||
|
|
||||||
const enableQty = ref(false)
|
const enableQty = ref(false);
|
||||||
const endload = ref(false)
|
const endload = ref(false);
|
||||||
const enableQtyPreordered = ref(false)
|
const enableQtyPreordered = ref(false);
|
||||||
const enableChangeTotalPrice = ref(false)
|
const enableChangeTotalPrice = ref(false);
|
||||||
|
|
||||||
watch(orderQuantity, (newValue: any) => {
|
watch(orderQuantity, (newValue: any) => {
|
||||||
if (!newValue)
|
if (!newValue) order.value.quantity = 0;
|
||||||
order.value.quantity = 0
|
else order.value.quantity = parseFloat(newValue);
|
||||||
else
|
|
||||||
order.value.quantity = parseFloat(newValue);
|
|
||||||
|
|
||||||
enableChangeTotalPrice.value = false
|
enableChangeTotalPrice.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(weight, (newValue: any) => {
|
watch(weight, (newValue: any) => {
|
||||||
if (order.value.product) {
|
if (order.value.product) {
|
||||||
if (!newValue)
|
if (!newValue) order.value.product.productInfo.weight = 0;
|
||||||
order.value.product.productInfo.weight = 0
|
else order.value.product.productInfo.weight = parseFloat(newValue);
|
||||||
else
|
|
||||||
order.value.product.productInfo.weight = parseFloat(newValue);
|
|
||||||
}
|
}
|
||||||
enableChangeTotalPrice.value = false
|
enableChangeTotalPrice.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(price, (newValue: any) => {
|
watch(price, (newValue: any) => {
|
||||||
if (order.value) {
|
if (order.value) {
|
||||||
if (!newValue)
|
if (!newValue) order.value.price = 0;
|
||||||
order.value.price = 0
|
else order.value.price = parseFloat(newValue);
|
||||||
else
|
|
||||||
order.value.price = parseFloat(newValue);
|
|
||||||
}
|
}
|
||||||
enableChangeTotalPrice.value = false
|
enableChangeTotalPrice.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(orderQuantityPreordered, (newValue: any) => {
|
watch(orderQuantityPreordered, (newValue: any) => {
|
||||||
if (!newValue)
|
if (!newValue) order.value.quantitypreordered = 0;
|
||||||
order.value.quantitypreordered = 0
|
else order.value.quantitypreordered = parseFloat(newValue);
|
||||||
else
|
|
||||||
order.value.quantitypreordered = parseFloat(newValue);
|
|
||||||
|
|
||||||
enableChangeTotalPrice.value = false
|
enableChangeTotalPrice.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(orderTotalPriceProduct, (newValue: any) => {
|
watch(orderTotalPriceProduct, (newValue: any) => {
|
||||||
if (!newValue)
|
if (!newValue) order.value.TotalPriceProduct = 0;
|
||||||
order.value.TotalPriceProduct = 0
|
else order.value.TotalPriceProduct = parseFloat(newValue);
|
||||||
else
|
|
||||||
order.value.TotalPriceProduct = parseFloat(newValue);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => props.order.TotalPriceProduct, (newValue: any) => {
|
watch(
|
||||||
if (!newValue)
|
() => props.order.TotalPriceProduct,
|
||||||
orderTotalPriceProduct.value = 0
|
(newValue: any) => {
|
||||||
else
|
if (!newValue) orderTotalPriceProduct.value = 0;
|
||||||
orderTotalPriceProduct.value = parseFloat(newValue);
|
else orderTotalPriceProduct.value = parseFloat(newValue);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function myimgclass() {
|
function myimgclass() {
|
||||||
if (props.showall) {
|
if (props.showall) {
|
||||||
return 'imgNormal'
|
return 'imgNormal';
|
||||||
} else {
|
} else {
|
||||||
return 'imgSmall'
|
return 'imgSmall';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function qtyInCart() {
|
||||||
|
return props.order.quantity + props.order.quantitypreordered;
|
||||||
|
}
|
||||||
|
|
||||||
async function addsubqty(addqty: boolean, subqty: boolean) {
|
async function addsubqty(addqty: boolean, subqty: boolean) {
|
||||||
if (products.isQtyAvailableByOrder(props.order)) {
|
if (products.isQtyAvailableByOrder(props.order)) {
|
||||||
if (addqty) {
|
if (addqty) {
|
||||||
if (props.order.quantity >= 100)
|
if (props.order.quantity >= 100) return false;
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subqty) {
|
if (subqty) {
|
||||||
if (props.order.quantity === 0)
|
if (props.order.quantity === 0) return false;
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (products.isInPreorderByOrder(props.order)) {
|
if (products.isInPreorderByOrder(props.order)) {
|
||||||
if (addqty) {
|
if (addqty) {
|
||||||
if (props.order.quantitypreordered >= 100)
|
if (props.order.quantitypreordered >= 100) return false;
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subqty) {
|
if (subqty) {
|
||||||
if (props.order.quantitypreordered === 0)
|
if (props.order.quantitypreordered === 0) return false;
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await products.addSubQtyToItem({
|
return await products
|
||||||
addqty,
|
.addSubQtyToItem({
|
||||||
subqty,
|
addqty,
|
||||||
order: props.order,
|
subqty,
|
||||||
}).then((res: any) => {
|
order: props.order,
|
||||||
if (res.risult) {
|
})
|
||||||
if (res.myord) {
|
.then((res: any) => {
|
||||||
order.value.quantity = res.myord.quantity
|
if (res.risult) {
|
||||||
order.value.quantitypreordered = res.myord.quantitypreordered
|
if (res.myord) {
|
||||||
|
order.value.quantity = res.myord.quantity;
|
||||||
|
order.value.quantitypreordered = res.myord.quantitypreordered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isApplicatoSconto() {
|
function isApplicatoSconto() {
|
||||||
const totalipotetico = order.value.product!.price * (order.value.quantity + order.value.quantitypreordered)
|
const totalipotetico =
|
||||||
|
order.value.product!.price *
|
||||||
|
(order.value.quantity + order.value.quantitypreordered);
|
||||||
if (totalipotetico.toFixed(2) > order.value.TotalPriceProduct.toFixed(2)) {
|
if (totalipotetico.toFixed(2) > order.value.TotalPriceProduct.toFixed(2)) {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeFromCard() {
|
function removeFromCard() {
|
||||||
products.removeFromCart({ order: order.value })
|
$q.dialog({
|
||||||
|
title: order.value.product.productInfo.name,
|
||||||
|
message: 'Sicuro di voler rimuovere il prodotto dal carrello?',
|
||||||
|
ok: {
|
||||||
|
label: 'Rimuovi',
|
||||||
|
color: 'negative',
|
||||||
|
rounded: true,
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
label: 'Annulla',
|
||||||
|
color: 'primary',
|
||||||
|
rounded: true,
|
||||||
|
},
|
||||||
|
}).onOk(() => {
|
||||||
|
products.removeFromCart({ order: order.value });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateOrder(paramstoupdate: any) {
|
async function updateOrder(paramstoupdate: any) {
|
||||||
endload.value = false
|
endload.value = false;
|
||||||
if (enableChangeTotalPrice.value) {
|
if (enableChangeTotalPrice.value) {
|
||||||
paramstoupdate = { ...paramstoupdate, TotalPriceProduct: order.value.TotalPriceProduct }
|
paramstoupdate = {
|
||||||
|
...paramstoupdate,
|
||||||
|
TotalPriceProduct: order.value.TotalPriceProduct,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const myOrdersCart = await products.updateOrderByOrder(props.idOrdersCart, order.value._id, paramstoupdate)
|
const myOrdersCart = await products.updateOrderByOrder(
|
||||||
emit('update')
|
props.idOrdersCart,
|
||||||
mounted()
|
order.value._id,
|
||||||
|
paramstoupdate
|
||||||
|
);
|
||||||
|
emit('update');
|
||||||
|
mounted();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRisparmio(): string {
|
function getRisparmio(): string {
|
||||||
return ((order.value.product!.price * order.value.quantity) - order.value.TotalPriceProduct).toFixed(2)
|
return (
|
||||||
|
order.value.product!.price * order.value.quantity -
|
||||||
|
order.value.TotalPriceProduct
|
||||||
|
).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
endload.value = false
|
endload.value = false;
|
||||||
weight.value = props.order.product?.productInfo.weight
|
weight.value = props.order.product?.productInfo.weight;
|
||||||
price.value = props.order.price
|
price.value = props.order.price;
|
||||||
if (props.order.quantity !== 0) {
|
if (props.order.quantity !== 0) {
|
||||||
orderQuantity.value = props.order.quantity
|
orderQuantity.value = props.order.quantity;
|
||||||
enableQty.value = true
|
enableQty.value = true;
|
||||||
}
|
}
|
||||||
if (props.order.quantitypreordered !== 0) {
|
if (props.order.quantitypreordered !== 0) {
|
||||||
orderQuantityPreordered.value = props.order.quantitypreordered
|
orderQuantityPreordered.value = props.order.quantitypreordered;
|
||||||
enableQtyPreordered.value = true
|
enableQtyPreordered.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
orderTotalPriceProduct.value = props.order.TotalPriceProduct
|
orderTotalPriceProduct.value = props.order.TotalPriceProduct;
|
||||||
endload.value = true
|
endload.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeTotalPrice() {
|
function changeTotalPrice() {
|
||||||
console.log('changeTotalPrice')
|
console.log('changeTotalPrice');
|
||||||
enableChangeTotalPrice.value = true
|
enableChangeTotalPrice.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
myimgclass,
|
myimgclass,
|
||||||
@@ -229,6 +247,7 @@ export default defineComponent({
|
|||||||
changeTotalPrice,
|
changeTotalPrice,
|
||||||
orderTotalPriceProduct,
|
orderTotalPriceProduct,
|
||||||
endload,
|
endload,
|
||||||
}
|
qtyInCart,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|||||||
@@ -86,26 +86,30 @@
|
|||||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="showall && !nomodif && products.CanDeleteIfSub(order)"
|
v-if="showall && !nomodif && products.CanDeleteIfSub(order)"
|
||||||
icon="fas fa-trash"
|
icon="fas fa-trash-alt"
|
||||||
color="negative"
|
|
||||||
round
|
round
|
||||||
size="xs"
|
size="sm"
|
||||||
|
class="elimina-btn"
|
||||||
@click="removeFromCard"
|
@click="removeFromCard"
|
||||||
>
|
>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
<!--
|
||||||
v-else-if="showall && !nomodif"
|
:label="
|
||||||
:disable="!products.enableSubQty(order)"
|
|
||||||
size="sm"
|
|
||||||
icon="fas fa-cart-arrow-down"
|
|
||||||
:color="products.enableSubQty(order) ? 'negative' : 'grey'"
|
|
||||||
@click="addsubqty(false, true)"
|
|
||||||
rounded
|
|
||||||
:label="
|
|
||||||
t('products.subcart', {
|
t('products.subcart', {
|
||||||
qta: products.qtaNextSub(order, order.product),
|
qta: products.qtaNextSub(order, order.product),
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
|
-->
|
||||||
|
<q-btn
|
||||||
|
v-else-if="!nomodif"
|
||||||
|
:disable="!products.enableSubQty(order)"
|
||||||
|
size="sm"
|
||||||
|
class="quantity-btn"
|
||||||
|
data-gradiente="negative"
|
||||||
|
:icon="qtyInCart() === 1 ? 'fas fa-trash': 'fas fa-minus'"
|
||||||
|
:color="products.enableSubQty(order) ? undefined : 'grey'"
|
||||||
|
@click="qtyInCart() === 1 ? removeFromCard(): addsubqty(false, true)"
|
||||||
|
rounded
|
||||||
></q-btn>
|
></q-btn>
|
||||||
<div v-if="editmode">
|
<div v-if="editmode">
|
||||||
<q-input
|
<q-input
|
||||||
@@ -115,6 +119,7 @@
|
|||||||
debounce="500"
|
debounce="500"
|
||||||
borderless
|
borderless
|
||||||
rounded
|
rounded
|
||||||
|
class="quantity-display"
|
||||||
dense
|
dense
|
||||||
:label="t('products.quantity')"
|
:label="t('products.quantity')"
|
||||||
></q-input>
|
></q-input>
|
||||||
@@ -124,6 +129,7 @@
|
|||||||
autofocus
|
autofocus
|
||||||
debounce="500"
|
debounce="500"
|
||||||
borderless
|
borderless
|
||||||
|
class="quantity-display"
|
||||||
rounded
|
rounded
|
||||||
densep
|
densep
|
||||||
:label="t('ecomm.preord')"
|
:label="t('ecomm.preord')"
|
||||||
@@ -159,24 +165,25 @@
|
|||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="showall"
|
v-else
|
||||||
:class="`q-mx-sm text-blue-14 qta`"
|
:class="`q-mx-sm text-blue-14 qta`"
|
||||||
>
|
>
|
||||||
{{ order.quantity + order.quantitypreordered }}
|
{{ order.quantity + order.quantitypreordered }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-btn
|
<!-- :label="
|
||||||
v-if="showall && !nomodif"
|
|
||||||
icon-right="fas fa-cart-plus"
|
|
||||||
color="positive"
|
|
||||||
:disable="!products.enableAddQty(order, order.product)"
|
|
||||||
rounded
|
|
||||||
size="sm"
|
|
||||||
:label="
|
|
||||||
t('products.addcart', {
|
t('products.addcart', {
|
||||||
qta: products.qtaNextAdd(order, order.product),
|
qta: products.qtaNextAdd(order, order.product),
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
|
-->
|
||||||
|
<q-btn
|
||||||
|
v-if="!nomodif"
|
||||||
|
icon-right="fas fa-plus"
|
||||||
|
class="quantity-btn"
|
||||||
|
:disable="!products.enableAddQty(order, order.product)"
|
||||||
|
rounded
|
||||||
|
size="sm"
|
||||||
@click="addsubqty(true, false)"
|
@click="addsubqty(true, false)"
|
||||||
>
|
>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
@@ -229,7 +236,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section side>
|
<!--<q-item-section side>
|
||||||
<q-item-label>
|
<q-item-label>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -243,7 +250,7 @@
|
|||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>-->
|
||||||
|
|
||||||
<!--<q-item-section side top>
|
<!--<q-item-section side top>
|
||||||
<q-item-label caption>meta</q-item-label>
|
<q-item-label caption>meta</q-item-label>
|
||||||
|
|||||||
@@ -2596,4 +2596,17 @@ body.body--dark {
|
|||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.7); /* Sfondo semi-trasparente */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,8 @@ export interface IOrder {
|
|||||||
date_payment?: Date
|
date_payment?: Date
|
||||||
date_shipping?: Date
|
date_shipping?: Date
|
||||||
date_delivered?: Date
|
date_delivered?: Date
|
||||||
notes?: string
|
note?: string
|
||||||
|
codice_sconto?: string
|
||||||
modify_at?: Date
|
modify_at?: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +383,7 @@ export interface IScontistica {
|
|||||||
qta: number,
|
qta: number,
|
||||||
perc_sconto: number,
|
perc_sconto: number,
|
||||||
price: number,
|
price: number,
|
||||||
|
applica: number,
|
||||||
comulativo: boolean,
|
comulativo: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +441,7 @@ export interface IOrderCart {
|
|||||||
date_ricevuto?: Date
|
date_ricevuto?: Date
|
||||||
created_at?: Date
|
created_at?: Date
|
||||||
note: string
|
note: string
|
||||||
|
codice_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
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ const msg_it = {
|
|||||||
price: 'Prezzo',
|
price: 'Prezzo',
|
||||||
qta: 'Quantita',
|
qta: 'Quantita',
|
||||||
comulativo: 'Cumulativo',
|
comulativo: 'Cumulativo',
|
||||||
|
applica: 'Applica',
|
||||||
},
|
},
|
||||||
otherpages: {
|
otherpages: {
|
||||||
myactivities: 'Attività',
|
myactivities: 'Attività',
|
||||||
@@ -1871,12 +1872,17 @@ const msg_it = {
|
|||||||
ecomm: {
|
ecomm: {
|
||||||
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',
|
||||||
|
applica_sconto: 'Applica',
|
||||||
|
rimuovi_sconto: 'Rimuovi',
|
||||||
|
sconto_appl: 'Sconto Applicato',
|
||||||
prodotto: 'prodotto',
|
prodotto: 'prodotto',
|
||||||
prodotti: 'prodotti',
|
prodotti: 'prodotti',
|
||||||
prod_sul_carrello: '{qty} {strprod} sul Carrello (Totale: {tot})',
|
prod_sul_carrello: '{qty} {strprod} sul Carrello (Totale: {tot})',
|
||||||
prodotto_tolto: 'Il prodotto è stato tolto dal Carrello',
|
prodotto_tolto: 'Il prodotto è stato tolto dal Carrello',
|
||||||
error_cart: 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.',
|
error_cart: 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.',
|
||||||
completa_ord: 'Invia l\'Ordine',
|
completa_ord: 'Invia l\'Ordine',
|
||||||
|
esporta_csv:'Esporta Lista',
|
||||||
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
|
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
|
||||||
order: 'Ordine',
|
order: 'Ordine',
|
||||||
ord_confirmed: 'Ordine Confermato',
|
ord_confirmed: 'Ordine Confermato',
|
||||||
|
|||||||
@@ -696,6 +696,7 @@ export const getcolorderscart = [
|
|||||||
AddCol({ name: 'items', label_trans: 'order.items' }),
|
AddCol({ name: 'items', label_trans: 'order.items' }),
|
||||||
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: '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 }),
|
||||||
@@ -892,6 +893,7 @@ export const colTableScontistica = [
|
|||||||
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'perc_sconto', label_trans: 'scontistica.perc_sconto', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'perc_sconto', label_trans: 'scontistica.perc_sconto', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
|
||||||
|
AddCol({ name: 'applica', label_trans: 'products.applica', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'comulativo', label_trans: 'products.comulativo', fieldtype: costanti.FieldType.boolean }),
|
AddCol({ name: 'comulativo', label_trans: 'products.comulativo', fieldtype: costanti.FieldType.boolean }),
|
||||||
AddCol(DeleteRec),
|
AddCol(DeleteRec),
|
||||||
AddCol(DuplicateRec),
|
AddCol(DuplicateRec),
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
|
|||||||
ricevuto: false,
|
ricevuto: false,
|
||||||
note: '',
|
note: '',
|
||||||
note_per_gestore: '',
|
note_per_gestore: '',
|
||||||
|
codice_sconto:'',
|
||||||
note_per_admin: '',
|
note_per_admin: '',
|
||||||
note_ordine_gas: '',
|
note_ordine_gas: '',
|
||||||
};
|
};
|
||||||
@@ -1374,10 +1375,12 @@ export const useProducts = defineStore('Products', {
|
|||||||
cart_id,
|
cart_id,
|
||||||
status,
|
status,
|
||||||
note,
|
note,
|
||||||
|
codice_sconto,
|
||||||
}: {
|
}: {
|
||||||
cart_id: string;
|
cart_id: string;
|
||||||
status: number;
|
status: number;
|
||||||
note: string;
|
note: string;
|
||||||
|
codice_sconto: string;
|
||||||
}) {
|
}) {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const globalStore = useGlobalStore();
|
const globalStore = useGlobalStore();
|
||||||
@@ -1395,6 +1398,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
cart_id,
|
cart_id,
|
||||||
status,
|
status,
|
||||||
note,
|
note,
|
||||||
|
codice_sconto,
|
||||||
options: this.getOptions(true),
|
options: this.getOptions(true),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1494,6 +1498,49 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
return ris;
|
return ris;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async ApplicaSconto({
|
||||||
|
cart_id,
|
||||||
|
codice_sconto,
|
||||||
|
}: {
|
||||||
|
cart_id: string;
|
||||||
|
codice_sconto: number;
|
||||||
|
}) {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const globalStore = useGlobalStore();
|
||||||
|
|
||||||
|
if (!globalStore.site.confpages.enableEcommerce) return null;
|
||||||
|
|
||||||
|
let ris = null;
|
||||||
|
|
||||||
|
ris = await Api.SendReq(
|
||||||
|
'/cart/' + this.userActive._id + '/app_sc',
|
||||||
|
'POST',
|
||||||
|
{
|
||||||
|
cart_id,
|
||||||
|
code: codice_sconto,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
this.updateDataProduct(res);
|
||||||
|
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log('error ApplicaSconto', error);
|
||||||
|
userStore.setErrorCatch(error);
|
||||||
|
return new Types.AxiosError(
|
||||||
|
serv_constants.RIS_CODE_ERR,
|
||||||
|
null,
|
||||||
|
toolsext.ERR_GENERICO,
|
||||||
|
error
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return ris;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
async addtoCartBase({
|
async addtoCartBase({
|
||||||
$q,
|
$q,
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -674,11 +674,11 @@ export default defineComponent({
|
|||||||
// console.log('row', serverData.value)
|
// console.log('row', serverData.value)
|
||||||
// console.log('mycolumns.value', mycolumns.value)
|
// console.log('mycolumns.value', mycolumns.value)
|
||||||
// naive encoding to csv format
|
// naive encoding to csv format
|
||||||
const content = [columns_listafiltrati.value.map((col: any) => (col.label))].concat(
|
const headers = columns_listafiltrati.value.map((col: any) => col.label);
|
||||||
listatotali.value.map((row: any) => columns_listafiltrati.value.map((col: any) => (
|
const rows = listatotali.value.map((row: any) =>
|
||||||
row[col.field]
|
columns_listafiltrati.value.map((col: any) => row[col.field]).join(',')
|
||||||
)).join(','))
|
);
|
||||||
).join('\r\n')
|
const content = [headers.join(',')].concat(rows).join('\r\n');
|
||||||
|
|
||||||
const status = exportFile(
|
const status = exportFile(
|
||||||
'lista-totali-' + productStore.getGasordineNameById(storeGasordine.value) + '_' + tools.getstrYYMMDDDate(tools.getDateNow()) + '.csv',
|
'lista-totali-' + productStore.getGasordineNameById(storeGasordine.value) + '_' + tools.getstrYYMMDDDate(tools.getDateNow()) + '.csv',
|
||||||
|
|||||||
@@ -447,6 +447,9 @@
|
|||||||
<div v-if="props.row.note" class="note">
|
<div v-if="props.row.note" class="note">
|
||||||
Note: {{ props.row.note }}
|
Note: {{ props.row.note }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="props.row.codice_sconto" class="codice_sconto">
|
||||||
|
Codice Sconto: {{ props.row.codice_sconto }}
|
||||||
|
</div>
|
||||||
<div v-if="props.row.note_per_gestore" class="note">
|
<div v-if="props.row.note_per_gestore" class="note">
|
||||||
Note per Gestore: {{ props.row.note_per_gestore }}
|
Note per Gestore: {{ props.row.note_per_gestore }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user