productora page

This commit is contained in:
María
2025-09-10 10:59:45 +02:00
parent dab9fd1fe6
commit 5c83090685
9 changed files with 467 additions and 436 deletions

View File

@@ -1,152 +1,24 @@
<template>
<div class="productcard_container">
<div class="row productcard_container-basic">
<div class="image_container" :class="expanded ? 'col-md-5' : 'col-md-2'">
<img
v-if="product.image"
class="image"
:src="product.image"
:alt="product.name"
/>
<img
v-else
class="image"
src="@/assets/img/consumo-default.png"
:alt="product.name"
/>
</div>
<div class="info_container" :class="expanded ? 'col-md-5' : 'col-md-6'">
<h2 v-b-toggle="'collapse-' + product.id" variant="primary">
{{ product.name }}
</h2>
<span v-if="product.price" class="price">{{
`${product.price}`
}}</span>
<span v-else class="price">Precio a consultar</span>
<span v-if="Number(product.shipping_cost)"
>| {{ `Gastos de envío ${product.shipping_cost}` }}</span
>
<span v-else>| Sin gastos de envío</span>
<span v-if="product.stock">| {{ `Stock ${product.stock}` }} </span>
<div
class="description"
:class="{ 'not-expanded-description': !expanded }"
>
<p
v-if="product.description"
v-html="sanitizedDescription"
></p>
<span v-if="product.shipping_terms">{{
product.shipping_terms
}}</span>
</div>
<b-collapse :id="'collapse-' + product.id" accordion="my-accordion" @show="onOpen" @hide="onClose">
<div class="tags_container">
<NuxtLink
:to="tagRoute(n)"
class="tag_container"
v-for="n in product.tags"
:key="n"
>
<img
alt="tag image"
class="tag_img"
src="@/assets/img/latienda-tag.svg"
/>
<span>{{ n }}</span>
</NuxtLink>
</div>
<div class="smlogos_container">
<p class="share-text">Comparte:</p>
<div class="smlogo_container">
<a class="smlogo_link" @click="shareFacebook">
<img
class="smlogo_img"
alt="facebook logo"
src="@/assets/img/latienda-smlogo-facebook.svg"
/>
</a>
</div>
<!-- <a @click="shareTwitter"> -->
<a :href="shareTwitter()">
<div class="smlogo_container">
<img
class="smlogo_img"
alt="twitter logo"
src="@/assets/img/latienda-smlogo-twitter.svg"
/>
</div>
</a>
<a
:href="shareWhatsApp()"
data-action="share/whatsapp/share"
target="_blank"
title="latiendacoop"
>
<div class="smlogo_container">
<img
alt="whatsapp logo"
class="smlogo_img"
src="@/assets/img/latienda-smlogo-whatsapp.svg"
/>
</div>
</a>
</div>
<div v-if="product.company" class="coop_info">
<NuxtLink :to="`c/${product.company.id}`">
<h2>{{ product.company.company_name }}</h2>
</NuxtLink>
<p>{{ product.company.description }}</p>
<a :href="product.company.web_link">{{
product.company.web_link
}}</a>
</div>
</b-collapse>
</div>
<div
:class="
expanded
? 'col-md-2 button_container-detail'
: 'col-md-4 button_container'
"
align="center"
>
<button
@click="buyIntent"
:class="expanded ? 'button_buy-simple' : 'button_buy'"
>
<img
class="button_cart_img"
alt="cart"
src="@/assets/img/latienda-carrito.svg"
/>
<span v-show="!expanded">Comprar</span>
</button>
<div
v-if="product.discount && product.discount > 0"
class="discount-tag"
>
{{ `Descuento ${product.discount}%` }}
</div>
<span v-if="product.company" v-show="!expanded">{{
product.company.company_name
}}</span>
</div>
<div class="c-card">
<div class="image-container">
<img v-if="product.image" class="image" :src="product.image" alt="" />
<img v-else class="image" :src="`@/assets/img/consumo-default.svg`" alt="" />
</div>
<div v-if="expanded && relatedProducts" class="related_products">
<h2>Productos relacionados</h2>
<ProductsRelated :related-products="relatedProducts" />
<div class="details-container">
<p>{{ product.name }}</p>
<p class="company">{{ product.company.company_name }}</p>
<p v-if="product.price" class="price">{{ product.price }}</p>
</div>
<div class="links-btns">
<NuxtLink :to="`/productos/${product.id}`" class="div-action show-link">
<img class="div-action-img" src="@/assets/img/eye.svg" />
VER
</NuxtLink>
<NuxtLink v-if="product.url" :to="product.url" class="div-action buy-link">
<img class="div-action-img" src="@/assets/img/shopping-cart.svg" />
COMPRAR
</NuxtLink>
</div>
<ProductModal v-if="modal" :product="product" @close-modal="closeModal" />
<BModal
id="modal-center"
v-model="active"
centered
title="latienda.coop"
:ok-variant="modalColor"> {{ modalText }}
</BModal>
</div>
</template>
@@ -312,200 +184,146 @@ export default {
</script>
<style lang="scss" scoped>
.productcard_container {
border: 3px $color-grey-nav solid;
border-radius: 5px;
margin-bottom: 12px;
}
.productcard_container-basic {
padding: 25px 20px;
}
.image_container {
height: 100%;
overflow: hidden;
margin: auto;
}
.image {
.image-container {
width: 100%;
height: 100%;
object-fit: cover;
}
.info_container {
h2 {
outline: none;
font-weight: $regular;
color: $color-navy;
font-size: $m;
}
.price {
font-weight: $bold;
color: $color-navy;
font-size: $m;
}
span {
color: $color-greytext;
}
.description {
margin-top: 8px;
font-family: $font-secondary;
font-size: $s;
color: $color-greytext;
}
}
.not-expanded-description {
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
overflow: hidden;
height: 11rem;
flex-shrink: 0;
align-self: stretch;
border-radius: 24px 24px 0 0;
@include mobile {
-webkit-line-clamp: 3;
max-height: 10rem;
max-width: 10rem;
}
.image {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 24px 24px 0 0;
}
}
.button_container {
.c-card {
width: 237px;
height: 316px;
display: flex;
flex-direction: column;
font-size: $m;
align-items: center;
justify-content: stretch;
background-color: #FDFCFB;
border: 5px solid white;
border-radius: 24px;
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.15);
text-decoration: none;
position: relative; // necesario para controlar hijos absolutos
overflow: hidden;
span {
margin-top: 15px;
text-align: center;
font-weight: medium;
font-size: $m;
color: $color-navy;
}
.button_buy {
border: 3px solid $color-orange;
border-radius: 5px;
background-color: $color-light;
&:hover {
box-shadow: 0 4px 16px rgba(99, 99, 99, 0.2);
transition: all 0.2s ease;
}
span {
color: $color-orange;
font-weight: $bold;
display: inline-block;
margin-bottom: 15px;
}
}
}
.button_buy-simple {
border: 3px solid $color-orange;
border-radius: 8px;
background-color: $color-light;
padding: 10px 20px;
&:hover {
box-shadow: 0 4px 16px rgba(99, 99, 99, 0.2);
transition: all 0.2s ease;
}
.button_cart_img {
margin-right: 0;
}
}
.tag_container {
margin: 25px 6px 0 0;
border: 2px solid $color-greylayout;
border-radius: 5px;
padding: 6px 10px;
display: inline-block;
font-family: $font-secondary;
font-size: $xs;
color: $color-greytext;
.tag_img {
width: 18px;
}
}
.discount-tag {
margin: 5px;
border: none;
background-color: $color-green;
border-radius: 5px;
padding: 6px 10px;
display: inline-block;
font-family: $font-secondary;
font-size: $xs;
color: $color-greytext;
}
.share-text {
color: $color-navy;
font-size: $m;
margin-top: 2rem;
padding-bottom: 0.2em;
}
.smlogo_container {
cursor: pointer;
display: inline-block;
margin-bottom: 0.5rem;
.smlogo_img {
width: 40px;
fill: $color-greytext;
}
img:hover {
transform: scale(1.1);
transition: all 0.2s ease;
}
}
.button_cart_img {
width: 20px;
margin-right: 10px;
}
.coop_info {
margin-top: 25px;
p,
a {
margin-top: 8px;
font-family: $font-secondary;
font-size: $s;
color: $color-greytext;
}
a {
text-decoration: underline;
}
p {
text-align: center;
display: -webkit-box;
-webkit-line-clamp: 3;
--webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
}
.related_products {
background-color: $color-lighter-green;
text-align: center;
padding: 0 15px;
h2 {
margin: 35px auto;
font-weight: $regular;
color: $color-navy;
width: 100%;
font-weight: $medium;
font-size: $m;
display: inline-block;
}
// detalles visibles por defecto
.details-container {
opacity: 1;
visibility: visible;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
height: 100%;
p {
margin: 0;
}
.company {
font-weight: $regular;
font-size: $s;
margin: 0;
}
.price {
font-weight: $bold;
font-size: $m;
margin-top: auto;
margin-bottom: 2px;
}
}
// botones ocultos por defecto
.links-btns {
opacity: 0;
visibility: hidden;
position: absolute;
bottom: 1rem;
left: 0;
width: 100%;
display: flex;
gap: 0.5rem;
transition: all 0.3s ease;
}
// en hover se intercambian
&:hover {
.details-container {
opacity: 0;
visibility: hidden;
transform: translateY(10px); // opcional efecto
}
.links-btns {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
}
}
.content > h2,
h3,
p {
margin: 0;
.links-btns {
display: flex;
flex-direction: column;
padding: 0 0.5rem;
.div-action {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
font-weight: $bold;
font-size: $s;
text-decoration: none;
&.show-link {
border: 1px solid $color-button;
padding: 0.25rem 0.5rem;
border-radius: 12px;
background-color: white;
&:hover {
background-color: $color-button;
color: white;
}
}
&.buy-link {
color: white;
border: 1px solid $color-button;
padding: 0.25rem 0.5rem;
border-radius: 12px;
background-color: $color-button;
&:hover {
background-color: white;
color: $color-button;
}
}
.div-action-img {
width: 1rem;
height: 1rem;
}
}
}
</style>