continua upgrade Vue 3
This commit is contained in:
18
src/components/CMyCart/CMyCart.scss
Executable file
18
src/components/CMyCart/CMyCart.scss
Executable file
@@ -0,0 +1,18 @@
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.text-title {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.centeritems{
|
||||
place-content: center;
|
||||
}
|
||||
|
||||
55
src/components/CMyCart/CMyCart.ts.old
Executable file
55
src/components/CMyCart/CMyCart.ts.old
Executable file
@@ -0,0 +1,55 @@
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
import MixinBase from '@src/mixins/mixin-base'
|
||||
import { CTitleBanner } from '@components'
|
||||
import { CCardState } from '../CCardState'
|
||||
import { CCopyBtn } from '../CCopyBtn'
|
||||
|
||||
import { IOrder, IProduct } from '@src/model'
|
||||
import { CSingleCart } from '../../components/CSingleCart'
|
||||
import MixinUsers from '@src/mixins/mixin-users'
|
||||
import { computed, defineComponent, ref } from "vue"
|
||||
import { useGlobalStore } from "@store/globalStore"
|
||||
|
||||
@Component({
|
||||
name: 'CMyCart',
|
||||
components: { CTitleBanner, CCardState, CCopyBtn, CSingleCart }
|
||||
})
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyCart',
|
||||
props: {},
|
||||
|
||||
setup() {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const myCart = computed(() => Products.cart)
|
||||
const myTotalPrice = computed(() => {
|
||||
if (Products.cart) {
|
||||
return Products.cart.totalPrice
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
})
|
||||
|
||||
const ordersCart = computed(() => {
|
||||
if (!!Products.cart) {
|
||||
return Products.cart.items
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
const numOrders = computed(() => {
|
||||
if (!!Products.cart) {
|
||||
return Products.cart.items.length
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function closecart() {
|
||||
globalStore.rightCartOpen = false
|
||||
}
|
||||
}
|
||||
46
src/components/CMyCart/CMyCart.vue.old
Executable file
46
src/components/CMyCart/CMyCart.vue.old
Executable file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div>
|
||||
<div id="mycontainer">
|
||||
<div class="myheader row justify-between">
|
||||
<div class="col-6">
|
||||
<q-btn class="q-mx-xs" round dense flat icon="fas fa-shopping-cart">
|
||||
|
||||
<q-badge v-if="getnumItemsCart > 0" color="red" floating transparent>
|
||||
{{ getnumItemsCart }}
|
||||
</q-badge>
|
||||
</q-btn>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right">
|
||||
<span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span> <span
|
||||
class="text-subtitle1 q-mr-sm ">€ {{ myTotalPrice.toFixed(2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div id="mybody">
|
||||
<div v-for="(rec, index) in ordersCart" :key="index" class="col">
|
||||
|
||||
<CSingleCart
|
||||
:order="rec.order"
|
||||
:showall="false">
|
||||
</CSingleCart>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="numOrders === 0" style="text-align: center" class="text-grey">
|
||||
Il Carrello è Vuoto
|
||||
</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" @click="closecart"></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyCart.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyCart.scss';
|
||||
</style>
|
||||
1
src/components/CMyCart/index.ts
Executable file
1
src/components/CMyCart/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export { default as CMyCart } from './CMyCart.vue'
|
||||
Reference in New Issue
Block a user