Files
dvcp_v2_wxcp_app/src/apps/AppCreditPoints/components/sysUserIntegral.vue

227 lines
4.7 KiB
Vue
Raw Normal View History

2022-05-19 17:28:10 +08:00
<template>
<div class="page">
<div class="bg-blue"></div>
<div class="header-content">
<div class="left-content" flex>
<div class="fill">
<span>总积分</span>
<div class="info num" v-text="info.sysUserIntegral"/>
</div>
<div class="btn" @click="gotoGive">积分赠送</div>
</div>
<img src="https://cdn.cunwuyun.cn/dvcp/credit/head.png" alt="">
</div>
<div class="detail-content" v-if="list.length">
<div class="title">积分明细</div>
<div class="item" v-for="(item, index) in list" :key="index">
<div class="item-info">
<p v-text="item.eventDesc"/>
<span v-text="item.doTime"/>
</div>
<div class="item-num" :class="'color-'+ item.integralCalcType">
{{ (item.integralCalcType == 1 ? '+' : '-') + item.changeIntegral }}
</div>
</div>
</div>
<AiEmpty v-else/>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: "sysUserIntegral",
appName: "员工积分",
computed: {
...mapState(['user', 'token']),
...mapActions(['selectEnterpriseContact'])
},
data() {
return {
info: {},
list: [],
current: 1,
pages: 0
}
},
created() {
this.getInfo()
2022-05-20 15:03:36 +08:00
uni.$on("onShow", () => {
this.getInfo();
})
uni.$on("reachBottom", () => {
this.current++;
2022-05-19 17:28:10 +08:00
this.getInfo()
})
2022-05-25 16:01:53 +08:00
uni.$on('updateIntegral', () => {
this.getInfo()
})
2022-05-19 17:28:10 +08:00
},
methods: {
// 积分排行
getInfo() {
let {current, user: {id: userId}, info: {details}} = this
if (!details?.pages || current <= details.pages) {
this.$http.post('/app/appvillagerintegraldetail/sysUserIntegralList', null, {
params: {userId, current, size: 10}
}).then(res => {
if (res?.data) {
this.info = res.data
this.list = [this.list, res.data.details?.records || []].flat()
}
})
}
},
gotoGive() {
uni.navigateTo({url: "./giveIntegral"})
}
2022-05-20 15:03:36 +08:00
},
destroyed() {
uni.$off("reachBottom")
uni.$off("onShow")
2022-05-19 17:28:10 +08:00
}
}
</script>
<style scoped lang="scss">
.page {
width: 100vw;
background-color: #f3f6f9;
.bg-blue {
width: 100%;
height: 176px;
2022-05-20 14:10:10 +08:00
background-color: #3975C6;
2022-05-19 17:28:10 +08:00
}
.header-content {
width: 690px;
height: 184px;
background: #FFF;
border-radius: 16px;
margin: -130px 0 40px 30px;
padding: 32px;
box-sizing: border-box;
position: relative;
.left-content {
position: absolute;
left: 32px;
right: 32px;
z-index: 99;
align-items: flex-end;
.btn {
border-radius: 28px;
2022-05-20 14:10:10 +08:00
border: 2px solid #3975C6;
2022-05-19 17:28:10 +08:00
padding: 0 28px;
line-height: 56px;
2022-05-20 14:10:10 +08:00
color: #3975C6;
2022-05-19 17:28:10 +08:00
}
}
span {
width: 140px;
color: #999;
}
.info {
height: 40px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
}
.num {
margin-top: 20px;
font-size: 40px;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: #5AAD6A;
line-height: 48px;
margin-bottom: 10px;
}
img {
position: absolute;
width: 360px;
height: 250px;
top: -40px;
right: 0;
}
}
.mar-b4 {
margin-bottom: 8px;
}
.mar-b8 {
margin-bottom: 16px;
}
.detail-content {
width: 690px;
background: #FFF;
border-radius: 16px;
margin: 0 0 0 32px;
padding: 30px 30px 94px;
box-sizing: border-box;
.title {
font-size: 34px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 48px;
margin-bottom: 30px;
}
.item {
padding: 34px 0 32px 0;
border-bottom: 2px solid #ddd;
display: flex;
.item-info {
width: 500px;
p {
word-break: break-all;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
line-height: 44px;
}
span {
display: inline-block;
margin-top: 8px;
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999;
line-height: 34px;
}
}
.item-num {
width: calc(100% - 500px);
text-align: right;
font-size: 36px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
line-height: 50px;
}
}
}
.color-1 {
color: #2C51CE !important;
}
.color-0 {
color: #E6736E !important;
}
}
</style>