6a18d3de61
- 门票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页注册
169 lines
3.6 KiB
Vue
169 lines
3.6 KiB
Vue
<template>
|
|
<view class="cards-page">
|
|
<view v-if="isLoading" class="load-more-tip">加载中...</view>
|
|
|
|
<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="stat-divider" />
|
|
<view class="stat">
|
|
<text class="stat-value muted">{{ card.total_count }}</text>
|
|
<text class="stat-label">总数</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<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, ref } from 'vue'
|
|
import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
|
import { membershipApi } from '@/modules/comprehensive/api/membership'
|
|
|
|
const cards = ref([])
|
|
const page = ref(1)
|
|
const pageSize = 20
|
|
const total = ref(0)
|
|
const isLoading = ref(false)
|
|
const isLoadingMore = ref(false)
|
|
|
|
const hasMore = computed(() => cards.value.length < total.value)
|
|
|
|
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())
|
|
})
|
|
|
|
onReachBottom(() => {
|
|
if (!hasMore.value || isLoadingMore.value) return
|
|
page.value += 1
|
|
loadCards(false)
|
|
})
|
|
|
|
loadCards(true)
|
|
|
|
const goDetail = (id) => {
|
|
uni.navigateTo({ url: `/pages/comprehensive/membership/card-detail?id=${id}` })
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.cards-page {
|
|
min-height: 100vh;
|
|
background: $bg-color-soft;
|
|
}
|
|
|
|
.card-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: $spacing-md;
|
|
padding: $spacing-md;
|
|
}
|
|
|
|
.item-card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.card-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: $spacing-sm;
|
|
}
|
|
|
|
.plan-name {
|
|
flex: 1;
|
|
color: $text-color-main;
|
|
font-size: 30rpx;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.status-tag {
|
|
padding: 4rpx 16rpx;
|
|
border-radius: $border-radius-sm;
|
|
font-size: 22rpx;
|
|
font-weight: 800;
|
|
}
|
|
|
|
.status-tag.available {
|
|
background: $color-success-light;
|
|
color: $color-success;
|
|
}
|
|
|
|
.status-tag.exhausted {
|
|
background: $color-warning-light;
|
|
color: $color-warning;
|
|
}
|
|
|
|
.status-tag.expired {
|
|
background: $bg-color-hover;
|
|
color: $text-color-muted;
|
|
}
|
|
|
|
.card-body {
|
|
margin-top: $spacing-md;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: $spacing-md;
|
|
}
|
|
|
|
.stat {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.stat-value {
|
|
color: $color-primary;
|
|
font-size: 48rpx;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.stat-value.muted {
|
|
color: $text-color-muted;
|
|
}
|
|
|
|
.stat-label {
|
|
margin-top: 4rpx;
|
|
color: $text-color-muted;
|
|
font-size: 22rpx;
|
|
}
|
|
|
|
.stat-divider {
|
|
width: 1rpx;
|
|
height: 56rpx;
|
|
background: $border-color;
|
|
}
|
|
</style>
|