2023-12-27 10:52:17 +00:00
|
|
|
<!-- 佣金排行榜 -->
|
2023-12-21 09:58:15 +00:00
|
|
|
<template>
|
2024-12-01 08:57:54 +00:00
|
|
|
<s-layout title="佣金排行榜">
|
|
|
|
<view class="commission-rank">
|
|
|
|
<view class="header">
|
|
|
|
<view class="rank" v-if="state.position">
|
|
|
|
您目前的排名
|
|
|
|
<text class="num">{{ state.position }}</text> 名
|
|
|
|
</view>
|
|
|
|
<view class="rank" v-else>您目前暂无排名</view>
|
|
|
|
</view>
|
|
|
|
<view class="wrapper">
|
|
|
|
<view class="nav acea-row row-around" style="justify-content: space-around; display: flex">
|
|
|
|
<view
|
|
|
|
class="item"
|
|
|
|
:class="state.currentTab === index ? 'font-color' : ''"
|
|
|
|
v-for="(item, index) in tabMaps"
|
|
|
|
:key="index"
|
|
|
|
@click="switchTap(index)"
|
|
|
|
>
|
|
|
|
{{ item }}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="list">
|
|
|
|
<view class="item" v-for="(item, index) in state.pagination.list" :key="index">
|
|
|
|
<view class="num" v-if="index <= 2">
|
|
|
|
<image :src="'/static/images/medal0' + (index + 1) + '.png'" />
|
|
|
|
</view>
|
|
|
|
<view class="num" v-else>
|
|
|
|
{{ index + 1 }}
|
|
|
|
</view>
|
|
|
|
<view class="pictrue">
|
|
|
|
<image :src="item.avatar" />
|
|
|
|
</view>
|
|
|
|
<view class="text">{{ item.nickname }}</view>
|
|
|
|
<view class="people">¥{{ fen2yuan(item.brokeragePrice) }}</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="noCommodity" v-if="state.pagination.list.length === 0">
|
|
|
|
<emptyPage title="暂无排行~" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<uni-load-more
|
|
|
|
v-if="state.pagination.total > 0"
|
|
|
|
:status="state.loadStatus"
|
|
|
|
:content-text="{
|
|
|
|
contentdown: '上拉加载更多',
|
|
|
|
}"
|
|
|
|
@tap="loadMore"
|
|
|
|
/>
|
|
|
|
</s-layout>
|
2023-12-21 09:58:15 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-12-01 08:57:54 +00:00
|
|
|
import sheep from '@/sheep';
|
|
|
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
|
|
|
import { reactive } from 'vue';
|
|
|
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
|
|
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
|
|
|
import _ from 'lodash-es';
|
|
|
|
import { resetPagination } from '@/sheep/util';
|
|
|
|
|
|
|
|
const tabMaps = ['周排行', '月排行'];
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
currentTab: 0,
|
|
|
|
position: 0, // 排名
|
|
|
|
pagination: {
|
|
|
|
list: [],
|
|
|
|
total: 0,
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
},
|
|
|
|
loadStatus: '',
|
|
|
|
});
|
|
|
|
|
|
|
|
async function switchTap(index) {
|
|
|
|
state.currentTab = index;
|
|
|
|
resetPagination(state.pagination);
|
|
|
|
calculateTimes();
|
|
|
|
getBrokerageRankList();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function getBrokerageRankList() {
|
|
|
|
const { code, data } = await BrokerageApi.getBrokerageUserChildSummaryPageByPrice({
|
|
|
|
pageNo: state.pagination.pageNo,
|
|
|
|
pageSize: state.pagination.pageSize,
|
|
|
|
'times[0]': state.times[0],
|
|
|
|
'times[1]': state.times[1],
|
|
|
|
});
|
|
|
|
if (code !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
state.pagination.list = _.concat(state.pagination.list, data.list);
|
|
|
|
state.pagination.total = data.total;
|
|
|
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
|
|
|
if (state.pagination.pageNo === 1) {
|
|
|
|
getBrokerageRankNumber();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function getBrokerageRankNumber() {
|
|
|
|
const { code, data } = await BrokerageApi.getRankByPrice({
|
|
|
|
times: state.times,
|
|
|
|
});
|
|
|
|
if (code !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
state.position = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
function formatDate(date) {
|
|
|
|
return sheep.$helper.timeFormat(date, 'yyyy-mm-dd hh:MM:ss');
|
|
|
|
}
|
|
|
|
|
|
|
|
function calculateTimes() {
|
|
|
|
let times;
|
|
|
|
if (state.currentTab === 0) {
|
|
|
|
times = getWeekTimes();
|
|
|
|
} else {
|
|
|
|
times = getMonthTimes();
|
|
|
|
}
|
|
|
|
state.times = [formatDate(times[0]), formatDate(times[1])];
|
|
|
|
}
|
|
|
|
|
|
|
|
onLoad(function () {
|
|
|
|
calculateTimes();
|
|
|
|
getBrokerageRankList();
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO 芋艿:此处可考虑抽离
|
|
|
|
/**
|
|
|
|
* 获得当前周的开始和结束时间
|
|
|
|
*/
|
|
|
|
function getWeekTimes() {
|
|
|
|
const today = new Date();
|
|
|
|
const dayOfWeek = today.getDay();
|
|
|
|
return [
|
|
|
|
new Date(today.getFullYear(), today.getMonth(), today.getDate() - dayOfWeek, 0, 0, 0),
|
|
|
|
new Date(
|
|
|
|
today.getFullYear(),
|
|
|
|
today.getMonth(),
|
|
|
|
today.getDate() + (6 - dayOfWeek),
|
|
|
|
23,
|
|
|
|
59,
|
|
|
|
59,
|
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获得当前月的开始和结束时间
|
|
|
|
*/
|
|
|
|
function getMonthTimes() {
|
|
|
|
const today = new Date();
|
|
|
|
const year = today.getFullYear();
|
|
|
|
const month = today.getMonth();
|
|
|
|
const startDate = new Date(year, month, 1, 0, 0, 0);
|
|
|
|
const nextMonth = new Date(year, month + 1, 1);
|
|
|
|
const endDate = new Date(nextMonth.getTime() - 1);
|
|
|
|
return [startDate, endDate];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 加载更多
|
|
|
|
function loadMore() {
|
|
|
|
if (state.loadStatus === 'noMore') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
state.pagination.pageNo++;
|
|
|
|
getBrokerageRankList();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 上拉加载更多
|
|
|
|
onReachBottom(() => loadMore());
|
2023-12-21 09:58:15 +00:00
|
|
|
</script>
|
2023-12-27 10:52:17 +00:00
|
|
|
<style lang="scss" scoped>
|
2024-12-01 08:57:54 +00:00
|
|
|
.commission-rank {
|
|
|
|
.header {
|
|
|
|
background: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCAFYAu4DAREAAhEBAxEB/8QAHAABAAIDAQEBAAAAAAAAAAAAAAIDAQQFBwYI/8QAGwEBAAIDAQEAAAAAAAAAAAAAAAECAwQFBgf/2gAMAwEAAhADEAAAAPnvKfaQAAAAAAAAAAAAAAAAAAAAAAAAAAAAImAYRgGDBiYGAYAAAMgyZETkyZBlOQSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAImAYRgwYMTGDBgxMDAMAAyAZMwykZMmYnJkyZTkEgAAAAAAAAAAAAAAAAAAAAAAAAAAACIMGEYMGJiJgwYmMEQjEsGYXY6TrXJGZqvau9hkzE5MmTMTIyZicmTJlOSQAAAAAAAAAAAAAAAAAAAAAAAAAABEwYRgwYmImCMxgiYmMQ7WhqfScnR73N0+xo6/R1cF+KsoZRiJryTp58nM28/E6G38/wBTc+a629qZ8uYSTklE5JGYmRkykTAAAAAAAAAAAAAAA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q3zaN9jlYdy3FSi+Tlbm99byODZWs60nEV2tq5c23u4tjSw14L+H/TfaAAAAAAAAAAAAAAAAAAAARMEUQmIFcxXMX4c
|
|
|
|
no-repeat;
|
|
|
|
width: 100%;
|
|
|
|
height: 344rpx;
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
|
|
|
.rank {
|
|
|
|
font-size: 33rpx;
|
|
|
|
color: #fff;
|
|
|
|
position: absolute;
|
|
|
|
top: 160rpx;
|
|
|
|
left: 48rpx;
|
|
|
|
|
|
|
|
.num {
|
|
|
|
font-size: 51rpx;
|
|
|
|
font-weight: bold;
|
|
|
|
margin: 0 10rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.wrapper {
|
|
|
|
width: 710rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
border-radius: 14rpx;
|
|
|
|
margin: -76rpx auto 0 auto;
|
|
|
|
|
|
|
|
.nav {
|
|
|
|
height: 99rpx;
|
|
|
|
border-bottom: 2.5rpx solid #f3f3f3;
|
|
|
|
font-size: 30rpx;
|
|
|
|
font-weight: bold;
|
|
|
|
color: #999;
|
|
|
|
line-height: 99rpx;
|
|
|
|
|
|
|
|
.item.font-color {
|
|
|
|
border-bottom: 4rpx solid #e93323;
|
|
|
|
margin-top: -2rpx;
|
|
|
|
color: #e93323;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.list {
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
|
|
|
.item {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-around;
|
|
|
|
align-items: center;
|
|
|
|
border-bottom: 1px solid #f3f3f3;
|
|
|
|
height: 101rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
|
|
.num {
|
|
|
|
color: #666;
|
|
|
|
flex: 0.08;
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
image {
|
|
|
|
width: 50rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.pictrue {
|
|
|
|
flex: 0.15;
|
|
|
|
|
|
|
|
image {
|
|
|
|
width: 68rpx;
|
|
|
|
height: 68rpx;
|
|
|
|
display: block;
|
|
|
|
border-radius: 50%;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.text {
|
|
|
|
color: #333;
|
|
|
|
flex: 0.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
.people {
|
|
|
|
text-align: right;
|
|
|
|
flex: 0.27;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|