chuangte_bike_newxcx/page_fenbao/huiyuan/myhuiyuan.vue

314 lines
7.0 KiB
Vue
Raw Normal View History

2025-06-06 11:32:12 +08:00
<template>
2026-01-28 18:00:39 +08:00
<view class="page">
2026-02-27 11:29:31 +08:00
<u-navbar title="我的卡包" :border-bottom="false" :background="bgc" back-icon-color="#111827" title-color="#111827"
2026-01-28 18:00:39 +08:00
title-size="34" title-bold height="44" :custom-back="btnfh">
</u-navbar>
<!-- 顶部操作 -->
<view class="top-bar">
<view class="jilu" @click="btngm">
<text>购买记录</text>
<u-icon name="arrow-right" size="28" color="#4297F3"></u-icon>
</view>
2025-06-06 11:32:12 +08:00
</view>
2026-01-28 18:00:39 +08:00
2025-06-06 11:32:12 +08:00
<!-- 会员卡列表 -->
2026-01-28 18:00:39 +08:00
<view class="list-container">
<view
v-for="(card, index) in cardList"
:key="index"
class="quota-card"
2025-06-06 11:32:12 +08:00
>
2026-01-28 18:00:39 +08:00
<!-- 卡片头部 -->
<view class="card-header">
<view class="user-info">
<view class="avatar-box">
<u-icon name="coupon" size="32" color="#4297F3"></u-icon>
</view>
<view class="info-text">
<text class="phone">{{ card.name || '会员卡' }}</text>
<text class="create-time">{{ card.startTime }} {{ card.endTime }}</text>
</view>
</view>
<view class="discount-tag">{{ card.discount }}</view>
</view>
2025-06-06 11:32:12 +08:00
<!-- 卡片内容 -->
<view class="card-content">
2026-01-28 18:00:39 +08:00
<view class="info-grid">
2025-06-06 11:32:12 +08:00
<view class="info-item">
2026-01-28 18:00:39 +08:00
<text class="label">使用限制</text>
<text class="value" v-if="card.enableLimit">{{ card.limitRound }}{{ card.limitCount }}</text>
<text class="value value-success" v-else>无限制</text>
2025-06-06 11:32:12 +08:00
</view>
<view class="info-item">
2026-01-28 18:00:39 +08:00
<text class="label">剩余次数</text>
<text class="value highlight">{{ card.surplusTotal || 0 }}</text>
2025-06-06 11:32:12 +08:00
</view>
</view>
2026-01-28 18:00:39 +08:00
<view class="time-row area-row">
<u-icon name="map" size="22" color="#999" style="margin-right: 8rpx;"></u-icon>
<text class="time-text">仅限{{ card.areaName || '—' }}使用</text>
</view>
2025-06-06 11:32:12 +08:00
</view>
</view>
2026-01-28 18:00:39 +08:00
<!-- 空状态 -->
<u-empty v-if="cardList.length === 0 && !loading" mode="data" text="您还没有会员卡" margin-top="120"></u-empty>
2025-06-06 11:32:12 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
return {
cardList: [],
2026-01-28 18:00:39 +08:00
loading: false,
bgc: {
backgroundColor: "#F7F8FA",
},
2026-02-27 11:29:31 +08:00
type: '',
redirectUrl: '',
redirectRemark: ''
2025-06-06 11:32:12 +08:00
}
},
2026-01-28 18:00:39 +08:00
onLoad(e) {
2026-03-16 10:03:51 +08:00
if (e.tyep) {
this.type = e.tyep
2026-02-27 11:29:31 +08:00
}
if (e.redirectUrl) {
this.redirectUrl = decodeURIComponent(e.redirectUrl)
}
if (e.redirectRemark) {
this.redirectRemark = decodeURIComponent(e.redirectRemark)
}
2025-06-06 11:32:12 +08:00
},
onShow() {
this.getlist()
},
methods: {
2026-01-28 18:00:39 +08:00
btnfh(){
if(this.type == 99){
uni.reLaunch({
2026-03-16 10:03:51 +08:00
url:'/pages/nearbystores/index'
2026-01-28 18:00:39 +08:00
})
}else{
uni.navigateBack()
}
},
2025-06-06 11:32:12 +08:00
// 查询用户会员卡列表
2026-01-28 18:00:39 +08:00
getlist() {
this.loading = true
2026-02-26 18:05:57 +08:00
this.$u.get(`/app/vipUser/list?pageNum=1&pageSize=999&isEffective=true&minSurplusCount=1&orderByColumn=createTime&isAsc=desc`).then((res) => {
2026-01-28 18:00:39 +08:00
this.loading = false
if (res.code == 200) {
this.cardList = res.rows || []
}
}).catch(() => {
this.loading = false
})
2025-06-06 11:32:12 +08:00
},
// 点击跳转到购买记录
btngm(){
uni.navigateTo({
url:'/page_fenbao/huiyuan/goumaijilu'
})
},
// 再次购买
handleRenew(card) {
uni.navigateTo({
url:'/page_fenbao/huiyuan/index?areaId=' + card.areaId
})
},
}
}
</script>
<style lang="scss" scoped>
2026-01-28 18:00:39 +08:00
page {
background-color: #F7F8FA;
2025-06-06 11:32:12 +08:00
min-height: 100vh;
}
2026-01-28 18:00:39 +08:00
.page {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.top-bar {
padding: 16rpx 24rpx;
background: #FFFFFF;
margin-bottom: 2rpx;
2026-02-27 11:29:31 +08:00
display: flex;
justify-content: flex-end;
gap: 32rpx;
2026-01-28 18:00:39 +08:00
}
.jilu {
display: flex;
align-items: center;
font-size: 28rpx;
color: #4297F3;
font-weight: 500;
text {
margin-right: 8rpx;
2025-06-06 11:32:12 +08:00
}
}
2026-01-28 18:00:39 +08:00
.list-container {
padding: 20rpx 24rpx;
}
.quota-card {
background: #FFFFFF;
border-radius: 16rpx;
margin-bottom: 16rpx;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
.card-header {
2025-06-06 11:32:12 +08:00
display: flex;
2026-01-28 18:00:39 +08:00
justify-content: space-between;
align-items: center;
padding: 20rpx 24rpx 16rpx;
border-bottom: 1rpx solid #F5F5F5;
.user-info {
display: flex;
align-items: center;
2025-06-06 11:32:12 +08:00
flex: 1;
2026-01-28 18:00:39 +08:00
min-width: 0;
.avatar-box {
width: 56rpx;
height: 56rpx;
background: linear-gradient(135deg, #E8F4FD 0%, #D4ECFD 100%);
border-radius: 50%;
2025-06-06 11:32:12 +08:00
display: flex;
align-items: center;
2026-01-28 18:00:39 +08:00
justify-content: center;
margin-right: 16rpx;
flex-shrink: 0;
}
.info-text {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
.phone {
font-size: 28rpx;
font-weight: 600;
2025-06-06 11:32:12 +08:00
color: #333;
2026-01-28 18:00:39 +08:00
margin-bottom: 4rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2025-06-06 11:32:12 +08:00
}
2026-01-28 18:00:39 +08:00
.create-time {
font-size: 22rpx;
color: #999;
2025-06-06 11:32:12 +08:00
}
}
2026-01-28 18:00:39 +08:00
}
.discount-tag {
padding: 8rpx 16rpx;
background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
color: #DC2626;
font-size: 24rpx;
font-weight: 600;
border-radius: 8rpx;
flex-shrink: 0;
}
}
.card-content {
padding: 16rpx 24rpx 20rpx;
.info-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16rpx 24rpx;
.info-item {
display: flex;
flex-direction: column;
.label {
font-size: 22rpx;
color: #999;
margin-bottom: 6rpx;
}
.value {
2025-06-06 11:32:12 +08:00
font-size: 26rpx;
2026-01-28 18:00:39 +08:00
color: #333;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.highlight {
color: #4297F3;
font-size: 30rpx;
font-weight: 600;
}
.value-success {
color: #52C41A;
2025-06-06 11:32:12 +08:00
}
}
}
2026-01-28 18:00:39 +08:00
.time-row {
2025-06-06 11:32:12 +08:00
display: flex;
2026-01-28 18:00:39 +08:00
align-items: center;
background: #F9FAFB;
padding: 12rpx 16rpx;
border-radius: 8rpx;
margin-top: 16rpx;
.time-text {
font-size: 22rpx;
color: #666;
flex: 1;
2025-06-06 11:32:12 +08:00
}
}
2026-01-28 18:00:39 +08:00
.area-row .time-text {
color: #EF4444;
font-size: 24rpx;
}
.action-row {
margin-top: 16rpx;
display: flex;
justify-content: flex-end;
}
.action-btn {
min-width: 180rpx;
height: 64rpx;
border-radius: 999rpx;
border: 1rpx solid #BFDBFE;
background: #EFF6FF;
color: #1D4ED8;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
text {
margin-left: 8rpx;
}
}
2025-06-06 11:32:12 +08:00
}
}
</style>