Integrazione ECommerce (conversione)
This commit is contained in:
5
src/views/ecommerce/cartList/cartList.scss
Executable file
5
src/views/ecommerce/cartList/cartList.scss
Executable file
@@ -0,0 +1,5 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
59
src/views/ecommerce/cartList/cartList.ts
Executable file
59
src/views/ecommerce/cartList/cartList.ts
Executable file
@@ -0,0 +1,59 @@
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
import { CProductCard } from '@src/components/CProductCard'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CartList',
|
||||
components: { CProductCard },
|
||||
filters: {
|
||||
capitalize(value: any) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
value = value.toString()
|
||||
return value.charAt(0).toUpperCase() + value.slice(1)
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const productStore = useProducts()
|
||||
const $router = useRouter()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
|
||||
function getCart() {
|
||||
return productStore.getCart()
|
||||
}
|
||||
|
||||
function getProducts() {
|
||||
return productStore.getProducts()
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
// Inizializza
|
||||
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
getCart,
|
||||
getProducts,
|
||||
}
|
||||
}
|
||||
})
|
||||
21
src/views/ecommerce/cartList/cartList.vue
Executable file
21
src/views/ecommerce/cartList/cartList.vue
Executable file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<div class="panel">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts" :key="index">
|
||||
<CProductCard :product="product"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./cartList.ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './cartList';
|
||||
</style>
|
||||
1
src/views/ecommerce/cartList/index.ts
Executable file
1
src/views/ecommerce/cartList/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CartList} from './cartList.vue'
|
||||
5
src/views/ecommerce/checkOut/checkOut.scss
Executable file
5
src/views/ecommerce/checkOut/checkOut.scss
Executable file
@@ -0,0 +1,5 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
178
src/views/ecommerce/checkOut/checkOut.ts
Executable file
178
src/views/ecommerce/checkOut/checkOut.ts
Executable file
@@ -0,0 +1,178 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Watch } from 'vue-property-decorator'
|
||||
|
||||
import { SingleProject } from '../../../components/projects/SingleProject/index'
|
||||
import { CTodo } from '../../../components/todos/CTodo'
|
||||
|
||||
import { CProgress } from '../../../components/CProgress'
|
||||
import { CDate } from '../../../components/CDate'
|
||||
import { Action } from 'vuex'
|
||||
import Products from '@src/store/Modules/Products'
|
||||
import { CSingleCart } from '../../../components/CSingleCart'
|
||||
import { CTitleBanner } from '@components'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import { ICart } from '@src/model'
|
||||
import MixinBase from '@src/mixins/mixin-base'
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
|
||||
const namespace: string = 'Products'
|
||||
|
||||
@Component({
|
||||
name: 'checkOut',
|
||||
components: { SingleProject, CProgress, CTodo, CDate, CSingleCart, CTitleBanner },
|
||||
filters: {
|
||||
capitalize(value) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
value = value.toString()
|
||||
return value.charAt(0).toUpperCase() + value.slice(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default class CheckOut extends MixinBase {
|
||||
public $q: any
|
||||
public mycart: ICart = {}
|
||||
public myrec: any[]
|
||||
public note: string = ''
|
||||
public statusnow: number = shared_consts.OrderStatus.NONE
|
||||
|
||||
public conferma_carrello: boolean = false
|
||||
public conferma_ordine: boolean = false
|
||||
|
||||
/*public $refs: {
|
||||
singleproject: SingleProject[],
|
||||
ctodo: CTodo
|
||||
}*/
|
||||
|
||||
get getItemsCart() {
|
||||
const cart = Products.getters.getCart()
|
||||
return cart.items || null
|
||||
}
|
||||
|
||||
get getNumItems() {
|
||||
const cart = Products.getters.getCart()
|
||||
if (!!cart.items)
|
||||
return cart.items.length || 0
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
get getCart() {
|
||||
return Products.getters.getCart()
|
||||
}
|
||||
|
||||
get getNote() {
|
||||
const cart = Products.getters.getCart()
|
||||
return cart.note
|
||||
}
|
||||
|
||||
public change_field(fieldname) {
|
||||
if (this.myrec[fieldname] !== this[fieldname]) {
|
||||
this.myrec[fieldname] = this[fieldname]
|
||||
|
||||
const mydata = {
|
||||
[fieldname]: this.myrec[fieldname]
|
||||
}
|
||||
|
||||
const aggiorna = fieldname !== 'status'
|
||||
tools.saveFieldToServer(this, 'carts', this.mycart._id, mydata, aggiorna)
|
||||
}
|
||||
}
|
||||
|
||||
get myTotalPrice() {
|
||||
if (Products.state.cart && Products.state.cart.totalPrice) {
|
||||
return Products.state.cart.totalPrice.toFixed(2)
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
get myTotalQty() {
|
||||
if (Products.state.cart) {
|
||||
return Products.state.cart.totalQty
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
public async mounted() {
|
||||
// Products.actions.loadCart()
|
||||
this.load()
|
||||
}
|
||||
|
||||
public async load() {
|
||||
this.mycart = this.getCart
|
||||
this.myrec = Object.keys(this.mycart)
|
||||
this.note = this.mycart.note
|
||||
|
||||
if (this.mycart)
|
||||
this.statusnow = await Products.actions.UpdateStatusCart({ cart_id: this.mycart._id, status })
|
||||
|
||||
console.log('myrec', this.myrec)
|
||||
}
|
||||
|
||||
public CanBeShipped() {
|
||||
return Products.state.cart.items.filter((rec) => rec.order.product.canBeShipped).length
|
||||
}
|
||||
|
||||
public CanBeBuyOnline() {
|
||||
return Products.state.cart.items.filter((rec) => rec.order.product.canBeBuyOnline).length
|
||||
}
|
||||
|
||||
get getnumsteps() {
|
||||
let numsteps = 1
|
||||
|
||||
if (this.CanBeShipped())
|
||||
numsteps++
|
||||
if (this.CanBeBuyOnline())
|
||||
numsteps++
|
||||
|
||||
return numsteps
|
||||
}
|
||||
|
||||
public docheckout() {
|
||||
|
||||
// Può essere spedito?
|
||||
|
||||
if (this.CanBeShipped()) {
|
||||
// mostra form di spedizione
|
||||
}
|
||||
|
||||
if (this.CanBeBuyOnline()) {
|
||||
// mostra form di acquisto Online
|
||||
}
|
||||
}
|
||||
|
||||
get nextstep() {
|
||||
return 0
|
||||
}
|
||||
|
||||
public completeOrder() {
|
||||
this.$q.dialog({
|
||||
message: 'Confermare l\'ordine di acquisto di ' + this.myTotalQty + ' prodotti ?',
|
||||
ok: {
|
||||
label: this.$t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: this.$t('dialog.cancel')
|
||||
},
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
const status = shared_consts.OrderStatus.CHECKOUT_SENT
|
||||
this.statusnow = await Products.actions.UpdateStatusCart({ cart_id: this.mycart._id, status })
|
||||
|
||||
if (this.statusnow === status) {
|
||||
tools.showPositiveNotif(this.$q, 'Ordine Confermato')
|
||||
setTimeout(() => {
|
||||
this.$router.push('/orderinfo')
|
||||
}, 2000)
|
||||
}
|
||||
// this.change_field('status')
|
||||
// this.change_field('status')
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
44
src/views/ecommerce/checkOut/checkOut.vue
Executable file
44
src/views/ecommerce/checkOut/checkOut.vue
Executable file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<CTitleBanner title="Carrello"></CTitleBanner>
|
||||
<div class="panel">
|
||||
<div>
|
||||
<div class="container">
|
||||
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in getItemsCart" :key="index">
|
||||
|
||||
<CSingleCart :order="itemorder.order" :showall="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div class="col-6 q-mr-sm" style="text-align: right">
|
||||
<span class="text-grey q-mr-xs">Totale:</span> <span
|
||||
class="text-subtitle1 q-mr-sm ">€ {{ myTotalPrice }}</span>
|
||||
</div>
|
||||
|
||||
<q-input v-if="getNumItems > 0" v-model="note" style="max-width: 400px;" label="Scrivi qui per eventuali note o chiarimenti:"
|
||||
filled dense
|
||||
debounce="1000"
|
||||
autogrow
|
||||
@input="change_field('note')">
|
||||
</q-input>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<q-stepper-navigation>
|
||||
<q-btn v-if="statusnow < shared_consts.OrderStatus.CHECKOUT_SENT" rounded icon="fas fa-shopping-cart" color="green" label="Completa l'Ordine" class="q-mb-sm"
|
||||
:disabled="myTotalQty < 1"
|
||||
@click="completeOrder"></q-btn>
|
||||
</q-stepper-navigation>
|
||||
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./checkOut.ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './checkOut';
|
||||
</style>
|
||||
1
src/views/ecommerce/checkOut/index.ts
Executable file
1
src/views/ecommerce/checkOut/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as checkOut} from './checkOut.vue'
|
||||
1
src/views/ecommerce/index.ts
Executable file
1
src/views/ecommerce/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export * from './productsList'
|
||||
1
src/views/ecommerce/orderInfo/index.ts
Executable file
1
src/views/ecommerce/orderInfo/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as orderInfo} from './orderInfo.vue'
|
||||
14
src/views/ecommerce/orderInfo/orderInfo.scss
Executable file
14
src/views/ecommerce/orderInfo/orderInfo.scss
Executable file
@@ -0,0 +1,14 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.mycol{
|
||||
color:gray;
|
||||
}
|
||||
|
||||
|
||||
.q-item__label--caption{
|
||||
color: blue;
|
||||
}
|
||||
227
src/views/ecommerce/orderInfo/orderInfo.ts
Executable file
227
src/views/ecommerce/orderInfo/orderInfo.ts
Executable file
@@ -0,0 +1,227 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Watch } from 'vue-property-decorator'
|
||||
|
||||
import { SingleProject } from '../../../components/projects/SingleProject/index'
|
||||
import { CTodo } from '../../../components/todos/CTodo'
|
||||
|
||||
import { CProgress } from '../../../components/CProgress'
|
||||
import { CDate } from '../../../components/CDate'
|
||||
import { Action } from 'vuex'
|
||||
import Products from '@src/store/Modules/Products'
|
||||
import { CSingleCart } from '../../../components/CSingleCart'
|
||||
import { CTitleBanner } from '@components'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import { ICart, IOrderCart } from '@src/model'
|
||||
import MixinBase from '@src/mixins/mixin-base'
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
|
||||
const namespace: string = 'Products'
|
||||
|
||||
@Component({
|
||||
name: 'checkOut',
|
||||
components: { SingleProject, CProgress, CTodo, CDate, CSingleCart, CTitleBanner },
|
||||
filters: {
|
||||
capitalize(value) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
value = value.toString()
|
||||
return value.charAt(0).toUpperCase() + value.slice(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default class OrderInfo extends MixinBase {
|
||||
public $q: any
|
||||
public myorderscart: IOrderCart[] = []
|
||||
public myarrrec: any = {}
|
||||
|
||||
public conferma_carrello: boolean = false
|
||||
public conferma_ordine: boolean = false
|
||||
|
||||
public taborders: string = 'incorso'
|
||||
public filter: string = ''
|
||||
public statusnow: number = 0
|
||||
public arrnumstatus: any = []
|
||||
public columns = [
|
||||
{
|
||||
name: 'numorder',
|
||||
required: true,
|
||||
align: 'left',
|
||||
label: 'Numero Ordine',
|
||||
field: 'numorder',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
name: 'nameSurname',
|
||||
required: true,
|
||||
align: 'left',
|
||||
label: 'Nome',
|
||||
field: 'nameSurname',
|
||||
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
|
||||
}
|
||||
]
|
||||
|
||||
/*public $refs: {
|
||||
singleproject: SingleProject[],
|
||||
ctodo: CTodo
|
||||
}*/
|
||||
|
||||
get getOrdersCart() {
|
||||
return Products.getters.getOrdersCart(this.taborders)
|
||||
}
|
||||
|
||||
get getAllOrdersCart() {
|
||||
return Products.getters.getOrdersAllCart()
|
||||
}
|
||||
|
||||
public change_field(myorderid, fieldname) {
|
||||
if (this.myarrrec[myorderid][fieldname] !== this[fieldname]) {
|
||||
this.myarrrec[myorderid][fieldname] = this[fieldname]
|
||||
|
||||
const mydata = {
|
||||
[fieldname]: this.myarrrec[myorderid][fieldname]
|
||||
}
|
||||
|
||||
const aggiorna = fieldname !== 'status'
|
||||
tools.saveFieldToServer(this, 'orderscart', myorderid, mydata, aggiorna)
|
||||
}
|
||||
}
|
||||
public updateorders() {
|
||||
this.myorderscart = this.getOrdersCart
|
||||
for (const ordercart of this.myorderscart) {
|
||||
this.myarrrec[ordercart._id] = Object.keys(ordercart)
|
||||
}
|
||||
|
||||
const allorders = this.getAllOrdersCart
|
||||
for (const status of [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
6,
|
||||
10
|
||||
]) {
|
||||
this.arrnumstatus[status] = allorders.filter((rec) => (rec.status === status)).reduce((sum, item) => sum + 1, 0)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public mounted() {
|
||||
|
||||
this.updateorders()
|
||||
|
||||
console.log('arrnumstatus;')
|
||||
console.log(this.arrnumstatus)
|
||||
|
||||
this.columns = [...this.columns,
|
||||
{
|
||||
name: 'comandi',
|
||||
align: 'center',
|
||||
required: false,
|
||||
label: 'Comandi',
|
||||
field: 'comandi',
|
||||
sortable: false
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
public CanBeShipped() {
|
||||
return Products.state.cart.items.filter((rec) => rec.order.product.canBeShipped).length
|
||||
}
|
||||
|
||||
public CanBeBuyOnline() {
|
||||
return Products.state.cart.items.filter((rec) => rec.order.product.canBeBuyOnline).length
|
||||
}
|
||||
|
||||
get getnumsteps() {
|
||||
let numsteps = 1
|
||||
|
||||
if (this.CanBeShipped())
|
||||
numsteps++
|
||||
if (this.CanBeBuyOnline())
|
||||
numsteps++
|
||||
|
||||
return numsteps
|
||||
}
|
||||
|
||||
public docheckout() {
|
||||
|
||||
// Può essere spedito?
|
||||
|
||||
if (this.CanBeShipped()) {
|
||||
// mostra form di spedizione
|
||||
}
|
||||
|
||||
if (this.CanBeBuyOnline()) {
|
||||
// mostra form di acquisto Online
|
||||
}
|
||||
}
|
||||
|
||||
get nextstep() {
|
||||
return 0
|
||||
}
|
||||
|
||||
public clickFunz(order, status) {
|
||||
|
||||
if (status === shared_consts.OrderStatus.ORDER_CONFIRMED) {
|
||||
// Conferma Ordine
|
||||
}
|
||||
|
||||
const statusStr = shared_consts.getStatusStr(status)
|
||||
|
||||
this.$q.dialog({
|
||||
message: 'Impostare l\'ordine n. ' + order.numorder + ' ' + statusStr + ' ?',
|
||||
ok: {
|
||||
label: this.$t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: this.$t('dialog.cancel')
|
||||
},
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
|
||||
this.statusnow = await Products.actions.UpdateOrderStatus({ order_id: order._id, status })
|
||||
|
||||
if (this.statusnow === status) {
|
||||
order.status = this.statusnow
|
||||
this.updateorders()
|
||||
tools.showPositiveNotif(this.$q, 'Ordine ' + statusStr)
|
||||
}
|
||||
// this.change_field('status')
|
||||
// this.change_field('status')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
191
src/views/ecommerce/orderInfo/orderInfo.vue
Executable file
191
src/views/ecommerce/orderInfo/orderInfo.vue
Executable file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<CTitleBanner title="Ordini"></CTitleBanner>
|
||||
<div class="panel">
|
||||
<q-tabs
|
||||
v-model="taborders"
|
||||
inline-label
|
||||
class="text-blue"
|
||||
>
|
||||
<q-tab class="text-black" v-if="this.arrnumstatus[2] > 0" name="incorso" icon="fas fa-tasks" :label="`(` + this.arrnumstatus[2] +`) in Corso`"/>
|
||||
<q-tab class="text-blue" v-if="this.arrnumstatus[3] > 0" name="confermati" icon="fas fa-calendar" :label="`(` + this.arrnumstatus[3] +`) Confermati`"/>
|
||||
<q-tab class="text-green" v-if="this.arrnumstatus[4] > 0" name="pagati" icon="fas fa-calendar" :label="`(` + this.arrnumstatus[4] +`) Pagati`"/>
|
||||
<q-tab class="text-blue-grey-8" v-if="this.arrnumstatus[6] > 0" name="completati" icon="fas fa-check" :label="`(` + this.arrnumstatus[6] +`) Completati`"/>
|
||||
<q-tab class="text-red" v-if="this.arrnumstatus[10] > 0" name="cancellati" icon="delete" :label="`(` + this.arrnumstatus[10] +`) Cancellati`"/>
|
||||
</q-tabs>
|
||||
|
||||
<div class="q-pa-sm">
|
||||
<q-table
|
||||
:grid="$q.screen.lt.sm"
|
||||
:hide-header="$q.screen.lt.sm"
|
||||
:columns="columns"
|
||||
row-key="numorder"
|
||||
:data="getOrdersCart">
|
||||
|
||||
<template v-if="$q.screen.lt.sm" v-slot:item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
||||
<q-card class="my-card-shadow yes_shadow">
|
||||
<q-list dense>
|
||||
<q-item v-for="col in props.cols.filter(col => col.name !== 'desc')" :key="col.name">
|
||||
<q-item-section>
|
||||
<q-item-label>{{ col.label }}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side>
|
||||
<q-item-label v-if="col.name === 'created_at'" caption>{{
|
||||
tools.getstrDateTime(col.value)
|
||||
}}
|
||||
<span v-if="taborders === '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 v-for="item of props.row.items">
|
||||
<div v-if="!!item.order.product">
|
||||
{{ item.order.product.name }} ({{ item.order.quantity }})<br>
|
||||
</div>
|
||||
</div>
|
||||
</q-item-label>
|
||||
<q-item-label v-else-if="col.name === 'totalPrice'" caption>
|
||||
{{ props.row.totalPrice }} €
|
||||
</q-item-label>
|
||||
<q-item-label v-else-if="col.name === 'status'" caption>
|
||||
{{ shared_consts.getStatusStr(props.row.status) }}
|
||||
</q-item-label>
|
||||
<q-item-label v-else caption>{{ col.value }}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else v-slot:body="props">
|
||||
<q-tr :props="props">
|
||||
<q-td key="numorder" :props="props">
|
||||
n. {{ props.row.numorder }}
|
||||
</q-td>
|
||||
<q-td key="nameSurname" :props="props">
|
||||
{{ props.row.nameSurname }}
|
||||
</q-td>
|
||||
<q-td key="created_at" :props="props">
|
||||
{{ tools.getstrDateTime(props.row.created_at) }}
|
||||
<span v-if="taborders === 'completati'">
|
||||
<br>Completato il:<br>{{ tools.getstrDateTime(props.row.completed_at) }}
|
||||
</span>
|
||||
</q-td>
|
||||
<q-td key="items" :props="props">
|
||||
<div v-for="item of props.row.items">
|
||||
<div v-if="!!item.order.product">
|
||||
{{ item.order.product.name }} ({{ item.order.quantity }})<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</q-td>
|
||||
<q-td key="totalPrice" :props="props">
|
||||
{{ props.row.totalPrice }} €
|
||||
</q-td>
|
||||
<q-td key="status" :props="props">
|
||||
<span :class="props.row.status">{{ shared_consts.getStatusStr(props.row.status) }}</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">
|
||||
<q-item clickable v-close-popup
|
||||
@click="clickFunz(props.row, shared_consts.OrderStatus.ORDER_CONFIRMED)">
|
||||
<q-item-section avatar>
|
||||
<q-avatar icon="fas fa-list-ol" color="grey" 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-section>
|
||||
</q-item>
|
||||
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div v-for="(ordercart, index) in getOrdersCart" :key="index">
|
||||
|
||||
<div>
|
||||
{{ ordercart.numorder }}<br>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in ordercart.items" :key="index">
|
||||
|
||||
<CSingleCart :order="itemorder.order" :showall="true" :nomodif="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div class="col-6 q-mr-sm" style="text-align: right">
|
||||
<span class="text-grey q-mr-xs">Totale:</span> <span
|
||||
class="text-subtitle1 q-mr-sm ">€ {{ ordercart.totalPrice.toFixed(2) }}</span>
|
||||
</div>
|
||||
|
||||
<q-input v-model="ordercart.note" style="max-width: 400px;" label="Note aggiuntive:"
|
||||
filled dense
|
||||
debounce="1000"
|
||||
autogrow
|
||||
@input="change_field(ordercart.id, 'note')">
|
||||
</q-input>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./orderInfo.ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './orderInfo';
|
||||
</style>
|
||||
1
src/views/ecommerce/productInfo/index.ts
Executable file
1
src/views/ecommerce/productInfo/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as ProductInfo} from './ProductInfo.vue'
|
||||
5
src/views/ecommerce/productInfo/productInfo.scss
Executable file
5
src/views/ecommerce/productInfo/productInfo.scss
Executable file
@@ -0,0 +1,5 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
51
src/views/ecommerce/productInfo/productInfo.ts
Executable file
51
src/views/ecommerce/productInfo/productInfo.ts
Executable file
@@ -0,0 +1,51 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
|
||||
import {
|
||||
IAction,
|
||||
IDrag, IProduct,
|
||||
IProductsState, ITodo, ITodosState,
|
||||
TypeProj
|
||||
} from '../../../model/index'
|
||||
import { SingleProject } from '../../../components/projects/SingleProject/index'
|
||||
import { CTodo } from '../../../components/todos/CTodo'
|
||||
|
||||
import { tools } from '../../../store/Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
import { lists } from '../../../store/Modules/lists'
|
||||
import * as ApiTables from '../../../store/Modules/ApiTables'
|
||||
|
||||
import { GlobalStore, Projects, Todos } from '@store'
|
||||
import { UserStore } from '@store'
|
||||
|
||||
import { Getter } from 'vuex-class'
|
||||
|
||||
import { date, Screen } from 'quasar'
|
||||
import { CProgress } from '../../../components/CProgress'
|
||||
import { CDate } from '../../../components/CDate'
|
||||
import { RouteNames } from '@src/router/route-names'
|
||||
import { CProductCard } from '@src/components/CProductCard'
|
||||
import { Action } from 'vuex'
|
||||
import Products from '@src/store/Modules/Products'
|
||||
|
||||
const namespace: string = 'Products'
|
||||
|
||||
@Component({
|
||||
name: 'ProductInfo',
|
||||
components: { SingleProject, CProgress, CTodo, CDate, CProductCard }
|
||||
})
|
||||
|
||||
export default class ProductInfo extends Vue {
|
||||
public $q: any
|
||||
public code: string = ''
|
||||
|
||||
public created() {
|
||||
console.log('created productInfo')
|
||||
console.log(this.$route)
|
||||
if (!!this.$route.params.codprod) {
|
||||
this.code = this.$route.params.codprod.toString()
|
||||
}
|
||||
|
||||
console.log('this.code', this.code)
|
||||
}
|
||||
}
|
||||
19
src/views/ecommerce/productInfo/productInfo.vue
Executable file
19
src/views/ecommerce/productInfo/productInfo.vue
Executable file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<div class="panel">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<CProductCard :code="code" complete="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./productInfo.ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './productInfo';
|
||||
</style>
|
||||
1
src/views/ecommerce/productsList/index.ts
Executable file
1
src/views/ecommerce/productsList/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as ProductsList} from './productsList.vue'
|
||||
5
src/views/ecommerce/productsList/productsList.scss
Executable file
5
src/views/ecommerce/productsList/productsList.scss
Executable file
@@ -0,0 +1,5 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
55
src/views/ecommerce/productsList/productsList.ts
Executable file
55
src/views/ecommerce/productsList/productsList.ts
Executable file
@@ -0,0 +1,55 @@
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
import { CProductCard } from '@src/components/CProductCard'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ProductsList',
|
||||
components: { CProductCard },
|
||||
filters: {
|
||||
capitalize(value: any) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
value = value.toString()
|
||||
return value.charAt(0).toUpperCase() + value.slice(1)
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const productStore = useProducts()
|
||||
const $router = useRouter()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
|
||||
function mounted() {
|
||||
// Inizializza
|
||||
productStore.loadProducts()
|
||||
}
|
||||
function getProducts() {
|
||||
return productStore.getProducts()
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
getProducts,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
21
src/views/ecommerce/productsList/productsList.vue
Executable file
21
src/views/ecommerce/productsList/productsList.vue
Executable file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<div class="panel">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts" :key="index">
|
||||
<CProductCard :product="product" :complete="false"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./productsList.ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './productsList';
|
||||
</style>
|
||||
0
src/views/scheletro_convers/scheletro_convers.scss
Executable file
0
src/views/scheletro_convers/scheletro_convers.scss
Executable file
40
src/views/scheletro_convers/scheletro_convers.ts
Executable file
40
src/views/scheletro_convers/scheletro_convers.ts
Executable file
@@ -0,0 +1,40 @@
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Scheletro',
|
||||
components: { },
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const productStore = useProducts()
|
||||
const $router = useRouter()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
|
||||
|
||||
function mounted() {
|
||||
// Inizializza
|
||||
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
}
|
||||
}
|
||||
})
|
||||
4
src/views/scheletro_convers/scheletro_convers.vue
Executable file
4
src/views/scheletro_convers/scheletro_convers.vue
Executable file
@@ -0,0 +1,4 @@
|
||||
<template>
|
||||
<div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user