| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <template>
- <view class="member-center">
- <scroll-view class="page" scroll-y>
- <!-- 会员状态卡 -->
- <view class="status-card">
- <view class="status-badge" :class="isFree ? 'badge-free' : 'badge-family'">
- <text class="badge-icon">{{ isFree ? '○' : '●' }}</text>
- <text class="badge-text">{{ currentLevelName }}</text>
- </view>
- <view class="status-body" v-if="membership && membership.levelCode !== 'FREE'">
- <view class="expiry-row">
- <text class="expiry-label">到期时间</text>
- <text class="expiry-value">{{ formatDate(membership.endDate) }}</text>
- </view>
- <view class="days-remaining" v-if="membership.isActive">
- <text class="days-num">{{ membership.daysRemaining || 0 }}</text>
- <text class="days-unit">天剩余</text>
- </view>
- <view class="expired-msg" v-else>
- <text class="expired-text">会员已过期,续费恢复权益</text>
- </view>
- </view>
- <view class="status-body" v-else>
- <text class="free-hint">当前为免费版,开通会员解锁全部特权</text>
- </view>
- </view>
- <!-- 会员权益亮点 -->
- <view class="benefit-card">
- <text class="benefit-card-title">{{ isFree ? '开通会员,即刻享有' : '您的会员权益' }}</text>
- <view class="feature-list">
- <view class="feature-item" v-for="(feature, idx) in features" :key="idx">
- <text class="feature-check">✓</text>
- <text class="feature-text">{{ feature }}</text>
- </view>
- </view>
- <!-- 主按钮:非会员开通 / 会员续费 -->
- <button class="btn-main" :class="isFree ? 'btn-upgrade' : 'btn-renew'" @click="goUpgrade">
- {{ isFree ? '立即开通会员' : '立即续费' }}
- </button>
- <view class="benefits-entry" @click="goBenefits">
- <text class="benefits-entry-icon">👑</text>
- <text class="benefits-entry-text">查看我的权益</text>
- <text class="benefits-entry-arrow">›</text>
- </view>
- </view>
- <!-- 我的管家入口 -->
- <view class="butler-entry" @click="goButlerSelect">
- <view class="butler-entry-icon">🤵</view>
- <view class="butler-entry-main">
- <text class="butler-entry-title">{{ butlerEntryTitle }}</text>
- <text class="butler-entry-sub">{{ butlerEntrySub }}</text>
- </view>
- <text class="butler-entry-arrow">›</text>
- </view>
- <!-- 权益对比表 -->
- <view class="compare-section">
- <text class="section-title">权益对比</text>
- <view class="compare-table">
- <view class="compare-row header-row">
- <text class="compare-cell cell-feature">权益项</text>
- <text class="compare-cell cell-free">免费</text>
- <text class="compare-cell cell-basic">体验会员</text>
- <text class="compare-cell cell-family">家庭会员</text>
- <text class="compare-cell cell-premium">高级会员</text>
- </view>
- <view class="compare-row" v-for="(item, idx) in compareData" :key="idx">
- <text class="compare-cell cell-feature">{{ item.name }}</text>
- <text class="compare-cell cell-free">{{ item.free }}</text>
- <text class="compare-cell cell-basic">{{ item.basic }}</text>
- <text class="compare-cell cell-family">{{ item.family }}</text>
- <text class="compare-cell cell-premium">{{ item.premium }}</text>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import { getMyMembership, getMyButler } from '../../utils/api.js'
- import { parseDate } from '../../utils/format.js'
- export default {
- data() {
- return {
- membership: null,
- isFree: true,
- currentLevelName: '免费用户',
- features: ['折扣购物', '家庭管理', '推荐佣金', '专属活动', '任务特权', '成长报告'],
- compareData: [
- { name: '商品折扣', free: '普通价格', basic: '会员折扣', family: '会员折扣', premium: '会员折扣' },
- { name: '家庭管理', free: '基础功能', basic: '3个孩子', family: '10个孩子', premium: '20个孩子' },
- { name: 'AI健康顾问', free: '—', basic: '3次/月', family: '不限', premium: '不限' },
- { name: '报告解读', free: '—', basic: '1次/月', family: '不限', premium: '深度解读' },
- { name: '测评预约', free: '仅查看', basic: '1次/月', family: '不限', premium: '优先' },
- { name: '管家服务', free: '—', basic: '—', family: '月1次', premium: '周1次' },
- { name: '推荐佣金', free: '不可参与', basic: '可参与', family: '可参与', premium: '可参与' },
- { name: '专属活动', free: '部分参与', basic: '部分参与', family: '全部参与', premium: '优先参与' }
- ],
- myButlerInfo: null,
- isL2Active: false
- }
- },
- computed: {
- butlerEntryTitle() {
- return this.myButlerInfo ? ('我的管家 · ' + this.myButlerInfo.nickname) : '我的管家'
- },
- butlerEntrySub() {
- return this.myButlerInfo ? '点击查看或更换' : '久久一生会员可自助选择专属管家'
- }
- },
- onShow() {
- this.loadData()
- this.loadButlerEntry()
- },
- methods: {
- loadData() {
- var that = this
- getMyMembership().then(function(res) {
- var m = res.data || {}
- that.membership = m
- if (m.levelCode && m.levelCode !== 'FREE') {
- that.isFree = false
- that.currentLevelName = m.levelName || '家庭会员'
- if (m.levelCode === 'BASIC') {
- that.currentLevelName = '体验会员'
- } else if (m.levelCode === 'FAMILY') {
- that.currentLevelName = '家庭会员'
- } else if (m.levelCode === 'PREMIUM') {
- that.currentLevelName = '高级会员'
- }
- } else {
- that.isFree = true
- that.currentLevelName = '免费用户'
- }
- }).catch(function() {})
- },
- goUpgrade() {
- uni.navigateTo({ url: '/pages/membership/upgrade' })
- },
- goBenefits() {
- uni.navigateTo({ url: '/pages/membership/benefits' })
- },
- goButlerSelect() {
- uni.navigateTo({ url: '/pages/butler/select' })
- },
- loadButlerEntry() {
- var that = this
- getMyButler().then(function (res) {
- if (res && res.code === 200 && res.data) {
- that.myButlerInfo = res.data
- }
- }).catch(function () {})
- },
- formatDate(date) {
- if (!date) return ''
- var d = parseDate(date)
- if (!d) return ''
- var month = d.getMonth() + 1
- var day = d.getDate()
- return d.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day)
- }
- }
- }
- </script>
- <style scoped>
- .page {
- min-height: 100vh;
- background: #FFF7ED;
- padding: 30rpx;
- box-sizing: border-box;
- }
- /* ===== 状态卡片 ===== */
- .status-card {
- background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 30rpx;
- }
- .status-badge {
- display: inline-flex;
- align-items: center;
- padding: 10rpx 24rpx;
- border-radius: 9999rpx;
- font-size: 24rpx;
- }
- .badge-free {
- background: rgba(255,255,255,0.2);
- color: #fff;
- }
- .badge-family {
- background: rgba(255,255,255,0.3);
- color: #fff;
- }
- .badge-icon {
- font-size: 20rpx;
- margin-right: 8rpx;
- }
- .badge-text {
- font-weight: 600;
- }
- .status-body {
- margin-top: 24rpx;
- }
- .expiry-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .expiry-label {
- font-size: 26rpx;
- color: rgba(255,255,255,0.8);
- }
- .expiry-value {
- font-size: 28rpx;
- color: #fff;
- font-weight: 500;
- }
- .days-remaining {
- display: flex;
- align-items: baseline;
- justify-content: center;
- margin-top: 20rpx;
- }
- .days-num {
- font-size: 56rpx;
- font-weight: bold;
- color: #FEF3C7;
- }
- .days-unit {
- font-size: 26rpx;
- color: rgba(255,255,255,0.7);
- margin-left: 8rpx;
- }
- .expired-msg {
- text-align: center;
- margin-top: 16rpx;
- }
- .expired-text {
- font-size: 26rpx;
- color: #FEF3C7;
- }
- .free-hint {
- font-size: 26rpx;
- color: rgba(255,255,255,0.85);
- text-align: center;
- display: block;
- }
- /* ===== 权益卡片 ===== */
- .benefit-card {
- background: #FFFFFF;
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 30rpx;
- box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
- }
- .benefit-card-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #1E293B;
- display: block;
- text-align: center;
- margin-bottom: 16rpx;
- }
- .feature-list {
- margin: 16rpx 0 24rpx;
- }
- .feature-item {
- display: flex;
- align-items: center;
- padding: 12rpx 0;
- }
- .feature-check {
- width: 36rpx;
- height: 36rpx;
- border-radius: 50%;
- background: #F97316;
- color: #fff;
- font-size: 22rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 16rpx;
- flex-shrink: 0;
- }
- .feature-text {
- font-size: 28rpx;
- color: #334155;
- }
- .btn-main {
- width: 100%;
- border-radius: 44rpx;
- font-size: 32rpx;
- font-weight: bold;
- padding: 24rpx 0;
- border: none;
- line-height: 1.4;
- }
- .btn-upgrade {
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- }
- .btn-renew {
- background: linear-gradient(135deg, #6366F1, #818CF8);
- color: #fff;
- }
- .btn-main::after {
- border: none;
- }
- .benefits-entry {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 24rpx;
- padding: 20rpx;
- background: #FFF7ED;
- border-radius: 16rpx;
- }
- .benefits-entry-icon {
- font-size: 32rpx;
- margin-right: 8rpx;
- }
- .benefits-entry-text {
- font-size: 28rpx;
- color: #F97316;
- font-weight: 500;
- }
- .benefits-entry-arrow {
- font-size: 28rpx;
- color: #F97316;
- margin-left: 8rpx;
- }
- /* ===== 权益对比表 ===== */
- .compare-section {
- background: #FFFFFF;
- border-radius: 20rpx;
- padding: 30rpx;
- box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
- }
- .section-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #1E293B;
- display: block;
- margin-bottom: 20rpx;
- }
- .compare-table {
- width: 100%;
- }
- .compare-row {
- display: flex;
- padding: 14rpx 0;
- border-bottom: 1rpx solid #F1F5F9;
- }
- .compare-row:last-child {
- border-bottom: none;
- }
- .header-row {
- border-bottom: 2rpx solid #FED7AA;
- }
- .compare-cell {
- flex: 1;
- font-size: 22rpx;
- color: #475569;
- text-align: center;
- word-break: break-all;
- }
- .cell-feature {
- flex: 1.2;
- text-align: left;
- color: #334155;
- font-weight: 500;
- }
- .header-row .compare-cell {
- color: #F97316;
- font-weight: bold;
- }
- /* ===== 我的管家入口 ===== */
- .butler-entry { display: flex; align-items: center; background: #fff; border-radius: 16rpx; padding: 28rpx; margin: 20rpx 0; }
- .butler-entry-icon { font-size: 48rpx; margin-right: 20rpx; }
- .butler-entry-main { flex: 1; display: flex; flex-direction: column; }
- .butler-entry-title { font-size: 30rpx; font-weight: bold; color: #333; }
- .butler-entry-sub { font-size: 24rpx; color: #999; margin-top: 6rpx; }
- .butler-entry-arrow { font-size: 40rpx; color: #ccc; }
- </style>
|