Corretto incongruenze OrdersCart
This commit is contained in:
@@ -10,7 +10,7 @@ import { CCopyBtn } from '../CCopyBtn'
|
||||
|
||||
import { func_tools, toolsext } from '@store/Modules/toolsext'
|
||||
|
||||
import { IOrder, IOrderCart, IProduct } from '@src/model'
|
||||
import { IBaseOrder, IOrder, IOrderCart, IProduct } from '@src/model'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useProducts } from '@store/Products'
|
||||
|
||||
@@ -43,11 +43,15 @@ export default defineComponent({
|
||||
const globalStore = useGlobalStore()
|
||||
const products = useProducts()
|
||||
|
||||
const listord = ref(<IOrderCart[]>[])
|
||||
const sumval = ref(0)
|
||||
|
||||
const site = ref(globalStore.site)
|
||||
|
||||
const myorder = reactive(<IOrder>{
|
||||
idapp: process.env.APP_ID,
|
||||
quantity: 0,
|
||||
quantitypreordered: 0,
|
||||
idStorehouse: '',
|
||||
idProvider: ''
|
||||
})
|
||||
@@ -87,7 +91,11 @@ export default defineComponent({
|
||||
return false
|
||||
}
|
||||
|
||||
await products.addtoCartBase({ $q, t, code: myproduct.value.code!, order: myorder, addqty: add })
|
||||
const ris = await products.addtoCartBase({ $q, t, code: myproduct.value.code!, order: myorder, addqty: add })
|
||||
updateproduct()
|
||||
if (ris && ris.myord) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getnumstore() {
|
||||
@@ -214,16 +222,36 @@ export default defineComponent({
|
||||
|
||||
function enableAddQty() {
|
||||
if (site.value.ecomm && site.value.ecomm.enablePreOrders) {
|
||||
return true
|
||||
return getQtyBookableAvailable() > 0 || getQtyAvailable() > 0
|
||||
} else {
|
||||
return getQtyAvailable() > 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function visuListDisponibili() {
|
||||
openlistorders.value = true
|
||||
sumval.value = products.getSumQtyOrderProductInOrdersCart(myproduct.value._id)
|
||||
|
||||
listord.value = arrordersCart.value.filter((ordercart: IOrderCart) => ordercart.items!.reduce((accumulator, item) => {
|
||||
return accumulator + item.order.quantity
|
||||
}, 0))
|
||||
}
|
||||
|
||||
function visuListBookable() {
|
||||
openlistorders.value = true
|
||||
sumval.value = products.getSumQtyPreOrderInOrdersCart(myproduct.value._id)
|
||||
|
||||
listord.value = arrordersCart.value.filter((ordercart: IOrderCart) => ordercart.items!.reduce((accumulator, item) => {
|
||||
return accumulator + item.order.quantitypreordered
|
||||
}, 0))
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
|
||||
return {
|
||||
visuListDisponibili,
|
||||
visuListBookable,
|
||||
addtoCart,
|
||||
iconWhishlist,
|
||||
getmycardcl,
|
||||
@@ -251,6 +279,8 @@ export default defineComponent({
|
||||
site,
|
||||
getQtyWarnPreOrdered,
|
||||
getQtyBookableAvailable,
|
||||
listord,
|
||||
sumval,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user