56 lines
1.3 KiB
TypeScript
Executable File
56 lines
1.3 KiB
TypeScript
Executable File
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
|
|
}
|
|
}
|