aggiornamento product
This commit is contained in:
@@ -39,8 +39,8 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const numOrders = computed(() => {
|
||||
if (!!products.cart) {
|
||||
return products.cart.items!.length
|
||||
if (!!products.cart && products.cart.items) {
|
||||
return products.cart.items.length
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</div>
|
||||
<div v-else style="text-align: center">
|
||||
<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>
|
||||
</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 { useUserStore } from '@store/UserStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
||||
|
||||
const myorder = ref(<IOrder>{
|
||||
idapp: process.env.APP_ID,
|
||||
quantity: 1,
|
||||
quantity: 0,
|
||||
idStorehouse: ''
|
||||
})
|
||||
|
||||
@@ -50,6 +50,12 @@ export default defineComponent({
|
||||
|
||||
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) {
|
||||
if (true) {
|
||||
return 'far fa-heart'
|
||||
@@ -98,105 +104,111 @@ export default defineComponent({
|
||||
else
|
||||
tools.showPositiveNotif($q, msg)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getnumstore() {
|
||||
if (myproduct.value.storehouses)
|
||||
return myproduct.value.storehouses.length
|
||||
else
|
||||
return 0
|
||||
}
|
||||
function getnumstore() {
|
||||
if (myproduct.value.storehouses)
|
||||
return myproduct.value.storehouses.length
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
function getSingleStorehouse() {
|
||||
const mystore = myproduct.value.storehouses[0]
|
||||
if (mystore)
|
||||
return mystore.name + ' (' + mystore.city + ')'
|
||||
else
|
||||
return ''
|
||||
}
|
||||
function getSingleStorehouse() {
|
||||
const mystore = myproduct.value.storehouses[0]
|
||||
if (mystore)
|
||||
return mystore.name + ' (' + mystore.city + ')'
|
||||
else
|
||||
return ''
|
||||
}
|
||||
|
||||
function getStorehouses() {
|
||||
function getStorehouses() {
|
||||
|
||||
const myarr: any = []
|
||||
let ind = 1
|
||||
myproduct.value.storehouses.forEach((store) => {
|
||||
myarr.push(
|
||||
{
|
||||
id: ind,
|
||||
label: store.name + ' (' + store.city + ')',
|
||||
value: store._id
|
||||
const myarr: any = []
|
||||
let ind = 1
|
||||
myproduct.value.storehouses.forEach((store) => {
|
||||
myarr.push(
|
||||
{
|
||||
id: ind,
|
||||
label: store.name + ' (' + store.city + ')',
|
||||
value: store._id
|
||||
})
|
||||
|
||||
ind++
|
||||
})
|
||||
|
||||
ind++
|
||||
})
|
||||
// console.log('arraystore', myarr)
|
||||
return myarr
|
||||
}
|
||||
|
||||
// console.log('arraystore', myarr)
|
||||
return myarr
|
||||
}
|
||||
function checkifCartDisable() {
|
||||
return !myorder.value.idStorehouse
|
||||
}
|
||||
|
||||
function checkifCartDisable() {
|
||||
return !myorder.value.idStorehouse
|
||||
}
|
||||
watch(() => props.code, (newval, oldval) => {
|
||||
console.log('change code')
|
||||
load()
|
||||
})
|
||||
|
||||
watch(() => props.code, (newval, oldval) => {
|
||||
console.log('change code')
|
||||
load()
|
||||
})
|
||||
watch(() => storeSelected.value, (newval, oldval) => {
|
||||
myorder.value.idStorehouse = newval
|
||||
})
|
||||
|
||||
watch(() => storeSelected.value, (newval, oldval) => {
|
||||
myorder.value.idStorehouse = newval
|
||||
})
|
||||
async function load() {
|
||||
// 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('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)
|
||||
|
||||
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) {
|
||||
if (myproduct.value.storehouses.length === 1) {
|
||||
myorder.value.idStorehouse = myproduct.value.storehouses[0]._id
|
||||
const ord = products.getOrderProductInCart(myproduct.value._id)
|
||||
if (ord) {
|
||||
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>
|
||||
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
||||
<div v-if="myorder">myorder: {{ myorder }}</div>
|
||||
|
||||
<q-img
|
||||
:src="`` + myproduct.img"
|
||||
:alt="myproduct.name"
|
||||
@@ -87,7 +85,7 @@
|
||||
|
||||
<q-btn
|
||||
icon="fas fa-cart-arrow-down"
|
||||
:color="enableSubQty() ? 'negative': 'grey'"
|
||||
:color="enableSubQty() ? 'negative' : 'grey'"
|
||||
:disable="checkifCartDisable() || !enableSubQty()"
|
||||
rounded
|
||||
size="md"
|
||||
@@ -153,6 +151,15 @@
|
||||
<q-separator />
|
||||
|
||||
<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>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</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>
|
||||
</div>
|
||||
|
||||
@@ -1619,6 +1619,7 @@ const msg_it = {
|
||||
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
|
||||
order: 'Ordine',
|
||||
ord_confirmed: 'Ordine Confermato',
|
||||
btn_cassa: 'Vai alla Cassa',
|
||||
|
||||
},
|
||||
install: {
|
||||
|
||||
@@ -3935,7 +3935,7 @@ export const tools = {
|
||||
try {
|
||||
if (riscode === this.OK) {
|
||||
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 (route.name !== '/')
|
||||
$router.push('/')
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<q-stepper-navigation>
|
||||
<div class="text-center">
|
||||
<q-btn
|
||||
v-if="statusnow < shared_consts.OrderStatus.CHECKOUT_SENT"
|
||||
rounded
|
||||
@@ -45,7 +45,7 @@
|
||||
:disabled="myTotalQty() < 1"
|
||||
@click="completeOrder"
|
||||
></q-btn>
|
||||
</q-stepper-navigation>
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
@@ -38,6 +38,47 @@ export default defineComponent({
|
||||
const statusnow = ref(0)
|
||||
const arrnumstatus = 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',
|
||||
required: true,
|
||||
@@ -83,6 +124,14 @@ export default defineComponent({
|
||||
label: 'Stato',
|
||||
field: 'status',
|
||||
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.value)
|
||||
|
||||
columns.value = [...columns.value,
|
||||
{
|
||||
name: 'comandi',
|
||||
align: 'center',
|
||||
required: false,
|
||||
label: 'Comandi',
|
||||
field: 'comandi',
|
||||
sortable: false
|
||||
}]
|
||||
|
||||
if (tools.isManager()) {
|
||||
columns.value = [...columns_Admin.value]
|
||||
}
|
||||
}
|
||||
|
||||
function CanBeShipped() {
|
||||
|
||||
@@ -125,7 +125,6 @@
|
||||
}}</span>
|
||||
</q-td>
|
||||
<q-td key="comandi" :props="props">
|
||||
Bottone:
|
||||
<div v-if="tools.isManager()" class="q-pa-sm">
|
||||
<q-btn-dropdown rounded dense label="Azioni">
|
||||
<q-list class="text-primary">
|
||||
|
||||
Reference in New Issue
Block a user