index.vue 3 KB
<!--
 * @Date: 2025-08-27 17:47:03
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2025-09-05 10:38:16
 * @FilePath: /lls_program/src/pages/RewardCategories/index.vue
 * @Description: 文件描述
-->
<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, index) in categories" :key="category.id" class="rounded-lg overflow-hidden shadow-sm" @click="goToRewards(index)">
            <view class="relative h-40">
              <!-- <view class="absolute inset-0 bg-black bg-opacity-30 flex flex-col justify-end p-4 text-white">
                <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>
        </view>
      </view>
    </view>
    <BottomNav />
  </view>
</template>

<script setup>
import { ref } from 'vue';
import Taro from '@tarojs/taro';
import BottomNav from '../../components/BottomNav.vue';

const categories = ref([
  {
    id: 'health',
    title: '银龄健康特色兑换区',
    description: '南京商圈线下实体店消费积分兑换',
    image: "https://cdn.ipadbiz.cn/lls_prog/images/%E6%97%A0logo%E7%A7%AF%E5%88%86%E5%85%91%E6%8D%A2%E5%95%86%E5%9F%8E.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)',
  },
  {
    id: 'merchants',
    title: '人驻商户多元场景广覆盖',
    description: '丰富商户积分兑换',
    image: 'https://cdn.ipadbiz.cn/lls_prog/images/%E6%97%A0logo%E9%93%B6%E9%BE%84%E8%B4%AD%E6%B5%B7%E6%8A%A5.png',
    bgPosition: 'center',
    bgColor: 'linear-gradient(135deg, #007bff, #0056b3)',
  }
]);

const goToRewards = (idx) => {
  if (idx !== 1) {
    Taro.navigateTo({ url: '/pages/Rewards/index' });
  } else {
    // 弹出确认提示框, 不用进行操作, 只是文本提示用户进行线下兑换
    Taro.showModal({
      title: '提示',
      content: '请联系客服进行线下兑换',
      showCancel: false
    }).then(res => {
      if (res.confirm) {
        // 点击了确认按钮
      }
    })
  }
};
</script>