|
|
|
|
<template>
|
|
|
|
|
<view>
|
|
|
|
|
<view class="uni-padding-wrap uni-common-mt">
|
|
|
|
|
<uni-segmented-control :current="typeId" :values="items" :style-type="styleType" :active-color="activeColor"
|
|
|
|
|
@clickItem="onClickItem" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="content">
|
|
|
|
|
<view v-if="typeId === 0">
|
|
|
|
|
<uni-list border-full v-for="(item,index) in preProfitAdList" :key="index">
|
|
|
|
|
<uni-list-item :title="item.createTime+'@'+item.scanCode"
|
|
|
|
|
:note="item.appType+'&'+item.platform+'&'+item.type" :thumb="item.url" thumb-size="lg"
|
|
|
|
|
:rightText="item.downloadNum+'次'" />
|
|
|
|
|
</uni-list>
|
|
|
|
|
<view class="ivOver" v-if="flagAd">-----已经到底啦-----</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="typeId === 1">
|
|
|
|
|
<uni-list border-full v-for="(item,index) in preprofitInviteList" :key="index">
|
|
|
|
|
<uni-list-item :title="item.createTime+'@'+item.scanCode"
|
|
|
|
|
:note="item.appType+'&'+item.platform+'&'+item.type" :thumb="item.url" thumb-size="lg"
|
|
|
|
|
:rightText="item.downloadNum+'次'" />
|
|
|
|
|
</uni-list>
|
|
|
|
|
<view class="ivOver" v-if="flagInvite">-----已经到底啦-----</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
queryFrontPreProfit
|
|
|
|
|
} from '@/api/profit.js'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
preProfitAdList: [],
|
|
|
|
|
preprofitInviteList:[],
|
|
|
|
|
items: ['广告', '邀请'],
|
|
|
|
|
typeId: 0,
|
|
|
|
|
activeColor: '#007aff',
|
|
|
|
|
styleType: 'text',
|
|
|
|
|
userInfo: {},
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
flagAd: false,
|
|
|
|
|
flagInvite: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
const userInfoSync = uni.getStorageSync('userInfo')
|
|
|
|
|
this.userInfo = userInfoSync
|
|
|
|
|
const typeProfitId = uni.getStorageSync('typeId')
|
|
|
|
|
this.typeId = typeProfitId
|
|
|
|
|
if (typeProfitId) {
|
|
|
|
|
this.queryFrontPreProfit()
|
|
|
|
|
} else {
|
|
|
|
|
this.queryFrontPreProfit()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 下拉刷新
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
if(this.typeId === 0){
|
|
|
|
|
this.pageNum = 1
|
|
|
|
|
this.preProfitAdList = []
|
|
|
|
|
this.queryFrontPreProfit()
|
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
|
}else{
|
|
|
|
|
this.pageNum = 1
|
|
|
|
|
this.preprofitInviteList = []
|
|
|
|
|
this.queryFrontPreProfit()
|
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 上划加载更多
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
if(this.typeId === 0){
|
|
|
|
|
if (this.preProfitAdList.length > this.pageNum*this.pageSize-1 ) {
|
|
|
|
|
this.flagAd = false;
|
|
|
|
|
this.pageNum += 1
|
|
|
|
|
this.queryFrontPreProfit();
|
|
|
|
|
}else{
|
|
|
|
|
this.flagAd = true;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (this.preprofitInviteList.length > this.pageNum*this.pageSize-1 ) {
|
|
|
|
|
this.flagInvite = false;
|
|
|
|
|
this.pageNum += 1
|
|
|
|
|
this.queryFrontPreProfit();
|
|
|
|
|
}else{
|
|
|
|
|
this.flagInvite = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onClickItem(e) {
|
|
|
|
|
let that = this
|
|
|
|
|
that.preProfitAdList = []
|
|
|
|
|
that.preprofitInviteList = []
|
|
|
|
|
if (that.typeId !== e.currentIndex) {
|
|
|
|
|
that.typeId = e.currentIndex
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '加载中',
|
|
|
|
|
mask: true,
|
|
|
|
|
success() {
|
|
|
|
|
// 查询即将入账邀请收益列表
|
|
|
|
|
const param = {
|
|
|
|
|
creatorId: that.userInfo.id,
|
|
|
|
|
type: that.typeId,
|
|
|
|
|
pageSize: that.pageSize,
|
|
|
|
|
pageNum: 1
|
|
|
|
|
}
|
|
|
|
|
queryFrontPreProfit(param).then(res => {
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
if(that.typeId === 0){
|
|
|
|
|
that.preProfitAdList.push(...res.data.rows)
|
|
|
|
|
}else{
|
|
|
|
|
that.preprofitInviteList.push(...res.data.rows)
|
|
|
|
|
}
|
|
|
|
|
console.log('点击操作preProfitAdList',that.preProfitAdList)
|
|
|
|
|
console.log('点击操作preprofitInviteList',that.preprofitInviteList)
|
|
|
|
|
} else {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
content: '即将到账列表数据加载失败!',
|
|
|
|
|
showCancel: false
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
complete() {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 查询即将入账邀请收益列表
|
|
|
|
|
async queryFrontPreProfit() {
|
|
|
|
|
const res = await queryFrontPreProfit({
|
|
|
|
|
creatorId: this.userInfo.id,
|
|
|
|
|
type: this.typeId,
|
|
|
|
|
pageSize: this.pageSize,
|
|
|
|
|
pageNum: this.pageNum
|
|
|
|
|
})
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
if(this.typeId === 0){
|
|
|
|
|
this.preProfitAdList.push(...res.data.rows)
|
|
|
|
|
}else{
|
|
|
|
|
this.preprofitInviteList.push(...res.data.rows)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
content: '即将到账列表数据加载失败!',
|
|
|
|
|
showCancel: false
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.ivOver{
|
|
|
|
|
width: 100%;
|
|
|
|
|
height:50px;
|
|
|
|
|
line-height: 50px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
background: #fff;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
</style>
|