You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
customAgent/src/components/product-card-list.vue

115 lines
2.4 KiB

<template>
<div class="product-card-container" v-if="productList && productList.length > 0">
<div class="product-card" v-for="(product, index) in productList" :key="index">
<div class="card-header">
<h3 class="product-name">{{ product.productName || product.name }}</h3>
<span class="product-code" v-if="product.productCode">{{ product.productCode }}</span>
</div>
<div class="card-body">
<div class="product-desc" v-if="product.description">{{ product.description }}</div>
<div class="product-features" v-if="product.features && product.features.length">
<span class="feature-tag" v-for="(tag, idx) in product.features" :key="idx">{{ tag }}</span>
</div>
</div>
<div class="card-footer" v-if="product.price || product.actionText">
<span class="price" v-if="product.price">{{ product.price }}</span>
<button class="action-btn" v-if="product.actionText" @click="handleAction(product)">{{ product.actionText
}}</button>
</div>
</div>
</div>
</template>
<script setup>
const props = defineProps({
productList: { type: Array, default: () => [] }
})
const emit = defineEmits(['action'])
function handleAction(product) {
emit('action', product)
}
</script>
<style scoped>
.product-card-container {
padding: 8px 0;
}
.product-card {
background: #fff;
border-radius: 12px;
padding: 16px;
margin-bottom: 12px;
border: 1px solid #f0f0f0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.product-name {
font-size: 16px;
font-weight: 600;
color: #333;
margin: 0;
}
.product-code {
font-size: 12px;
color: #999;
}
.card-body {
margin-bottom: 12px;
}
.product-desc {
font-size: 13px;
color: #666;
line-height: 1.5;
}
.product-features {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 8px;
}
.feature-tag {
display: inline-block;
padding: 2px 8px;
background: #f0f6ff;
color: #025CEA;
border-radius: 4px;
font-size: 11px;
}
.card-footer {
display: flex;
align-items: center;
justify-content: space-between;
}
.price {
font-size: 18px;
font-weight: 600;
color: #ff4757;
}
.action-btn {
padding: 6px 16px;
background: #025CEA;
color: #fff;
border: none;
border-radius: 20px;
font-size: 13px;
cursor: pointer;
}
</style>