mall-uniapp/pages/users/user_integral/index.vue

329 lines
13 KiB
Vue
Raw Normal View History

2020-08-13 08:12:57 +00:00
<template>
<view>
<view class='integral-details'>
<view class='header'>
<view class='currentScore'>当前积分</view>
2023-08-21 15:58:13 +00:00
<view class="scoreNum">{{ userInfo.point || 0}}</view>
2020-08-13 08:12:57 +00:00
<view class='line'></view>
<view class='nav acea-row'>
<view class='item'>
2023-08-21 15:58:13 +00:00
<view class='num'>{{ userInfo.totalPoint || 0}}</view>
2020-08-13 08:12:57 +00:00
<view>累计积分</view>
</view>
2023-08-21 15:58:13 +00:00
<!-- TODO 芋艿后续接入消费统计 -->
2020-08-13 08:12:57 +00:00
<view class='item'>
2023-08-21 15:58:13 +00:00
<view class='num'>{{integral.deductionIntegral || 0}}</view>
2020-08-13 08:12:57 +00:00
<view>累计消费</view>
</view>
<view class='item'>
2023-08-21 15:58:13 +00:00
<view class='num'>0</view>
<view>冻结积分</view>
2020-08-13 08:12:57 +00:00
</view>
</view>
</view>
<view class='wrapper'>
<view class='nav acea-row'>
<view class='item acea-row row-center-wrapper' :class='current==index?"on":""' v-for="(item,index) in navList" :key='index'
2023-08-21 15:58:13 +00:00
@click='nav(index)'>
<text class='iconfont' :class="item.icon" />{{item.name}}
</view>
2020-08-13 08:12:57 +00:00
</view>
<view class='list' :hidden='current!=0'>
2023-08-21 15:58:13 +00:00
<view class='tip acea-row row-middle'>
<text class='iconfont icon-shuoming' />提示积分数值的高低会直接影响您的会员等级
</view>
2020-08-13 08:12:57 +00:00
<view class='item acea-row row-between-wrapper' v-for="(item,index) in integralList" :key="index">
<view>
2023-08-21 15:58:13 +00:00
<view class='state'>{{ item.title }}</view>
<view>{{ formatDate(item.createTime) }}</view>
2020-08-13 08:12:57 +00:00
</view>
2023-08-21 15:58:13 +00:00
<view class='num font-color' v-if="item.point > 0">+{{ item.point }}</view>
<view class='num' v-else>{{ item.point }} </view>
2020-08-13 08:12:57 +00:00
</view>
<view class='loadingicon acea-row row-center-wrapper' v-if="integralList.length>0">
2023-08-21 15:58:13 +00:00
<text class='loading iconfont icon-jiazai' :hidden='loading === false' /> {{loadTitle}}
2020-08-13 08:12:57 +00:00
</view>
2023-08-21 15:58:13 +00:00
<view v-if="integralList.length === 0">
<emptyPage title="暂无积分记录哦~" />
2020-08-13 08:12:57 +00:00
</view>
</view>
2023-08-21 15:58:13 +00:00
<view class='list2' :hidden='current !== 1'>
2020-08-13 08:12:57 +00:00
<navigator class='item acea-row row-between-wrapper' open-type='switchTab' hover-class='none' url='/pages/index/index'>
<view class='pictrue'>
<image src='../../../static/images/score.png'></image>
</view>
<view class='name'>购买商品可获得积分奖励</view>
<view class='earn'>赚积分</view>
</navigator>
<navigator class='item acea-row row-between-wrapper' hover-class='none' url='/pages/users/user_sgin/index'>
<view class='pictrue'>
<image src='../../../static/images/score.png'></image>
</view>
<view class='name'>每日签到可获得积分奖励</view>
<view class='earn'>赚积分</view>
</navigator>
</view>
</view>
</view>
</view>
</template>
<script>
2023-08-21 15:58:13 +00:00
import { toLogin } from '@/libs/login.js';
import { mapGetters } from "vuex";
import * as PointApi from '@/api/member/point';
import dayjs from "@/plugin/dayjs/dayjs.min.js";
2020-08-13 08:12:57 +00:00
export default {
data() {
return {
navList: [{
'name': '分值明细',
'icon': 'icon-mingxi'
},
{
'name': '分值提升',
'icon': 'icon-tishengfenzhi'
}
],
current: 0,
page: 1,
limit: 10,
integralList: [],
2023-08-21 15:58:13 +00:00
integral: {},
2020-08-13 08:12:57 +00:00
loadend: false,
loading: false,
loadTitle: '加载更多',
};
},
2023-08-21 15:58:13 +00:00
computed: mapGetters(['isLogin', 'userInfo']),
watch:{
isLogin:{
2023-08-21 15:58:13 +00:00
handler: function(newV,oldV) {
if (newV) {
this.getIntegralList();
}
},
deep:true
}
},
2020-08-13 08:12:57 +00:00
onLoad() {
2023-08-21 15:58:13 +00:00
if (!this.isLogin) {
toLogin();
return;
2020-08-13 08:12:57 +00:00
}
2023-08-21 15:58:13 +00:00
this.getIntegralList();
2020-08-13 08:12:57 +00:00
},
/**
2023-08-21 15:58:13 +00:00
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getIntegralList();
},
2020-08-13 08:12:57 +00:00
methods: {
/**
* 获取积分明细
*/
getIntegralList: function() {
2023-08-21 15:58:13 +00:00
if (this.loading || this.loadend) {
return;
}
this.loading = true;
this.loadTitle = '';
PointApi.getPointRecordPage({
pageNo: this.page,
pageSize: this.limit
}).then(res => {
const list = res.data.list;
const loadend = list.length < this.limit;
this.signList = this.$util.SplitArray(list, this.signList);
this.$set(this, 'integralList', this.signList);
this.loadend = loadend;
this.loading = false;
this.loadtitle = loadend ? "哼😕~我也是有底线的~" : "加载更多"
}).catch(err => {
this.loading = false;
this.loadtitle = '加载更多';
});
2020-08-13 08:12:57 +00:00
},
nav: function(current) {
this.current = current;
2023-08-21 15:58:13 +00:00
},
formatDate: function(date) {
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
},
2020-08-13 08:12:57 +00:00
}
}
</script>
<style scoped lang="scss">
.integral-details .header {
background-image: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMgIyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT3/wgARCAHMAu4DAREAAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAAAAECAwQF/8QAGQEBAQEBAQEAAAAAAAAAAAAAAAECAwUH/9oADAMBAAIQAxAAAAD5nh/QwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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fUIxciMFH3nFSJQcfpsIVEqaUmxQZl9TL6mX1LGUa1ShT1X0uEK6VFsUEvYcExxa0zh8r6TCNz0xhz9xw5aZxpwqjLWWMsZYzL6mX1MvqZXUyupldTK7jJ7jJ6mS+aMmXQyZGVPkZcv8ALLXyftJVIq1U0RjT3pRroaqhqjpwKjLWWFiLUUX89kf8oyYP4Nnj1Nm5SNnlzQ8Ga/5Gmt6a/WHH50QjTWsKb3RZs+J/keFNb4vXKNdE41VeAWrgrhF74oy4mVyZlMjB19Vqw/xm/Wfp0IwjDcqaJQjPeqmJ+M16w9emqapoao2vpVEWlGYOEoKu9+xjYKxFVekhpptPQ1VU0Yi+fao+RR8ij5FHx9CdBY0181F+RzQsWEvnV+R
background-repeat: no-repeat;
background-size: 100% 100%;
width: 100%;
height: 460rpx;
font-size: 72rpx;
color: #fff;
padding: 31rpx 0 45rpx 0;
box-sizing: border-box;
text-align: center;
font-family: 'Guildford Pro';
}
.integral-details .header .currentScore {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.8);
text-align: center;
margin-bottom: 11rpx;
}
2023-08-21 15:58:13 +00:00
2020-08-13 08:12:57 +00:00
.integral-details .header .scoreNum{
font-family: "Guildford Pro";
}
2023-08-21 15:58:13 +00:00
2020-08-13 08:12:57 +00:00
.integral-details .header .line {
width: 60rpx;
height: 3rpx;
background-color: #fff;
margin: 20rpx auto 0 auto;
}
.integral-details .header .nav {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.8);
flex: 1;
margin-top: 35rpx;
}
.integral-details .header .nav .item {
width: 33.33%;
text-align: center;
}
.integral-details .header .nav .item .num {
color: #fff;
font-size: 40rpx;
margin-bottom: 5rpx;
font-family: 'Guildford Pro';
}
.integral-details .wrapper .nav {
flex: 1;
width: 690rpx;
border-radius: 20rpx 20rpx 0 0;
margin: -96rpx auto 0 auto;
background-color: #f7f7f7;
height: 96rpx;
font-size: 30rpx;
color: #bbb;
}
.integral-details .wrapper .nav .item {
text-align: center;
width: 50%;
}
.integral-details .wrapper .nav .item.on {
background-color: #fff;
color: $theme-color;
2020-08-13 08:12:57 +00:00
font-weight: bold;
border-radius: 20rpx 0 0 0;
}
.integral-details .wrapper .nav .item:nth-of-type(2).on {
border-radius: 0 20rpx 0 0;
}
.integral-details .wrapper .nav .item .iconfont {
font-size: 38rpx;
margin-right: 10rpx;
}
.integral-details .wrapper .list {
background-color: #fff;
padding: 24rpx 30rpx;
}
.integral-details .wrapper .list .tip {
font-size: 25rpx;
width: 690rpx;
height: 60rpx;
border-radius: 50rpx;
background-color: #fff5e2;
border: 1rpx solid #ffeac1;
color: #c8a86b;
padding: 0 20rpx;
box-sizing: border-box;
margin-bottom: 24rpx;
}
.integral-details .wrapper .list .tip .iconfont {
font-size: 35rpx;
margin-right: 15rpx;
}
.integral-details .wrapper .list .item {
height: 124rpx;
border-bottom: 1rpx solid #eee;
font-size: 24rpx;
color: #999;
}
.integral-details .wrapper .list .item .state {
font-size: 28rpx;
color: #282828;
margin-bottom: 8rpx;
}
.integral-details .wrapper .list .item .num {
font-size: 36rpx;
font-family: 'Guildford Pro';
}
.integral-details .wrapper .list2 {
background-color: #fff;
padding: 24rpx 0;
}
.integral-details .wrapper .list2 .item {
background-image: linear-gradient(to right, #fff7e7 0%, #fffdf9 100%);
width: 690rpx;
height: 180rpx;
position: relative;
border-radius: 10rpx;
margin: 0 auto 20rpx auto;
padding: 0 25rpx 0 180rpx;
box-sizing: border-box;
}
.integral-details .wrapper .list2 .item .pictrue {
width: 90rpx;
height: 150rpx;
position: absolute;
bottom: 0;
left: 45rpx;
}
.integral-details .wrapper .list2 .item .pictrue image {
width: 100%;
height: 100%;
}
.integral-details .wrapper .list2 .item .name {
width: 285rpx;
font-size: 30rpx;
font-weight: bold;
color: #c8a86b;
}
.integral-details .wrapper .list2 .item .earn {
font-size: 26rpx;
color: #c8a86b;
border: 2rpx solid #c8a86b;
text-align: center;
line-height: 52rpx;
height: 52rpx;
width: 160rpx;
border-radius: 50rpx;
}
</style>