创作者微信小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

272 lines
7.5 KiB

<template>
<view class="container">
<view class="top">
<uni-notice-bar show-get-more show-icon more-text="查看更多" :text="noticeList[0].content" @getmore="getMore" />
<uni-section title="昨日收益" type="line">
<uni-group mode="card">
<view>广告收益:{{profitInfo.yesterdayAdProfit}}</view>
<view>邀请收益:{{profitInfo.yesterdayInviteProfit}}</view>
<view>总收益:{{profitInfo.totalProfit}}</view>
<view>上月收益:{{profitInfo.lastMonthProfit}}</view>
<view>当月收益:{{profitInfo.thisMonthProfit}}</view>
</uni-group>
</uni-section>
</view>
<view class="middle">
<uni-section title="收益明细" type="line">
<uni-group mode="card">
<uni-segmented-control :current="current" :values="items" :style-type="styleType"
:active-color="activeColor" @clickItem="onClickItem" />
<view class="content">
<view v-if="current === 0">
<uni-collapse>
<uni-collapse-item title="广告" :show-animation="true">
<view class="content"
v-for="(item,index) in downloadAndInviteCountInfo.creatorProfitDownloadCount"
:key="index">
<text class="text" @click="linkTo(0,0)">日期:{{item.createTime}}---</text>
<text class="text">次数:{{item.downloadNum}}</text>
</view>
</uni-collapse-item>
<uni-collapse-item title="邀请" :show-animation="true">
<view class="content"
v-for="(item,index) in downloadAndInviteCountInfo.creatorProfitInviteCount"
:key="index">
<text class="text" @click="linkTo(1,0)">日期:{{item.createTime}}---</text>
<text class="text">次数:{{item.inviteDownloadNum}}</text>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view v-if="current === 1">
<uni-collapse>
<uni-collapse-item title="广告" :show-animation="true">
<view class="content">
<text class="text" @click="linkTo(0,1)">额度:{{inProfitInfo.profit}}</text>
</view>
</uni-collapse-item>
<uni-collapse-item title="邀请" :show-animation="true">
<view class="content">
<text class="text" @click="linkTo(1,1)">额度:{{inProfitInfo.inviteProfit}}</text>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view v-if="current === 2">
<uni-collapse>
<uni-collapse-item title="广告" :show-animation="true">
<view class="content">
<text class="text" @click="linkTo(0,2)">额度:{{endProfitInfo.profit}}</text>
</view>
</uni-collapse-item>
<uni-collapse-item title="邀请" :show-animation="true">
<view class="content">
<text class="text" @click="linkTo(1,2)">额度:{{endProfitInfo.inviteProfit}}</text>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</view>
</uni-group>
</uni-section>
</view>
</view>
</template>
<script>
import {
queryFrontProfitInfo, //查询指定艺术家收益统计
queryFrontPreDownloadAndInviteCount, //查询指定艺术家即将入账广告及邀请次数列表
queryFrontPreProfit, //查询指定艺术家即将入账收益列表
queryFrontInOrOutAmt, //查询指定艺术家已入账/转入钱包累计收益
} from '@/api/profit.js'
import {
getNoticeList
} from '@/api/userInfo.js'
export default {
data() {
return {
nvueWidth: 730,
profitInfo: {
yesterdayAdProfit: 0,
yesterdayInviteProfit: 0,
totalProfit: 0,
lastMonthProfit: 0,
thisMonthProfit: 0
},
downloadAndInviteCountInfo: {},
profitList: [],
items: ['即将入账', '已入账', '已转入钱包'],
current: 0,
activeColor: '#007aff',
styleType: 'text',
inProfitInfo: {},
endProfitInfo: {},
userInfo: {},
noticeList: [],
pageSize: 10,
pageNum: 1
}
},
// 下拉刷新
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
created() {
const userInfoSync = uni.getStorageSync('userInfo')
this.userInfo = userInfoSync
this.queryFrontProfitInfo();
this.queryFrontPreDownloadAndInviteCount()
this.queryFrontInAmt()
this.queryFrontEndAmt()
this.getNoticeList()
},
methods: {
// 获取艺术家收益统计
async queryFrontProfitInfo() {
const res = await queryFrontProfitInfo(this.userInfo.id)
//console.log('res', res)
if (res.data.code === 200) {
this.profitInfo = res.data.data
//console.log('profitInfo', this.profitInfo)
} else {
uni.showModal({
content: '收益统计加载失败!',
showCancel: false
});
}
},
// 查询指定艺术家即将入账广告及邀请次数列表
async queryFrontPreDownloadAndInviteCount() {
const res = await queryFrontPreDownloadAndInviteCount(this.userInfo.id)
//console.log('res', res)
if (res.data.code === 200) {
this.downloadAndInviteCountInfo = res.data.data
//console.log('downloadAndInviteCountInfo', this.downloadAndInviteCountInfo)
} else {
uni.showModal({
content: '收益统计次数加载失败!',
showCancel: false
});
}
},
// 查询指定艺术家已入账累计收益
async queryFrontInAmt() {
const res = await queryFrontInOrOutAmt({
creatorId: this.userInfo.id,
status: '1'
})
//console.log('InAmt', res)
if (res.data.code === 200) {
this.inProfitInfo = res.data.data
} else {
uni.showModal({
content: '已入账收益加载失败!',
showCancel: false
});
}
},
// 查询指定艺术家转入钱包累计收益
async queryFrontEndAmt() {
const res = await queryFrontInOrOutAmt({
creatorId: this.userInfo.id,
status: '2'
})
//console.log('endAmt', res)
if (res.data.code === 200) {
this.endProfitInfo = res.data.data
} else {
uni.showModal({
content: '转入钱包收益加载失败!',
showCancel: false
});
}
},
// 获取公告分页
async getNoticeList() {
const res = await getNoticeList({
pageSize: this.pageSize,
pageNum: this.pageNum,
})
//console.log('res', res)
if (res.data.code === 200) {
this.noticeList = res.data.rows
//console.log('noticeList', this.noticeList)
} else {
uni.showModal({
content: '公告列表加载失败!',
showCancel: false
});
}
},
// 跳转即将到账收益详情页(status:0->即将入账;1->已入账;2->转入钱包)
linkTo(typeId, status) {
if (status === 0) {
uni.setStorage({
key: 'typeId',
data: typeId,
success() {
uni.navigateTo({
url: '../profit/profitPreDetails'
})
}
})
} else if (status === 1) {
uni.setStorage({
key: 'typeId',
data: typeId,
success() {
uni.navigateTo({
url: '../profit/profitInDetails'
})
}
})
} else {
uni.setStorage({
key: 'typeId',
data: typeId,
success() {
uni.navigateTo({
url: '../profit/profitEndDetails'
})
}
})
}
},
onClickItem(e) {
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
},
//查看更多公告
getMore() {
uni.navigateTo({
url: '../../pages-userInfo/notice/notice',
})
}
},
}
</script>
<style lang="scss">
.container {
font-family: Franklin Gothic Medium, Arial Narrow, Arial, sans-serif;
}
.uni-padding-wrap {
// width: 750rpx;
padding: 0px 30px;
}
.uni-common-mt {
margin-top: 30px;
}
</style>