分佣:promoter-rank 迁移
parent
17ae7587cb
commit
5b8b91356f
|
@ -5,6 +5,11 @@ export function getBrokerageUserSummary() {
|
||||||
return request.get('app-api/member/brokerage-user/get-summary');
|
return request.get('app-api/member/brokerage-user/get-summary');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获得分销用户排行分页
|
||||||
|
export function getBrokerageUserRankPage(data) {
|
||||||
|
return request.get('app-api/member/brokerage-user/rank-page', data);
|
||||||
|
}
|
||||||
|
|
||||||
// 获得分销提现分页记录
|
// 获得分销提现分页记录
|
||||||
export function getBrokerageWithdrawPage(data) {
|
export function getBrokerageWithdrawPage(data) {
|
||||||
return request.get('app-api/member/brokerage-withdraw/page', data);
|
return request.get('app-api/member/brokerage-withdraw/page', data);
|
||||||
|
|
|
@ -4,75 +4,63 @@
|
||||||
<view class="redBg bg-color">
|
<view class="redBg bg-color">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="nav acea-row row-center-wrapper">
|
<view class="nav acea-row row-center-wrapper">
|
||||||
<view class="item" :class="active == index ? 'font-color' : ''" v-for="(item,index) in navList" :key="index"
|
<view class="item" :class="active === index ? 'font-color' : ''" v-for="(item, index) in navList"
|
||||||
@click="switchTap(index)">
|
:key="index" @click="switchTap(index)">
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- top3 排名 -->
|
||||||
<view class="rank acea-row row-bottom row-around">
|
<view class="rank acea-row row-bottom row-around">
|
||||||
<view class="item" v-show="Two.uid">
|
<view class="item" v-show="Two.userId">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="Two.avatar"></image>
|
<image :src="Two.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{Two.nickname}}</view>
|
<view class="name line1">{{Two.nickname}}</view>
|
||||||
<view class="num">{{Two.spreadCount}}人</view>
|
<view class="num">{{ Two.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" v-show="One.uid">
|
<view class="item" v-show="One.userId">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="One.avatar"></image>
|
<image :src="One.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{One.nickname}}</view>
|
<view class="name line1">{{One.nickname}}</view>
|
||||||
<view class="num">{{One.spreadCount}}人</view>
|
<view class="num">{{ One.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" v-show="Three.uid">
|
<view class="item" v-show="Three.userId">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="Three.avatar"></image>
|
<image :src="Three.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{Three.nickname}}</view>
|
<view class="name line1">{{Three.nickname}}</view>
|
||||||
<view class="num">{{Three.spreadCount}}人</view>
|
<view class="num">{{ Three.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 其它排名 -->
|
||||||
<view class="list" v-if="rankList.length">
|
<view class="list" v-if="rankList.length">
|
||||||
<view class="item acea-row row-between-wrapper" v-for="(item,index) in rankList" :key="index">
|
<view class="item acea-row row-between-wrapper" v-for="(item,index) in rankList" :key="index">
|
||||||
<view class="num">{{index+4}}</view>
|
<view class="num">{{ index + 4 }}</view>
|
||||||
<view class="picTxt acea-row row-between-wrapper">
|
<view class="picTxt acea-row row-between-wrapper">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="item.avatar"></image>
|
<image :src="item.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="text line1">{{item.nickname}}</view>
|
<view class="text line1">{{item.nickname}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="people font-color">{{item.spreadCount}}人</view>
|
<view class="people font-color">{{ item.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef MP -->
|
|
||||||
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
|
||||||
<!-- #endif -->
|
|
||||||
<home></home>
|
<home></home>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { toLogin } from '@/libs/login.js';
|
||||||
getRankList
|
import { mapGetters } from "vuex";
|
||||||
} from '@/api/user.js';
|
|
||||||
import {
|
|
||||||
toLogin
|
|
||||||
} from '@/libs/login.js';
|
|
||||||
import {
|
|
||||||
mapGetters
|
|
||||||
} from "vuex";
|
|
||||||
// #ifdef MP
|
|
||||||
import authorize from '@/components/Authorize';
|
|
||||||
// #endif
|
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
export default {
|
import * as BrokerageAPI from '@/api/member/brokerage.js'
|
||||||
|
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||||
|
export default {
|
||||||
components: {
|
components: {
|
||||||
// #ifdef MP
|
|
||||||
authorize,
|
|
||||||
// #endif
|
|
||||||
home
|
home
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -85,77 +73,65 @@
|
||||||
loading: false,
|
loading: false,
|
||||||
loadend: false,
|
loadend: false,
|
||||||
rankList: [],
|
rankList: [],
|
||||||
Two: {},
|
times: [],
|
||||||
One: {},
|
|
||||||
Three: {},
|
One: {}, // 排名第一
|
||||||
isAuto: false, //没有授权的不会自动授权
|
Two: {}, // 排名第二
|
||||||
isShowAuth: false //是否隐藏授权
|
Three: {}, // 排名第三
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(['isLogin']),
|
computed: mapGetters(['isLogin']),
|
||||||
watch:{
|
watch:{
|
||||||
isLogin:{
|
isLogin:{
|
||||||
handler:function(newV,oldV){
|
handler:function(newV, oldV) {
|
||||||
if(newV){
|
if (newV) {
|
||||||
this.getRanklist();
|
this.getRanklist();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep:true
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
if (this.isLogin) {
|
if (!this.isLogin) {
|
||||||
this.getRanklist();
|
toLogin();
|
||||||
} else {
|
return;
|
||||||
toLogin();
|
|
||||||
}
|
}
|
||||||
},
|
this.calculateTimes();
|
||||||
// onShow: function () {
|
this.getRanklist();
|
||||||
// if(this.isClone && app.globalData.isLog){
|
},
|
||||||
// this.setData({ loadend: false, page: 1, rankList:[]});
|
|
||||||
// this.getRanklist();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
methods: {
|
methods: {
|
||||||
onLoadFun() {
|
|
||||||
this.getRanklist();
|
|
||||||
},
|
|
||||||
// 授权关闭
|
|
||||||
authColse: function(e) {
|
|
||||||
this.isShowAuth = e
|
|
||||||
},
|
|
||||||
getRanklist: function() {
|
getRanklist: function() {
|
||||||
let that = this;
|
if (this.loadend || this.loading) {
|
||||||
if (that.loadend) return;
|
return;
|
||||||
if (that.loading) return;
|
}
|
||||||
that.loading = true;
|
this.loading = true;
|
||||||
getRankList({
|
BrokerageAPI.getBrokerageUserRankPage({
|
||||||
page: that.page,
|
pageNo: this.page,
|
||||||
limit: that.limit,
|
pageSize: this.limit,
|
||||||
type: that.type
|
'times[0]': this.times[0],
|
||||||
|
'times[1]': this.times[1],
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let list = res.data;
|
let list = res.data.list;
|
||||||
that.rankList.push.apply(that.rankList, list);
|
this.rankList.push.apply(this.rankList, list);
|
||||||
if (that.page == 1) {
|
if (this.page === 1) {
|
||||||
that.One = that.rankList.shift() || {};
|
this.One = this.rankList.shift() || {};
|
||||||
that.Two = that.rankList.shift() || {};
|
this.Two = this.rankList.shift() || {};
|
||||||
that.Three = that.rankList.shift() || {};
|
this.Three = this.rankList.shift() || {};
|
||||||
}
|
}
|
||||||
that.loadend = list.length < that.limit;
|
this.loadend = list.length < this.limit;
|
||||||
that.loading = false;
|
this.loading = false;
|
||||||
that.$set(that, 'rankList', that.rankList);
|
this.$set(this, 'rankList', this.rankList);
|
||||||
that.One = that.One;
|
|
||||||
that.Two = that.Two;
|
|
||||||
that.Three = that.Three;
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
that.loading = false;
|
this.loading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
switchTap: function(index) {
|
switchTap: function(index) {
|
||||||
if (this.active === index) return;
|
if (this.active === index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.active = index;
|
this.active = index;
|
||||||
// week
|
// week
|
||||||
this.type = index ? 'month' : 'week';
|
this.type = index ? 'month' : 'week';
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.loadend = false;
|
this.loadend = false;
|
||||||
|
@ -163,15 +139,36 @@
|
||||||
this.Two = {};
|
this.Two = {};
|
||||||
this.One = {};
|
this.One = {};
|
||||||
this.Three = {};
|
this.Three = {};
|
||||||
this.getRanklist();
|
this.calculateTimes();
|
||||||
|
this.getRanklist();
|
||||||
},
|
},
|
||||||
|
calculateTimes: function() {
|
||||||
|
// TODO @芋艿:优化代码
|
||||||
|
let startDate;
|
||||||
|
let endDate;
|
||||||
|
const today = new Date();
|
||||||
|
if (this.type === 'week') {
|
||||||
|
const dayOfWeek = today.getDay();
|
||||||
|
startDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - dayOfWeek, 0, 0, 0);
|
||||||
|
endDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + (6 - dayOfWeek), 23, 59, 59);
|
||||||
|
} else {
|
||||||
|
const year = today.getFullYear();
|
||||||
|
const month = today.getMonth();
|
||||||
|
startDate = new Date(year, month, 1, 0, 0, 0);
|
||||||
|
const nextMonth = new Date(year, month + 1, 1);
|
||||||
|
endDate = new Date(nextMonth.getTime() - 1);
|
||||||
|
}
|
||||||
|
this.times = [ this.formatDate(startDate), this.formatDate(endDate) ]
|
||||||
|
},
|
||||||
|
formatDate: function(date) {
|
||||||
|
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onReachBottom: function() {
|
onReachBottom: function() {
|
||||||
this.getRanklist();
|
this.getRanklist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.PromoterRank .redBg {
|
.PromoterRank .redBg {
|
||||||
padding: 45rpx 0 30rpx 0;
|
padding: 45rpx 0 30rpx 0;
|
||||||
|
|
Loading…
Reference in New Issue