1343 行
29 KiB
Vue
1343 行
29 KiB
Vue
<template>
|
||
<view class="vip fc-page">
|
||
<!-- 自定义导航栏:深绿渐变沉浸式 -->
|
||
<fc-navbar title="会员中心" theme="gradient" :show-back="true" />
|
||
|
||
<!-- 顶部深绿沉浸底座 -->
|
||
<view class="vip__backdrop">
|
||
<view class="vip__backdrop-ambient"></view>
|
||
</view>
|
||
|
||
<!-- 浮空 VIP 尊享卡片 -->
|
||
<view class="vip__card-wrap">
|
||
<view class="vip__card">
|
||
<!-- 卡片装饰流光 -->
|
||
<view class="vip__card-sheen"></view>
|
||
|
||
<!-- 用户身份信息 -->
|
||
<view class="vip__card-user" @click="handleUserClick">
|
||
<view class="vip__avatar">
|
||
<text class="vip__avatar-txt">{{ userInitial }}</text>
|
||
</view>
|
||
<view class="vip__user-meta">
|
||
<view class="vip__user-title-row">
|
||
<text class="vip__user-name fc-ellipsis">{{ nickName }}</text>
|
||
<view class="vip__badge" :class="{ 'vip__badge--active': isMember }">
|
||
<image class="vip__badge-icon" :src="iconUrl('crown')" mode="aspectFit" />
|
||
<text class="vip__badge-txt">{{ isMember ? (userInfo.memberLevel || 'VIP 会员') : '未开通' }}</text>
|
||
</view>
|
||
</view>
|
||
<text class="vip__user-desc">
|
||
{{ isMember ? '有效期至 ' + expireText : '开通立享多项专属特权,尊享优质服务' }}
|
||
</text>
|
||
</view>
|
||
<image class="vip__card-crown" :src="iconUrl('home-crown')" mode="aspectFit" />
|
||
</view>
|
||
|
||
<!-- 资产数据三栏(空间充裕、通透) -->
|
||
<view class="vip__assets">
|
||
<view class="vip__asset-col" @click="recharge">
|
||
<view class="vip__asset-val-box">
|
||
<text class="vip__asset-val">{{ balanceText }}</text>
|
||
<text class="vip__asset-unit">元</text>
|
||
</view>
|
||
<view class="vip__asset-label-row">
|
||
<text class="vip__asset-lbl">账户余额</text>
|
||
<text class="vip__asset-act">充值 ›</text>
|
||
</view>
|
||
</view>
|
||
<view class="vip__asset-sep"></view>
|
||
<view class="vip__asset-col" @click="scrollToCoupons">
|
||
<view class="vip__asset-val-box">
|
||
<text class="vip__asset-val">{{ couponCount }}</text>
|
||
<text class="vip__asset-unit">张</text>
|
||
</view>
|
||
<view class="vip__asset-label-row">
|
||
<text class="vip__asset-lbl">优惠券</text>
|
||
<text class="vip__asset-act">领券 ›</text>
|
||
</view>
|
||
</view>
|
||
<view class="vip__asset-sep"></view>
|
||
<view class="vip__asset-col">
|
||
<view class="vip__asset-val-box">
|
||
<text class="vip__asset-val">{{ assets.points || 0 }}</text>
|
||
<text class="vip__asset-unit">分</text>
|
||
</view>
|
||
<view class="vip__asset-label-row">
|
||
<text class="vip__asset-lbl">可用积分</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 尊享特权:优化为 2 列大卡片,告别 4 列狭小拥挤 -->
|
||
<view class="fc-card vip__section">
|
||
<view class="vip__sec-head">
|
||
<text class="vip__sec-title">VIP 尊享专属特权</text>
|
||
<text class="vip__sec-tip">开通即可享有以下权益</text>
|
||
</view>
|
||
|
||
<view class="vip__privileges-grid">
|
||
<!-- 特权 1:每日免费看 -->
|
||
<view class="vip__priv-item">
|
||
<view class="vip__priv-icon-wrap vip__priv-icon-wrap--green">
|
||
<image class="vip__priv-icon" :src="iconUrl('eye')" mode="aspectFit" />
|
||
</view>
|
||
<view class="vip__priv-content">
|
||
<text class="vip__priv-name">每日免费看</text>
|
||
<text class="vip__priv-desc">每日享 {{ benefits.freeView || 20 }} 条免费看</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 特权 2:发布折扣 -->
|
||
<view class="vip__priv-item">
|
||
<view class="vip__priv-icon-wrap vip__priv-icon-wrap--gold">
|
||
<image class="vip__priv-icon" :src="iconUrl('mine-post')" mode="aspectFit" />
|
||
</view>
|
||
<view class="vip__priv-content">
|
||
<text class="vip__priv-name">全场发布优惠</text>
|
||
<text class="vip__priv-desc">发布享 {{ benefits.postDiscount || '8折' }} 专属优惠</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 特权 3:分销佣金 -->
|
||
<view class="vip__priv-item">
|
||
<view class="vip__priv-icon-wrap vip__priv-icon-wrap--cyan">
|
||
<image class="vip__priv-icon" :src="iconUrl('mine-dist')" mode="aspectFit" />
|
||
</view>
|
||
<view class="vip__priv-content">
|
||
<text class="vip__priv-name">分销佣金加成</text>
|
||
<text class="vip__priv-desc">推广提成加速到账</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 特权 4:专属皇冠标 -->
|
||
<view class="vip__priv-item">
|
||
<view class="vip__priv-icon-wrap vip__priv-icon-wrap--orange">
|
||
<image class="vip__priv-icon" :src="iconUrl('crown')" mode="aspectFit" />
|
||
</view>
|
||
<view class="vip__priv-content">
|
||
<text class="vip__priv-name">专属身份勋章</text>
|
||
<text class="vip__priv-desc">全站彰显 VIP 尊贵标</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 开通方案选择 -->
|
||
<view class="fc-card vip__section">
|
||
<view class="vip__sec-head">
|
||
<text class="vip__sec-title">{{ isMember ? '续费套餐' : '选择开通套餐' }}</text>
|
||
<text class="vip__sec-tip">支持随时续期无缝顺延</text>
|
||
</view>
|
||
|
||
<!-- 套餐 3 栏精致卡片 -->
|
||
<view class="vip__plans-row">
|
||
<view
|
||
v-for="p in plans"
|
||
:key="p.planId"
|
||
class="vip__plan-card"
|
||
:class="{ 'vip__plan-card--active': planId === p.planId }"
|
||
@click="selectPlan(p)"
|
||
>
|
||
<!-- 优雅角标 -->
|
||
<view v-if="p.tag" class="vip__plan-badge">
|
||
<text>{{ p.tag }}</text>
|
||
</view>
|
||
|
||
<text class="vip__plan-name">{{ p.name }}</text>
|
||
|
||
<view class="vip__plan-price-row">
|
||
<text class="vip__plan-symbol">¥</text>
|
||
<text class="vip__plan-val">{{ p.price }}</text>
|
||
</view>
|
||
|
||
<text v-if="p.originPrice && p.originPrice > p.price" class="vip__plan-del">
|
||
¥{{ p.originPrice }}
|
||
</text>
|
||
|
||
<view v-if="p.postQuota && p.postQuota > 0" class="vip__plan-quota-chip">
|
||
<text>送{{ p.postQuota }}条发布</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 支付方式切换(单选优雅行) -->
|
||
<view class="vip__pay-toggle">
|
||
<text class="vip__pay-label">支付方式</text>
|
||
<view class="vip__pay-options">
|
||
<view
|
||
class="vip__pay-opt"
|
||
:class="{ 'vip__pay-opt--active': payType === 'wxpay' }"
|
||
@click="selectPayType('wxpay')"
|
||
>
|
||
<image class="vip__pay-opt-icon" :src="iconUrl('paywechat')" mode="aspectFit" />
|
||
<text class="vip__pay-opt-txt">微信支付</text>
|
||
<view class="vip__radio" :class="{ 'vip__radio--active': payType === 'wxpay' }">
|
||
<text v-if="payType === 'wxpay'" class="vip__radio-dot"></text>
|
||
</view>
|
||
</view>
|
||
|
||
<view
|
||
class="vip__pay-opt"
|
||
:class="{ 'vip__pay-opt--active': payType === 'balance' }"
|
||
@click="selectPayType('balance')"
|
||
>
|
||
<image class="vip__pay-opt-icon" :src="iconUrl('wallet')" mode="aspectFit" />
|
||
<text class="vip__pay-opt-txt">余额支付 (¥{{ balanceText }})</text>
|
||
<view class="vip__radio" :class="{ 'vip__radio--active': payType === 'balance' }">
|
||
<text v-if="payType === 'balance'" class="vip__radio-dot"></text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 专属优惠券专区(优雅排版) -->
|
||
<view id="vip-coupons-section" class="fc-card vip__section">
|
||
<view class="vip__sec-head">
|
||
<text class="vip__sec-title">专属优惠券</text>
|
||
<text class="vip__sec-tip">已拥有 {{ couponCount }} 张</text>
|
||
</view>
|
||
|
||
<view v-if="coupons.length > 0" class="vip__coupons-box">
|
||
<view v-for="c in coupons" :key="c.id" class="vip__coupon-card">
|
||
<!-- 券左侧金额 -->
|
||
<view class="vip__coupon-face">
|
||
<text class="vip__coupon-val">{{ couponValue(c) }}</text>
|
||
<text class="vip__coupon-cond">{{ couponCond(c) }}</text>
|
||
</view>
|
||
<!-- 券右侧信息 -->
|
||
<view class="vip__coupon-info">
|
||
<view class="vip__coupon-main">
|
||
<text class="vip__coupon-name fc-ellipsis">{{ c.name }}</text>
|
||
<text class="vip__coupon-expire">
|
||
{{ c.days > 0 ? c.days + ' 天内有效' : '永久有效' }}
|
||
</text>
|
||
</view>
|
||
<view class="vip__coupon-action">
|
||
<view
|
||
v-if="c.received"
|
||
class="vip__coupon-btn vip__coupon-btn--disabled"
|
||
>
|
||
<text>已领取</text>
|
||
</view>
|
||
<view
|
||
v-else
|
||
class="vip__coupon-btn"
|
||
@click="receiveCoupon(c)"
|
||
>
|
||
<text>领取</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view v-else class="vip__coupon-empty">
|
||
<text class="vip__coupon-empty-txt">暂无可领取的专属优惠券</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 常用功能入口(清爽列表) -->
|
||
<view class="fc-card vip__section vip__menu-card">
|
||
<view class="vip__menu-item" @click="go('/pages/member/orders')">
|
||
<view class="vip__menu-left">
|
||
<view class="vip__menu-icon-box">
|
||
<image class="vip__menu-icon" :src="iconUrl('link-order')" mode="aspectFit" />
|
||
</view>
|
||
<text class="vip__menu-text">我的订单记录</text>
|
||
</view>
|
||
<view class="vip__menu-right">
|
||
<text class="vip__menu-sub">查看明细</text>
|
||
<text class="vip__menu-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="vip__menu-item" @click="recharge">
|
||
<view class="vip__menu-left">
|
||
<view class="vip__menu-icon-box">
|
||
<image class="vip__menu-icon" :src="iconUrl('link-recharge')" mode="aspectFit" />
|
||
</view>
|
||
<text class="vip__menu-text">账户余额充值</text>
|
||
</view>
|
||
<view class="vip__menu-right">
|
||
<text class="vip__menu-sub">快捷到账</text>
|
||
<text class="vip__menu-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="vip__menu-item" @click="go('/pages/distribution/index')">
|
||
<view class="vip__menu-left">
|
||
<view class="vip__menu-icon-box">
|
||
<image class="vip__menu-icon" :src="iconUrl('link-dist')" mode="aspectFit" />
|
||
</view>
|
||
<text class="vip__menu-text">分销推广中心</text>
|
||
</view>
|
||
<view class="vip__menu-right">
|
||
<text class="vip__menu-sub">赚取高佣</text>
|
||
<text class="vip__menu-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部防遮挡垫高 -->
|
||
<view class="vip__dock-pad"></view>
|
||
|
||
<!-- 底部吸底结算栏(优雅通透) -->
|
||
<view class="vip__dock">
|
||
<view class="vip__dock-left">
|
||
<view class="vip__dock-cost-line">
|
||
<text class="vip__dock-tag">实付</text>
|
||
<text class="vip__dock-sym">¥</text>
|
||
<text class="vip__dock-amount">{{ currentPrice }}</text>
|
||
<text v-if="savedMoneyText" class="vip__dock-saved-pill">{{ savedMoneyText }}</text>
|
||
</view>
|
||
<text class="vip__dock-meta">开通即享专属会员全部特权</text>
|
||
</view>
|
||
|
||
<button class="vip__dock-submit" :loading="submitting" :disabled="submitting" @click="openVip">
|
||
<text class="vip__dock-submit-txt">{{ isMember ? '立即续费' : '立即开通' }}</text>
|
||
</button>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||
import memberApi from '@/common/api/member.js'
|
||
import couponApi from '@/common/api/coupon.js'
|
||
import { useUserStore } from '@/common/store/index.js'
|
||
import { iconUrl, loadUiConfig } from '@/common/store/ui.js'
|
||
import { formatTime } from '@/common/utils/format.js'
|
||
import { pay } from '@/common/utils/pay.js'
|
||
import config from '@/common/config/index.js'
|
||
|
||
export default {
|
||
components: { FcNavbar },
|
||
data() {
|
||
return {
|
||
plans: [],
|
||
benefits: {},
|
||
assets: {},
|
||
coupons: [],
|
||
planId: 'M12',
|
||
payType: config.defaultPayType || 'wxpay',
|
||
submitting: false,
|
||
}
|
||
},
|
||
computed: {
|
||
/**
|
||
* 当前登录用户信息
|
||
* @returns {Object}
|
||
*/
|
||
userInfo() {
|
||
try {
|
||
return useUserStore().state.userInfo || {}
|
||
} catch (e) {
|
||
return {}
|
||
}
|
||
},
|
||
/**
|
||
* 当前是否已登录
|
||
* @returns {boolean}
|
||
*/
|
||
isLogin() {
|
||
try {
|
||
return useUserStore().isLogin.value
|
||
} catch (e) {
|
||
return false
|
||
}
|
||
},
|
||
/**
|
||
* 昵称展示
|
||
* @returns {string}
|
||
*/
|
||
nickName() {
|
||
if (!this.isLogin) return '点击登录'
|
||
return this.userInfo.nickname || this.userInfo.phone || '会员用户'
|
||
},
|
||
/**
|
||
* 头像首字母
|
||
* @returns {string}
|
||
*/
|
||
userInitial() {
|
||
if (!this.isLogin) return '登'
|
||
const n = this.userInfo.nickname || this.userInfo.phone || 'V'
|
||
return n.slice(0, 1).toUpperCase()
|
||
},
|
||
/**
|
||
* 是否为会员状态
|
||
* @returns {boolean}
|
||
*/
|
||
isMember() {
|
||
try {
|
||
return useUserStore().isMember.value
|
||
} catch (e) {
|
||
return false
|
||
}
|
||
},
|
||
/**
|
||
* 到期时间文字
|
||
* @returns {string}
|
||
*/
|
||
expireText() {
|
||
if (!this.userInfo.memberExpireAt) return '--'
|
||
return formatTime(this.userInfo.memberExpireAt).slice(0, 10)
|
||
},
|
||
/**
|
||
* 余额格式化
|
||
* @returns {string}
|
||
*/
|
||
balanceText() {
|
||
const b = this.assets.balance
|
||
return b != null ? Number(b).toFixed(2) : '0.00'
|
||
},
|
||
/**
|
||
* 优惠券数量
|
||
* @returns {number}
|
||
*/
|
||
couponCount() {
|
||
if (this.assets.couponCount != null) {
|
||
return Number(this.assets.couponCount)
|
||
}
|
||
return (this.assets.coupons || []).length
|
||
},
|
||
/**
|
||
* 选中的套餐对象
|
||
* @returns {Object|null}
|
||
*/
|
||
selectedPlan() {
|
||
return this.plans.find((x) => x.planId === this.planId) || null
|
||
},
|
||
/**
|
||
* 当前实付金额
|
||
* @returns {number|string}
|
||
*/
|
||
currentPrice() {
|
||
return this.selectedPlan ? this.selectedPlan.price : '0.00'
|
||
},
|
||
/**
|
||
* 立省文案
|
||
* @returns {string}
|
||
*/
|
||
savedMoneyText() {
|
||
if (!this.selectedPlan || !this.selectedPlan.originPrice) return ''
|
||
const save = Number(this.selectedPlan.originPrice) - Number(this.selectedPlan.price)
|
||
return save > 0 ? `省 ¥${save.toFixed(0)}` : ''
|
||
},
|
||
},
|
||
/**
|
||
* 页面加载生命周期
|
||
*/
|
||
onLoad() {
|
||
loadUiConfig()
|
||
this.init()
|
||
},
|
||
/**
|
||
* 页面展示生命周期
|
||
*/
|
||
onShow() {
|
||
if (this.isLogin) {
|
||
this.loadAssets()
|
||
useUserStore().fetchProfile()
|
||
}
|
||
},
|
||
/**
|
||
* 下拉刷新生命周期
|
||
*/
|
||
async onPullDownRefresh() {
|
||
await this.init()
|
||
uni.stopPullDownRefresh()
|
||
},
|
||
methods: {
|
||
iconUrl,
|
||
/**
|
||
* 初始化数据
|
||
* @returns {Promise<void>}
|
||
*/
|
||
async init() {
|
||
try {
|
||
const [plans, benefits, assets] = await Promise.all([
|
||
memberApi.plans(),
|
||
memberApi.benefits(),
|
||
memberApi.assets(),
|
||
])
|
||
this.plans = Array.isArray(plans) ? plans : []
|
||
this.benefits = benefits || {}
|
||
this.assets = assets || {}
|
||
|
||
if (this.plans.length > 0) {
|
||
const rec = this.plans.find((p) => p.tag && p.tag.includes('推荐'))
|
||
this.planId = rec ? rec.planId : this.plans[this.plans.length - 1].planId
|
||
}
|
||
} catch (e) {
|
||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||
}
|
||
this.loadAssets()
|
||
this.loadCoupons()
|
||
},
|
||
/**
|
||
* 加载资产
|
||
* @returns {Promise<void>}
|
||
*/
|
||
async loadAssets() {
|
||
try {
|
||
this.assets = await memberApi.assets()
|
||
} catch (e) {}
|
||
},
|
||
/**
|
||
* 加载优惠券
|
||
* @returns {Promise<void>}
|
||
*/
|
||
async loadCoupons() {
|
||
try {
|
||
const res = await couponApi.list({ page: 1, size: 20 })
|
||
this.coupons = res && res.list ? res.list : []
|
||
} catch (e) {
|
||
this.coupons = []
|
||
}
|
||
},
|
||
/**
|
||
* 选择套餐
|
||
* @param {Object} plan
|
||
*/
|
||
selectPlan(plan) {
|
||
if (!plan) return
|
||
this.planId = plan.planId
|
||
},
|
||
/**
|
||
* 切换支付类型
|
||
* @param {string} type
|
||
*/
|
||
selectPayType(type) {
|
||
this.payType = type
|
||
},
|
||
/**
|
||
* 格式化券面值
|
||
* @param {Object} c
|
||
* @returns {string}
|
||
*/
|
||
couponValue(c) {
|
||
if (!c) return '¥0'
|
||
return Number(c.type) === 0 || c.type === 'discount' ? `${Number(c.amount) * 10}折` : `¥${c.amount}`
|
||
},
|
||
/**
|
||
* 格式化券门槛
|
||
* @param {Object} c
|
||
* @returns {string}
|
||
*/
|
||
couponCond(c) {
|
||
if (!c) return '无门槛'
|
||
return c.type === 'discount'
|
||
? '折扣优惠'
|
||
: Number(c.minAmount) > 0
|
||
? `满 ${c.minAmount} 可用`
|
||
: '无门槛'
|
||
},
|
||
/**
|
||
* 领取优惠券
|
||
* @param {Object} c
|
||
* @returns {Promise<void>}
|
||
*/
|
||
async receiveCoupon(c) {
|
||
if (!this.checkLogin()) return
|
||
try {
|
||
await couponApi.receive(c.id)
|
||
uni.showToast({ title: '领取成功', icon: 'success' })
|
||
await Promise.all([this.loadCoupons(), this.loadAssets()])
|
||
} catch (e) {
|
||
uni.showToast({ title: e.message || '领取失败', icon: 'none' })
|
||
}
|
||
},
|
||
/**
|
||
* 检查登录状态
|
||
* @returns {boolean}
|
||
*/
|
||
checkLogin() {
|
||
if (!this.isLogin) {
|
||
uni.navigateTo({ url: '/pages/auth/login' })
|
||
return false
|
||
}
|
||
return true
|
||
},
|
||
/**
|
||
* 用户区域点击
|
||
*/
|
||
handleUserClick() {
|
||
if (!this.isLogin) {
|
||
uni.navigateTo({ url: '/pages/auth/login' })
|
||
}
|
||
},
|
||
/**
|
||
* 滚动到优惠券区域
|
||
*/
|
||
scrollToCoupons() {
|
||
uni.createSelectorQuery()
|
||
.select('#vip-coupons-section')
|
||
.boundingClientRect((res) => {
|
||
if (res) {
|
||
uni.pageScrollTo({ scrollTop: res.top, duration: 250 })
|
||
}
|
||
})
|
||
.exec()
|
||
},
|
||
/**
|
||
* 提交开通或续费
|
||
* @returns {Promise<void>}
|
||
*/
|
||
async openVip() {
|
||
if (!this.checkLogin()) return
|
||
if (!this.planId) {
|
||
uni.showToast({ title: '请选择套餐', icon: 'none' })
|
||
return
|
||
}
|
||
|
||
// 余额不足校验
|
||
if (this.payType === 'balance') {
|
||
const bal = Number(this.assets.balance || 0)
|
||
const price = Number(this.selectedPlan ? this.selectedPlan.price : 0)
|
||
if (bal < price) {
|
||
uni.showModal({
|
||
title: '余额不足',
|
||
content: '当前账户余额不足,是否前往充值?',
|
||
confirmText: '去充值',
|
||
success: (r) => {
|
||
if (r.confirm) this.recharge()
|
||
},
|
||
})
|
||
return
|
||
}
|
||
}
|
||
|
||
this.submitting = true
|
||
uni.showLoading({ title: '正在处理…' })
|
||
|
||
try {
|
||
const res = await memberApi.open({ planId: this.planId, payType: this.payType })
|
||
if (this.payType === config.constants.PAY_TYPE.WXPAY && res && res.orderNo) {
|
||
await pay({ orderNo: res.orderNo, payType: this.payType })
|
||
}
|
||
|
||
uni.hideLoading()
|
||
uni.showToast({ title: '开通成功!', icon: 'success' })
|
||
|
||
await Promise.all([useUserStore().fetchProfile(), this.loadAssets()])
|
||
|
||
setTimeout(() => {
|
||
this.submitting = false
|
||
}, 600)
|
||
} catch (e) {
|
||
uni.hideLoading()
|
||
this.submitting = false
|
||
uni.showToast({ title: e.message || '开通未完成', icon: 'none' })
|
||
}
|
||
},
|
||
/**
|
||
* 前往充值
|
||
*/
|
||
recharge() {
|
||
if (!this.checkLogin()) return
|
||
uni.navigateTo({ url: '/pages/member/recharge' })
|
||
},
|
||
/**
|
||
* 路由跳转
|
||
* @param {string} url
|
||
*/
|
||
go(url) {
|
||
if (!url) return
|
||
if (!this.checkLogin()) return
|
||
uni.navigateTo({ url })
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.vip {
|
||
min-height: 100vh;
|
||
background: #f4f7f5;
|
||
position: relative;
|
||
}
|
||
|
||
/* 顶部深绿沉浸底座 */
|
||
.vip__backdrop {
|
||
height: 160rpx;
|
||
background: linear-gradient(180deg, #034827 0%, #065e34 100%);
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.vip__backdrop-ambient {
|
||
position: absolute;
|
||
top: -80rpx;
|
||
right: -40rpx;
|
||
width: 260rpx;
|
||
height: 260rpx;
|
||
border-radius: 50%;
|
||
background: radial-gradient(circle, rgba(0, 224, 112, 0.18) 0%, rgba(0, 224, 112, 0) 70%);
|
||
}
|
||
|
||
/* 浮空卡片容器(向上负边距重叠在底座上,产生现代高端的层级感) */
|
||
.vip__card-wrap {
|
||
margin: -120rpx 28rpx 0;
|
||
position: relative;
|
||
z-index: 2;
|
||
}
|
||
|
||
.vip__card {
|
||
position: relative;
|
||
border-radius: 28rpx;
|
||
padding: 34rpx 30rpx 28rpx;
|
||
background: linear-gradient(135deg, #074a2b 0%, #095934 60%, #053b22 100%);
|
||
box-shadow: 0 16rpx 36rpx rgba(4, 58, 33, 0.22);
|
||
border: 1rpx solid rgba(255, 255, 255, 0.18);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.vip__card-sheen {
|
||
position: absolute;
|
||
top: -40rpx;
|
||
right: -40rpx;
|
||
width: 200rpx;
|
||
height: 200rpx;
|
||
border-radius: 50%;
|
||
background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
|
||
pointer-events: none;
|
||
}
|
||
|
||
/* 用户信息区 */
|
||
.vip__card-user {
|
||
display: flex;
|
||
align-items: center;
|
||
position: relative;
|
||
z-index: 1;
|
||
}
|
||
|
||
.vip__avatar {
|
||
width: 96rpx;
|
||
height: 96rpx;
|
||
border-radius: 50%;
|
||
background: rgba(255, 255, 255, 0.2);
|
||
border: 2rpx solid rgba(255, 255, 255, 0.8);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 22rpx;
|
||
flex-shrink: 0;
|
||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.12);
|
||
}
|
||
|
||
.vip__avatar-txt {
|
||
font-size: 40rpx;
|
||
font-weight: 700;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.vip__user-meta {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.vip__user-title-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.vip__user-name {
|
||
font-size: 34rpx;
|
||
font-weight: 700;
|
||
color: #ffffff;
|
||
max-width: 260rpx;
|
||
}
|
||
|
||
.vip__badge {
|
||
margin-left: 14rpx;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
padding: 4rpx 14rpx;
|
||
border-radius: 999rpx;
|
||
background: rgba(255, 255, 255, 0.18);
|
||
border: 1rpx solid rgba(255, 255, 255, 0.25);
|
||
|
||
&--active {
|
||
background: #00e070;
|
||
border-color: #00e070;
|
||
.vip__badge-txt {
|
||
color: #04301e;
|
||
font-weight: 700;
|
||
}
|
||
}
|
||
}
|
||
|
||
.vip__badge-icon {
|
||
width: 22rpx;
|
||
height: 22rpx;
|
||
margin-right: 6rpx;
|
||
}
|
||
|
||
.vip__badge-txt {
|
||
font-size: 20rpx;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.vip__user-desc {
|
||
display: block;
|
||
margin-top: 8rpx;
|
||
font-size: 22rpx;
|
||
color: rgba(255, 255, 255, 0.72);
|
||
}
|
||
|
||
.vip__card-crown {
|
||
width: 80rpx;
|
||
height: 80rpx;
|
||
opacity: 0.85;
|
||
}
|
||
|
||
/* 资产三栏(优雅排版) */
|
||
.vip__assets {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-top: 32rpx;
|
||
padding-top: 24rpx;
|
||
border-top: 1rpx solid rgba(255, 255, 255, 0.14);
|
||
}
|
||
|
||
.vip__asset-col {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
|
||
.vip__asset-sep {
|
||
width: 2rpx;
|
||
height: 38rpx;
|
||
background: rgba(255, 255, 255, 0.14);
|
||
}
|
||
|
||
.vip__asset-val-box {
|
||
display: flex;
|
||
align-items: baseline;
|
||
}
|
||
|
||
.vip__asset-val {
|
||
font-size: 36rpx;
|
||
font-weight: 700;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.vip__asset-unit {
|
||
margin-left: 4rpx;
|
||
font-size: 20rpx;
|
||
color: rgba(255, 255, 255, 0.75);
|
||
}
|
||
|
||
.vip__asset-label-row {
|
||
margin-top: 6rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.vip__asset-lbl {
|
||
font-size: 22rpx;
|
||
color: rgba(255, 255, 255, 0.72);
|
||
}
|
||
|
||
.vip__asset-act {
|
||
margin-left: 6rpx;
|
||
font-size: 20rpx;
|
||
color: #00e070;
|
||
font-weight: 600;
|
||
}
|
||
|
||
/* 卡片模块通用样式 */
|
||
.vip__section {
|
||
margin: 24rpx 28rpx;
|
||
border-radius: 24rpx;
|
||
padding: 30rpx 28rpx;
|
||
background: #ffffff;
|
||
box-shadow: 0 4rpx 20rpx rgba(4, 50, 28, 0.04);
|
||
}
|
||
|
||
.vip__sec-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.vip__sec-title {
|
||
font-size: 30rpx;
|
||
font-weight: 700;
|
||
color: #04291c;
|
||
}
|
||
|
||
.vip__sec-tip {
|
||
font-size: 22rpx;
|
||
color: #8fb3a3;
|
||
}
|
||
|
||
/* 专属特权:2 列精致卡片布局,宽敞舒展 */
|
||
.vip__privileges-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.vip__priv-item {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 20rpx 18rpx;
|
||
background: #f7faf8;
|
||
border-radius: 18rpx;
|
||
border: 1rpx solid #eef4f0;
|
||
}
|
||
|
||
.vip__priv-icon-wrap {
|
||
width: 68rpx;
|
||
height: 68rpx;
|
||
border-radius: 18rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 16rpx;
|
||
flex-shrink: 0;
|
||
|
||
&--green {
|
||
background: #e4fdf0;
|
||
}
|
||
&--gold {
|
||
background: #fff8e6;
|
||
}
|
||
&--cyan {
|
||
background: #e8f9fd;
|
||
}
|
||
&--orange {
|
||
background: #fdf1ea;
|
||
}
|
||
}
|
||
|
||
.vip__priv-icon {
|
||
width: 38rpx;
|
||
height: 38rpx;
|
||
}
|
||
|
||
.vip__priv-content {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.vip__priv-name {
|
||
font-size: 26rpx;
|
||
font-weight: 700;
|
||
color: #04291c;
|
||
}
|
||
|
||
.vip__priv-desc {
|
||
margin-top: 6rpx;
|
||
font-size: 20rpx;
|
||
color: #668877;
|
||
}
|
||
|
||
/* 套餐选择 3 栏 */
|
||
.vip__plans-row {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.vip__plan-card {
|
||
position: relative;
|
||
border: 2rpx solid #e4ece7;
|
||
border-radius: 20rpx;
|
||
background: #ffffff;
|
||
padding: 28rpx 8rpx 22rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
transition: all 0.2s;
|
||
|
||
&--active {
|
||
border-color: #00c860;
|
||
background: #f3fcf6;
|
||
box-shadow: 0 6rpx 18rpx rgba(0, 200, 96, 0.12);
|
||
}
|
||
}
|
||
|
||
.vip__plan-badge {
|
||
position: absolute;
|
||
top: -14rpx;
|
||
right: 8rpx;
|
||
background: linear-gradient(135deg, #00e070 0%, #00b85c 100%);
|
||
color: #04301e;
|
||
font-size: 18rpx;
|
||
font-weight: 700;
|
||
padding: 2rpx 12rpx;
|
||
border-radius: 999rpx;
|
||
box-shadow: 0 2rpx 8rpx rgba(0, 184, 92, 0.25);
|
||
}
|
||
|
||
.vip__plan-name {
|
||
font-size: 26rpx;
|
||
font-weight: 600;
|
||
color: #04291c;
|
||
}
|
||
|
||
.vip__plan-price-row {
|
||
display: flex;
|
||
align-items: baseline;
|
||
margin-top: 10rpx;
|
||
}
|
||
|
||
.vip__plan-symbol {
|
||
font-size: 22rpx;
|
||
font-weight: 700;
|
||
color: #e0891b;
|
||
}
|
||
|
||
.vip__plan-val {
|
||
font-size: 42rpx;
|
||
font-weight: 800;
|
||
color: #e0891b;
|
||
line-height: 1;
|
||
}
|
||
|
||
.vip__plan-del {
|
||
margin-top: 6rpx;
|
||
font-size: 20rpx;
|
||
color: #a4beaf;
|
||
text-decoration: line-through;
|
||
}
|
||
|
||
.vip__plan-quota-chip {
|
||
margin-top: 10rpx;
|
||
padding: 2rpx 12rpx;
|
||
border-radius: 999rpx;
|
||
background: rgba(4, 135, 74, 0.08);
|
||
color: #04874a;
|
||
font-size: 18rpx;
|
||
font-weight: 600;
|
||
}
|
||
|
||
/* 支付方式单选优雅行 */
|
||
.vip__pay-toggle {
|
||
margin-top: 28rpx;
|
||
padding-top: 22rpx;
|
||
border-top: 1rpx solid #edf4f0;
|
||
}
|
||
|
||
.vip__pay-label {
|
||
font-size: 24rpx;
|
||
font-weight: 600;
|
||
color: #04291c;
|
||
margin-bottom: 16rpx;
|
||
display: block;
|
||
}
|
||
|
||
.vip__pay-options {
|
||
display: flex;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.vip__pay-opt {
|
||
flex: 1;
|
||
height: 84rpx;
|
||
border-radius: 16rpx;
|
||
border: 2rpx solid #e4ece7;
|
||
background: #fbfdfc;
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 0 16rpx;
|
||
transition: all 0.2s;
|
||
|
||
&--active {
|
||
border-color: #00c860;
|
||
background: #f3fcf6;
|
||
}
|
||
}
|
||
|
||
.vip__pay-opt-icon {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
}
|
||
|
||
.vip__pay-opt-txt {
|
||
margin-left: 10rpx;
|
||
flex: 1;
|
||
font-size: 22rpx;
|
||
font-weight: 600;
|
||
color: #04291c;
|
||
}
|
||
|
||
.vip__radio {
|
||
width: 30rpx;
|
||
height: 30rpx;
|
||
border-radius: 50%;
|
||
border: 2rpx solid #b8d6c7;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
&--active {
|
||
border-color: #00c860;
|
||
background: #00c860;
|
||
}
|
||
}
|
||
|
||
.vip__radio-dot {
|
||
width: 12rpx;
|
||
height: 12rpx;
|
||
border-radius: 50%;
|
||
background: #ffffff;
|
||
}
|
||
|
||
/* 优惠券区域 */
|
||
.vip__coupons-box {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.vip__coupon-card {
|
||
display: flex;
|
||
align-items: stretch;
|
||
background: #f7faf8;
|
||
border-radius: 18rpx;
|
||
border: 1rpx solid #e4ece7;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.vip__coupon-face {
|
||
width: 170rpx;
|
||
background: #eaf8f0;
|
||
padding: 20rpx 10rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
border-right: 2rpx dashed #cde3d6;
|
||
}
|
||
|
||
.vip__coupon-val {
|
||
font-size: 34rpx;
|
||
font-weight: 800;
|
||
color: #04874a;
|
||
}
|
||
|
||
.vip__coupon-cond {
|
||
font-size: 18rpx;
|
||
color: #3b6b54;
|
||
margin-top: 4rpx;
|
||
}
|
||
|
||
.vip__coupon-info {
|
||
flex: 1;
|
||
min-width: 0;
|
||
padding: 16rpx 20rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.vip__coupon-main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.vip__coupon-name {
|
||
font-size: 26rpx;
|
||
font-weight: 700;
|
||
color: #04291c;
|
||
}
|
||
|
||
.vip__coupon-expire {
|
||
margin-top: 6rpx;
|
||
font-size: 20rpx;
|
||
color: #8fb3a3;
|
||
}
|
||
|
||
.vip__coupon-action {
|
||
margin-left: 16rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.vip__coupon-btn {
|
||
padding: 8rpx 26rpx;
|
||
border-radius: 999rpx;
|
||
background: #00c860;
|
||
color: #ffffff;
|
||
font-size: 22rpx;
|
||
font-weight: 700;
|
||
|
||
&--disabled {
|
||
background: #e4e9e6;
|
||
color: #929d96;
|
||
}
|
||
}
|
||
|
||
.vip__coupon-empty {
|
||
padding: 30rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.vip__coupon-empty-txt {
|
||
font-size: 22rpx;
|
||
color: #8fb3a3;
|
||
}
|
||
|
||
/* 常用功能列表 */
|
||
.vip__menu-card {
|
||
padding: 4rpx 28rpx;
|
||
}
|
||
|
||
.vip__menu-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
height: 98rpx;
|
||
border-bottom: 1rpx solid #edf4f0;
|
||
|
||
&:last-child {
|
||
border-bottom: none;
|
||
}
|
||
}
|
||
|
||
.vip__menu-left {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.vip__menu-icon-box {
|
||
width: 52rpx;
|
||
height: 52rpx;
|
||
border-radius: 14rpx;
|
||
background: #f2fef7;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 18rpx;
|
||
}
|
||
|
||
.vip__menu-icon {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
|
||
.vip__menu-text {
|
||
font-size: 26rpx;
|
||
color: #04291c;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.vip__menu-right {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.vip__menu-sub {
|
||
font-size: 22rpx;
|
||
color: #8fb3a3;
|
||
margin-right: 8rpx;
|
||
}
|
||
|
||
.vip__menu-arrow {
|
||
font-size: 32rpx;
|
||
color: #b8d6c7;
|
||
}
|
||
|
||
/* 垫高 */
|
||
.vip__dock-pad {
|
||
height: 140rpx;
|
||
}
|
||
|
||
/* 底部操作栏 */
|
||
.vip__dock {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
z-index: 98;
|
||
background: #ffffff;
|
||
border-top: 1rpx solid #eef3f0;
|
||
padding: 16rpx 32rpx calc(16rpx + env(safe-area-inset-bottom));
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
box-shadow: 0 -6rpx 24rpx rgba(4, 50, 28, 0.05);
|
||
}
|
||
|
||
.vip__dock-left {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.vip__dock-cost-line {
|
||
display: flex;
|
||
align-items: baseline;
|
||
}
|
||
|
||
.vip__dock-tag {
|
||
font-size: 22rpx;
|
||
color: #8fb3a3;
|
||
}
|
||
|
||
.vip__dock-sym {
|
||
margin-left: 6rpx;
|
||
font-size: 24rpx;
|
||
font-weight: 700;
|
||
color: #e0891b;
|
||
}
|
||
|
||
.vip__dock-amount {
|
||
font-size: 44rpx;
|
||
font-weight: 800;
|
||
color: #e0891b;
|
||
line-height: 1;
|
||
}
|
||
|
||
.vip__dock-saved-pill {
|
||
margin-left: 10rpx;
|
||
padding: 2rpx 12rpx;
|
||
border-radius: 999rpx;
|
||
background: #fff4e0;
|
||
color: #b86e0f;
|
||
font-size: 18rpx;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.vip__dock-meta {
|
||
margin-top: 4rpx;
|
||
font-size: 20rpx;
|
||
color: #8fb3a3;
|
||
}
|
||
|
||
.vip__dock-submit {
|
||
width: 260rpx;
|
||
height: 84rpx;
|
||
border-radius: 999rpx;
|
||
background: linear-gradient(135deg, #00c860 0%, #04874a 100%);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border: none;
|
||
box-shadow: 0 6rpx 20rpx rgba(0, 200, 96, 0.28);
|
||
|
||
&::after {
|
||
border: none;
|
||
}
|
||
}
|
||
|
||
.vip__dock-submit-txt {
|
||
font-size: 30rpx;
|
||
font-weight: 700;
|
||
color: #ffffff;
|
||
}
|
||
</style>
|