quantità
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
<div class="myheader row justify-between">
|
<div class="myheader row justify-between">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<q-btn class="q-mx-xs" round dense flat icon="fas fa-shopping-cart">
|
<q-btn class="q-mx-xs" round dense flat icon="fas fa-shopping-cart">
|
||||||
|
|
||||||
<q-badge v-if="getnumItemsCart() > 0" color="red" floating transparent>
|
<q-badge v-if="getnumItemsCart() > 0" color="red" floating transparent>
|
||||||
{{ getnumItemsCart() }}
|
{{ getnumItemsCart() }}
|
||||||
</q-badge>
|
</q-badge>
|
||||||
|
|||||||
@@ -1227,6 +1227,40 @@
|
|||||||
</CMySelect>
|
</CMySelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
|
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
|
||||||
|
<CMySelect
|
||||||
|
:type_out="col.field_outtype"
|
||||||
|
:col="col"
|
||||||
|
:row="row"
|
||||||
|
:multiple="true"
|
||||||
|
:withToggle="true"
|
||||||
|
:label="col.label ? col.label : $t(col.label_trans)"
|
||||||
|
:filter_table="col.filter_table"
|
||||||
|
:filter_field="col.filter_field"
|
||||||
|
:value_extra="value_extra"
|
||||||
|
v-model:arrvalue="scope.value"
|
||||||
|
@update:arrvalue="changevalRec"
|
||||||
|
:addall="false"
|
||||||
|
:addnone="false"
|
||||||
|
label-color="primary"
|
||||||
|
class="combowidth"
|
||||||
|
color="primary"
|
||||||
|
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
||||||
|
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
||||||
|
:options="
|
||||||
|
globalStore.getTableJoinByName(
|
||||||
|
col.jointable,
|
||||||
|
col.addall,
|
||||||
|
col.addnone,
|
||||||
|
col.filter
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:sola_lettura="!isInModif"
|
||||||
|
:useinput="col.allowNewValue"
|
||||||
|
:newvaluefunc="addNewValue"
|
||||||
|
>
|
||||||
|
</CMySelect>
|
||||||
|
|
||||||
|
<!--
|
||||||
<q-select
|
<q-select
|
||||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||||
v-model="scope.value"
|
v-model="scope.value"
|
||||||
@@ -1269,7 +1303,7 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>-->
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
|
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
|
||||||
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
|
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
const myproduct = ref(<IProduct> {})
|
const myproduct = ref(<IProduct> {})
|
||||||
|
|
||||||
|
const storeSelected = ref('')
|
||||||
|
|
||||||
function iconWhishlist(order: IProduct) {
|
function iconWhishlist(order: IProduct) {
|
||||||
if (true) {
|
if (true) {
|
||||||
return 'far fa-heart'
|
return 'far fa-heart'
|
||||||
@@ -64,17 +66,13 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function decqty() {
|
function decqty() {
|
||||||
if (myorder.value.quantity) {
|
if (myorder.value.quantity > 0)
|
||||||
if (myorder.value.quantity > 0)
|
myorder.value.quantity--
|
||||||
myorder.value.quantity--
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addqty() {
|
function addqty() {
|
||||||
if (myorder.value.quantity) {
|
if (myorder.value.quantity < 10)
|
||||||
if (myorder.value.quantity < 10)
|
myorder.value.quantity++
|
||||||
myorder.value.quantity++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addtoCart() {
|
function addtoCart() {
|
||||||
@@ -91,7 +89,7 @@ export default defineComponent({
|
|||||||
} else {
|
} else {
|
||||||
products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => {
|
products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => {
|
||||||
let strprod = t('ecomm.prodotto')
|
let strprod = t('ecomm.prodotto')
|
||||||
if (myorder.value.quantity! > 1)
|
if (myorder.value.quantity > 1)
|
||||||
strprod = t('ecomm.prodotti')
|
strprod = t('ecomm.prodotti')
|
||||||
if (ris)
|
if (ris)
|
||||||
tools.showPositiveNotif($q, t('ecomm.haveadded') + ' ' + myorder.value.quantity + ' ' + strprod + ' ' + t('ecomm.tocart'))
|
tools.showPositiveNotif($q, t('ecomm.haveadded') + ' ' + myorder.value.quantity + ' ' + strprod + ' ' + t('ecomm.tocart'))
|
||||||
@@ -144,6 +142,10 @@ export default defineComponent({
|
|||||||
load()
|
load()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(() => storeSelected.value, (newval, oldval) => {
|
||||||
|
myorder.value.idStorehouse = newval
|
||||||
|
})
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
// console.log('created Cproductcard', code)
|
// console.log('created Cproductcard', code)
|
||||||
if (props.code) {
|
if (props.code) {
|
||||||
@@ -187,6 +189,7 @@ export default defineComponent({
|
|||||||
myorder,
|
myorder,
|
||||||
tools,
|
tools,
|
||||||
t,
|
t,
|
||||||
|
storeSelected,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
||||||
<div v-if="myorder">
|
<div v-if="myorder">
|
||||||
qta: {{ myorder.quantity }}
|
myorder: {{ myorder }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img>
|
<q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img>
|
||||||
@@ -50,13 +50,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-mb-sm no-wrap items-center centeritems">
|
<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">
|
<q-field outlined dense style="width: 40px; height: 30px;" class="q-mx-xs">
|
||||||
<template v-slot:control>
|
<template v-slot:control>
|
||||||
<div class="self-center no-outline" tabindex="0">{{ order.quantity }}</div>
|
<div class="self-center no-outline" tabindex="0">{{ order.quantity }}</div>
|
||||||
</template>
|
</template>
|
||||||
</q-field>
|
</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>
|
||||||
<div v-if="complete || getnumstore() > 1">
|
<div v-if="complete || getnumstore() > 1">
|
||||||
<div class="text-blue text-title row items-center q-mr-md centeritems">
|
<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 class="text-green-6 text-title row items-center q-my-sm centeritems">
|
||||||
|
|
||||||
<div v-if="getnumstore() > 1">
|
<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>
|
:options="getStorehouses()" :label="t('products.magazzino') + `:`" emit-value map-options>
|
||||||
</q-select>
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<q-card-actions vertical align="center">
|
<q-card-actions vertical align="center">
|
||||||
<q-btn icon="fas fa-cart-plus" color="primary" :disable="checkifCartDisable()" rounded size="md"
|
<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>
|
||||||
<!--
|
<!--
|
||||||
<q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri">
|
<q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri">
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { CMyCart, CSigninNoreg } from '@/components'
|
|||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { useNotifStore } from '@src/store/NotifStore'
|
import { useNotifStore } from '@src/store/NotifStore'
|
||||||
|
|
||||||
|
|
||||||
import { Platform } from 'quasar';
|
import { Platform } from 'quasar';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -68,6 +69,8 @@ export default defineComponent({
|
|||||||
const testStore = useTestStore()
|
const testStore = useTestStore()
|
||||||
const notifStore = useNotifStore()
|
const notifStore = useNotifStore()
|
||||||
|
|
||||||
|
const { getnumItemsCart } = MixinUsers()
|
||||||
|
|
||||||
const site = computed(() => globalStore.site)
|
const site = computed(() => globalStore.site)
|
||||||
const isfinishLoading = computed(() => globalStore.finishLoading)
|
const isfinishLoading = computed(() => globalStore.finishLoading)
|
||||||
|
|
||||||
@@ -501,18 +504,6 @@ export default defineComponent({
|
|||||||
$router.replace('/signup')
|
$router.replace('/signup')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getnumItemsCart() {
|
|
||||||
/* const arrcart = Products.cart
|
|
||||||
if (!!arrcart) {
|
|
||||||
if (!!arrcart.items) {
|
|
||||||
const total = arrcart.items.reduce((sum, item) => sum + item.order.quantity, 0)
|
|
||||||
return total
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function getnumOrdersCart() {
|
function getnumOrdersCart() {
|
||||||
/* const arrorderscart = Products.orders.filter((rec) => rec.status < shared_consts.OrderStatus.RECEIVED)
|
/* const arrorderscart = Products.orders.filter((rec) => rec.status < shared_consts.OrderStatus.RECEIVED)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export interface IOrder {
|
|||||||
after_price?: string
|
after_price?: string
|
||||||
color?: string
|
color?: string
|
||||||
size?: string
|
size?: string
|
||||||
quantity?: number
|
quantity: number
|
||||||
weight?: number
|
weight?: number
|
||||||
stars?: number
|
stars?: number
|
||||||
product?: IProduct
|
product?: IProduct
|
||||||
|
|||||||
@@ -68,8 +68,11 @@ const msg_it = {
|
|||||||
theme: 'Tema',
|
theme: 'Tema',
|
||||||
ritiro_presso: 'Ritiro presso',
|
ritiro_presso: 'Ritiro presso',
|
||||||
magazzino: 'Magazzino',
|
magazzino: 'Magazzino',
|
||||||
addcart: 'Aggiungi al Carrello',
|
addcart: 'Aggiungi {qta} al Carrello',
|
||||||
origine: 'Origine',
|
origine: 'Origine',
|
||||||
|
},
|
||||||
|
storehouses: {
|
||||||
|
name: 'Magazzino',
|
||||||
},
|
},
|
||||||
otherpages: {
|
otherpages: {
|
||||||
myactivities: 'Attività',
|
myactivities: 'Attività',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts" :key="index">
|
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts()" :key="index">
|
||||||
<CProductCard :product="product"/>
|
<CProductCard :product="product"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user