2
This commit is contained in:
@@ -1,94 +1,116 @@
|
||||
<template>
|
||||
<view class="vip-page" style="background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); min-height: 100vh;">
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="main-content">
|
||||
<!-- VIP状态头部 -->
|
||||
<view class="vip-header">
|
||||
<view class="vip-crown">
|
||||
<text class="crown-icon">👑</text>
|
||||
</view>
|
||||
<text class="vip-title">{{ isVip ? 'VIP会员' : '成为VIP会员' }}</text>
|
||||
<text class="vip-subtitle">{{ isVip ? '尊享专属特权' : '解锁更多权益' }}</text>
|
||||
<view class="vip-status" :class="{ active: isVip }">
|
||||
<text class="status-text">{{ isVip ? 'VIP会员' : '普通用户' }}</text>
|
||||
</view>
|
||||
<view class="vip-page">
|
||||
<view class="vip-hero">
|
||||
<image class="hero-icon" src="/static/icons/icons8-vip-48 (1).png" mode="aspectFit" />
|
||||
<view class="hero-text">
|
||||
<text class="hero-title">{{ isVip ? 'VIP会员' : '升级 VIP 会员' }}</text>
|
||||
<text class="hero-subtitle">{{ isVip ? '尊享完整数据与高效体验' : '开通后可查看全部历史数据并解锁高级功能' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 会员功能 -->
|
||||
<view class="features-section">
|
||||
<text class="section-title">会员功能</text>
|
||||
<view class="feature-card">
|
||||
<view class="feature-icon">💾</view>
|
||||
<text class="feature-text">永久存储数据</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- VIP状态信息 -->
|
||||
<view v-if="isVip" class="vip-info">
|
||||
<view class="info-card">
|
||||
<text class="info-label">会员状态</text>
|
||||
<text class="info-value active">已激活</text>
|
||||
</view>
|
||||
<view class="info-card">
|
||||
<text class="info-label">有效期至</text>
|
||||
<text class="info-value">{{ expireDisplay }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格和购买 -->
|
||||
<view v-if="!isVip" class="purchase-section">
|
||||
<view class="price-card">
|
||||
<text class="price-label">会员价格</text>
|
||||
<view class="price-display">
|
||||
<text class="price-symbol">¥</text>
|
||||
<text class="price-amount">{{ price }}</text>
|
||||
<text class="price-period">/月</text>
|
||||
</view>
|
||||
</view>
|
||||
<button class="purchase-btn" @click="onPay">
|
||||
<text class="btn-text">立即开通VIP</text>
|
||||
</button>
|
||||
<view class="status-pill" :class="{ active: isVip }">
|
||||
<text>{{ isVip ? '已开通' : '普通用户' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 背景装饰 -->
|
||||
<view class="bg-decoration">
|
||||
<view class="decoration-circle circle-1"></view>
|
||||
<view class="decoration-circle circle-2"></view>
|
||||
<view class="decoration-circle circle-3"></view>
|
||||
<view class="vip-summary" v-if="isVip">
|
||||
<view class="summary-item">
|
||||
<text class="summary-label">会员状态</text>
|
||||
<text class="summary-value success">已激活</text>
|
||||
</view>
|
||||
<view class="summary-item">
|
||||
<text class="summary-label">有效期至</text>
|
||||
<text class="summary-value">{{ expireDisplay }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="vip-summary" v-else>
|
||||
<view class="summary-item">
|
||||
<text class="summary-label">当前身份</text>
|
||||
<text class="summary-value">普通用户</text>
|
||||
</view>
|
||||
<view class="summary-item">
|
||||
<text class="summary-label">会员价格</text>
|
||||
<text class="summary-value highlight">¥{{ priceDisplay }}/月</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="benefit-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">会员特权</text>
|
||||
<text class="section-subtitle">聚焦数据留存与专业形象,让经营更有底气</text>
|
||||
</view>
|
||||
<view class="benefit-grid">
|
||||
<view v-for="item in benefits" :key="item.key" class="benefit-card">
|
||||
<image v-if="item.icon" :src="item.icon" class="benefit-icon" mode="aspectFit" />
|
||||
<text class="benefit-title">{{ item.title }}</text>
|
||||
<text class="benefit-desc">{{ item.desc }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!isVip" class="purchase-card">
|
||||
<view class="purchase-text">
|
||||
<text class="purchase-title">立即升级 VIP</text>
|
||||
<text class="purchase-desc">不限历史数据、专属标识,助您高效管账</text>
|
||||
</view>
|
||||
<button class="purchase-btn" @click="onPay">
|
||||
<text>立即开通</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { VIP_PRICE_PER_MONTH } from '../../common/config.js'
|
||||
import { get, post } from '../../common/http.js'
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
isVip: false,
|
||||
expire: '',
|
||||
price: VIP_PRICE_PER_MONTH
|
||||
isVip: false,
|
||||
expire: '',
|
||||
price: 0,
|
||||
benefits: []
|
||||
}
|
||||
},
|
||||
onShow(){
|
||||
this.loadVip()
|
||||
this.composeBenefits()
|
||||
},
|
||||
computed: {
|
||||
expireDisplay(){
|
||||
const s = String(this.expire || '')
|
||||
return s || '11年11月11日'
|
||||
},
|
||||
priceDisplay(){
|
||||
const n = Number(this.price)
|
||||
return Number.isFinite(n) && n > 0 ? n.toFixed(2) : '0.00'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadVip(){
|
||||
try {
|
||||
this.isVip = String(uni.getStorageSync('USER_VIP_IS_VIP') || 'false').toLowerCase() === 'true'
|
||||
this.expire = uni.getStorageSync('USER_VIP_END') || ''
|
||||
} catch(e) {}
|
||||
composeBenefits(){
|
||||
this.benefits = [
|
||||
{ key: 'history', title: '完整历史留存', desc: '无限期保留交易、库存与客户数据', icon: '/static/icons/icons8-graph-report-50.png' },
|
||||
{ key: 'analysis', title: '高级统计面板', desc: '秒级汇总销售毛利,掌握生意节奏', icon: '/static/icons/icons8-profit-50.png' },
|
||||
{ key: 'priority', title: '优先客服支持', desc: '遇到问题优先处理,响应更迅速', icon: '/static/icons/icons8-account-male-100.png' }
|
||||
]
|
||||
},
|
||||
onPay(){
|
||||
uni.showToast({ title: '静态页面演示:支付功能未接入', icon: 'none' })
|
||||
async loadVip(){
|
||||
try {
|
||||
const data = await get('/api/vip/status')
|
||||
this.isVip = !!data?.isVip
|
||||
this.expire = data?.expireAt || ''
|
||||
if (typeof data?.price === 'number') this.price = data.price
|
||||
} catch(e) {
|
||||
// 保底:不回退到硬编码价格,仅展示0并提示可开通
|
||||
this.isVip = false
|
||||
}
|
||||
},
|
||||
async onPay(){
|
||||
try {
|
||||
await post('/api/vip/pay', {})
|
||||
uni.showToast({ title: '已开通VIP', icon: 'success' })
|
||||
await this.loadVip()
|
||||
} catch(e) {
|
||||
uni.showToast({ title: String(e.message || '开通失败'), icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,272 +118,238 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #1a1a2e !important;
|
||||
background: linear-gradient(180deg, #f8fbff 0%, #ffffff 60%) !important;
|
||||
}
|
||||
|
||||
.vip-page {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
|
||||
overflow: hidden;
|
||||
padding: 32rpx 24rpx 120rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 28rpx;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
.vip-hero {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
padding: 26rpx 28rpx;
|
||||
border-radius: 24rpx;
|
||||
background: rgba(255,255,255,0.98);
|
||||
border: 2rpx solid #edf2f9;
|
||||
box-shadow: 0 10rpx 30rpx rgba(76,141,255,0.12);
|
||||
}
|
||||
|
||||
.hero-icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #f0f6ff;
|
||||
padding: 12rpx;
|
||||
}
|
||||
|
||||
.hero-text {
|
||||
flex: 1;
|
||||
padding: 60rpx 40rpx 40rpx;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
/* VIP头部区域 */
|
||||
.vip-header {
|
||||
text-align: center;
|
||||
margin-bottom: 80rpx;
|
||||
|
||||
.vip-crown {
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.crown-icon {
|
||||
font-size: 80rpx;
|
||||
filter: drop-shadow(0 4rpx 12rpx rgba(255, 215, 0, 0.3));
|
||||
}
|
||||
}
|
||||
|
||||
.vip-title {
|
||||
display: block;
|
||||
font-size: 48rpx;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin-bottom: 16rpx;
|
||||
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.vip-subtitle {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.vip-status {
|
||||
display: inline-block;
|
||||
padding: 16rpx 32rpx;
|
||||
border-radius: 50rpx;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
backdrop-filter: blur(10rpx);
|
||||
border: 1rpx solid rgba(255, 215, 0, 0.4);
|
||||
|
||||
&.active {
|
||||
background: linear-gradient(45deg, #ffd700, #ffed4e);
|
||||
border: 1rpx solid rgba(255, 215, 0, 0.3);
|
||||
|
||||
.status-text {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.hero-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
color: $uni-color-primary;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
/* 会员功能区域 */
|
||||
.features-section {
|
||||
margin-bottom: 60rpx;
|
||||
|
||||
.section-title {
|
||||
display: block;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
backdrop-filter: blur(15rpx);
|
||||
border-radius: 24rpx;
|
||||
padding: 40rpx;
|
||||
text-align: center;
|
||||
border: 1rpx solid rgba(255, 215, 0, 0.3);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-4rpx);
|
||||
box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
font-size: 60rpx;
|
||||
margin-bottom: 24rpx;
|
||||
filter: drop-shadow(0 4rpx 12rpx rgba(255, 215, 0, 0.3));
|
||||
}
|
||||
|
||||
.feature-text {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
}
|
||||
.hero-subtitle {
|
||||
font-size: 26rpx;
|
||||
color: #5175b5;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
/* VIP信息卡片 */
|
||||
.vip-info {
|
||||
margin-bottom: 60rpx;
|
||||
|
||||
.info-card {
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
backdrop-filter: blur(15rpx);
|
||||
border-radius: 20rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 20rpx;
|
||||
border: 1rpx solid rgba(255, 215, 0, 0.3);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.info-label {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
|
||||
&.active {
|
||||
color: #ffd700;
|
||||
}
|
||||
}
|
||||
}
|
||||
.status-pill {
|
||||
flex: 0 0 auto;
|
||||
padding: 12rpx 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #e6edfb;
|
||||
color: #4463a6;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
border: 2rpx solid rgba(76,141,255,0.2);
|
||||
}
|
||||
|
||||
/* 购买区域 */
|
||||
.purchase-section {
|
||||
.price-card {
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
backdrop-filter: blur(15rpx);
|
||||
border-radius: 24rpx;
|
||||
padding: 40rpx;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
border: 1rpx solid rgba(255, 215, 0, 0.3);
|
||||
|
||||
.price-label {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.price-display {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: center;
|
||||
gap: 8rpx;
|
||||
|
||||
.price-symbol {
|
||||
font-size: 32rpx;
|
||||
color: #ffd700;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.price-amount {
|
||||
font-size: 60rpx;
|
||||
font-weight: 700;
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
.price-period {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.purchase-btn {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
background: linear-gradient(45deg, #ffd700, #ffed4e);
|
||||
border-radius: 50rpx;
|
||||
border: none;
|
||||
box-shadow: 0 8rpx 24rpx rgba(255, 215, 0, 0.3);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: translateY(2rpx);
|
||||
box-shadow: 0 4rpx 16rpx rgba(255, 215, 0, 0.4);
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.status-pill.active {
|
||||
background: #4c8dff;
|
||||
color: #fff;
|
||||
border-color: #4c8dff;
|
||||
}
|
||||
|
||||
/* 背景装饰 */
|
||||
.bg-decoration {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
|
||||
.decoration-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
|
||||
&.circle-1 {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
top: -150rpx;
|
||||
right: -100rpx;
|
||||
}
|
||||
|
||||
&.circle-2 {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
bottom: 200rpx;
|
||||
left: -100rpx;
|
||||
}
|
||||
|
||||
&.circle-3 {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
top: 50%;
|
||||
right: 50rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
.vip-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0,1fr));
|
||||
gap: 16rpx;
|
||||
background: rgba(255,255,255,0.98);
|
||||
padding: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
border: 2rpx solid #eef3fb;
|
||||
box-shadow: 0 8rpx 24rpx rgba(99,132,191,0.10);
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
background: #f6f9ff;
|
||||
border-radius: 18rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
border: 2rpx solid rgba(76,141,255,0.12);
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-size: 24rpx;
|
||||
color: #5f7394;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2c3d;
|
||||
}
|
||||
|
||||
.summary-value.success {
|
||||
color: #1ead91;
|
||||
}
|
||||
|
||||
.summary-value.highlight {
|
||||
color: #2f58d1;
|
||||
}
|
||||
|
||||
.benefit-section {
|
||||
background: rgba(255,255,255,0.98);
|
||||
border-radius: 24rpx;
|
||||
padding: 28rpx;
|
||||
border: 2rpx solid #edf2f9;
|
||||
box-shadow: 0 12rpx 28rpx rgba(32,75,143,0.10);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 800;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.section-subtitle {
|
||||
font-size: 24rpx;
|
||||
color: #5f7394;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.benefit-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.benefit-card {
|
||||
background: #f7faff;
|
||||
border-radius: 20rpx;
|
||||
padding: 24rpx 20rpx;
|
||||
border: 2rpx solid rgba(76,141,255,0.12);
|
||||
box-shadow: 0 8rpx 20rpx rgba(0,0,0,0.04);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.benefit-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.benefit-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.benefit-desc {
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: #5f7394;
|
||||
}
|
||||
|
||||
.purchase-card {
|
||||
margin-top: auto;
|
||||
background: linear-gradient(135deg, rgba(76,141,255,0.14) 0%, rgba(76,141,255,0.06) 100%);
|
||||
border-radius: 28rpx;
|
||||
padding: 30rpx 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24rpx;
|
||||
border: 2rpx solid rgba(76,141,255,0.18);
|
||||
box-shadow: 0 10rpx 24rpx rgba(76,141,255,0.15);
|
||||
}
|
||||
|
||||
.purchase-text {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.purchase-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
|
||||
.purchase-desc {
|
||||
font-size: 24rpx;
|
||||
color: #4463a6;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.purchase-btn {
|
||||
flex: 0 0 auto;
|
||||
padding: 20rpx 36rpx;
|
||||
border-radius: 999rpx;
|
||||
border: none;
|
||||
background: linear-gradient(135deg, #4788ff 0%, #2d6be6 100%);
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
box-shadow: 0 10rpx 22rpx rgba(45,107,230,0.20);
|
||||
}
|
||||
|
||||
.purchase-btn:active {
|
||||
opacity: 0.88;
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
@media (max-width: 375px) {
|
||||
.benefits-grid {
|
||||
.vip-summary {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.vip-header .vip-title {
|
||||
font-size: 42rpx;
|
||||
.benefit-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: 40rpx 30rpx;
|
||||
.purchase-card {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.status-pill {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user