分佣:commission-rank 迁移
parent
5b8b91356f
commit
b15fb02ecf
|
@ -1,21 +0,0 @@
|
||||||
import request from "@/utils/request.js";
|
|
||||||
|
|
||||||
// 获得个人分销统计
|
|
||||||
export function getBrokerageUserSummary() {
|
|
||||||
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) {
|
|
||||||
return request.get('app-api/member/brokerage-withdraw/page', data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获得分销记录分页
|
|
||||||
export function getBrokerageRecordPage(data) {
|
|
||||||
return request.get('app-api/member/brokerage-record/page', data);
|
|
||||||
}
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
// 获得个人分销统计
|
||||||
|
export function getBrokerageUserSummary() {
|
||||||
|
return request.get('app-api/trade/brokerage-user/get-summary');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得分销用户排行分页(基于用户量)
|
||||||
|
export function getBrokerageUserRankPageByUserCount(data) {
|
||||||
|
return request.get('app-api/trade/brokerage-user/rank-page-by-user-count', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得分销用户排行(基于佣金)
|
||||||
|
export function getBrokerageUserRankByPrice(data) {
|
||||||
|
return request.get('app-api/trade/brokerage-user/get-rank-by-price', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得分销用户排行分页(基于佣金)
|
||||||
|
export function getBrokerageUserRankPageByPrice(data) {
|
||||||
|
return request.get('app-api/trade/brokerage-user/rank-page-by-price', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得分销提现分页记录
|
||||||
|
export function getBrokerageWithdrawPage(data) {
|
||||||
|
return request.get('app-api/trade/brokerage-withdraw/page', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得分销记录分页
|
||||||
|
export function getBrokerageRecordPage(data) {
|
||||||
|
return request.get('app-api/trade/brokerage-record/page', data);
|
||||||
|
}
|
|
@ -7,63 +7,49 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="wrapper">
|
<view class="wrapper">
|
||||||
<view class="nav acea-row row-around">
|
<view class="nav acea-row row-around">
|
||||||
<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>
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<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" v-if="index <= 2">
|
<view class="num" v-if="index <= 2">
|
||||||
<image :src="'/static/images/medal0'+(index+1)+'.png'"></image>
|
<image :src="'/static/images/medal0' + (index+1) + '.png'" />
|
||||||
</view>
|
</view>
|
||||||
<view class="num" v-else>
|
<view class="num" v-else>
|
||||||
{{index+1}}
|
{{index + 1}}
|
||||||
</view>
|
</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.brokeragePrice}}</view>
|
<view class="people font-color">¥{{ fen2yuan(item.brokeragePrice) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='noCommodity' v-if="rankList.length == 0 && (page != 1 || active== 0)">
|
<view class='noCommodity' v-if="rankList.length === 0 && (page !== 1 || active === 0)">
|
||||||
<emptyPage title="暂无排行~"></emptyPage>
|
<emptyPage title="暂无排行~"></emptyPage>
|
||||||
</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';
|
||||||
getBrokerageRank,
|
|
||||||
brokerageRankNumber
|
|
||||||
} from '@/api/user.js';
|
|
||||||
import {
|
|
||||||
toLogin
|
|
||||||
} from '@/libs/login.js';
|
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import emptyPage from '@/components/emptyPage.vue'
|
import emptyPage from '@/components/emptyPage.vue'
|
||||||
import {
|
import { mapGetters } from "vuex";
|
||||||
mapGetters
|
import * as BrokerageAPI from '@/api/trade/brokerage.js'
|
||||||
} from "vuex";
|
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||||
// #ifdef MP
|
import * as DateUtil from '@/utils/date.js';
|
||||||
import authorize from '@/components/Authorize';
|
import * as Util from '@/utils/util.js';
|
||||||
// #endif
|
export default {
|
||||||
export default {
|
|
||||||
components: {
|
components: {
|
||||||
emptyPage,
|
emptyPage,
|
||||||
home,
|
home,
|
||||||
// #ifdef MP
|
|
||||||
authorize
|
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -77,15 +63,13 @@
|
||||||
loadTitle: '加载更多',
|
loadTitle: '加载更多',
|
||||||
type: 'week',
|
type: 'week',
|
||||||
position: 0,
|
position: 0,
|
||||||
isAuto: false, //没有授权的不会自动授权
|
|
||||||
isShowAuth: false //是否隐藏授权
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(['isLogin']),
|
computed: mapGetters(['isLogin']),
|
||||||
watch:{
|
watch:{
|
||||||
isLogin:{
|
isLogin:{
|
||||||
handler:function(newV,oldV){
|
handler:function(newV, oldV) {
|
||||||
if(newV){
|
if (newV) {
|
||||||
this.getBrokerageRankList();
|
this.getBrokerageRankList();
|
||||||
this.getBrokerageRankNumber(this.type);
|
this.getBrokerageRankNumber(this.type);
|
||||||
}
|
}
|
||||||
|
@ -94,61 +78,73 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
if (this.isLogin) {
|
if (!this.isLogin) {
|
||||||
this.getBrokerageRankList();
|
toLogin();
|
||||||
this.getBrokerageRankNumber(this.type);
|
return;
|
||||||
} else {
|
|
||||||
toLogin();
|
|
||||||
}
|
}
|
||||||
|
this.calculateTimes();
|
||||||
|
this.getBrokerageRankList();
|
||||||
|
this.getBrokerageRankNumber(this.type);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onLoadFun: function() {
|
|
||||||
this.getBrokerageRankList();
|
|
||||||
this.getBrokerageRankNumber(this.type);
|
|
||||||
},
|
|
||||||
// 授权关闭
|
|
||||||
authColse: function(e) {
|
|
||||||
this.isShowAuth = e
|
|
||||||
},
|
|
||||||
switchTap: function(index) {
|
switchTap: function(index) {
|
||||||
this.active = index;
|
this.active = index;
|
||||||
this.type = index ? 'month' : 'week';
|
this.type = index ? 'month' : 'week';
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.loadend = false;
|
this.loadend = false;
|
||||||
this.$set(this, 'rankList', []);
|
this.$set(this, 'rankList', []);
|
||||||
|
this.calculateTimes();
|
||||||
this.getBrokerageRankList();
|
this.getBrokerageRankList();
|
||||||
this.getBrokerageRankNumber(this.type);
|
this.getBrokerageRankNumber(this.type);
|
||||||
},
|
},
|
||||||
getBrokerageRankNumber(type) {
|
getBrokerageRankNumber() {
|
||||||
brokerageRankNumber({
|
BrokerageAPI.getBrokerageUserRankByPrice({
|
||||||
type: type
|
// 'startTime': this.times[0],
|
||||||
|
// 'endTime': this.times[1],
|
||||||
|
'times': this.times
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.position = res.data;
|
this.position = res.data;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getBrokerageRankList: function() {
|
getBrokerageRankList: function() {
|
||||||
if (this.loadend) return;
|
if (this.loadend || this.loading) {
|
||||||
if (this.loading) return;
|
return;
|
||||||
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.loadTitle = '';
|
this.loadTitle = '';
|
||||||
getBrokerageRank({
|
BrokerageAPI.getBrokerageUserRankPageByPrice({
|
||||||
page: this.page,
|
pageNo: this.page,
|
||||||
limit: this.limit,
|
pageSize: this.limit,
|
||||||
type: this.type
|
'times[0]': this.times[0],
|
||||||
|
'times[1]': this.times[1],
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let list = res.data;
|
let list = res.data.list;
|
||||||
let loadend = list.length <= this.limit;
|
let loadend = list.length <= this.limit;
|
||||||
this.rankList.push.apply(this.rankList, list);
|
this.rankList.push.apply(this.rankList, list);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.loadend = loadend;
|
this.loadend = loadend;
|
||||||
this.loadTitle = loadend ? '😕我也是有底线的' : '加载更多';
|
this.loadTitle = loadend ? '😕我也是有底线的' : '加载更多';
|
||||||
this.$set(this, 'rankList', this.rankList);
|
this.$set(this, 'rankList', this.rankList);
|
||||||
//this.position = res.data.position;
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.loadTitle = '加载更多';
|
this.loadTitle = '加载更多';
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
calculateTimes: function() {
|
||||||
|
let times;
|
||||||
|
if (this.type === 'week') {
|
||||||
|
times = DateUtil.getWeekTimes();
|
||||||
|
} else {
|
||||||
|
times = DateUtil.getMonthTimes();
|
||||||
|
}
|
||||||
|
this.times = [ this.formatDate(times[0]), this.formatDate(times[1]) ]
|
||||||
|
},
|
||||||
|
formatDate: function(date) {
|
||||||
|
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
},
|
||||||
|
fen2yuan(price) {
|
||||||
|
return Util.fen2yuan(price)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onReachBottom: function() {
|
onReachBottom: function() {
|
||||||
this.getBrokerageRankList();
|
this.getBrokerageRankList();
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
import emptyPage from '@/components/emptyPage.vue'
|
import emptyPage from '@/components/emptyPage.vue'
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import * as BrokerageAPI from '@/api/member/brokerage.js'
|
import * as BrokerageAPI from '@/api/trade/brokerage.js'
|
||||||
import * as Util from '@/utils/util.js';
|
import * as Util from '@/utils/util.js';
|
||||||
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -57,8 +57,10 @@
|
||||||
import { toLogin } from '@/libs/login.js';
|
import { toLogin } from '@/libs/login.js';
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import * as BrokerageAPI from '@/api/member/brokerage.js'
|
import * as BrokerageAPI from '@/api/trade/brokerage.js'
|
||||||
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||||
|
import * as DateUtil from '@/utils/date.js';
|
||||||
|
import * as Util from '@/utils/util.js';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
home
|
home
|
||||||
|
@ -105,7 +107,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
BrokerageAPI.getBrokerageUserRankPage({
|
BrokerageAPI.getBrokerageUserRankPageByUserCount({
|
||||||
pageNo: this.page,
|
pageNo: this.page,
|
||||||
pageSize: this.limit,
|
pageSize: this.limit,
|
||||||
'times[0]': this.times[0],
|
'times[0]': this.times[0],
|
||||||
|
@ -143,22 +145,13 @@
|
||||||
this.getRanklist();
|
this.getRanklist();
|
||||||
},
|
},
|
||||||
calculateTimes: function() {
|
calculateTimes: function() {
|
||||||
// TODO @芋艿:优化代码
|
let times;
|
||||||
let startDate;
|
|
||||||
let endDate;
|
|
||||||
const today = new Date();
|
|
||||||
if (this.type === 'week') {
|
if (this.type === 'week') {
|
||||||
const dayOfWeek = today.getDay();
|
times = DateUtil.getWeekTimes();
|
||||||
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 {
|
} else {
|
||||||
const year = today.getFullYear();
|
times = DateUtil.getMonthTimes();
|
||||||
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) ]
|
this.times = [ this.formatDate(times[0]), this.formatDate(times[1]) ]
|
||||||
},
|
},
|
||||||
formatDate: function(date) {
|
formatDate: function(date) {
|
||||||
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
|
|
@ -35,10 +35,7 @@
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||||
// #endif
|
// #endif
|
||||||
import {
|
import { spreadBanner } from '@/api/user.js';
|
||||||
getUserInfo,
|
|
||||||
spreadBanner
|
|
||||||
} from '@/api/user.js';
|
|
||||||
import {
|
import {
|
||||||
toLogin
|
toLogin
|
||||||
} from '@/libs/login.js';
|
} from '@/libs/login.js';
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
import emptyPage from '@/components/emptyPage.vue'
|
import emptyPage from '@/components/emptyPage.vue'
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import * as BrokerageAPI from '@/api/member/brokerage.js'
|
import * as BrokerageAPI from '@/api/trade/brokerage.js'
|
||||||
import * as Util from '@/utils/util.js';
|
import * as Util from '@/utils/util.js';
|
||||||
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
import { toLogin } from '@/libs/login.js';
|
import { toLogin } from '@/libs/login.js';
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import * as BrokerageAPI from '@/api/member/brokerage.js'
|
import * as BrokerageAPI from '@/api/trade/brokerage.js'
|
||||||
import * as Util from '@/utils/util.js';
|
import * as Util from '@/utils/util.js';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得当前周的开始和结束时间
|
||||||
|
*/
|
||||||
|
export 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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得当前月的开始和结束时间
|
||||||
|
*/
|
||||||
|
export 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]
|
||||||
|
}
|
Loading…
Reference in New Issue