Gestione Ordini: evaso...
This commit is contained in:
@@ -1027,20 +1027,23 @@ export const shared_consts = {
|
||||
CHECKOUT_SENT: 2,
|
||||
ORDER_CONFIRMED: 3,
|
||||
PAYED: 4,
|
||||
DELIVEDED: 5,
|
||||
RECEIVED: 6,
|
||||
DELIVERED: 5, // Consegnato
|
||||
SHIPPED: 6, //Spedito
|
||||
RECEIVED: 7,
|
||||
COMPLETED: 6,
|
||||
CANCELED: 10,
|
||||
},
|
||||
|
||||
OrderStatStr: {
|
||||
IN_CORSO: 1,
|
||||
CONFERMATI: 2,
|
||||
PAGATI: 3,
|
||||
COMPLETATI: 4,
|
||||
CANCELLATI: 5,
|
||||
|
||||
//
|
||||
STATO_PER_SCARICARE_LE_QTA_DAL_MAGAZZINO: 4, // inferiore ai completati
|
||||
OrderStat: {
|
||||
// IN_CART: { label: 'In Carrello', value: 1 }, //IN_CART
|
||||
IN_CORSO: { label: 'In Corso', value: 2, icon: 'fas fa-tasks', color: 'text-black' }, //CHECKOUT_SENT
|
||||
CONFERMATI: { label: 'Confermati', value: 3, icon: 'fas fa-calendar', color: 'text-blue' }, //ORDER_CONFIRMED
|
||||
PAGATI: { label: 'Pagati', value: 4, icon: 'money', color: 'text-green' }, //PAYED
|
||||
DELIVERED: { label: 'Consegnato', value: 5, icon: 'fas fa-calendar', color: 'text-blue' }, //DELIVERED
|
||||
SHIPPED: { label: 'Spediti', value: 6, icon: 'fas fa-shipping-fast', color: 'text-green' }, //SHIPPED
|
||||
RECEIVED: { label: 'Ricevuti', value: 7, icon: '', color: 'text-blue' }, //RECEIVED
|
||||
COMPLETATI: { label: 'Completati', value: 8, icon: 'fas fa-check', color: 'text-blue' }, //COMPLETED
|
||||
CANCELLATI: { label: 'Cancellati', value: 10, icon: 'delete', color: 'text-red' }, //CANCELED
|
||||
},
|
||||
|
||||
OrderStatusView: [
|
||||
@@ -1081,17 +1084,65 @@ export const shared_consts = {
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: 'Spedito',
|
||||
label: 'Consegnato',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: 'Ricevuto',
|
||||
label: 'Spedito',
|
||||
value: 6,
|
||||
},
|
||||
{
|
||||
label: 'Ricevuto',
|
||||
value: 7,
|
||||
},
|
||||
{
|
||||
label: 'Completato',
|
||||
value: 8,
|
||||
},
|
||||
{
|
||||
label: 'Cancellato',
|
||||
value: 10,
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
OrderCmdStr: [
|
||||
{
|
||||
label: 'Imposta Ordine in Lavorazione', //CHECKOUT_SENT
|
||||
value: 2,
|
||||
icon: 'fas fa-list-ol',
|
||||
color: 'secondary',
|
||||
},
|
||||
{
|
||||
label: 'Conferma Ordine Evaso (e aggiorna Qta in Stock)', //ORDER_CONFIRMED
|
||||
value: 3,
|
||||
icon: 'fas fa-calendar-check',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
label: 'Imposta come Pagato', //PAYED
|
||||
value: 4,
|
||||
icon: 'money',
|
||||
color: 'positive',
|
||||
},
|
||||
{
|
||||
label: 'Imposta come Consegnato', //DELIVERED
|
||||
value: 5,
|
||||
icon: 'fas fa-shipping-fast',
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
label: 'Imposta come Spedito', //DELIVERED
|
||||
value: 5,
|
||||
icon: 'fas fa-shipping-fast',
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
label: 'Imposta come Cancellato', //CANCELED
|
||||
value: 10,
|
||||
icon: 'delete',
|
||||
color: 'red',
|
||||
},
|
||||
],
|
||||
|
||||
ConfSite: {
|
||||
@@ -1901,7 +1952,7 @@ export const shared_consts = {
|
||||
if (proj_add)
|
||||
proj = Object.assign({}, proj, proj_add);
|
||||
|
||||
proj = {...proj, ...this.REACTIONS_FIELD};
|
||||
proj = { ...proj, ...this.REACTIONS_FIELD };
|
||||
|
||||
if (table) {
|
||||
let proj_add3 = this.getProjectByTable(table);
|
||||
|
||||
@@ -154,6 +154,9 @@ export default defineComponent({
|
||||
if (myorder.value.quantity > 0) {
|
||||
myproduct.value.quantityAvailable -= myorder.value.quantity
|
||||
}
|
||||
if (myproduct.value.tempTotalQty > 0) {
|
||||
myproduct.value.quantityAvailable -= myproduct.value.tempTotalQty
|
||||
}
|
||||
}
|
||||
|
||||
function getQtyAvailable() {
|
||||
@@ -190,7 +193,7 @@ export default defineComponent({
|
||||
console.log('myproduct', myproduct, 'product', props.product)
|
||||
|
||||
if (!!myproduct.value) {
|
||||
if (myproduct.value.storehouses.length === 1) {
|
||||
if (myproduct.value.storehouses && myproduct.value.storehouses.length === 1) {
|
||||
myorder.value.idStorehouse = myproduct.value.storehouses[0]._id
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
<div class="q-pa-md row items-start q-gutter-md">
|
||||
<q-card :class="getmycardcl()" v-if="!!myproduct" bordered>
|
||||
<!--<q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img>-->
|
||||
<img src="https://cdn.quasar.dev/img/parallax2.jpg">
|
||||
<img src="https://cdn.quasar.dev/img/parallax2.jpg" />
|
||||
|
||||
<q-list>
|
||||
<q-item>
|
||||
<q-btn v-if="!complete" fab color="primary" icon="fas fa-info" class="absolute"
|
||||
style="top: 0; right: 12px; transform: translateY(-50%)" :to="`/product/` + myproduct.code" />
|
||||
<q-btn
|
||||
v-if="!complete"
|
||||
fab
|
||||
color="primary"
|
||||
icon="fas fa-info"
|
||||
class="absolute"
|
||||
style="top: 0; right: 12px; transform: translateY(-50%)"
|
||||
:to="`/product/` + myproduct.code"
|
||||
/>
|
||||
|
||||
<div class="row items-center centeritems">
|
||||
<div class="text-h7 boldhigh">
|
||||
@@ -32,12 +39,14 @@
|
||||
{{ t('products.price') }}
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
<span class="prod_price" v-if="!!myproduct.price">{{ myproduct.price ? myproduct.price.toFixed(2) : 0
|
||||
<span class="prod_price" v-if="!!myproduct.price">{{
|
||||
myproduct.price ? myproduct.price.toFixed(2) : 0
|
||||
}}</span>
|
||||
<span v-if="!!myproduct.after_price">{{
|
||||
myproduct.after_price
|
||||
}}</span>
|
||||
|
||||
tempTotalQty : {{ myproduct.tempTotalQty }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
@@ -50,22 +59,30 @@
|
||||
<span class="text-blue q-ml-xs text-h8">
|
||||
{{ myproduct.producer.city }} ({{
|
||||
myproduct.producer.region
|
||||
}})</span>
|
||||
}})</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="complete && myproduct.producer && myproduct.producer.name"
|
||||
class="text-grey text-title row items-center">
|
||||
<div
|
||||
v-if="complete && myproduct.producer && myproduct.producer.name"
|
||||
class="text-grey text-title row items-center"
|
||||
>
|
||||
<q-icon name="place" class="q-mr-xs" />
|
||||
{{ t('products.producer') }}:
|
||||
<span class="text-black q-ml-xs text-h8">
|
||||
{{ myproduct.producer.name }}</span>
|
||||
{{ myproduct.producer.name }}</span
|
||||
>
|
||||
</div>
|
||||
<div v-if="complete && myproduct.weight" class="text-grey text-title row items-center">
|
||||
<div
|
||||
v-if="complete && myproduct.weight"
|
||||
class="text-grey text-title row items-center"
|
||||
>
|
||||
<q-icon name="fas fa-balance-scale" class="q-mr-xs" />
|
||||
{{ t('products.weight') }}:
|
||||
<span class="text-black q-ml-xs text-h8">
|
||||
{{ myproduct.weight }}
|
||||
{{ tools.getUnitsMeasure(myproduct.unit, true) }}</span>
|
||||
{{ tools.getUnitsMeasure(myproduct.unit, true) }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -89,11 +106,9 @@
|
||||
{{ getQtyWarn() }}
|
||||
</span>
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
</q-item-label>
|
||||
<q-item-label> </q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
</q-list>
|
||||
<div class="row q-mb-sm no-wrap items-center centeritems">
|
||||
<!--<q-btn
|
||||
@@ -104,12 +119,23 @@
|
||||
@click="decqty()"
|
||||
></q-btn>-->
|
||||
|
||||
<q-btn icon="fas fa-cart-arrow-down" :color="enableSubQty() ? 'negative' : 'grey'"
|
||||
:disable="checkifCartDisable() || !enableSubQty()" rounded size="md" :label="t('products.subcart', { qta: 1 })"
|
||||
@click="addtoCart(false)">
|
||||
<q-btn
|
||||
icon="fas fa-cart-arrow-down"
|
||||
:color="enableSubQty() ? 'negative' : 'grey'"
|
||||
:disable="checkifCartDisable() || !enableSubQty()"
|
||||
rounded
|
||||
size="md"
|
||||
:label="t('products.subcart', { qta: 1 })"
|
||||
@click="addtoCart(false)"
|
||||
>
|
||||
</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>
|
||||
<div class="self-center no-outline" tabindex="0">
|
||||
{{ myorder.quantity }}
|
||||
@@ -118,8 +144,15 @@
|
||||
</q-field>
|
||||
|
||||
<!--<q-btn round size="xs" text-color="grey" icon="fas fa-plus" @click="addqty()"></q-btn>-->
|
||||
<q-btn icon-right="fas fa-cart-plus" color="positive" :disable="checkifCartDisable() || !enableAddQty()" rounded
|
||||
size="md" :label="t('products.addcart', { qta: 1 })" @click="addtoCart(true)">
|
||||
<q-btn
|
||||
icon-right="fas fa-cart-plus"
|
||||
color="positive"
|
||||
:disable="checkifCartDisable() || !enableAddQty()"
|
||||
rounded
|
||||
size="md"
|
||||
:label="t('products.addcart', { qta: 1 })"
|
||||
@click="addtoCart(true)"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
<div v-if="complete || getnumstore() > 1">
|
||||
@@ -127,10 +160,19 @@
|
||||
<q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm" />
|
||||
{{ t('products.ritiro_presso') }}:
|
||||
</div>
|
||||
<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">
|
||||
<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
|
||||
: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>
|
||||
<div v-else>
|
||||
@@ -142,8 +184,15 @@
|
||||
</div>
|
||||
|
||||
<q-card-actions vertical align="center">
|
||||
<q-btn v-if="myorder.quantity > 0" rounded icon="fas fa-shopping-cart" color="primary"
|
||||
:label="$t('ecomm.btn_cassa')" class="q-mb-sm" to="/checkout"></q-btn>
|
||||
<q-btn
|
||||
v-if="myorder.quantity > 0"
|
||||
rounded
|
||||
icon="fas fa-shopping-cart"
|
||||
color="primary"
|
||||
: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>
|
||||
|
||||
@@ -506,7 +506,7 @@ export default defineComponent({
|
||||
|
||||
|
||||
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.COMPLETED)
|
||||
// const arrorderscart = Products.orders
|
||||
if (!!arrorderscart) {
|
||||
return arrorderscart.length
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface IProduct {
|
||||
color?: string,
|
||||
size?: string,
|
||||
quantityAvailable: number,
|
||||
tempTotalQty: number,
|
||||
stockQty: number,
|
||||
canBeShipped?: boolean,
|
||||
canBeBuyOnline?: boolean,
|
||||
@@ -116,17 +117,25 @@ export interface ICart {
|
||||
export interface IOrderCart {
|
||||
_id?: any
|
||||
idapp?: string
|
||||
numorder?: number
|
||||
userId?: string
|
||||
totalQty?: number
|
||||
totalPrice?: number
|
||||
numorder: number
|
||||
userId: string
|
||||
totalQty: number
|
||||
totalPrice: number
|
||||
department?: string
|
||||
items?: IBaseOrder[]
|
||||
nameSurname?: string
|
||||
status?: number
|
||||
status: number
|
||||
note?: string
|
||||
modify_at?: Date
|
||||
completed_at?: Date
|
||||
evaso: boolean
|
||||
date_evaso?: Date
|
||||
consegnato: boolean
|
||||
date_consegnato?: Date
|
||||
pagato: boolean
|
||||
date_pagato?: Date
|
||||
spedito: boolean
|
||||
date_spedito?: Date
|
||||
}
|
||||
|
||||
export interface IShareWithUs {
|
||||
|
||||
@@ -1619,9 +1619,15 @@ const msg_it = {
|
||||
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
|
||||
order: 'Ordine',
|
||||
ord_confirmed: 'Ordine Confermato',
|
||||
ord_not_confirmed: 'E\' avvenuto un errore. Ordine non Confermato. Ricaricare la pagina e riprovare.',
|
||||
btn_cassa: 'Vai alla Cassa',
|
||||
available: 'Disponibili',
|
||||
di_cui_x_in_carrello: '({qty} nel tuo carrello)',
|
||||
evaso: 'Ordine Evaso',
|
||||
consegnato: 'Ordine Consegnato',
|
||||
pagato: 'Ordine Pagato',
|
||||
spedito: 'Ordine Spedito',
|
||||
completed: 'Ordine Completato'
|
||||
|
||||
},
|
||||
install: {
|
||||
|
||||
@@ -351,6 +351,14 @@ export const getcolorderscart = [
|
||||
AddCol({ name: 'items', label_trans: 'order.items' }),
|
||||
AddCol({ name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
|
||||
AddCol({ name: 'note', label_trans: 'order.note' }),
|
||||
AddCol({ name: 'evaso', label_trans: 'order.evaso', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_evaso', label_trans: 'order.date_evaso', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_consegnato', label_trans: 'order.date_consegnato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'pagato', label_trans: 'order.pagato', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_pagato', label_trans: 'order.date_pagato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'spedito', label_trans: 'order.spedito', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_spedito', label_trans: 'order.date_spedito', fieldtype: costanti.FieldType.date }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
@@ -34,15 +34,21 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
getOrdersCart: (state: IProductsState) => (tipoord: number): IOrderCart[] | undefined => {
|
||||
console.log('state.orders', state.orders)
|
||||
if (tipoord === shared_consts.OrderStatStr.IN_CORSO)
|
||||
if (tipoord === shared_consts.OrderStat.IN_CORSO.value)
|
||||
return state.orders.filter((rec: IOrderCart) => (rec.status ? rec.status : 0) <= shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||
else if (tipoord === shared_consts.OrderStatStr.CONFERMATI)
|
||||
else if (tipoord === shared_consts.OrderStat.CONFERMATI.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.ORDER_CONFIRMED)
|
||||
else if (tipoord === shared_consts.OrderStatStr.PAGATI)
|
||||
else if (tipoord === shared_consts.OrderStat.PAGATI.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.PAYED)
|
||||
else if (tipoord === shared_consts.OrderStatStr.COMPLETATI)
|
||||
else if (tipoord === shared_consts.OrderStat.DELIVERED.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.DELIVERED)
|
||||
else if (tipoord === shared_consts.OrderStat.SHIPPED.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.SHIPPED)
|
||||
else if (tipoord === shared_consts.OrderStat.RECEIVED.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.RECEIVED)
|
||||
else if (tipoord === shared_consts.OrderStatStr.CANCELLATI)
|
||||
else if (tipoord === shared_consts.OrderStat.COMPLETATI.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.COMPLETED)
|
||||
else if (tipoord === shared_consts.OrderStat.CANCELLATI.value)
|
||||
return state.orders.filter((rec: IOrderCart) => rec.status === shared_consts.OrderStatus.CANCELED)
|
||||
},
|
||||
|
||||
@@ -86,6 +92,7 @@ export const useProducts = defineStore('Products', {
|
||||
quantityAvailable: 0,
|
||||
stockQty: 0,
|
||||
canBeShipped: false,
|
||||
tempTotalQty: 0,
|
||||
canBeBuyOnline: false,
|
||||
weight: 0,
|
||||
unit: 0,
|
||||
@@ -371,7 +378,7 @@ export const useProducts = defineStore('Products', {
|
||||
return ris
|
||||
},
|
||||
|
||||
async UpdateStatusCart({ cart_id, status }: { cart_id: string, status: number }) {
|
||||
async CreateOrdersCart({ cart_id, status }: { cart_id: string, status: number }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
@@ -381,7 +388,38 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
let ris = null
|
||||
|
||||
ris = await Api.SendReq('/cart/' + userStore.my._id + '/cartstatus', 'POST', { cart_id, status })
|
||||
ris = await Api.SendReq('/cart/' + userStore.my._id + '/createorderscart', 'POST', { cart_id, status })
|
||||
.then((res) => {
|
||||
|
||||
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_SENT) {
|
||||
// Cancella il Carrello, ho creato l'ordine !
|
||||
this.cart = {}
|
||||
}
|
||||
if (res.data.orders)
|
||||
this.orders = res.data.orders
|
||||
|
||||
return res.data.recOrderCart
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error UpdateStatusCart', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
|
||||
})
|
||||
|
||||
return ris
|
||||
},
|
||||
|
||||
async UpdateStatusCart({ ordercart_id, status }: { ordercart_id: string, status: number }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
if (!globalStore.site.confpages.enableEcommerce)
|
||||
return null
|
||||
|
||||
let ris = null
|
||||
|
||||
ris = await Api.SendReq('/cart/updatestatuscart', 'POST', { ordercart_id, status })
|
||||
.then((res) => {
|
||||
|
||||
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_SENT) {
|
||||
@@ -400,7 +438,7 @@ export const useProducts = defineStore('Products', {
|
||||
return ris
|
||||
},
|
||||
|
||||
async UpdateOrderStatus({ order_id, status }: { order_id: string, status: number }) {
|
||||
async UpdateOrderCartStatus({ order_id, status }: { order_id: string, status: number }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
@@ -410,12 +448,12 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
let ris = null
|
||||
|
||||
ris = await Api.SendReq('/cart/' + userStore.my._id + '/orderstatus', 'POST', { order_id, status })
|
||||
ris = await Api.SendReq('/cart/' + userStore.my._id + '/ordercartstatus', 'POST', { order_id, status })
|
||||
.then((res) => {
|
||||
return res.data.status
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error UpdateOrderStatus', error)
|
||||
console.log('error UpdateOrderCartStatus', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
|
||||
})
|
||||
|
||||
@@ -31,6 +31,7 @@ export default defineComponent({
|
||||
const myrec = ref(<any[string]>[])
|
||||
const oldrec = ref(<any[string]>[])
|
||||
const note = ref('')
|
||||
const recOrderCart = ref(<IOrderCart>{})
|
||||
const statusnow = ref(shared_consts.OrderStatus.NONE)
|
||||
|
||||
function mounted() {
|
||||
@@ -96,8 +97,9 @@ export default defineComponent({
|
||||
oldrec.value = myrec.value
|
||||
note.value = mycart.value.note!
|
||||
|
||||
if (mycart.value)
|
||||
statusnow.value = await productStore.UpdateStatusCart({ cart_id: mycart.value._id, status: 0 })
|
||||
if (mycart.value) {
|
||||
recOrderCart.value = await productStore.CreateOrdersCart({ cart_id: mycart.value._id, status: 0 })
|
||||
}
|
||||
|
||||
console.log('myrec', myrec.value)
|
||||
}
|
||||
@@ -147,13 +149,18 @@ export default defineComponent({
|
||||
title: t('ecomm.order')
|
||||
}).onOk(async () => {
|
||||
const status = shared_consts.OrderStatus.CHECKOUT_SENT
|
||||
statusnow.value = await productStore.UpdateStatusCart({ cart_id: mycart.value._id, status })
|
||||
|
||||
const myordercart = await productStore.CreateOrdersCart({ cart_id: mycart.value._id, status })
|
||||
|
||||
statusnow.value = myordercart ? myordercart.status : 0
|
||||
|
||||
if (statusnow.value === status) {
|
||||
tools.showPositiveNotif($q, t('ecomm.ord_confirmed'))
|
||||
setTimeout(() => {
|
||||
$router.push('/orderinfo')
|
||||
}, 2000)
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('ecomm.ord_not_confirmed'))
|
||||
}
|
||||
// change_field('status')
|
||||
// change_field('status')
|
||||
@@ -178,6 +185,8 @@ export default defineComponent({
|
||||
statusnow,
|
||||
shared_consts,
|
||||
myTotalQty,
|
||||
recOrderCart,
|
||||
mycart,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<q-page v-if="recOrderCart">
|
||||
<CTitleBanner title="Carrello"></CTitleBanner>
|
||||
<div class="panel">
|
||||
<div>
|
||||
@@ -36,14 +36,14 @@
|
||||
|
||||
<div class="text-center">
|
||||
<q-btn
|
||||
v-if="statusnow < shared_consts.OrderStatus.CHECKOUT_SENT"
|
||||
v-if="recOrderCart && recOrderCart.status < shared_consts.OrderStatus.CHECKOUT_SENT"
|
||||
rounded
|
||||
icon="fas fa-shopping-cart"
|
||||
color="green"
|
||||
:label="$t('ecomm.completa_ord')"
|
||||
class="q-mb-sm"
|
||||
:disabled="myTotalQty() < 1"
|
||||
@click="completeOrder"
|
||||
@click="completeOrder()"
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,3 +12,10 @@ $heightBtn: 100%;
|
||||
.q-item__label--caption{
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.ordstat{
|
||||
text-align: center;
|
||||
border: 1px solid #8778cb;
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export default defineComponent({
|
||||
const conferma_carrello = ref(false)
|
||||
const conferma_ordine = ref(false)
|
||||
|
||||
const taborders = ref(shared_consts.OrderStatStr.IN_CORSO)
|
||||
const taborders = ref(shared_consts.OrderStat.IN_CORSO.value)
|
||||
const statusnow = ref(0)
|
||||
const arrnumstatus = ref(<any[]>[])
|
||||
const columns = ref(<any>[
|
||||
@@ -143,7 +143,7 @@ export default defineComponent({
|
||||
|
||||
function getOrdersCart(): IOrderCart[] | undefined {
|
||||
const ris = productStore.getOrdersCart(taborders.value)
|
||||
console.log(ris)
|
||||
// console.log(ris)
|
||||
return ris
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const allorders = getAllOrdersCart()
|
||||
for (const status of [2, 3, 4, 6, 10]) {
|
||||
for (const status of [2, 3, 4, 5, 6, 7, 8, 10]) {
|
||||
arrnumstatus.value[status] = allorders.filter((rec) => (rec.status === status)).reduce((sum, item) => sum + 1, 0)
|
||||
}
|
||||
|
||||
@@ -170,8 +170,18 @@ export default defineComponent({
|
||||
|
||||
updateorders()
|
||||
|
||||
console.log('arrnumstatus;')
|
||||
console.log(arrnumstatus.value)
|
||||
taborders.value = -1
|
||||
|
||||
Object.keys(arrnumstatus.value).forEach((stat: any) => {
|
||||
if (arrnumstatus.value[stat] > 0) {
|
||||
if (taborders.value === -1)
|
||||
taborders.value = parseInt(stat)
|
||||
}
|
||||
})
|
||||
|
||||
if (taborders.value === -1)
|
||||
taborders.value = shared_consts.OrderStat.IN_CORSO.value
|
||||
|
||||
|
||||
if (tools.isManager()) {
|
||||
columns.value = [...columns_Admin.value]
|
||||
@@ -234,7 +244,7 @@ export default defineComponent({
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
|
||||
statusnow.value = await productStore.UpdateOrderStatus({ order_id: order._id, status })
|
||||
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status })
|
||||
|
||||
if (statusnow.value === status) {
|
||||
order.status = statusnow.value
|
||||
|
||||
@@ -3,38 +3,15 @@
|
||||
<CTitleBanner title="Ordini"></CTitleBanner>
|
||||
<div class="panel">
|
||||
<q-tabs v-model="taborders" inline-label class="text-blue">
|
||||
<span v-for="(stat, index) of shared_consts.OrderStat" :key="index">
|
||||
<q-tab
|
||||
class="text-black"
|
||||
:name="shared_consts.OrderStatStr.IN_CORSO"
|
||||
icon="fas fa-tasks"
|
||||
:label="`(` + arrnumstatus[2] + `) in Corso`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-blue"
|
||||
:name="shared_consts.OrderStatStr.CONFERMATI"
|
||||
icon="fas fa-calendar"
|
||||
:label="`(` + arrnumstatus[3] + `) Confermati`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-green"
|
||||
:name="shared_consts.OrderStatStr.PAGATI"
|
||||
icon="fas fa-calendar"
|
||||
:label="`(` + arrnumstatus[4] + `) Pagati`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-blue-grey-8"
|
||||
v-if="arrnumstatus[6] > 0"
|
||||
:name="shared_consts.OrderStatStr.COMPLETATI"
|
||||
icon="fas fa-check"
|
||||
:label="`(` + arrnumstatus[6] + `) Completati`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-red"
|
||||
v-if="arrnumstatus[10] > 0"
|
||||
:name="shared_consts.OrderStatStr.CANCELLATI"
|
||||
icon="delete"
|
||||
:label="`(` + arrnumstatus[10] + `) Cancellati`"
|
||||
v-if="arrnumstatus[stat.value] > 0"
|
||||
:class="stat.color"
|
||||
:name="stat.value"
|
||||
:icon="stat.icon"
|
||||
:label="`(` + arrnumstatus[stat.value] + `) ` + stat.label"
|
||||
/>
|
||||
</span>
|
||||
</q-tabs>
|
||||
|
||||
<div class="q-pa-sm">
|
||||
@@ -56,10 +33,6 @@
|
||||
<q-item-section side>
|
||||
<q-item-label v-if="col.name === 'created_at'" caption
|
||||
>{{ tools.getstrDateTime(col.value) }}
|
||||
<span v-if="taborders === shared_consts.OrderStatStr.COMPLETATI">
|
||||
<br />Completato il:
|
||||
{{ tools.getstrDateTime(props.row.completed_at) }}
|
||||
</span>
|
||||
</q-item-label>
|
||||
<q-item-label v-else-if="col.name === 'items'" caption>
|
||||
<div
|
||||
@@ -101,7 +74,7 @@
|
||||
</q-td>
|
||||
<q-td key="created_at" :props="props">
|
||||
{{ tools.getstrDateTime(props.row.created_at) }}
|
||||
<span v-if="taborders === shared_consts.OrderStatStr.COMPLETATI">
|
||||
<span v-if="taborders === shared_consts.OrderStat.COMPLETATI">
|
||||
<br />Completato il:<br />{{
|
||||
tools.getstrDateTime(props.row.completed_at)
|
||||
}}
|
||||
@@ -123,114 +96,47 @@
|
||||
<span :class="props.row.status">{{
|
||||
shared_consts.getStatusStr(props.row.status)
|
||||
}}</span>
|
||||
<div v-if="props.row.evaso" class="ordstat">
|
||||
{{ tools.getstrDateTime(props.row.date_evaso) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.spedito') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.consegnato" class="ordstat">
|
||||
{{ tools.getstrDateTime(props.row.date_consegnato) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.consegnato') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.pagato" class="ordstat">
|
||||
{{ tools.getstrDateTime(props.row.date_pagato) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.pagato') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.spedito">
|
||||
{{ tools.getstrDateTime(props.row.date_spedito) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.spedito') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.completed">
|
||||
{{ tools.getstrDateTime(props.row.date_completed) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.completed') }}</span>
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td key="comandi" :props="props">
|
||||
<div v-if="tools.isManager()" class="q-pa-sm">
|
||||
<q-btn-dropdown rounded dense label="Azioni">
|
||||
<q-list class="text-primary">
|
||||
<q-item
|
||||
v-for="(cmd, index) of shared_consts.OrderCmdStr"
|
||||
:key="index"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.ORDER_CONFIRMED
|
||||
)
|
||||
"
|
||||
@click="clickFunz(props.row, cmd.value)"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-list-ol"
|
||||
color="grey"
|
||||
:icon="cmd.icon"
|
||||
:color="cmd.color"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Inviato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.ORDER_CONFIRMED
|
||||
)
|
||||
"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-calendar-check"
|
||||
color="secondary"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Confermato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(props.row, shared_consts.OrderStatus.PAYED)
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="money"
|
||||
color="positive"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Pagato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.RECEIVED
|
||||
)
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-check"
|
||||
color="primary"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Completato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.CANCELED
|
||||
)
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="delete"
|
||||
color="negative"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Cancellato</q-item-label>
|
||||
<q-item-label>{{ cmd.label }}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
|
||||
Reference in New Issue
Block a user