GameServicePlatform/components/service-card/index.vue

305 lines
6.0 KiB
Vue

<template>
<view class="service-card cyber-card" @click="handleClick">
<!-- 封面图片 -->
<view class="card-cover">
<image :src="service.coverImage" mode="aspectFill" class="cover-image" />
<!-- 渐变遮罩 -->
<view class="cover-overlay"></view>
<!-- 热门标签 -->
<view v-if="service.salesCount > 1000" class="hot-badge">
<text class="hot-icon">🔥</text>
<text class="hot-text">HOT</text>
</view>
<!-- 分类标签 -->
<view class="category-tag">
{{ service.categoryName }}
</view>
</view>
<!-- 卡片内容 -->
<view class="card-content">
<!-- 服务名称 -->
<view class="service-name">{{ service.name }}</view>
<!-- 服务描述 -->
<view class="service-desc">{{ service.description }}</view>
<!-- 标签 -->
<view class="tags-container">
<view v-for="tag in service.tags" :key="tag" class="tag-item">
{{ tag }}
</view>
</view>
<!-- 商家信息 -->
<view class="merchant-info">
<image :src="service.merchantAvatar" class="merchant-avatar" />
<text class="merchant-name">{{ service.merchantName }}</text>
<text class="player-count">{{ service.playerCount }}位选手</text>
</view>
<!-- 底部信息 -->
<view class="card-footer">
<view class="price-container">
<text class="price-symbol">¥</text>
<text class="price-value">{{ service.price }}</text>
<text v-if="service.originalPrice > service.price" class="original-price">
¥{{ service.originalPrice }}
</text>
</view>
<view class="stats-container">
<view class="stat-item">
<text class="stat-icon">⭐</text>
<text class="stat-text">{{ service.rating }}</text>
</view>
<view class="stat-item">
<text class="stat-icon">📦</text>
<text class="stat-text">{{ formatSales(service.salesCount) }}</text>
</view>
</view>
</view>
</view>
<!-- 霓虹边框效果 -->
<view class="neon-border"></view>
</view>
</template>
<script setup>
import { defineProps, defineEmits } from 'vue'
const props = defineProps({
service: {
type: Object,
required: true
}
})
const emit = defineEmits(['click'])
const handleClick = () => {
emit('click', props.service)
}
const formatSales = (count) => {
if (count >= 10000) {
return (count / 10000).toFixed(1) + 'w'
} else if (count >= 1000) {
return (count / 1000).toFixed(1) + 'k'
}
return count
}
</script>
<style lang="scss" scoped>
.service-card {
margin-bottom: 24rpx;
background: linear-gradient(135deg, rgba(20, 25, 50, 0.95) 0%, rgba(10, 14, 39, 0.9) 100%);
border: 1px solid rgba(0, 255, 255, 0.2);
border-radius: 16rpx;
overflow: hidden;
position: relative;
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
border-color: rgba(0, 255, 255, 0.5);
}
}
.card-cover {
position: relative;
width: 100%;
height: 360rpx;
overflow: hidden;
}
.cover-image {
width: 100%;
height: 100%;
}
.cover-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 120rpx;
background: linear-gradient(180deg, transparent 0%, rgba(10, 14, 39, 0.9) 100%);
}
.hot-badge {
position: absolute;
top: 20rpx;
right: 20rpx;
display: flex;
align-items: center;
padding: 8rpx 16rpx;
background: linear-gradient(135deg, rgba(255, 107, 107, 0.9) 0%, rgba(255, 71, 71, 0.9) 100%);
border-radius: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.4);
}
.hot-icon {
font-size: 24rpx;
margin-right: 4rpx;
}
.hot-text {
font-size: 24rpx;
font-weight: bold;
color: #ffffff;
}
.category-tag {
position: absolute;
top: 20rpx;
left: 20rpx;
padding: 8rpx 16rpx;
background: rgba(0, 255, 255, 0.2);
border: 1px solid rgba(0, 255, 255, 0.4);
border-radius: 8rpx;
backdrop-filter: blur(10rpx);
font-size: 24rpx;
color: #00ffff;
}
.card-content {
padding: 24rpx;
}
.service-name {
font-size: 32rpx;
font-weight: bold;
color: #ffffff;
margin-bottom: 16rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.service-desc {
font-size: 26rpx;
color: #a0a4c4;
margin-bottom: 16rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.tags-container {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
margin-bottom: 20rpx;
}
.tag-item {
padding: 6rpx 16rpx;
background: rgba(0, 255, 255, 0.1);
border: 1px solid rgba(0, 255, 255, 0.3);
border-radius: 6rpx;
font-size: 22rpx;
color: #00ffff;
}
.merchant-info {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.merchant-avatar {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 12rpx;
border: 1px solid rgba(0, 255, 255, 0.3);
}
.merchant-name {
font-size: 24rpx;
color: #a0a4c4;
flex: 1;
}
.player-count {
font-size: 22rpx;
color: #7a7e9d;
}
.card-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.price-container {
display: flex;
align-items: baseline;
}
.price-symbol {
font-size: 28rpx;
font-weight: bold;
color: #00ffff;
}
.price-value {
font-size: 40rpx;
font-weight: bold;
color: #00ffff;
text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
margin-right: 12rpx;
}
.original-price {
font-size: 24rpx;
color: #7a7e9d;
text-decoration: line-through;
}
.stats-container {
display: flex;
gap: 24rpx;
}
.stat-item {
display: flex;
align-items: center;
gap: 6rpx;
}
.stat-icon {
font-size: 24rpx;
}
.stat-text {
font-size: 24rpx;
color: #a0a4c4;
}
.neon-border {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 16rpx;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease;
box-shadow:
0 0 20rpx rgba(0, 255, 255, 0.3),
0 0 40rpx rgba(0, 255, 255, 0.2),
inset 0 0 20rpx rgba(0, 255, 255, 0.1);
}
.service-card:active .neon-border {
opacity: 1;
}
</style>