Files
blind-select/frontend-app/pages/user/history.vue
T
admin 06488f0237 Initial commit: 帮我选盲选应用
功能:
- Go后端 (Gin + GORM + PostgreSQL)
- UniApp用户端 (iOS/Android/小程序)
- DaisyUI5后台管理
- JWT认证 + 微信登录
- 盲选加权算法
- 会员系统 + 优惠券
- 打分评价 + 偏好学习
2026-06-08 20:18:31 +00:00

115 lines
3.1 KiB
Vue

<template>
<view class="page-history">
<view class="header">
<text class="title">📋 盲选记录</text>
</view>
<view class="history-list">
<view class="history-item card" v-for="item in history" :key="item.session_id">
<view class="item-header">
<text class="item-shop">{{ item.merchant }}</text>
<text class="item-time">{{ formatTime(item.created_at) }}</text>
</view>
<text class="item-name">{{ item.package_name }}</text>
<text class="item-price">¥{{ item.price_range }}</text>
<view class="item-footer">
<text class="match-badge" v-if="item.match_score">🎯 {{ (item.match_score * 100).toFixed(0) }}% 匹配</text>
<text class="status-badge" :class="item.accepted ? 'accepted' : ''">
{{ item.accepted ? '✅ 已前往' : '⏳ 未前往' }}
</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { blindApi } from '@/api/index.js'
const history = ref([])
function formatTime(dateStr) {
if (!dateStr) return ''
const d = new Date(dateStr)
const now = new Date()
const diff = now - d
if (diff < 3600000) return Math.floor(diff / 60000) + '分钟前'
if (diff < 86400000) return Math.floor(diff / 3600000) + '小时前'
return Math.floor(diff / 86400000) + '天前'
}
// Mock data for demo
history.value = [
{ session_id: 1, merchant: '松阪牛料理', package_name: '主厨精选7道式', price_range: '298-398', match_score: 0.85, accepted: true, created_at: new Date().toISOString() },
{ session_id: 2, merchant: '渝味晓宇火锅', package_name: '双人麻辣火锅套餐', price_range: '168-228', match_score: 0.72, accepted: true, created_at: new Date(Date.now() - 86400000).toISOString() },
{ session_id: 3, merchant: '迷雾剧场剧本杀', package_name: '沉浸式推理剧本', price_range: '128-168', match_score: 0.65, accepted: false, created_at: new Date(Date.now() - 172800000).toISOString() },
]
</script>
<style lang="scss" scoped>
.page-history {
min-height: 100vh;
background: #f5f5f5;
}
.header {
background: linear-gradient(135deg, #FF6B35, #FF8C42);
padding: 80rpx 30rpx 30rpx;
color: #fff;
.title { font-size: 36rpx; font-weight: 700; }
}
.card {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin: 16rpx 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
}
.item-header {
display: flex;
justify-content: space-between;
.item-shop { font-size: 28rpx; font-weight: 600; }
.item-time { font-size: 20rpx; color: #999; }
}
.item-name {
font-size: 26rpx;
color: #666;
display: block;
margin-top: 6rpx;
}
.item-price {
font-size: 24rpx;
color: #FF6B35;
font-weight: 600;
display: block;
margin-top: 6rpx;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 12rpx;
}
.match-badge {
font-size: 20rpx;
color: #999;
}
.status-badge {
font-size: 20rpx;
padding: 4rpx 12rpx;
border-radius: 10rpx;
&.accepted {
background: #E8F5E9;
color: #4CAF50;
}
}
</style>