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