123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414 |
- <template>
- <view>
- <navbar :config="config"></navbar>
- <view class="top-box">
- <text class="title">积分余额</text>
- <text class="integral">{{ $addDecimals(integral_able , 8) }}</text>
- <text class="worth">当前积分价值:{{ pointconfigInfo.point_price }}元</text>
- <view class="integral-btns">
- <text class="integral-btn" @click.stop="exchangeIntegral()">兑换余额</text>
- <text class="integral-btn" @click.stop="goIntegralTransferred()" v-if="openProxy == true">积分转赠</text>
- </view>
- </view>
- <view class="content-box">
- <view class="list-box">
- <view class="list-box-title">
- <text @click.stop="activeType = 1"
- :class="['list-title' , activeType == 1 ? 'active-list-title' : '']">积分详情</text>
- <text @click.stop="activeType = 2"
- :class="['list-title' , activeType == 2 ? 'active-list-title' : '']">积分明细</text>
- </view>
- <view class="list-item-box">
- <template v-if="activeType === 1">
- <block v-for="item in integralInfo">
- <view class="list-item list-info-item">
- <image class="list-info-img" :src="item.icon" mode=""></image>
- <view class="list-info-text">
- <text class="text-title">{{ item.name }}</text>
- <text v-if="item.way"
- class="text-num">{{ $addDecimals(subtractionNum(pointconfigInfo[item.key_1] , pointconfigInfo[item.key_2]) , item.length) }}</text>
- <!-- <text v-if="item.way" class="text-num">{{ pointconfigInfo[item.key_1] }}</text> -->
- <text v-else class="text-num">{{ $addDecimals(pointconfigInfo[item.key] , item.length) }}</text>
- </view>
- </view>
- </block>
- </template>
- <template v-if="activeType === 2">
- <block v-for="(item, index) in pointsList" :key="index">
- <view class="list-item">
- <view class="list-item-text">
- {{item.mode}}
- </view>
- <view class="list-item-val">
- <text class="list-item-time">{{ item.create_time }}</text>
- <text class="list-item-nums">
- {{ item.bill_type == 1 ? '+' : '-'}}{{ $addDecimals(item.value) }}积分
- </text>
- </view>
- </view>
- </block>
- <loadMore v-if="pointsList.length>0" :status="status"></loadMore>
- <nodata v-else :config="{ top: 1, content: '暂无数据~' }"></nodata>
- </template>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getAccountInfo
- } from "@/api/login.js"
- import math from "@/common/math.js"
- import {
- pointconfig,
- destroyIntegral
- } from "@/api/personal-center.js"
- import {
- detailedInfo
- } from "@/api/notice.js";
- export default {
- data() {
- return {
- activeType: 2,
- config: {
- back: true, //false是tolbar页面 是则不写
- title: '我的积分',
- color: '#FFFFFF',
- // autoBack:true,
- //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
- backgroundColor: [1, "#3775F6"],
- statusBarFontColor: '#FFFFFF'
- },
- // 积分余额
- integral_able: 0,
- pointsList: [],
- pointconfigInfo: {
- platform_total_point: 0,
- every_day_put_int_point: 0,
- point_price: 0
- },
- params: {
- page: 1,
- limit: 10
- },
- status: 'loading', //more|loading|noMore
- integralInfo: [{
- icon: '../../static/personal/integral1.png',
- name: '平台空投总积分数量',
- key: 'platform_total_point',
- length: 8,
- },
- {
- icon: '../../static/personal/integral2.png',
- name: '平台未释放积分数量',
- way: true,
- length: 8,
- // key_1 - key_2
- key_1: 'platform_total_point',
- key_2: 'give_total_point',
- },
- {
- icon: '../../static/personal/integral3.png',
- name: '每日权重空投数量',
- key: 'every_day_put_int_point',
- length: 8
- },
- {
- icon: '../../static/personal/integral4.png',
- name: '当前积分价值(元)',
- key: 'point_price',
- length: 2
- },
- {
- icon: '../../static/personal/integral5.png',
- name: '已空投积分数',
- key: 'give_total_point',
- length: 8
- },
- {
- icon: '../../static/personal/destroy.png',
- name: '已销毁积分数',
- key: 'all_handling_fee',
- length: 8
- }
- ],
- openProxy: false, // 是否开启区域代理
- }
- },
- onShow() {
- this.pointsList = [];
- this.getUserInfo()
- this.getMydetailed();
- this.isOpenProxy()
- },
- onLoad() {
- this.getPointconfig()
- // this.getDestoryPoint()
- },
- onReachBottom() {
- if (this.activeType === 2 && this.status !== 'loading' && this.status !== 'noMore') {
- this.params.page++
- this.getMydetailed()
- }
- },
- onPullDownRefresh() {
- this.params.page = 1
- this.pointsList = []
- this.getMydetailed()
- this.isOpenProxy()
- },
- methods: {
- //获取个人信息
- getUserInfo() {
- this.$http.get(getAccountInfo).then(res => {
- if (res && res.code == 200) {
- this.integral_able = res.data.integral_able;
- uni.setStorageSync("personal", res.data)
- } else {
- this.isLogin = false
- }
- })
- },
- // 计算 平台未释放积分数量
- subtractionNum(num_1 = 0, num_2 = 0) {
- return math.subtract(num_1, num_2)
- },
- // 获取积分详情
- getPointconfig() {
- this.$http.get(pointconfig).then((res) => {
- if (res && res.code == 200) {
- uni.stopPullDownRefresh()
- this.pointconfigInfo = res.data
- this.getDestoryPoint()
- }
- });
- },
- getDestoryPoint() {
- this.$http.get(destroyIntegral).then((res) => {
- if (res && res.code == 200) {
- uni.stopPullDownRefresh()
- this.pointconfigInfo.all_handling_fee = res.data.all_handling_fee
- }
- });
- },
- // 获取积分明细
- getMydetailed() {
- this.status = 'loading';
- this.$http.get(detailedInfo, this.params).then((res) => {
- if (res && res.code == 200) {
- uni.stopPullDownRefresh()
- this.pointsList = this.pointsList.concat(res.page.list);
- if (res.page.totalPage <= res.page.currPage) {
- this.status = 'noMore'
- } else {
- this.status = 'more'
- }
- }
- });
- },
- // 兑换余额
- exchangeIntegral() {
- uni.navigateTo({
- url: "/pages/user/exchange"
- })
- },
- // 积分转赠
- goIntegralTransferred() {
- uni.navigateTo({
- url: "/pages/user/Integral-transferred"
- })
- },
- isOpenProxy() {
- this.$http.get('/saleconfig/openPayment').then(res => {
- if (res && res.code == 200) {
- this.openProxy = res.openPayment;
- }
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top-box {
- width: 100%;
- min-height: 354rpx;
- padding: 50rpx 60rpx 90rpx;
- background-color: #FA6138;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- color: #ffffff;
- .worth,
- .title {
- font-size: 28rpx;
- color: #ffffff;
- }
- .integral {
- font-size: 50rpx;
- }
- .integral-btns {
- display: flex;
- align-items: center;
- margin-top: 40rpx;
- .integral-btn {
- width: 270rpx;
- height: 72rpx;
- background: #FA6138;
- border: 1rpx solid #ffffff;
- border-radius: 36rpx;
- text-align: center;
- line-height: 70rpx;
- margin-right: 30rpx;
- font-size: 26rpx;
- &:last-child {
- margin: 0 0 0 30rpx;
- background-color: #fff;
- color: #FA6138;
- }
- }
- }
- }
- .content-box {
- width: 100%;
- position: relative;
- }
- .list-box {
- width: 100%;
- position: absolute;
- top: -40rpx;
- // transform: translateY(-40rpx);
- border-radius: 40rpx 40rpx 0 0;
- background-color: #fff;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- .list-box-title {
- width: 100%;
- height: 103.5rpx;
- display: flex;
- justify-content: space-around;
- align-items: center;
- padding: 0 60rpx;
- font-size: 32rpx;
- color: #1a1a1a;
- border-bottom: 1rpx solid #e6e6e6;
- .list-title {
- height: 100%;
- line-height: 103rpx;
- // border-bottom: 4rpx solid #1a1a1a;
- }
- .active-list-title {
- font-size: 32rpx;
- font-weight: 700;
- color: #FA6138;
- position: relative;
- &:before {
- content: '';
- position: absolute;
- left: 0;
- bottom: 0;
- width: 100%;
- height: 4rpx;
- border-radius: 2rpx;
- background-color: #FA6138;
- }
- }
- }
- .list-item-box {
- width: 100%;
- padding: 0 60rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- }
- .list-item {
- width: 100%;
- // min-height: 161rpx;
- padding: 40rpx 0;
- border-bottom: 1rpx solid #e6e6e6;
- // text-align: left;
- display: flex;
- flex-direction: column;
- // align-items: center;
- justify-content: center;
- .list-item-text {
- // opacity: 0.9;
- font-size: 28rpx;
- color: #1a1a1a;
- }
- .list-item-val {
- padding-top: 14rpx;
- display: flex;
- justify-content: space-between;
- align-content: center;
- align-items: center;
- .list-item-time {
- font-size: 24rpx;
- color: #999999;
- flex-shrink: 0;
- }
- .list-item-nums {
- padding-left: 10px;
- font-size: 30rpx;
- color: #FA6138;
- }
- }
- }
- .list-info-item {
- width: 100%;
- display: flex;
- flex-direction: row;
- align-items: center;
- .list-info-img {
- width: 71rpx;
- height: 71rpx;
- }
- .list-info-text {
- width: calc(100% - 71rpx);
- padding-left: 22rpx;
- display: flex;
- flex-direction: column;
- .text-title {
- font-size: 28rpx;
- color: #1a1a1a;
- }
- .text-num {
- padding-top: 6rpx;
- font-size: 24rpx;
- color: #666666;
- }
- }
- }
- }
- </style>
|