修复bug,添加我的积分页面
This commit is contained in:
@@ -285,3 +285,25 @@ export const getRevenueList = (data) =>{
|
||||
export const revenueDetails = (data) =>{
|
||||
return get(`/api/resident/revenueNotice/${data.id}`)
|
||||
}
|
||||
|
||||
// =======积分相关=========
|
||||
// 获取积分余额
|
||||
export const getPointsBalance = (data) => {
|
||||
return get('/api/resident/points/balance', data)
|
||||
}
|
||||
// 获取积分商城商品列表
|
||||
export const getPointsMallList = (data) => {
|
||||
return get('/api/resident/points/mall/list', data)
|
||||
}
|
||||
// 积分兑换
|
||||
export const postPointsExchange = (data) => {
|
||||
return post('/api/resident/points/mall/exchange', data)
|
||||
}
|
||||
// 获取积分明细列表
|
||||
export const getPointsRecordList = (data) => {
|
||||
return get('/api/resident/points/record/list', data)
|
||||
}
|
||||
// 获取积分兑换订单列表
|
||||
export const getPointsOrderList = (data) => {
|
||||
return get('/api/resident/points/order/list', data)
|
||||
}
|
||||
293
property-uniapp-project/pageSubPack/my/myPointsIndex.vue
Normal file
293
property-uniapp-project/pageSubPack/my/myPointsIndex.vue
Normal file
@@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="header-area">
|
||||
<view class="status-bar"></view>
|
||||
<uni-nav-bar title="我的积分" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false"
|
||||
color="#ffffff" :iconStyle="{ color: '#ffffff' }">
|
||||
</uni-nav-bar>
|
||||
<view class="points-display">
|
||||
<text class="points-num">{{ totalPoints }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 三个功能入口 -->
|
||||
<view class="entry-card">
|
||||
<view class="entry-item" v-for="(item, index) in entryList" :key="index" @click="goPage(item)">
|
||||
<image :src="item.icon" class="entry-icon" mode="aspectFit" />
|
||||
<text class="entry-text">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 虚拟兑换 -->
|
||||
<view class="virtual-exchange">
|
||||
<text class="virtual-title">虚拟兑换</text>
|
||||
</view>
|
||||
<view class="section-header">
|
||||
<view class="section-line"></view>
|
||||
<text class="section-title">热门虚拟权益服务</text>
|
||||
<view class="section-line"></view>
|
||||
</view>
|
||||
|
||||
<!-- 人气兑换商品区域 -->
|
||||
<view class="goods-card">
|
||||
<uni-section title="人气兑换" type="line"></uni-section>
|
||||
<view class="goods-grid">
|
||||
<view class="goods-item" v-for="(item, index) in goodsList" :key="index">
|
||||
<image :src="item.image" class="goods-img" mode="aspectFill" />
|
||||
<text class="goods-name">{{ item.name }}</text>
|
||||
<text class="goods-desc">{{ item.desc }}</text>
|
||||
<text class="goods-points">{{ item.points }}分</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-more" @click="goMore">
|
||||
<text class="more-text">更多积分兑换</text>
|
||||
<text class="more-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getPointsBalance } from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
const totalPoints = ref(780)
|
||||
|
||||
const entryList = ref([{
|
||||
title: '积分商城',
|
||||
icon: 'https://wuye.ckdzkj.com/images/propertyImgs/pointsMall.png',
|
||||
url: '/pageSubPack/my/myPointsMall'
|
||||
}, {
|
||||
title: '积分明细',
|
||||
icon: 'https://wuye.ckdzkj.com/images/propertyImgs/pointsRecord.png',
|
||||
url: '/pageSubPack/my/myPointsRecord'
|
||||
}, {
|
||||
title: '积分订单',
|
||||
icon: 'https://wuye.ckdzkj.com/images/propertyImgs/pointsOrder.png',
|
||||
url: '/pageSubPack/my/myPointsOrder'
|
||||
}])
|
||||
|
||||
const goodsList = ref([
|
||||
{ id: 1, name: '植物精油', desc: '温和无刺激 下单即赠试用装', points: 6000, image: 'https://via.placeholder.com/200x200/4CAF50/FFF?text=植物' },
|
||||
{ id: 2, name: '肯德基香辣劲脆鸡腿堡电子', desc: '下单即赠试用装', points: 6000, image: 'https://via.placeholder.com/200x200/FF5722/FFF?text=KFC' },
|
||||
{ id: 3, name: '植物精油', desc: '温和无刺激 下单即赠试用装', points: 6000, image: 'https://via.placeholder.com/200x200/4CAF50/FFF?text=植物' },
|
||||
{ id: 4, name: '肯德基香辣劲脆鸡腿堡电子', desc: '下单即赠试用装', points: 4000, image: 'https://via.placeholder.com/200x200/FF5722/FFF?text=KFC' },
|
||||
{ id: 5, name: '植物精油', desc: '温和无刺激 下单即赠试用装', points: 6000, image: 'https://via.placeholder.com/200x200/4CAF50/FFF?text=植物' },
|
||||
{ id: 6, name: '肯德基香辣劲脆鸡腿堡电子', desc: '下单即赠试用装', points: 4000, image: 'https://via.placeholder.com/200x200/FF5722/FFF?text=KFC' }
|
||||
])
|
||||
|
||||
const getBalance = async () => {
|
||||
try {
|
||||
const res = await getPointsBalance()
|
||||
if (res.code === 200 && res.data) {
|
||||
totalPoints.value = res.data.balance || res.data.points || 0
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取积分余额失败:', err)
|
||||
}
|
||||
}
|
||||
|
||||
const goPage = (item) => {
|
||||
uni.navigateTo({
|
||||
url: item.url
|
||||
})
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}
|
||||
|
||||
const goMore = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pageSubPack/my/myPointsMall'
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getBalance()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* ===== 顶部蓝色区域 ===== */
|
||||
.header-area {
|
||||
background: #2E59FD;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
width: 100vw;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.points-display {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 30rpx 0 20rpx;
|
||||
}
|
||||
|
||||
.points-num {
|
||||
font-size: 64rpx;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
line-height: 1.1;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
|
||||
/* ===== 三个功能入口 ===== */
|
||||
.entry-card {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
margin: -30rpx 30rpx 0;
|
||||
padding: 36rpx 0;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.entry-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-icon {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.entry-text {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ===== 虚拟兑换 ===== */
|
||||
.virtual-exchange {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 40rpx 0 30rpx;
|
||||
}
|
||||
|
||||
.virtual-title {
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ===== 热门虚拟权益服务(横线 + 文字 + 横线) ===== */
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 110rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.section-line {
|
||||
flex: 1;
|
||||
height: 1rpx;
|
||||
background: #cccccc;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
margin: 0 24rpx;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ===== 人气兑换商品卡片 ===== */
|
||||
.goods-card {
|
||||
background: #ffffff;
|
||||
border-radius: 32rpx;
|
||||
margin: 0 30rpx;
|
||||
padding: 20rpx 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.goods-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -10rpx;
|
||||
}
|
||||
|
||||
.goods-item {
|
||||
width: calc(33.33% - 20rpx);
|
||||
margin: 0 10rpx 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.goods-img {
|
||||
width: 210rpx;
|
||||
height: 210rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f0f0f0;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
line-height: 1.3;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.goods-desc {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
text-align: left;
|
||||
line-height: 1.3;
|
||||
margin-top: 6rpx;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.goods-points {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #FF8F40;
|
||||
margin-top: 8rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* ===== 更多积分兑换 ===== */
|
||||
.goods-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 30rpx 0 10rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.more-text {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
</style>
|
||||
232
property-uniapp-project/pageSubPack/my/myPointsMall.vue
Normal file
232
property-uniapp-project/pageSubPack/my/myPointsMall.vue
Normal file
@@ -0,0 +1,232 @@
|
||||
<template>
|
||||
<view class="contentStyle">
|
||||
<!-- <view class="status-bar"></view>
|
||||
<uni-nav-bar title="积分商城" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||
</uni-nav-bar> -->
|
||||
|
||||
<pull-refresh-scroll
|
||||
custom-class="page"
|
||||
:refreshing="isRefreshing"
|
||||
:loading-more="loading"
|
||||
:no-more-data="noMoreData"
|
||||
:empty="list.length === 0"
|
||||
empty-text="暂无商品"
|
||||
@refresh="onRefresh"
|
||||
@loadMore="loadMore"
|
||||
>
|
||||
<view class="mall-list">
|
||||
<view class="mall-card" v-for="(item, index) in list" :key="index" @click="onProductClick(item)">
|
||||
<image :src="item.image || defaultImg" class="product-img" mode="aspectFill" />
|
||||
<view class="product-info">
|
||||
<text class="product-name">{{ item.name }}</text>
|
||||
<text class="product-desc">{{ item.description || '' }}</text>
|
||||
<view class="product-bottom">
|
||||
<view class="product-points">
|
||||
<text class="points-value">{{ item.points }}</text>
|
||||
<text class="points-unit">积分</text>
|
||||
</view>
|
||||
<view class="exchange-btn">立即兑换</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</pull-refresh-scroll>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getPointsMallList, postPointsExchange } from '/pageSubPack/api/apiSub.js'
|
||||
import PullRefreshScroll from '/components/pull-refresh-scroll/pull-refresh-scroll.vue'
|
||||
|
||||
const defaultImg = 'https://wuyeadmin.bugtc.com/images/propertyImgs/points.png'
|
||||
|
||||
const list = ref([])
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const noMoreData = ref(false)
|
||||
const loading = ref(false)
|
||||
const isRefreshing = ref(false)
|
||||
|
||||
const getList = async () => {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getPointsMallList({
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
})
|
||||
const newList = res.rows || res.data || []
|
||||
if (pageNum.value === 1) {
|
||||
list.value = newList
|
||||
} else {
|
||||
list.value = [...list.value, ...newList]
|
||||
}
|
||||
if (newList.length < pageSize.value) {
|
||||
noMoreData.value = true
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
console.error('积分商城接口报错:', err)
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (isRefreshing.value) isRefreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onRefresh = () => {
|
||||
isRefreshing.value = true
|
||||
pageNum.value = 1
|
||||
noMoreData.value = false
|
||||
loading.value = false
|
||||
getList()
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (loading.value || noMoreData.value) return
|
||||
pageNum.value++
|
||||
getList()
|
||||
}
|
||||
|
||||
const onProductClick = (item) => {
|
||||
uni.showModal({
|
||||
title: '确认兑换',
|
||||
content: `确定使用 ${item.points} 积分兑换「${item.name}」吗?`,
|
||||
success: async (modalRes) => {
|
||||
if (!modalRes.confirm) return
|
||||
try {
|
||||
uni.showLoading({ title: '兑换中...', mask: true })
|
||||
const res = await postPointsExchange({ productId: item.id || item.productId })
|
||||
uni.hideLoading()
|
||||
if (res.code === 200) {
|
||||
uni.showToast({ title: '兑换成功', icon: 'success' })
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '兑换失败', icon: 'none' })
|
||||
}
|
||||
} catch (err) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: err.msg || '兑换失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentStyle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
width: 100vw;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.mall-list {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.mall-card {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.product-img {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 12rpx;
|
||||
flex-shrink: 0;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-left: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.product-bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.product-points {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.points-value {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #ff6b35;
|
||||
}
|
||||
|
||||
.points-unit {
|
||||
font-size: 24rpx;
|
||||
color: #ff6b35;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
|
||||
.exchange-btn {
|
||||
padding: 10rpx 28rpx;
|
||||
background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
border-radius: 30rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.exchange-btn:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
229
property-uniapp-project/pageSubPack/my/myPointsOrder.vue
Normal file
229
property-uniapp-project/pageSubPack/my/myPointsOrder.vue
Normal file
@@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<view class="contentStyle">
|
||||
<!-- <view class="status-bar"></view>
|
||||
<uni-nav-bar title="积分订单" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||
</uni-nav-bar> -->
|
||||
|
||||
<pull-refresh-scroll
|
||||
custom-class="page"
|
||||
:refreshing="isRefreshing"
|
||||
:loading-more="loading"
|
||||
:no-more-data="noMoreData"
|
||||
:empty="list.length === 0"
|
||||
empty-text="暂无兑换订单"
|
||||
@refresh="onRefresh"
|
||||
@loadMore="loadMore"
|
||||
>
|
||||
<view class="order-list">
|
||||
<view class="order-card" v-for="(item, index) in list" :key="index" @click="onOrderClick(item)">
|
||||
<view class="order-header">
|
||||
<text class="order-product">{{ item.productName }}</text>
|
||||
<text class="order-status" :class="getStatusClass(item.status)">
|
||||
{{ getStatusText(item.status) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="order-body">
|
||||
<view class="order-row">
|
||||
<text class="order-label">兑换积分</text>
|
||||
<text class="order-points">{{ item.points }}积分</text>
|
||||
</view>
|
||||
<view class="order-row">
|
||||
<text class="order-label">兑换时间</text>
|
||||
<text class="order-time">{{ item.createTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</pull-refresh-scroll>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getPointsOrderList } from '/pageSubPack/api/apiSub.js'
|
||||
import PullRefreshScroll from '/components/pull-refresh-scroll/pull-refresh-scroll.vue'
|
||||
|
||||
const list = ref([])
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const noMoreData = ref(false)
|
||||
const loading = ref(false)
|
||||
const isRefreshing = ref(false)
|
||||
|
||||
const getList = async () => {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getPointsOrderList({
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
})
|
||||
const newList = res.rows || res.data || []
|
||||
if (pageNum.value === 1) {
|
||||
list.value = newList
|
||||
} else {
|
||||
list.value = [...list.value, ...newList]
|
||||
}
|
||||
if (newList.length < pageSize.value) {
|
||||
noMoreData.value = true
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
console.error('积分订单接口报错:', err)
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (isRefreshing.value) isRefreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onRefresh = () => {
|
||||
isRefreshing.value = true
|
||||
pageNum.value = 1
|
||||
noMoreData.value = false
|
||||
loading.value = false
|
||||
getList()
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (loading.value || noMoreData.value) return
|
||||
pageNum.value++
|
||||
getList()
|
||||
}
|
||||
|
||||
const onOrderClick = (item) => {
|
||||
uni.showToast({ title: `订单号:${item.orderNo || item.id}`, icon: 'none' })
|
||||
}
|
||||
|
||||
const getStatusText = (status) => {
|
||||
const map = { '0': '待处理', '1': '已发货', '2': '已完成', '3': '已取消' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
const getStatusClass = (status) => {
|
||||
const map = { '0': 'status-pending', '1': 'status-shipped', '2': 'status-done', '3': 'status-cancel' }
|
||||
return map[status] || ''
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentStyle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
width: 100vw;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.order-list {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.order-product {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 26rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
color: #fa8c16;
|
||||
background: #fff7e6;
|
||||
}
|
||||
|
||||
.status-shipped {
|
||||
color: #1677ff;
|
||||
background: #e6f4ff;
|
||||
}
|
||||
|
||||
.status-done {
|
||||
color: #07c160;
|
||||
background: #e6f9f0;
|
||||
}
|
||||
|
||||
.status-cancel {
|
||||
color: #999;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.order-body {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
|
||||
.order-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.order-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.order-label {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.order-points {
|
||||
font-size: 28rpx;
|
||||
color: #ff6b35;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.order-time {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
190
property-uniapp-project/pageSubPack/my/myPointsRecord.vue
Normal file
190
property-uniapp-project/pageSubPack/my/myPointsRecord.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<view class="contentStyle">
|
||||
<!-- <view class="status-bar"></view>
|
||||
<uni-nav-bar title="积分明细" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||
</uni-nav-bar> -->
|
||||
|
||||
<pull-refresh-scroll
|
||||
custom-class="page"
|
||||
:refreshing="isRefreshing"
|
||||
:loading-more="loading"
|
||||
:no-more-data="noMoreData"
|
||||
:empty="list.length === 0"
|
||||
empty-text="暂无积分记录"
|
||||
@refresh="onRefresh"
|
||||
@loadMore="loadMore"
|
||||
>
|
||||
<view class="record-list">
|
||||
<view class="record-card" v-for="(item, index) in list" :key="index">
|
||||
<view class="record-left">
|
||||
<text class="record-title">{{ item.title }}</text>
|
||||
<text class="record-time">{{ item.createTime }}</text>
|
||||
</view>
|
||||
<view class="record-right">
|
||||
<text class="record-points" :class="item.type === 'income' ? 'income' : 'expense'">
|
||||
{{ item.type === 'income' ? '+' : '-' }}{{ item.points }}
|
||||
</text>
|
||||
<text class="record-balance">余额:{{ item.balance }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</pull-refresh-scroll>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getPointsRecordList } from '/pageSubPack/api/apiSub.js'
|
||||
import PullRefreshScroll from '/components/pull-refresh-scroll/pull-refresh-scroll.vue'
|
||||
|
||||
const list = ref([])
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const noMoreData = ref(false)
|
||||
const loading = ref(false)
|
||||
const isRefreshing = ref(false)
|
||||
|
||||
const getList = async () => {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getPointsRecordList({
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
})
|
||||
const newList = res.rows || res.data || []
|
||||
if (pageNum.value === 1) {
|
||||
list.value = newList
|
||||
} else {
|
||||
list.value = [...list.value, ...newList]
|
||||
}
|
||||
if (newList.length < pageSize.value) {
|
||||
noMoreData.value = true
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
console.error('积分明细接口报错:', err)
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (isRefreshing.value) isRefreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onRefresh = () => {
|
||||
isRefreshing.value = true
|
||||
pageNum.value = 1
|
||||
noMoreData.value = false
|
||||
loading.value = false
|
||||
getList()
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (loading.value || noMoreData.value) return
|
||||
pageNum.value++
|
||||
getList()
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentStyle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
width: 100vw;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
margin: 0 40rpx;
|
||||
border-radius: 12rpx 12rpx 0 0;
|
||||
}
|
||||
|
||||
.record-list {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.record-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 28rpx 20rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.record-card:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.record-left {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.record-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.record-time {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.record-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
flex-shrink: 0;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.record-points {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.record-points.income {
|
||||
color: #07c160;
|
||||
}
|
||||
|
||||
.record-points.expense {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.record-balance {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -72,8 +72,8 @@ const photoList = ref([])
|
||||
// 状态映射
|
||||
const statusMap = {
|
||||
'0': { text: '待处理', class: 'pending' },
|
||||
'1': { text: '处理中', class: 'processing' },
|
||||
'2': { text: '已完成', class: 'completed' }
|
||||
// '1': { text: '处理中', class: 'processing' },
|
||||
'1': { text: '已完成', class: 'completed' }
|
||||
}
|
||||
|
||||
const statusText = computed(() => {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<view class="contentStyle">
|
||||
<!-- 顶部分段控制器 -->
|
||||
<view style="width: 60vw;">
|
||||
<uni-segmented-control :current="currentTab" :values="tabs" @clickItem="onTabClick" style-type="text"
|
||||
active-color="#007AFF" inactive-color="#999" class="seg-control"></uni-segmented-control>
|
||||
<view class="tab-wrap">
|
||||
<view class="tab-item" :class="{ active: currentTab === index }" v-for="(tab, index) in tabs"
|
||||
:key="index" @click="onTabClick({ currentIndex: index })">
|
||||
<text class="tab-text">{{ tab }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表区域 -->
|
||||
@@ -19,8 +21,8 @@
|
||||
<view class="card-header">
|
||||
<text class="card-title">{{ item.title }}</text>
|
||||
<text class="card-tag"
|
||||
:class="item.status === 'pending' ? 'pending' : item.status === 'processing' ? 'processing' : 'completed'">
|
||||
{{ item.status === 'pending' ? '待处理' : item.status === 'processing' ? '处理中' : '已完成' }}
|
||||
:class="item.status === 'pending' ? 'pending' : 'completed'">
|
||||
{{ item.status === 'pending' ? '待处理' : '已完成' }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -55,7 +57,7 @@ import {onLoad} from '@dcloudio/uni-app'
|
||||
import {getComplainList} from '../api/apiSub.js'
|
||||
|
||||
// 分段器
|
||||
const tabs = ref(["待处理", "处理中", "已完成"])
|
||||
const tabs = ref(["待处理", "已完成"])
|
||||
const currentTab = ref(0)
|
||||
const dataList = ref([])
|
||||
|
||||
@@ -67,8 +69,8 @@ const completedList = ref([])
|
||||
// 状态映射
|
||||
const statusMap = {
|
||||
"0":'pending',
|
||||
'1':'processing',
|
||||
'2':'completed'
|
||||
// '1':'processing',
|
||||
'1':'completed'
|
||||
}
|
||||
// 接口数据映射为模板所需格式
|
||||
const mapItem = (item) => {
|
||||
@@ -177,8 +179,43 @@ const addComplaintsSuggestions = () => {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.seg-control {
|
||||
margin-bottom: 20rpx;
|
||||
.tab-wrap {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 10rpx 40rpx 20rpx;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
position: relative;
|
||||
padding: 10rpx 0;
|
||||
margin-right: 80rpx;
|
||||
}
|
||||
|
||||
.tab-item:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.tab-item.active .tab-text {
|
||||
color: #007AFF;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tab-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 96rpx;
|
||||
height: 4rpx;
|
||||
background: #2F77FD;
|
||||
border-radius: 32rpx;
|
||||
}
|
||||
|
||||
.card-wrapper {
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import {getQuestionnaireList} from '../api/apiSub.js'
|
||||
|
||||
// 状态栏高度
|
||||
@@ -130,8 +131,8 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 生命周期:页面挂载完成
|
||||
onMounted(() => {
|
||||
// 生命周期:每次显示时刷新数据
|
||||
onShow(() => {
|
||||
getDataList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -225,6 +225,31 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myPointsIndex",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的积分",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myPointsMall",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分商城"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myPointsRecord",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分明细"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myPointsOrder",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分订单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "myHouseIndex",
|
||||
"style": {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<scroll-view class="page" scroll-y>
|
||||
<view class="topBox">
|
||||
<view class="name">
|
||||
<image src="https://wuyeadmin.bugtc.com/images/logo-app.png" class="img" />
|
||||
<image src="https://wuye.ckdzkj.com/images/logo-app.png" class="img" />
|
||||
<span style="padding: 5rpx 5rpx;display: flex;flex-direction: column;line-height: 60rpx;">
|
||||
<span style="font-size: 36rpx;font-weight: 600;">
|
||||
{{loginName}}
|
||||
@@ -25,7 +25,7 @@
|
||||
style="align-self: flex-end;font-size: 24rpx;vertical-align: baseline;">{{ item.desc }}</span></span>
|
||||
</view>
|
||||
<view class="item-arrow"></view>
|
||||
<!-- <image src="https://wuyeadmin.bugtc.com/images/propertyImgs/arrow-right.png" class="arrow-icon" /> -->
|
||||
<!-- <image src="https://wuye.ckdzkj.com/images/propertyImgs/arrow-right.png" class="arrow-icon" /> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -51,25 +51,26 @@
|
||||
import { requireLogin } from '@/common/checkLogin.js'
|
||||
|
||||
|
||||
const list = ref([{
|
||||
icon:'https://wuyeadmin.bugtc.com/images/propertyImgs/house.png',
|
||||
const list = ref([
|
||||
{
|
||||
icon:'https://wuye.ckdzkj.com/images/propertyImgs/points.png',
|
||||
title: "我的积分",
|
||||
desc:'999'
|
||||
},
|
||||
{
|
||||
icon:'https://wuye.ckdzkj.com/images/propertyImgs/house.png',
|
||||
title: "我的房屋"
|
||||
},
|
||||
// {
|
||||
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/user.png",
|
||||
// title: "住户管理",
|
||||
// // desc: "您可以在这里添加家人、朋友、租客~"
|
||||
// },
|
||||
{
|
||||
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/parking.png",
|
||||
icon: "https://wuye.ckdzkj.com/images/propertyImgs/parking.png",
|
||||
title: "我的车位"
|
||||
},
|
||||
{
|
||||
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/car.png",
|
||||
icon: "https://wuye.ckdzkj.com/images/propertyImgs/car.png",
|
||||
title: "我的车辆"
|
||||
},
|
||||
{
|
||||
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/setting.png",
|
||||
icon: "https://wuye.ckdzkj.com/images/propertyImgs/setting.png",
|
||||
title: "设置"
|
||||
}
|
||||
])
|
||||
@@ -101,7 +102,7 @@
|
||||
if (!requireLogin()) return
|
||||
const cachedVillageId = uni.getStorageSync('currentVillageId')
|
||||
// 设置和我的房屋不需要绑定小区(我的房屋用于首次绑定)
|
||||
if (item.title !== '设置' && item.title !== '我的房屋') {
|
||||
if (item.title !== '设置' && item.title !== '我的房屋' && item.title !== '我的积分') {
|
||||
if (!cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) {
|
||||
uni.showToast({ title: '未绑定小区,没有权限', icon: 'none', duration: 2000 })
|
||||
return
|
||||
@@ -129,7 +130,11 @@
|
||||
url: '/pageSubPack/my/myCarIndex',
|
||||
|
||||
});
|
||||
} else if (item.title == '设置') {
|
||||
} else if (item.title == '我的积分') {
|
||||
uni.navigateTo({
|
||||
url: '/pageSubPack/my/myPointsIndex'
|
||||
});
|
||||
} else if (item.title == '设置') {
|
||||
goSetting()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user