other components...
This commit is contained in:
57
src/components/CMyCart/CMyCart.ts
Executable file
57
src/components/CMyCart/CMyCart.ts
Executable file
@@ -0,0 +1,57 @@
|
||||
import { CCardState } from '../CCardState'
|
||||
|
||||
import { computed, defineComponent } from 'vue'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import CCopyBtn from '@/components/CCopyBtn/CCopyBtn'
|
||||
import CSingleCart from '@/components/CSingleCart/CSingleCart'
|
||||
import CTitleBanner from '@/components/CTitleBanner/CTitleBanner'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyCart',
|
||||
props: {},
|
||||
components: { CTitleBanner, CCardState, CCopyBtn, CSingleCart },
|
||||
|
||||
setup() {
|
||||
const globalStore = useGlobalStore()
|
||||
const products = useProducts()
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return {
|
||||
myCart,
|
||||
myTotalPrice,
|
||||
ordersCart,
|
||||
numOrders,
|
||||
closecart,
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -1,55 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,12 @@
|
||||
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>
|
||||
<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">
|
||||
Reference in New Issue
Block a user