Aggiornamento modifiche preOrdini

This commit is contained in:
Surya Paolo
2023-12-20 21:56:30 +01:00
parent 265c8f4d9e
commit 56b433dae3
13 changed files with 252 additions and 71 deletions

View File

@@ -40,14 +40,29 @@ export default defineComponent({
}
function addsubqty(addqty: boolean, subqty: boolean) {
if (addqty) {
if (props.order.quantity >= 10)
return false
}
if (products.isQtyAvailableByOrder(props.order)) {
if (addqty) {
if (props.order.quantity >= 20)
return false
}
if (subqty) {
if (props.order.quantity === 0)
return false
if (subqty) {
if (props.order.quantity === 0)
return false
}
} else {
if (products.isInPreorderByOrder(props.order)) {
if (addqty) {
if (props.order.quantitypreordered >= 20)
return false
}
if (subqty) {
if (props.order.quantitypreordered === 0)
return false
}
}
}
products.addSubQtyToItem({
@@ -56,14 +71,15 @@ export default defineComponent({
order: props.order,
}).then((res: any) => {
if (res.risult) {
order.value.quantity = res.qty
order.value.quantity = res.myord.quantity
order.value.quantitypreordered = res.myord.quantitypreordered
}
})
}
function isApplicatoSconto() {
const totalipotetico = order.value.price! * order.value.quantity
if (totalipotetico > order.value.TotalPriceProduct!) {
const totalipotetico = order.value.price * (order.value.quantity + order.value.quantitypreordered)
if (totalipotetico > order.value.TotalPriceProduct) {
return true
}
return false

View File

@@ -22,14 +22,14 @@
<div class="self-center no-outline" tabindex="0" >{{ order.quantity }}</div>
</template>
</q-field>-->
<div :class="`q-mx-sm text-blue-14`">{{ order.quantity }}</div>
<div v-if="order.quantity > 0" :class="`q-mx-sm text-blue-14`">{{ order.quantity + order.quantitypreordered }}</div>
<q-btn v-if="showall && !nomodif" round size="xs" text-color="grey" icon="fas fa-plus"
@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">&nbsp; {{ (order.price * order.quantity).toFixed(2) }}</span>
<span class="ordine_scontato_barrato">&nbsp; {{ ((order.price * order.quantity) + (order.price * order.quantitypreordered)).toFixed(2) }}</span>
</div>
&nbsp;{{ order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0 }}
</div>