index.vue
4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
<view class="min-h-screen flex flex-col bg-white">
<AppHeader title="积分兑换" :showBack="false" />
<view class="flex-1 pb-20">
<view class="p-4 space-y-4">
<view v-for="category in categories" :key="category.id" class="rounded-lg overflow-hidden shadow-sm" @click="goToRewards">
<template v-if="category.id !== 'merchants'">
<view class="relative h-40">
<view class="absolute inset-0 bg-black bg-opacity-30 flex flex-col justify-end p-4 text-white" :style="{ background: category.bgColor || 'linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.6))' }">
<h3 class="text-xl font-bold mb-1">{{ category.title }}</h3>
<p class="text-sm text-white text-opacity-90">
{{ category.description }}
</p>
</view>
<image :src="category.image" :alt="category.title" class="w-full h-full object-cover" :style="{ objectPosition: category.bgPosition || 'center' }" />
<view v-if="category.iconUrl" class="absolute top-4 left-4 w-12 h-12 bg-white bg-opacity-90 rounded-full flex items-center justify-center">
<image :src="category.iconUrl" alt="" class="w-8 h-8" />
</view>
</view>
</template>
<template v-else>
<view class="bg-white border border-gray-100 rounded-lg p-4">
<view class="flex justify-between items-center mb-3">
<view>
<h3 class="text-lg font-bold">{{ category.title }}</h3>
<p class="text-sm text-gray-600">
{{ category.description }}
</p>
</view>
<Right size="20" class="text-gray-400" />
</view>
<view class="grid grid-cols-5 gap-2">
<view v-for="(merchant, index) in category.merchants.slice(0, 10)" :key="index" class="flex flex-col items-center">
<image :src="merchant.logo" :alt="merchant.name" class="w-12 h-12 object-contain rounded-md" />
<span class="text-xs text-gray-600 mt-1 text-center truncate w-full">
{{ merchant.name }}
</span>
</view>
</view>
</view>
</template>
</view>
</view>
</view>
<BottomNav />
</view>
</template>
<script setup>
import { ref } from 'vue';
import Taro from '@tarojs/taro';
import AppHeader from '../../components/AppHeader.vue';
import BottomNav from '../../components/BottomNav.vue';
import { Right } from '@nutui/icons-vue-taro';
const categories = ref([
{
id: 'health',
title: '银龄健康特色兑换区',
description: '南京商圈线下实体店消费积分兑换',
image: "/static/images/rewards/reward-banner.png",
bgPosition: 'center'
},
{
id: 'online',
title: '民政领域网上商城"银龄购"',
description: '线上康复健康购物积分兑换',
image: 'https://images.unsplash.com/photo-1563013544-824ae1b704d3?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80',
bgPosition: 'center',
bgColor: 'linear-gradient(135deg, #0ea5e9, #2563eb)',
iconUrl: 'https://cdn-icons-png.flaticon.com/512/3144/3144456.png'
},
{
id: 'merchants',
title: '人驻商户多元场景广覆盖',
description: '丰富商户积分兑换',
image: 'https://images.unsplash.com/photo-1607082349566-187342175e2f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80',
bgPosition: 'center',
merchants: [
{ name: '上海老饭店', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=上海老饭店&font=roboto' },
{ name: '功德林', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=功德林&font=roboto' },
{ name: '一茶一坐', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=一茶一坐&font=roboto' },
{ name: '杏花楼', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=杏花楼&font=roboto' },
{ name: '新雅', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=新雅&font=roboto' },
{ name: '五芳斋', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=五芳斋&font=roboto' },
{ name: '沈大成', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=沈大成&font=roboto' },
{ name: '老凤祥', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=老凤祥&font=roboto' },
{ name: '御宝轩', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=御宝轩&font=roboto' },
{ name: '恒源祥', logo: 'https://placehold.co/100x100/e2f3ff/0369a1?text=恒源祥&font=roboto' }
]
}
]);
const goToRewards = () => {
Taro.navigateTo({ url: '/pages/Rewards/index' });
};
</script>