aggiornamento Ordini GAS filtri
This commit is contained in:
@@ -47,6 +47,8 @@ export default defineComponent({
|
||||
const $q = useQuasar()
|
||||
|
||||
const orderQuantity = ref(<number | undefined>undefined);
|
||||
const weight = ref(<number | undefined>undefined);
|
||||
const price = ref(<number | undefined>undefined);
|
||||
const orderQuantityPreordered = ref(<number | undefined>undefined);
|
||||
const orderTotalPriceProduct = ref(<number | undefined>undefined);
|
||||
|
||||
@@ -64,6 +66,26 @@ export default defineComponent({
|
||||
enableChangeTotalPrice.value = false
|
||||
});
|
||||
|
||||
watch(weight, (newValue: any) => {
|
||||
if (order.value.product) {
|
||||
if (!newValue)
|
||||
order.value.product.productInfo.weight = 0
|
||||
else
|
||||
order.value.product.productInfo.weight = parseFloat(newValue);
|
||||
}
|
||||
enableChangeTotalPrice.value = false
|
||||
});
|
||||
|
||||
watch(price, (newValue: any) => {
|
||||
if (order.value) {
|
||||
if (!newValue)
|
||||
order.value.price = 0
|
||||
else
|
||||
order.value.price = parseFloat(newValue);
|
||||
}
|
||||
enableChangeTotalPrice.value = false
|
||||
});
|
||||
|
||||
watch(orderQuantityPreordered, (newValue: any) => {
|
||||
if (!newValue)
|
||||
order.value.quantitypreordered = 0
|
||||
@@ -137,7 +159,7 @@ export default defineComponent({
|
||||
|
||||
function isApplicatoSconto() {
|
||||
const totalipotetico = order.value.product!.price * (order.value.quantity + order.value.quantitypreordered)
|
||||
if (totalipotetico > order.value.TotalPriceProduct) {
|
||||
if (totalipotetico.toFixed(2) > order.value.TotalPriceProduct.toFixed(2)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -164,6 +186,8 @@ export default defineComponent({
|
||||
|
||||
function mounted() {
|
||||
endload.value = false
|
||||
weight.value = props.order.product?.productInfo.weight
|
||||
price.value = props.order.price
|
||||
if (props.order.quantity !== 0) {
|
||||
orderQuantity.value = props.order.quantity
|
||||
enableQty.value = true
|
||||
@@ -195,6 +219,8 @@ export default defineComponent({
|
||||
t,
|
||||
updateOrder,
|
||||
orderQuantity,
|
||||
weight,
|
||||
price,
|
||||
orderQuantityPreordered,
|
||||
enableQty,
|
||||
enableQtyPreordered,
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
<template>
|
||||
<div v-if="order && order.product && order.product.productInfo" class="q-pa-xs q-gutter-xs">
|
||||
<div
|
||||
v-if="order && order.product && order.product.productInfo"
|
||||
class="q-pa-xs q-gutter-xs"
|
||||
>
|
||||
order: {{order}}
|
||||
<div v-if="order.product">
|
||||
<q-item>
|
||||
<q-item-section top thumbnail class="q-ml-none">
|
||||
<img
|
||||
v-if="order.product && order.product.productInfo && order.product.productInfo.img"
|
||||
v-if="
|
||||
order.product &&
|
||||
order.product.productInfo &&
|
||||
order.product.productInfo.img
|
||||
"
|
||||
:src="`` + order.product.productInfo.img"
|
||||
:alt="order.product.productInfo.name"
|
||||
:class="myimgclass()"
|
||||
@@ -18,6 +26,7 @@
|
||||
</div>
|
||||
{{ order.product.productInfo.name }}
|
||||
</q-item-label>
|
||||
|
||||
<q-item-label caption>
|
||||
<div
|
||||
class="text-black text-h8"
|
||||
@@ -32,6 +41,28 @@
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||
<q-input
|
||||
v-if="editmode"
|
||||
v-model="weight"
|
||||
autofocus
|
||||
debounce="500"
|
||||
borderless
|
||||
rounded
|
||||
dense
|
||||
:label="t('products.weight')"
|
||||
></q-input>
|
||||
<q-input
|
||||
v-if="editmode"
|
||||
v-model="price"
|
||||
autofocus
|
||||
debounce="500"
|
||||
borderless
|
||||
rounded
|
||||
dense
|
||||
:label="t('products.price')"
|
||||
></q-input>
|
||||
</div>
|
||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||
<q-btn
|
||||
v-if="showall && !nomodif"
|
||||
@@ -91,7 +122,8 @@
|
||||
@click="
|
||||
updateOrder({
|
||||
quantitypreordered: order.quantitypreordered,
|
||||
quantity: order.quantity,
|
||||
quantity: order.quantity,
|
||||
price: order.price,
|
||||
})
|
||||
"
|
||||
>
|
||||
@@ -132,8 +164,13 @@
|
||||
: 0
|
||||
}}
|
||||
</span>
|
||||
<span v-if="tools.isManager() && order.TotalPriceProduct !== order.TotalPriceProductCalc"
|
||||
:class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
|
||||
<span
|
||||
v-if="
|
||||
tools.isManager() &&
|
||||
order.TotalPriceProduct.toFixed(2) !== order.TotalPriceProductCalc.toFixed(2)
|
||||
"
|
||||
:class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"
|
||||
>
|
||||
(Calc: €
|
||||
{{
|
||||
order.TotalPriceProductCalc
|
||||
@@ -148,16 +185,20 @@
|
||||
>€
|
||||
{{
|
||||
(
|
||||
(order.price * order.quantity) +
|
||||
(order.price * order.quantitypreordered)
|
||||
order.price * order.quantity +
|
||||
order.price * order.quantitypreordered
|
||||
).toFixed(2)
|
||||
}}</span
|
||||
>)</span
|
||||
>
|
||||
</span>
|
||||
<span v-if="isApplicatoSconto() && !editmode" class="ordine_scritta_sconto">{{
|
||||
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
|
||||
}}</span>
|
||||
<span
|
||||
v-if="isApplicatoSconto() && !editmode"
|
||||
class="ordine_scritta_sconto"
|
||||
>{{
|
||||
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
Reference in New Issue
Block a user