Aggiungi il codice alla cassa in automatico
This commit is contained in:
@@ -10,17 +10,15 @@
|
||||
</q-btn>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right">
|
||||
<span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span> <span
|
||||
class="text-subtitle1 q-mr-sm ">€ {{ myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span>
|
||||
<span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span> <span class="text-subtitle1 q-mr-sm ">€ {{
|
||||
myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div id="mybody">
|
||||
<div v-for="(rec, index) in ordersCart" :key="index" class="col">
|
||||
|
||||
<CSingleCart
|
||||
:order="rec.order"
|
||||
:showall="false">
|
||||
<CSingleCart :order="rec.order" :showall="false">
|
||||
</CSingleCart>
|
||||
|
||||
</div>
|
||||
@@ -29,10 +27,13 @@
|
||||
{{ $t('ecomm.carrello_vuoto') }}
|
||||
</div>
|
||||
<div v-else style="text-align: center">
|
||||
<q-btn
|
||||
rounded icon="fas fa-shopping-cart" color="green" :label="$t('ecomm.btn_cassa')" class="q-mb-sm" to="/checkout"
|
||||
@click="closecart"></q-btn>
|
||||
<div class="text-center">
|
||||
<q-btn rounded icon="fas fa-shopping-cart" color="primary" :label="$t('ecomm.btn_cassa')"
|
||||
class="q-mb-sm" to="/checkout">
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -6,25 +6,25 @@
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.centeritems{
|
||||
.centeritems {
|
||||
place-content: center;
|
||||
}
|
||||
|
||||
.prod_price{
|
||||
.prod_price {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.prod_disp{
|
||||
.prod_disp {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.prod_qtywarn{
|
||||
.prod_qtywarn {
|
||||
padding-left: 10px;
|
||||
font-size: 1rem;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.totali{
|
||||
.totali {
|
||||
font-weight: bold;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
@@ -32,4 +32,9 @@
|
||||
.prod_sconti {
|
||||
font-size: 1.1rem;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.product_code {
|
||||
font-size: 0.75rem;
|
||||
color: gray;
|
||||
}
|
||||
@@ -79,41 +79,15 @@ export default defineComponent({
|
||||
return 'fas fa-heart'
|
||||
}
|
||||
}
|
||||
function addtoCart(add: boolean) {
|
||||
async function addtoCart(add: boolean) {
|
||||
|
||||
if (!userStore.isLogged) {
|
||||
tools.showNeutralNotif($q, t('ecomm.area_personale'))
|
||||
globalStore.rightDrawerOpen = true
|
||||
return false
|
||||
}
|
||||
await products.addtoCartBase({ $q, t, code: myproduct.value.code!, order: myorder, addqty: add })
|
||||
|
||||
products.addToCart({ product: myproduct.value, order: myorder, addqty: add }).then((ris) => {
|
||||
let strprod = t('ecomm.prodotto')
|
||||
|
||||
if (myorder.quantity > 1 || myorder.quantity === 0)
|
||||
strprod = t('ecomm.prodotti')
|
||||
|
||||
let msg = ''
|
||||
if (ris === null)
|
||||
msg = t('ecomm.error_cart')
|
||||
else {
|
||||
|
||||
if (myorder.quantity === 0) {
|
||||
msg = t('ecomm.prodotto_tolto')
|
||||
} else {
|
||||
msg = t('ecomm.prod_sul_carrello', { strprod, qty: myorder.quantity })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updateproduct()
|
||||
|
||||
if (ris === null || myorder.quantity === 0)
|
||||
tools.showNotif($q, msg)
|
||||
else
|
||||
tools.showPositiveNotif($q, msg)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function getnumstore() {
|
||||
@@ -139,14 +113,14 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function updateproduct() {
|
||||
myproduct.value = products.getProduct(props.code)
|
||||
myproduct.value = products.getProductByCode(props.code)
|
||||
products.updateQuantityAvailable(myproduct.value._id)
|
||||
}
|
||||
|
||||
function getStorehouses() {
|
||||
if (!myproduct.value)
|
||||
return []
|
||||
|
||||
|
||||
const myarr: any = []
|
||||
let ind = 1
|
||||
myproduct.value.storehouses.forEach((store) => {
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
<div class="text-h7 boldhigh">
|
||||
{{ myproduct.name }}
|
||||
</div>
|
||||
<div class="product_code">
|
||||
{{$t('ecomm.codice')}}: {{ myproduct.code }}
|
||||
</div>
|
||||
</div>
|
||||
</q-item>
|
||||
<q-item>
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.ordine_scontato_barrato{
|
||||
text-decoration: line-through;
|
||||
.ordine_scontato{
|
||||
color: gray;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.barrato {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.ordine_scontato_nuovo{
|
||||
font-size: 1.1rem;
|
||||
|
||||
@@ -73,11 +73,16 @@ export default defineComponent({
|
||||
products.removeFromCart({ order: order.value })
|
||||
}
|
||||
|
||||
function getRisparmio(): string {
|
||||
return ((order.value.price * order.value.quantity) - order.value.TotalPriceProduct).toFixed(2)
|
||||
}
|
||||
|
||||
return {
|
||||
myimgclass,
|
||||
addsubqty,
|
||||
removeFromCard,
|
||||
isApplicatoSconto,
|
||||
getRisparmio,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
@click="addsubqty(true, false)"></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 no-wrap text-subtitle3 q-mr-sm">
|
||||
<div v-if="isApplicatoSconto()">
|
||||
<span class="ordine_scontato_barrato">€ {{ (order.price * order.quantity).toFixed(2) }}</span>
|
||||
</div>
|
||||
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{ $t('ecomm.sconto_applicato') }}</span>
|
||||
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
|
||||
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">€ {{ order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0 }}</span>
|
||||
<span v-if="isApplicatoSconto()">
|
||||
<span class="ordine_scontato">(<span class="barrato">€ {{(order.price * order.quantity).toFixed(2) }}</span>)</span>
|
||||
</span>
|
||||
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{ $t('ecomm.sconto_applicato', {risparmio: getRisparmio()}) }}</span>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<q-btn v-if="!nomodif" icon="fas fa-times" color="negative" round size="xs" @click="removeFromCard">
|
||||
|
||||
Reference in New Issue
Block a user