quantità
This commit is contained in:
@@ -55,6 +55,8 @@ export default defineComponent({
|
||||
|
||||
const myproduct = ref(<IProduct> {})
|
||||
|
||||
const storeSelected = ref('')
|
||||
|
||||
function iconWhishlist(order: IProduct) {
|
||||
if (true) {
|
||||
return 'far fa-heart'
|
||||
@@ -64,17 +66,13 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function decqty() {
|
||||
if (myorder.value.quantity) {
|
||||
if (myorder.value.quantity > 0)
|
||||
myorder.value.quantity--
|
||||
}
|
||||
if (myorder.value.quantity > 0)
|
||||
myorder.value.quantity--
|
||||
}
|
||||
|
||||
function addqty() {
|
||||
if (myorder.value.quantity) {
|
||||
if (myorder.value.quantity < 10)
|
||||
myorder.value.quantity++
|
||||
}
|
||||
if (myorder.value.quantity < 10)
|
||||
myorder.value.quantity++
|
||||
}
|
||||
|
||||
function addtoCart() {
|
||||
@@ -91,7 +89,7 @@ export default defineComponent({
|
||||
} else {
|
||||
products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => {
|
||||
let strprod = t('ecomm.prodotto')
|
||||
if (myorder.value.quantity! > 1)
|
||||
if (myorder.value.quantity > 1)
|
||||
strprod = t('ecomm.prodotti')
|
||||
if (ris)
|
||||
tools.showPositiveNotif($q, t('ecomm.haveadded') + ' ' + myorder.value.quantity + ' ' + strprod + ' ' + t('ecomm.tocart'))
|
||||
@@ -144,6 +142,10 @@ export default defineComponent({
|
||||
load()
|
||||
})
|
||||
|
||||
watch(() => storeSelected.value, (newval, oldval) => {
|
||||
myorder.value.idStorehouse = newval
|
||||
})
|
||||
|
||||
async function load() {
|
||||
// console.log('created Cproductcard', code)
|
||||
if (props.code) {
|
||||
@@ -187,6 +189,7 @@ export default defineComponent({
|
||||
myorder,
|
||||
tools,
|
||||
t,
|
||||
storeSelected,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
||||
<div v-if="myorder">
|
||||
qta: {{ myorder.quantity }}
|
||||
myorder: {{ myorder }}
|
||||
</div>
|
||||
|
||||
<q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img>
|
||||
@@ -50,13 +50,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-mb-sm no-wrap items-center centeritems">
|
||||
<q-btn round size="xs" text-color="grey" icon="fas fa-minus" @click="decqty"></q-btn>
|
||||
<q-btn round size="xs" text-color="grey" icon="fas fa-minus" @click="decqty()"></q-btn>
|
||||
<q-field outlined dense style="width: 40px; height: 30px;" class="q-mx-xs">
|
||||
<template v-slot:control>
|
||||
<div class="self-center no-outline" tabindex="0">{{ order.quantity }}</div>
|
||||
</template>
|
||||
</q-field>
|
||||
<q-btn round size="xs" text-color="grey" icon="fas fa-plus" @click="addqty"></q-btn>
|
||||
<q-btn round size="xs" text-color="grey" icon="fas fa-plus" @click="addqty()"></q-btn>
|
||||
</div>
|
||||
<div v-if="complete || getnumstore() > 1">
|
||||
<div class="text-blue text-title row items-center q-mr-md centeritems">
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="text-green-6 text-title row items-center q-my-sm centeritems">
|
||||
|
||||
<div v-if="getnumstore() > 1">
|
||||
<q-select :behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" outlined v-model="order.idStorehouse"
|
||||
<q-select :behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" outlined v-model="storeSelected"
|
||||
:options="getStorehouses()" :label="t('products.magazzino') + `:`" emit-value map-options>
|
||||
</q-select>
|
||||
</div>
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
<q-card-actions vertical align="center">
|
||||
<q-btn icon="fas fa-cart-plus" color="primary" :disable="checkifCartDisable()" rounded size="md"
|
||||
:label="t('products.addcart')" @click="addtoCart">
|
||||
:label="t('products.addcart', {qta: order.quantity})" @click="addtoCart()">
|
||||
</q-btn>
|
||||
<!--
|
||||
<q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri">
|
||||
|
||||
Reference in New Issue
Block a user