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 { 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 { tools } from '@store/Modules/tools'
|
||||||
import { useProducts } from '@store/Products'
|
import { useProducts } from '@store/Products'
|
||||||
|
|
||||||
@@ -43,11 +43,15 @@ export default defineComponent({
|
|||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
const products = useProducts()
|
const products = useProducts()
|
||||||
|
|
||||||
|
const listord = ref(<IOrderCart[]>[])
|
||||||
|
const sumval = ref(0)
|
||||||
|
|
||||||
const site = ref(globalStore.site)
|
const site = ref(globalStore.site)
|
||||||
|
|
||||||
const myorder = reactive(<IOrder>{
|
const myorder = reactive(<IOrder>{
|
||||||
idapp: process.env.APP_ID,
|
idapp: process.env.APP_ID,
|
||||||
quantity: 0,
|
quantity: 0,
|
||||||
|
quantitypreordered: 0,
|
||||||
idStorehouse: '',
|
idStorehouse: '',
|
||||||
idProvider: ''
|
idProvider: ''
|
||||||
})
|
})
|
||||||
@@ -87,7 +91,11 @@ export default defineComponent({
|
|||||||
return false
|
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() {
|
function getnumstore() {
|
||||||
@@ -214,16 +222,36 @@ export default defineComponent({
|
|||||||
|
|
||||||
function enableAddQty() {
|
function enableAddQty() {
|
||||||
if (site.value.ecomm && site.value.ecomm.enablePreOrders) {
|
if (site.value.ecomm && site.value.ecomm.enablePreOrders) {
|
||||||
return true
|
return getQtyBookableAvailable() > 0 || getQtyAvailable() > 0
|
||||||
} else {
|
} else {
|
||||||
return getQtyAvailable() > 0
|
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)
|
onMounted(load)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
visuListDisponibili,
|
||||||
|
visuListBookable,
|
||||||
addtoCart,
|
addtoCart,
|
||||||
iconWhishlist,
|
iconWhishlist,
|
||||||
getmycardcl,
|
getmycardcl,
|
||||||
@@ -251,6 +279,8 @@ export default defineComponent({
|
|||||||
site,
|
site,
|
||||||
getQtyWarnPreOrdered,
|
getQtyWarnPreOrdered,
|
||||||
getQtyBookableAvailable,
|
getQtyBookableAvailable,
|
||||||
|
listord,
|
||||||
|
sumval,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -109,12 +109,12 @@
|
|||||||
<q-list>
|
<q-list>
|
||||||
<q-item
|
<q-item
|
||||||
:clickable="tools.isManager()"
|
:clickable="tools.isManager()"
|
||||||
@click="tools.isManager() ? (openlistorders = true) : null"
|
@click="tools.isManager() ? (visuListDisponibili()) : null"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon
|
<q-icon
|
||||||
:color="getQtyAvailable() >= 0 ? 'green' : 'blue'"
|
color="green"
|
||||||
:name="getQtyAvailable() >= 0 ? 'fas fa-store' : 'fas fa-edit'"
|
name="fas fa-store"
|
||||||
/>
|
/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|
||||||
@@ -146,9 +146,9 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
v-if="getQtyBookableAvailable() > 0"
|
v-if="getQtyBookableAvailable() > 0 || (myproduct.bookableQty > 0)"
|
||||||
:clickable="tools.isManager()"
|
:clickable="tools.isManager()"
|
||||||
@click="tools.isManager() ? (openlistorders = true) : null"
|
@click="tools.isManager() ? (visuListBookable()) : null"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon color="blue" name="fas fa-edit" />
|
<q-icon color="blue" name="fas fa-edit" />
|
||||||
@@ -210,7 +210,6 @@
|
|||||||
class="self-center no-outline"
|
class="self-center no-outline"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
Preord.: {{ myorder.quantitypreordered }}
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-field>
|
</q-field>
|
||||||
@@ -298,7 +297,7 @@
|
|||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
v-for="(ordcart, index) of arrordersCart"
|
v-for="(ordcart, index) of listord"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="listaev listaev__table"
|
class="listaev listaev__table"
|
||||||
>
|
>
|
||||||
@@ -347,7 +346,7 @@
|
|||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
Totali:
|
Totali:
|
||||||
<span class="totali">{{
|
<span class="totali">{{
|
||||||
products.getSumQtyOrderProductInOrdersCart(myproduct._id)
|
sumval
|
||||||
}}</span>
|
}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
|
|||||||
@@ -1,45 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="order && order.product" class="q-pa-xs q-gutter-xs">
|
<div v-if="order && order.product" class="q-pa-xs q-gutter-xs">
|
||||||
|
|
||||||
<div v-if="order.product" class="row items-center justify-evenly no-wrap">
|
<div v-if="order.product" class="row items-center justify-evenly no-wrap">
|
||||||
<div class="col-2 text-h6 ellipsis">
|
<div class="col-2 text-h6 ellipsis">
|
||||||
<q-img v-if="order.product && order.product.img" :src="`` + order.product.img" :alt="order.product.name"
|
<q-img
|
||||||
:class="myimgclass">
|
v-if="order.product && order.product.img"
|
||||||
|
:src="`` + order.product.img"
|
||||||
|
:alt="order.product.name"
|
||||||
|
:class="myimgclass"
|
||||||
|
>
|
||||||
</q-img>
|
</q-img>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 q-ml-xs">
|
<div class="col-4 q-ml-xs">
|
||||||
{{ order.product.name }}
|
{{ order.product.name }}
|
||||||
<div v-if="showall">
|
<div v-if="showall">
|
||||||
<br><span class="text-grey">{{ order.product.description }}</span>
|
<br /><span class="text-grey">{{ order.product.description }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||||
<q-btn v-if="showall && !nomodif" round size="xs" text-color="grey" icon="fas fa-minus"
|
<q-btn
|
||||||
@click="addsubqty(false, true)"></q-btn>
|
v-if="showall && !nomodif"
|
||||||
<!--<q-field outlined dense style="width: 25px; height: 20px; " class="q-mx-xs text-subtitle4">
|
round
|
||||||
<template v-slot:control>
|
size="xs"
|
||||||
<div class="self-center no-outline" tabindex="0" >{{ order.quantity }}</div>
|
text-color="grey"
|
||||||
</template>
|
icon="fas fa-minus"
|
||||||
</q-field>-->
|
@click="addsubqty(false, true)"
|
||||||
<div v-if="order.quantity > 0" :class="`q-mx-sm text-blue-14`">{{ order.quantity + order.quantitypreordered }}</div>
|
></q-btn>
|
||||||
<q-btn v-if="showall && !nomodif" round size="xs" text-color="grey" icon="fas fa-plus"
|
<div v-if="order.quantity > 0" :class="`q-mx-sm text-blue-14`">
|
||||||
@click="addsubqty(true, false)"></q-btn>
|
{{ order.quantity }}
|
||||||
|
</div>
|
||||||
|
<div v-if="order.quantity > 0 && order.quantitypreordered > 0">
|
||||||
|
+ {{ $t('ecomm.preord') }}:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="order.quantitypreordered > 0"
|
||||||
|
:class="`q-mx-sm text-blue-14`"
|
||||||
|
>
|
||||||
|
{{ 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>
|
</div>
|
||||||
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
|
<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 :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"
|
||||||
|
>€ {{
|
||||||
|
order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
<span v-if="isApplicatoSconto()">
|
<span v-if="isApplicatoSconto()">
|
||||||
<span class="ordine_scontato">(<span class="barrato">€ {{((order.price * order.quantity) + (order.price * order.quantitypreordered)).toFixed(2) }}</span>)</span>
|
<span class="ordine_scontato"
|
||||||
|
>(<span class="barrato"
|
||||||
|
>€
|
||||||
|
{{
|
||||||
|
(
|
||||||
|
order.price * order.quantity +
|
||||||
|
order.price * order.quantitypreordered
|
||||||
|
).toFixed(2)
|
||||||
|
}}</span
|
||||||
|
>)</span
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{ $t('ecomm.sconto_applicato', {risparmio: getRisparmio()}) }}</span>
|
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{
|
||||||
|
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
<q-btn v-if="!nomodif" icon="fas fa-times" color="negative" round size="xs" @click="removeFromCard">
|
<q-btn
|
||||||
|
v-if="!nomodif"
|
||||||
|
icon="fas fa-times"
|
||||||
|
color="negative"
|
||||||
|
round
|
||||||
|
size="xs"
|
||||||
|
@click="removeFromCard"
|
||||||
|
>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1651,7 +1651,8 @@ const msg_it = {
|
|||||||
ord_not_confirmed: 'E\' avvenuto un errore. Ordine non Confermato. Ricaricare la pagina e riprovare.',
|
ord_not_confirmed: 'E\' avvenuto un errore. Ordine non Confermato. Ricaricare la pagina e riprovare.',
|
||||||
btn_cassa: 'Vai alla Cassa',
|
btn_cassa: 'Vai alla Cassa',
|
||||||
available: 'Disponibili',
|
available: 'Disponibili',
|
||||||
preorders: 'In Prenotazione',
|
preorders: 'Pre-Ordinabili',
|
||||||
|
preord: 'Pre-Ordinate',
|
||||||
di_cui_x_in_carrello: '(nel tuo carrello: {qty})',
|
di_cui_x_in_carrello: '(nel tuo carrello: {qty})',
|
||||||
evaso: 'Ordine Evaso',
|
evaso: 'Ordine Evaso',
|
||||||
consegnato: 'Ordine Consegnato',
|
consegnato: 'Ordine Consegnato',
|
||||||
|
|||||||
@@ -123,6 +123,28 @@ export const useProducts = defineStore('Products', {
|
|||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getSumQtyPreOrderInOrdersCart: (state: IProductsState) => (idproduct: string): number => {
|
||||||
|
let totalQuantity = 0;
|
||||||
|
|
||||||
|
if (state.orders) {
|
||||||
|
const orderscart = state.orders
|
||||||
|
if (orderscart) {
|
||||||
|
for (const myord of orderscart) {
|
||||||
|
if (myord.items) {
|
||||||
|
for (const item of myord.items) {
|
||||||
|
if (item.order) {
|
||||||
|
if ((item.order.idProduct === idproduct) && (item.order.status! < shared_consts.OrderStatus.CHECKOUT_SENT)) {
|
||||||
|
totalQuantity += (item.order.quantitypreordered) || 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return totalQuantity
|
||||||
|
},
|
||||||
|
|
||||||
getSumQtyOrderProductInOrdersCart: (state: IProductsState) => (idproduct: string): number => {
|
getSumQtyOrderProductInOrdersCart: (state: IProductsState) => (idproduct: string): number => {
|
||||||
let totalQuantity = 0;
|
let totalQuantity = 0;
|
||||||
|
|
||||||
@@ -134,7 +156,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
for (const item of myord.items) {
|
for (const item of myord.items) {
|
||||||
if (item.order) {
|
if (item.order) {
|
||||||
if ((item.order.idProduct === idproduct) && (item.order.status! < shared_consts.OrderStatus.CHECKOUT_SENT)) {
|
if ((item.order.idProduct === idproduct) && (item.order.status! < shared_consts.OrderStatus.CHECKOUT_SENT)) {
|
||||||
totalQuantity += (item.order.quantity + item.order.quantitypreordered) || 0;
|
totalQuantity += (item.order.quantity) || 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,22 +205,6 @@ export const useProducts = defineStore('Products', {
|
|||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
|
|
||||||
/* updateQuantityAvailable: (state: IProductsState) => (id: string): any => {
|
|
||||||
|
|
||||||
const indelem = state.products.findIndex((prod: IProduct) => prod._id === id)
|
|
||||||
if (indelem >= 0) {
|
|
||||||
state.products[indelem].quantityAvailable = state.products[indelem].stockQty
|
|
||||||
if (state.products[indelem].QuantitaOrdinateInAttesa! > 0) {
|
|
||||||
state.products[indelem].quantityAvailable! -= state.products[indelem].QuantitaOrdinateInAttesa!
|
|
||||||
}
|
|
||||||
state.products[indelem].bookableAvailableQty = state.products[indelem].bookableQty
|
|
||||||
if (state.products[indelem].QuantitaPrenotateInAttesa! > 0) {
|
|
||||||
state.products[indelem].bookableAvailableQty! -= state.products[indelem].QuantitaPrenotateInAttesa!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},*/
|
|
||||||
|
|
||||||
getRecordEmpty: (state: IProductsState) => (): IProduct => {
|
getRecordEmpty: (state: IProductsState) => (): IProduct => {
|
||||||
|
|
||||||
const tomorrow = tools.getDateNow()
|
const tomorrow = tools.getDateNow()
|
||||||
@@ -461,16 +467,15 @@ export const useProducts = defineStore('Products', {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isQtyAvailableByProduct(product)) {
|
if (this.isQtyAvailableByProduct(product)) {
|
||||||
order.quantitypreordered = 0
|
|
||||||
order.quantity = 1
|
order.quantity = 1
|
||||||
|
order.quantitypreordered = 0
|
||||||
} else {
|
} else {
|
||||||
if (this.isInPreorderByProduct(product)) {
|
if (this.isInPreorderByProduct(product)) {
|
||||||
order.quantity = 0
|
|
||||||
order.quantitypreordered = 1
|
order.quantitypreordered = 1
|
||||||
|
order.quantity = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!order.idStorehouse) {
|
if (!order.idStorehouse) {
|
||||||
if (product.storehouses.length === 1) {
|
if (product.storehouses.length === 1) {
|
||||||
order.idStorehouse = product.storehouses[0]._id
|
order.idStorehouse = product.storehouses[0]._id
|
||||||
@@ -500,7 +505,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
}
|
}
|
||||||
this.updateDataProduct(res)
|
this.updateDataProduct(res)
|
||||||
|
|
||||||
return { risult: !!res }
|
return { risult: !!res, myord: res.data.myord }
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log('error addToCart', error)
|
console.log('error addToCart', error)
|
||||||
@@ -631,11 +636,17 @@ export const useProducts = defineStore('Products', {
|
|||||||
async addtoCartBase({ $q, t, code, order, addqty }: { $q: any, t: any, code: string, order: IOrder, addqty: boolean }) {
|
async addtoCartBase({ $q, t, code, order, addqty }: { $q: any, t: any, code: string, order: IOrder, addqty: boolean }) {
|
||||||
let product = this.getProductByCode(code)
|
let product = this.getProductByCode(code)
|
||||||
|
|
||||||
return this.addToCart({ product, order, addqty }).then((ris) => {
|
return await this.addToCart({ product, order, addqty })
|
||||||
|
.then((ris) => {
|
||||||
let strprod = t('ecomm.prodotto')
|
let strprod = t('ecomm.prodotto')
|
||||||
|
|
||||||
let msg = ''
|
let msg = ''
|
||||||
console.log('ris', ris)
|
console.log('ris', ris)
|
||||||
|
if (ris && ris.myord == null) {
|
||||||
|
msg = t('ecomm.prodotto_tolto')
|
||||||
|
tools.showNotif($q, msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (ris === null || ris.myord == null) {
|
if (ris === null || ris.myord == null) {
|
||||||
msg = t('ecomm.error_cart')
|
msg = t('ecomm.error_cart')
|
||||||
tools.showNegativeNotif($q, msg)
|
tools.showNegativeNotif($q, msg)
|
||||||
@@ -646,9 +657,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
if (qta > 1 || qta === 0)
|
if (qta > 1 || qta === 0)
|
||||||
strprod = t('ecomm.prodotti')
|
strprod = t('ecomm.prodotti')
|
||||||
|
|
||||||
if (qta === 0) {
|
if (qta > 0) {
|
||||||
msg = t('ecomm.prodotto_tolto')
|
|
||||||
} else {
|
|
||||||
msg = t('ecomm.prod_sul_carrello', { strprod, qty: qta })
|
msg = t('ecomm.prod_sul_carrello', { strprod, qty: qta })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,19 +670,53 @@ export const useProducts = defineStore('Products', {
|
|||||||
else
|
else
|
||||||
tools.showPositiveNotif($q, msg)
|
tools.showPositiveNotif($q, msg)
|
||||||
|
|
||||||
|
return ris
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getQuantityByOrder(order: IOrder): string {
|
getQuantityByOrder($t: any, order: IOrder): string {
|
||||||
let mystr = '';
|
let mystr = '';
|
||||||
if (order.quantity > 0) {
|
if (order.quantity > 0) {
|
||||||
mystr += order.quantity
|
mystr += order.quantity
|
||||||
}
|
}
|
||||||
|
if ((order.quantitypreordered > 0) && (order.quantity > 0)) {
|
||||||
|
mystr += ' ' + $t('ecomm.available')
|
||||||
|
mystr += ' + '
|
||||||
|
}
|
||||||
if (order.quantitypreordered > 0) {
|
if (order.quantitypreordered > 0) {
|
||||||
mystr += ' Prenotata :' + order.quantitypreordered
|
mystr += ' ' + order.quantitypreordered + ' ' + $t('ecomm.preord');
|
||||||
}
|
}
|
||||||
return mystr
|
return mystr
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isQtyAvailableByProduct(product: IProduct): boolean {
|
||||||
|
if (product) {
|
||||||
|
return (product.quantityAvailable! > 0)
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
isInPreorderByProduct(product: IProduct): boolean {
|
||||||
|
if (product) {
|
||||||
|
return (product.bookableAvailableQty! > 0)
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
isQtyAvailableByOrder(order: IOrder): boolean {
|
||||||
|
if (order && order.product) {
|
||||||
|
return this.isQtyAvailableByProduct(order.product)
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
isInPreorderByOrder(order: IOrder): boolean {
|
||||||
|
if (order && order.product) {
|
||||||
|
return this.isInPreorderByProduct(order.product)
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const myprod = productStore.getProductByCode(lowerSearchText);
|
const myprod = productStore.getProductByCode(lowerSearchText);
|
||||||
if (myprod && myprod.active) {
|
if (myprod && myprod.active) {
|
||||||
let myorder: IOrder = { quantity: 1, price: 0, TotalPriceProduct: 0 }
|
let myorder: IOrder = { quantity: 1, quantitypreordered: 0, price: 0, TotalPriceProduct: 0 }
|
||||||
await productStore.addtoCartBase({ $q, t, code: myprod.code!, order: myorder, addqty: true })
|
await productStore.addtoCartBase({ $q, t, code: myprod.code!, order: myorder, addqty: true })
|
||||||
search.value = ''
|
search.value = ''
|
||||||
load()
|
load()
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
v-if="!!item && item.order && item.order.product"
|
v-if="!!item && item.order && item.order.product"
|
||||||
>
|
>
|
||||||
{{ item.order.product.name }} ({{
|
{{ item.order.product.name }} ({{
|
||||||
productStore.getQuantityByOrder(item.order)
|
productStore.getQuantityByOrder($t, item.order)
|
||||||
}})<br />
|
}})<br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
<div v-for="(item, index) of props.row.items" :key="index">
|
<div v-for="(item, index) of props.row.items" :key="index">
|
||||||
<div v-if="!!item.order && item.order.product">
|
<div v-if="!!item.order && item.order.product">
|
||||||
{{ item.order.product.name }} ({{
|
{{ item.order.product.name }} ({{
|
||||||
productStore.getQuantityByOrder(item.order)
|
productStore.getQuantityByOrder($t, item.order)
|
||||||
}})<br />
|
}})<br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user