l-assiette/index.php

130 lines
3.0 KiB
PHP
Raw Normal View History

2018-09-25 00:16:24 +00:00
<!DOCTYPE HTML>
<html lang="es">
<head>
<title>Cocina Francesa</title>
2018-10-06 14:50:08 +00:00
<link rel="stylesheet" href="/ihc/dist/css/base.css?v=2" type="text/css"/>
2018-09-25 00:16:24 +00:00
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
2018-10-06 14:50:08 +00:00
<script src="/ihc/dist/js/topbar.min.js"></script>
<div id="vueApp">
<router-view></router-view>
</div>
<!-- Vue y Vuerouter -->
<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
2018-10-06 14:50:08 +00:00
<script src="/ihc/dist/dependencias/vuerouter.min.js"></script>
<script src="/ihc/dist/dependencias/vue.js"></script>
<script>
Vue.use(VueRouter);
const carritoUsuario = [];
const footer = {
template: `<?php include "./src/componentes/mi-footer.vue" ?>`
};
const navBar = {
template: `<?php include "./src/componentes/navBar.vue" ?>`
};
const headerMin = {
template: `<?php include "./src/componentes/headerMin.vue" ?>`
};
const inicio = {
template: `<?php include "./src/componentes/inicio.vue" ?>`,
components: {
'mi-footer': footer,
'header-min': headerMin,
'nav-bar': navBar
}
};
const carrito = {
template: `<?php include "./src/componentes/carrito.vue"?>`,
components: {
'mi-footer': footer,
'header-min': headerMin,
'nav-bar': navBar
},
data: function () {
return {
item: carritoUsuario,
descuento: 0
};
},
computed: {
cantidadItems: function () {
let items = 0;
for (const i in this.item)
items++;
return items;
},
subTotal: function () {
let subT = 0;
for (const itemI in this.item ) {
if (this.item.hasOwnProperty(itemI)){
const item = this.item[itemI];
subT += (item["precio"] * item["cantidad"]);
}
}
return subT;
},
total: function () {
return this.subTotal - this.descuento;
},
noEstaVacio: function () {
for (const i in this.item) {
return true;
}
return false;
},
},
methods: {
restarCantidad: function (elem) {
const cantidad = parseInt(elem.cantidad);
if (cantidad > 0)
elem.cantidad = cantidad -1;
},
aumentarCantidad: function (elem) {
const cantidad = parseInt(elem.cantidad);
if (cantidad >= 0)
elem.cantidad = cantidad+1;
}
}
};
const routes = [
{path: '/ihc/',component: inicio},
{path: '/ihc/carrito/', component: carrito}
];
const router = new VueRouter({
mode: 'history',
routes: routes
});
const vm = new Vue({
el: '#vueApp',
router: router
})
.$mount('#vueApp');
</script>
2018-09-25 00:16:24 +00:00
<!-- Logica principal -->
2018-10-06 14:50:08 +00:00
<!--<script src="./dist/js/base.min.js?v=2"></script>-->
2018-09-25 00:16:24 +00:00
</body>
</html>