cambios de la reunion de hoy
This commit is contained in:
parent
16d06ffc4c
commit
5b4292e06f
|
@ -97,11 +97,11 @@ class ProductController {
|
||||||
async findById(req, res) {
|
async findById(req, res) {
|
||||||
const { dateExpired, postalCode } = req.query
|
const { dateExpired, postalCode } = req.query
|
||||||
const id = Number(req.params.id)
|
const id = Number(req.params.id)
|
||||||
const _products = await db.getProducts(dateExpired, postalCode);
|
const product = await db.getProductById(req.params.id);
|
||||||
const filterProduct = _products[0].filter(item => item.itemFk === id)
|
//const filterProduct = _products[0].filter(item => item.itemFk === id)
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
data: filterProduct
|
data: product
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,12 @@ async function getProducts(dateExpired, postalCode) {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getProductById(id) {
|
||||||
|
const conn = await connect();
|
||||||
|
const rows = await conn.query(`CALL catalogue_findById(${id})`);
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
//Procedure for create transactions, do not carry out any manipulation at the bank
|
//Procedure for create transactions, do not carry out any manipulation at the bank
|
||||||
async function orderData_put(jsonOrderData) {
|
async function orderData_put(jsonOrderData) {
|
||||||
const conn = await connect();
|
const conn = await connect();
|
||||||
|
@ -81,6 +87,7 @@ async function findAll_banner() {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getProducts,
|
getProducts,
|
||||||
|
getProductById,
|
||||||
orderData_get,
|
orderData_get,
|
||||||
orderData_put,
|
orderData_put,
|
||||||
getProvinces,
|
getProvinces,
|
||||||
|
|
|
@ -34,6 +34,7 @@ export default defineComponent({
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
isNew: String,
|
isNew: String,
|
||||||
|
hasPostalCode: Boolean,
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "md-card",
|
default: "md-card",
|
||||||
|
@ -77,7 +78,7 @@ export default defineComponent({
|
||||||
<template>
|
<template>
|
||||||
<div class="card-container" :class="size">
|
<div class="card-container" :class="size">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="`/product/${id}`"
|
:to="(hasPostalCode)?`/product/${id}`:''"
|
||||||
class="card-container-head"
|
class="card-container-head"
|
||||||
:class="[headClass]"
|
:class="[headClass]"
|
||||||
role="heading"
|
role="heading"
|
||||||
|
@ -112,7 +113,7 @@ export default defineComponent({
|
||||||
<div class="card-container-body">
|
<div class="card-container-body">
|
||||||
<p class="card-name" v-if="title">{{ title }}</p>
|
<p class="card-name" v-if="title">{{ title }}</p>
|
||||||
|
|
||||||
<div class="card-values">
|
<div class="card-values" v-if="hasPostalCode">
|
||||||
<p class="price" v-if="finalValue">{{ finalValue }}€</p>
|
<p class="price" v-if="finalValue">{{ finalValue }}€</p>
|
||||||
<p class="price offer tachado" v-if="+price !== finalValue">
|
<p class="price offer tachado" v-if="+price !== finalValue">
|
||||||
{{ price }}€
|
{{ price }}€
|
||||||
|
|
|
@ -205,7 +205,7 @@ export function useCheckoutForm() {
|
||||||
const handleFetchPaymentMethod = async ({ type, values }) => {
|
const handleFetchPaymentMethod = async ({ type, values }) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const productsId = cart.map((item) => item.itemFk);
|
const productsId = cart.map((item) => item.id);
|
||||||
const cartItensData = cart.map(({ id, message, ...rest }) => ({
|
const cartItensData = cart.map(({ id, message, ...rest }) => ({
|
||||||
id,
|
id,
|
||||||
message: message || "",
|
message: message || "",
|
||||||
|
|
|
@ -275,14 +275,15 @@ export default defineComponent({
|
||||||
|
|
||||||
<div class="products-section-body">
|
<div class="products-section-body">
|
||||||
<Container cardContainer class="category-container">
|
<Container cardContainer class="category-container">
|
||||||
<template v-for="item in products.data" :key="item?.itemFk">
|
<template v-for="item in products.data" :key="item?.id">
|
||||||
<Card
|
<Card
|
||||||
v-if="item"
|
v-if="item"
|
||||||
:price="item.price"
|
:price="item.price"
|
||||||
:title="item.name"
|
:title="item.name"
|
||||||
:imgSrc="item.image"
|
:imgSrc="item.image"
|
||||||
:isNew="item.isNew"
|
:isNew="item.isNew"
|
||||||
:id="item.itemFk"
|
:id="item.id"
|
||||||
|
:hasPostalCode="(item.postalCode !== 'undefined')?true:false"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
@ -68,8 +68,8 @@ export default defineComponent({
|
||||||
|
|
||||||
<div class="products-body">
|
<div class="products-body">
|
||||||
<Container cardContainer>
|
<Container cardContainer>
|
||||||
<template v-for="({ id, name, price, image, isNew }, i) in products?.data" :key="id">
|
<template v-for="({ id, name, price, image, isNew, postalCode }, i) in products?.data" :key="id">
|
||||||
<Card v-if="i < 8" :id="id" :price="price" :title="name" :imgSrc="image" :isNew="isNew"
|
<Card v-if="i < 8" :id="id" :price="price" :title="name" :imgSrc="image" :isNew="isNew" :hasPostalCode="(postalCode !== 'undefined')?true:false"
|
||||||
imgClass="list-products" size="md-card" />
|
imgClass="list-products" size="md-card" />
|
||||||
</template>
|
</template>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
@ -190,9 +190,9 @@ export default defineComponent({
|
||||||
<p class="product-content-paragraph">
|
<p class="product-content-paragraph">
|
||||||
SKU:
|
SKU:
|
||||||
<span class="green-text" style="display: inline-flex">
|
<span class="green-text" style="display: inline-flex">
|
||||||
{{ products.current?.itemFk }}
|
{{ products.current?.id }}
|
||||||
<q-skeleton
|
<q-skeleton
|
||||||
v-if="!products.current?.itemFk"
|
v-if="!products.current?.id"
|
||||||
width="100px"
|
width="100px"
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
|
@ -303,7 +303,7 @@ export default defineComponent({
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="products.next?.itemFk"
|
v-if="products.next?.id"
|
||||||
color="white"
|
color="white"
|
||||||
class="btn outlined rounded sm-btn product-pag-item product-next-btn"
|
class="btn outlined rounded sm-btn product-pag-item product-next-btn"
|
||||||
:to="`${+$route.params.id + 1}`"
|
:to="`${+$route.params.id + 1}`"
|
||||||
|
|
|
@ -197,7 +197,7 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
await getProducts(params);
|
await getProducts(params);
|
||||||
|
|
||||||
const hasCurrentProduct = computed(() => {
|
const hasCurrentProduct = computed(() => {
|
||||||
return cart.value.find((p) => p.itemFk === product.itemFk);
|
return cart.value.find((p) => p.id === product.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isEmpty.value) {
|
if (isEmpty.value) {
|
||||||
|
@ -209,7 +209,7 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!products.value.data.some((item) => item.itemFk === product.itemFk)) {
|
if (!products.value.data.some((item) => item.id === product.id)) {
|
||||||
push("/");
|
push("/");
|
||||||
return quasarNotify({
|
return quasarNotify({
|
||||||
message:
|
message:
|
||||||
|
|
Loading…
Reference in New Issue