aggiornamento product
This commit is contained in:
@@ -39,8 +39,8 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const numOrders = computed(() => {
|
const numOrders = computed(() => {
|
||||||
if (!!products.cart) {
|
if (!!products.cart && products.cart.items) {
|
||||||
return products.cart.items!.length
|
return products.cart.items.length
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else style="text-align: center">
|
<div v-else style="text-align: center">
|
||||||
<q-btn
|
<q-btn
|
||||||
rounded icon="fas fa-shopping-cart" color="green" label="Vai alla Cassa" class="q-mb-sm" to="/checkout"
|
rounded icon="fas fa-shopping-cart" color="green" :label="$t('ecomm.btn_cassa')" class="q-mb-sm" to="/checkout"
|
||||||
@click="closecart"></q-btn>
|
@click="closecart"></q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, ref, toRef, computed, PropType, watch } from 'vue'
|
import { defineComponent, ref, toRef, computed, PropType, watch, onMounted } from 'vue'
|
||||||
import { useI18n } from '@src/boot/i18n'
|
import { useI18n } from '@src/boot/i18n'
|
||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const myorder = ref(<IOrder>{
|
const myorder = ref(<IOrder>{
|
||||||
idapp: process.env.APP_ID,
|
idapp: process.env.APP_ID,
|
||||||
quantity: 1,
|
quantity: 0,
|
||||||
idStorehouse: ''
|
idStorehouse: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -50,6 +50,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
const storeSelected = ref('')
|
const storeSelected = ref('')
|
||||||
|
|
||||||
|
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
|
||||||
|
// console.log('valoriopt', item.table)
|
||||||
|
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
function iconWhishlist(order: IProduct) {
|
function iconWhishlist(order: IProduct) {
|
||||||
if (true) {
|
if (true) {
|
||||||
return 'far fa-heart'
|
return 'far fa-heart'
|
||||||
@@ -98,105 +104,111 @@ export default defineComponent({
|
|||||||
else
|
else
|
||||||
tools.showPositiveNotif($q, msg)
|
tools.showPositiveNotif($q, msg)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getnumstore() {
|
function getnumstore() {
|
||||||
if (myproduct.value.storehouses)
|
if (myproduct.value.storehouses)
|
||||||
return myproduct.value.storehouses.length
|
return myproduct.value.storehouses.length
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSingleStorehouse() {
|
function getSingleStorehouse() {
|
||||||
const mystore = myproduct.value.storehouses[0]
|
const mystore = myproduct.value.storehouses[0]
|
||||||
if (mystore)
|
if (mystore)
|
||||||
return mystore.name + ' (' + mystore.city + ')'
|
return mystore.name + ' (' + mystore.city + ')'
|
||||||
else
|
else
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStorehouses() {
|
function getStorehouses() {
|
||||||
|
|
||||||
const myarr: any = []
|
const myarr: any = []
|
||||||
let ind = 1
|
let ind = 1
|
||||||
myproduct.value.storehouses.forEach((store) => {
|
myproduct.value.storehouses.forEach((store) => {
|
||||||
myarr.push(
|
myarr.push(
|
||||||
{
|
{
|
||||||
id: ind,
|
id: ind,
|
||||||
label: store.name + ' (' + store.city + ')',
|
label: store.name + ' (' + store.city + ')',
|
||||||
value: store._id
|
value: store._id
|
||||||
|
})
|
||||||
|
|
||||||
|
ind++
|
||||||
})
|
})
|
||||||
|
|
||||||
ind++
|
// console.log('arraystore', myarr)
|
||||||
})
|
return myarr
|
||||||
|
}
|
||||||
|
|
||||||
// console.log('arraystore', myarr)
|
function checkifCartDisable() {
|
||||||
return myarr
|
return !myorder.value.idStorehouse
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkifCartDisable() {
|
watch(() => props.code, (newval, oldval) => {
|
||||||
return !myorder.value.idStorehouse
|
console.log('change code')
|
||||||
}
|
load()
|
||||||
|
})
|
||||||
|
|
||||||
watch(() => props.code, (newval, oldval) => {
|
watch(() => storeSelected.value, (newval, oldval) => {
|
||||||
console.log('change code')
|
myorder.value.idStorehouse = newval
|
||||||
load()
|
})
|
||||||
})
|
|
||||||
|
|
||||||
watch(() => storeSelected.value, (newval, oldval) => {
|
async function load() {
|
||||||
myorder.value.idStorehouse = newval
|
// console.log('created Cproductcard', code)
|
||||||
})
|
if (props.code) {
|
||||||
|
myproduct.value = await products.loadProduct({ code: props.code })
|
||||||
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
|
myproduct.value = props.product
|
||||||
|
}
|
||||||
|
|
||||||
async function load() {
|
console.log('myproduct', myproduct, 'product', props.product)
|
||||||
// console.log('created Cproductcard', code)
|
|
||||||
if (props.code) {
|
|
||||||
myproduct.value = await products.loadProduct({ code: props.code })
|
|
||||||
} else {
|
|
||||||
// @ts-ignore
|
|
||||||
myproduct.value = props.product
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('myproduct', myproduct, 'product', props.product)
|
if (!!myproduct.value) {
|
||||||
|
if (myproduct.value.storehouses.length === 1) {
|
||||||
|
myorder.value.idStorehouse = myproduct.value.storehouses[0]._id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!!myproduct.value) {
|
const ord = products.getOrderProductInCart(myproduct.value._id)
|
||||||
if (myproduct.value.storehouses.length === 1) {
|
if (ord) {
|
||||||
myorder.value.idStorehouse = myproduct.value.storehouses[0]._id
|
myorder.value.quantity = ord.quantity
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getmycardcl() {
|
||||||
|
return (props.complete) ? 'my-card-big' : 'my-card'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getclimg() {
|
||||||
|
return (props.complete) ? 'myimgtitle centermydiv' : 'centermydiv'
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableSubQty() {
|
||||||
|
return myorder.value ? myorder.value.quantity > 0 : true
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(load)
|
||||||
|
|
||||||
|
return {
|
||||||
|
decqty,
|
||||||
|
addqty,
|
||||||
|
addtoCart,
|
||||||
|
iconWhishlist,
|
||||||
|
getmycardcl,
|
||||||
|
getclimg,
|
||||||
|
getnumstore,
|
||||||
|
getSingleStorehouse,
|
||||||
|
getStorehouses,
|
||||||
|
checkifCartDisable,
|
||||||
|
myproduct,
|
||||||
|
myorder,
|
||||||
|
tools,
|
||||||
|
t,
|
||||||
|
storeSelected,
|
||||||
|
enableSubQty,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function getmycardcl() {
|
|
||||||
return (props.complete) ? 'my-card-big' : 'my-card'
|
|
||||||
}
|
|
||||||
|
|
||||||
function getclimg() {
|
|
||||||
return (props.complete) ? 'myimgtitle centermydiv' : 'centermydiv'
|
|
||||||
}
|
|
||||||
|
|
||||||
function enableSubQty() {
|
|
||||||
return myorder.value ? myorder.value.quantity > 0 : true
|
|
||||||
}
|
|
||||||
|
|
||||||
load()
|
|
||||||
|
|
||||||
return {
|
|
||||||
decqty,
|
|
||||||
addqty,
|
|
||||||
addtoCart,
|
|
||||||
iconWhishlist,
|
|
||||||
getmycardcl,
|
|
||||||
getclimg,
|
|
||||||
getnumstore,
|
|
||||||
getSingleStorehouse,
|
|
||||||
getStorehouses,
|
|
||||||
checkifCartDisable,
|
|
||||||
myproduct,
|
|
||||||
myorder,
|
|
||||||
tools,
|
|
||||||
t,
|
|
||||||
storeSelected,
|
|
||||||
enableSubQty,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
||||||
<div v-if="myorder">myorder: {{ myorder }}</div>
|
|
||||||
|
|
||||||
<q-img
|
<q-img
|
||||||
:src="`` + myproduct.img"
|
:src="`` + myproduct.img"
|
||||||
:alt="myproduct.name"
|
:alt="myproduct.name"
|
||||||
@@ -87,7 +85,7 @@
|
|||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
icon="fas fa-cart-arrow-down"
|
icon="fas fa-cart-arrow-down"
|
||||||
:color="enableSubQty() ? 'negative': 'grey'"
|
:color="enableSubQty() ? 'negative' : 'grey'"
|
||||||
:disable="checkifCartDisable() || !enableSubQty()"
|
:disable="checkifCartDisable() || !enableSubQty()"
|
||||||
rounded
|
rounded
|
||||||
size="md"
|
size="md"
|
||||||
@@ -153,6 +151,15 @@
|
|||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
||||||
<q-card-actions vertical align="center">
|
<q-card-actions vertical align="center">
|
||||||
|
<q-btn
|
||||||
|
v-if="myorder.quantity > 0"
|
||||||
|
rounded
|
||||||
|
icon="fas fa-shopping-cart"
|
||||||
|
color="green"
|
||||||
|
:label="$t('ecomm.btn_cassa')"
|
||||||
|
class="q-mb-sm"
|
||||||
|
to="/checkout"
|
||||||
|
></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">
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</CVerifyTelegram>
|
</CVerifyTelegram>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<div v-if="tools.isLogged() && site.confpages.enableRegMultiChoice">
|
<div v-if="tools.isLogged() && (site.confpages.enableRegMultiChoice || (!site.confpages.enabledRegNeedTelegram))">
|
||||||
<CVerifyEmail v-if="!tools.isEmailVerified() && !tools.TelegVerificato()">
|
<CVerifyEmail v-if="!tools.isEmailVerified() && !tools.TelegVerificato()">
|
||||||
</CVerifyEmail>
|
</CVerifyEmail>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1619,6 +1619,7 @@ const msg_it = {
|
|||||||
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
|
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
|
||||||
order: 'Ordine',
|
order: 'Ordine',
|
||||||
ord_confirmed: 'Ordine Confermato',
|
ord_confirmed: 'Ordine Confermato',
|
||||||
|
btn_cassa: 'Vai alla Cassa',
|
||||||
|
|
||||||
},
|
},
|
||||||
install: {
|
install: {
|
||||||
|
|||||||
@@ -3935,7 +3935,7 @@ export const tools = {
|
|||||||
try {
|
try {
|
||||||
if (riscode === this.OK) {
|
if (riscode === this.OK) {
|
||||||
this.showNotif(mythisq, t('login.completato'), { color: 'positive', icon: 'check' })
|
this.showNotif(mythisq, t('login.completato'), { color: 'positive', icon: 'check' })
|
||||||
console.log('mythis.$router.name', route.name)
|
// console.log('mythis.$router.name', route.name)
|
||||||
if (ispageLogin) {
|
if (ispageLogin) {
|
||||||
if (route.name !== '/')
|
if (route.name !== '/')
|
||||||
$router.push('/')
|
$router.push('/')
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-stepper-navigation>
|
<div class="text-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="statusnow < shared_consts.OrderStatus.CHECKOUT_SENT"
|
v-if="statusnow < shared_consts.OrderStatus.CHECKOUT_SENT"
|
||||||
rounded
|
rounded
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
:disabled="myTotalQty() < 1"
|
:disabled="myTotalQty() < 1"
|
||||||
@click="completeOrder"
|
@click="completeOrder"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</q-stepper-navigation>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-page>
|
</q-page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -38,6 +38,47 @@ export default defineComponent({
|
|||||||
const statusnow = ref(0)
|
const statusnow = ref(0)
|
||||||
const arrnumstatus = ref(<any[]>[])
|
const arrnumstatus = ref(<any[]>[])
|
||||||
const columns = ref(<any>[
|
const columns = ref(<any>[
|
||||||
|
{
|
||||||
|
name: 'numorder',
|
||||||
|
required: true,
|
||||||
|
align: 'left',
|
||||||
|
label: 'Numero Ordine',
|
||||||
|
field: 'numorder',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'created_at',
|
||||||
|
required: true,
|
||||||
|
align: 'center',
|
||||||
|
label: 'Effettuato il',
|
||||||
|
field: 'created_at',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'items',
|
||||||
|
required: true,
|
||||||
|
label: 'Articoli',
|
||||||
|
field: 'items',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'totalPrice',
|
||||||
|
required: true,
|
||||||
|
label: 'Totale',
|
||||||
|
field: 'totalPrice',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'status',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
label: 'Stato',
|
||||||
|
field: 'status',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const columns_Admin = ref(<any>[
|
||||||
{
|
{
|
||||||
name: 'numorder',
|
name: 'numorder',
|
||||||
required: true,
|
required: true,
|
||||||
@@ -83,6 +124,14 @@ export default defineComponent({
|
|||||||
label: 'Stato',
|
label: 'Stato',
|
||||||
field: 'status',
|
field: 'status',
|
||||||
sortable: true
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'comandi',
|
||||||
|
align: 'center',
|
||||||
|
required: false,
|
||||||
|
label: 'Comandi',
|
||||||
|
field: 'comandi',
|
||||||
|
sortable: false
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -124,16 +173,9 @@ export default defineComponent({
|
|||||||
console.log('arrnumstatus;')
|
console.log('arrnumstatus;')
|
||||||
console.log(arrnumstatus.value)
|
console.log(arrnumstatus.value)
|
||||||
|
|
||||||
columns.value = [...columns.value,
|
if (tools.isManager()) {
|
||||||
{
|
columns.value = [...columns_Admin.value]
|
||||||
name: 'comandi',
|
}
|
||||||
align: 'center',
|
|
||||||
required: false,
|
|
||||||
label: 'Comandi',
|
|
||||||
field: 'comandi',
|
|
||||||
sortable: false
|
|
||||||
}]
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CanBeShipped() {
|
function CanBeShipped() {
|
||||||
|
|||||||
@@ -125,7 +125,6 @@
|
|||||||
}}</span>
|
}}</span>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="comandi" :props="props">
|
<q-td key="comandi" :props="props">
|
||||||
Bottone:
|
|
||||||
<div v-if="tools.isManager()" class="q-pa-sm">
|
<div v-if="tools.isManager()" class="q-pa-sm">
|
||||||
<q-btn-dropdown rounded dense label="Azioni">
|
<q-btn-dropdown rounded dense label="Azioni">
|
||||||
<q-list class="text-primary">
|
<q-list class="text-primary">
|
||||||
|
|||||||
Reference in New Issue
Block a user