feat: 页面重写与流程优化
- 门票Tab展示已购门票记录(可核销/已核销/已退款) - 购买次数去掉合计金额行 - 登录后直接跳profile/detail,合并setup页(不区分模式) - profile/detail增加返回首页按钮 - 约课页移除UnauthLoginPanel - 401跳转改为reLaunch到login页,不显示toast - membership/cards仅展示可用卡,恢复点击进详情 - available-sessions改为只读展示,移除预约逻辑 - profile/orders重写样式,单行状态筛选 - profile/balance重写样式,onShow自动刷新 - profile/index移除冗余菜单项(篮球门票/充值/我的预约/个人信息/切换场馆) - profile/index移除AgreementLinks,我的次卡改为我的会员卡 - pages.json移除setup页注册
This commit is contained in:
@@ -1,47 +1,37 @@
|
||||
<template>
|
||||
<view class="cards-page">
|
||||
<UnauthLoginPanel
|
||||
v-if="!session.isLoggedIn"
|
||||
@login="login"
|
||||
/>
|
||||
<view v-if="isLoading" class="load-more-tip">加载中...</view>
|
||||
|
||||
<block v-else>
|
||||
<view class="list">
|
||||
<view v-for="card in cards" :key="card.id" class="card membership-card" @tap="goDetail(card.id)">
|
||||
<view class="card-top">
|
||||
<text class="plan-name">{{ card.plan_name }}</text>
|
||||
<text class="badge" :class="statusBadgeClass(card.status)">{{ card.status_label }}</text>
|
||||
<view v-else-if="cards.length" class="card-list">
|
||||
<view v-for="card in cards" :key="card.id" class="card item-card" @tap="goDetail(card.id)">
|
||||
<view class="card-header">
|
||||
<text class="plan-name">{{ card.plan_name }}</text>
|
||||
<text class="status-tag" :class="card.status">{{ card.status_label }}</text>
|
||||
</view>
|
||||
<view class="card-body">
|
||||
<view class="stat">
|
||||
<text class="stat-value">{{ card.remaining_count }}</text>
|
||||
<text class="stat-label">剩余</text>
|
||||
</view>
|
||||
<view class="count-row">
|
||||
<view class="count-block">
|
||||
<text class="count-value">{{ card.remaining_count }}</text>
|
||||
<text class="count-label">剩余次数</text>
|
||||
</view>
|
||||
<view class="count-divider" />
|
||||
<view class="count-block">
|
||||
<text class="count-value muted">{{ card.total_count }}</text>
|
||||
<text class="count-label">总次数</text>
|
||||
</view>
|
||||
<view class="stat-divider" />
|
||||
<view class="stat">
|
||||
<text class="stat-value muted">{{ card.total_count }}</text>
|
||||
<text class="stat-label">总数</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="isLoading" class="load-more-tip">加载中...</view>
|
||||
<view v-else-if="cards.length === 0" class="empty-state">暂无次卡</view>
|
||||
<view v-else-if="!hasMore" class="load-more-tip">已加载全部</view>
|
||||
<view v-if="isLoadingMore" class="load-more-tip">加载中...</view>
|
||||
</view>
|
||||
</block>
|
||||
<view v-if="!hasMore && cards.length >= pageSize" class="load-more-tip">已加载全部</view>
|
||||
</view>
|
||||
|
||||
<view v-else class="empty-state">暂无次卡</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
||||
import { membershipApi } from '@/modules/comprehensive/api/membership'
|
||||
import { useComprehensiveSessionStore } from '@/modules/comprehensive/stores/session'
|
||||
import UnauthLoginPanel from '@/components/UnauthLoginPanel.vue'
|
||||
|
||||
const session = useComprehensiveSessionStore()
|
||||
const cards = ref([])
|
||||
const page = ref(1)
|
||||
const pageSize = 20
|
||||
@@ -51,10 +41,23 @@ const isLoadingMore = ref(false)
|
||||
|
||||
const hasMore = computed(() => cards.value.length < total.value)
|
||||
|
||||
onMounted(async () => {
|
||||
await session.init()
|
||||
if (session.isLoggedIn) loadCards(true)
|
||||
})
|
||||
const loadCards = async (reset) => {
|
||||
if (reset) {
|
||||
page.value = 1
|
||||
isLoading.value = true
|
||||
} else {
|
||||
isLoadingMore.value = true
|
||||
}
|
||||
try {
|
||||
const data = await membershipApi.getCards({ page: page.value, pageSize })
|
||||
const items = data.items.filter((c) => c.status === 'available')
|
||||
cards.value = reset ? items : [...cards.value, ...items]
|
||||
total.value = items.length
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
isLoadingMore.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
loadCards(true).finally(() => uni.stopPullDownRefresh())
|
||||
@@ -66,37 +69,11 @@ onReachBottom(() => {
|
||||
loadCards(false)
|
||||
})
|
||||
|
||||
const loadCards = async (reset) => {
|
||||
if (reset) {
|
||||
page.value = 1
|
||||
isLoading.value = true
|
||||
} else {
|
||||
isLoadingMore.value = true
|
||||
}
|
||||
try {
|
||||
const data = await membershipApi.getCards({ page: page.value, pageSize })
|
||||
cards.value = reset ? data.items : [...cards.value, ...data.items]
|
||||
total.value = data.total
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
isLoadingMore.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const login = async () => {
|
||||
await session.login()
|
||||
loadCards(true)
|
||||
}
|
||||
loadCards(true)
|
||||
|
||||
const goDetail = (id) => {
|
||||
uni.navigateTo({ url: `/pages/comprehensive/membership/card-detail?id=${id}` })
|
||||
}
|
||||
|
||||
const statusBadgeClass = (status) => {
|
||||
if (status === 'available') return 'success'
|
||||
if (status === 'exhausted') return 'warning'
|
||||
return 'muted'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -105,19 +82,23 @@ const statusBadgeClass = (status) => {
|
||||
background: $bg-color-soft;
|
||||
}
|
||||
|
||||
.list {
|
||||
.card-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $spacing-md;
|
||||
padding: $spacing-md;
|
||||
}
|
||||
|
||||
.membership-card {
|
||||
margin-bottom: $spacing-md;
|
||||
.item-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.card-top {
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: $spacing-md;
|
||||
gap: $spacing-sm;
|
||||
}
|
||||
|
||||
.plan-name {
|
||||
@@ -125,62 +106,61 @@ const statusBadgeClass = (status) => {
|
||||
color: $text-color-main;
|
||||
font-size: 30rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.badge {
|
||||
.status-tag {
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: $border-radius-sm;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.badge.success {
|
||||
.status-tag.available {
|
||||
background: $color-success-light;
|
||||
color: $color-success;
|
||||
}
|
||||
|
||||
.badge.warning {
|
||||
.status-tag.exhausted {
|
||||
background: $color-warning-light;
|
||||
color: $color-warning;
|
||||
}
|
||||
|
||||
.badge.muted {
|
||||
.status-tag.expired {
|
||||
background: $bg-color-hover;
|
||||
color: $text-color-muted;
|
||||
}
|
||||
|
||||
.count-row {
|
||||
.card-body {
|
||||
margin-top: $spacing-md;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $spacing-md;
|
||||
}
|
||||
|
||||
.count-block {
|
||||
.stat {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.count-value {
|
||||
.stat-value {
|
||||
color: $color-primary;
|
||||
font-size: 44rpx;
|
||||
font-size: 48rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.count-value.muted {
|
||||
.stat-value.muted {
|
||||
color: $text-color-muted;
|
||||
}
|
||||
|
||||
.count-label {
|
||||
.stat-label {
|
||||
margin-top: 4rpx;
|
||||
color: $text-color-muted;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.count-divider {
|
||||
.stat-divider {
|
||||
width: 1rpx;
|
||||
height: 56rpx;
|
||||
background: $border-color;
|
||||
|
||||
Reference in New Issue
Block a user