📖 code review:【分销】我的团队
parent
9e25f8e944
commit
2317d14ef5
|
@ -1,92 +1,158 @@
|
|||
<!-- 页面 TODO 芋艿:检查未开发 -->
|
||||
<!-- 页面 TODO 芋艿:该页面的实现代码需要优化,包括 js 和 css,以及相关的样式设计 -->
|
||||
<template>
|
||||
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
|
||||
<view class="promoter-list">
|
||||
<view class='promoterHeader bg-color' style='backgroundColor:#e93323!important;height:218rpx;color:#fff'>
|
||||
<view class='headerCon acea-row row-between' style='padding: 28px 29px 0 29px;'>
|
||||
<view
|
||||
class="promoterHeader bg-color"
|
||||
style="backgroundcolor: #e93323 !important; height: 218rpx; color: #fff"
|
||||
>
|
||||
<view class="headerCon acea-row row-between" style="padding: 28px 29px 0 29px">
|
||||
<view>
|
||||
<view class='name' style="color:#fff">推广人数</view>
|
||||
<view><text class='num'
|
||||
style="color:#fff">{{(state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}</text>人
|
||||
<view class="name" style="color: #fff">推广人数</view>
|
||||
<view>
|
||||
<text class="num" style="color: #fff">
|
||||
{{
|
||||
state.summary.firstBrokerageUserCount + state.summary.secondBrokerageUserCount ||
|
||||
0
|
||||
}}
|
||||
</text>
|
||||
人
|
||||
</view>
|
||||
</view>
|
||||
<view class='iconfont icon-tuandui'></view>
|
||||
<view class="iconfont icon-tuandui" />
|
||||
</view>
|
||||
</view>
|
||||
<view style='padding: 0 30rpx;'>
|
||||
<view class='nav acea-row row-around l1'>
|
||||
<view :class="state.level == 1 ? 'item on' : 'item'" @click='setType(1)'>
|
||||
一级({{state.getSummary.firstBrokerageUserCount || 0 }})</view>
|
||||
<view :class="state.level == 2 ? 'item on' : 'item'" @click='setType(2)'>
|
||||
二级({{state.getSummary.secondBrokerageUserCount || 0 }})
|
||||
<view style="padding: 0 30rpx">
|
||||
<view class="nav acea-row row-around l1">
|
||||
<view :class="state.level == 1 ? 'item on' : 'item'" @click="setType(1)">
|
||||
一级({{ state.summary.firstBrokerageUserCount || 0 }})
|
||||
</view>
|
||||
<view :class="state.level == 2 ? 'item on' : 'item'" @click="setType(2)">
|
||||
二级({{ state.summary.secondBrokerageUserCount || 0 }})
|
||||
</view>
|
||||
</view>
|
||||
<view class='search acea-row row-between-wrapper'
|
||||
style="display: flex;height: 100rpx;align-items: center;">
|
||||
<view class='input'>
|
||||
<input placeholder='点击搜索会员名称' v-model="state.nickname" confirm-type='search' name="search"
|
||||
@confirm="submitForm" />
|
||||
|
||||
<view
|
||||
class="search acea-row row-between-wrapper"
|
||||
style="display: flex; height: 100rpx; align-items: center"
|
||||
>
|
||||
<view class="input">
|
||||
<input
|
||||
placeholder="点击搜索会员名称"
|
||||
v-model="state.nickname"
|
||||
confirm-type="search"
|
||||
name="search"
|
||||
@confirm="submitForm"
|
||||
/>
|
||||
</view>
|
||||
<image src="/static/images/search.png" mode="" style='width: 60rpx;height: 64rpx;' @click="submitForm"></image>
|
||||
<image
|
||||
src="/static/images/search.png"
|
||||
mode=""
|
||||
style="width: 60rpx; height: 64rpx"
|
||||
@click="submitForm"
|
||||
/>
|
||||
</view>
|
||||
<view class='list'>
|
||||
<view class="sortNav acea-row row-middle" style="display: flex;align-items: center;">
|
||||
<view class="sortItem" @click='setSort("userCount","asc")' v-if="sort === 'userCountDESC'">
|
||||
<view class="list">
|
||||
<view class="sortNav acea-row row-middle" style="display: flex; align-items: center">
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('userCount', 'asc')"
|
||||
v-if="sort === 'userCountDESC'"
|
||||
>
|
||||
团队排序
|
||||
<image src='/static/images/sort1.png'></image>
|
||||
<!-- TODO 芋艿:看看怎么从项目里拿出去 -->
|
||||
<image src="/static/images/sort1.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("userCount", "desc")'
|
||||
v-else-if="sort === 'userCountASC'">团队排序
|
||||
<image src='/static/images/sort3.png'></image>
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('userCount', 'desc')"
|
||||
v-else-if="sort === 'userCountASC'"
|
||||
>
|
||||
团队排序
|
||||
<image src="/static/images/sort3.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("userCount","desc")' v-else>团队排序
|
||||
<image src='/static/images/sort2.png'></image>
|
||||
<view class="sortItem" @click="setSort('userCount', 'desc')" v-else>
|
||||
团队排序
|
||||
<image src="/static/images/sort2.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("price","asc")' v-if="sort === 'priceDESC'">
|
||||
<view class="sortItem" @click="setSort('price', 'asc')" v-if="sort === 'priceDESC'">
|
||||
金额排序
|
||||
<image src='/static/images/sort1.png'></image>
|
||||
<image src="/static/images/sort1.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("price", "desc")' v-else-if="sort === 'priceASC'">
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('price', 'desc')"
|
||||
v-else-if="sort === 'priceASC'"
|
||||
>
|
||||
金额排序
|
||||
<image src='/static/images/sort3.png'></image>
|
||||
<image src="/static/images/sort3.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("price","desc")' v-else>金额排序
|
||||
<image src='/static/images/sort2.png'></image>
|
||||
<view class="sortItem" @click="setSort('price', 'desc')" v-else>
|
||||
金额排序
|
||||
<image src="/static/images/sort2.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("orderCount","asc")' v-if="sort === 'orderCountDESC'">
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('orderCount', 'asc')"
|
||||
v-if="sort === 'orderCountDESC'"
|
||||
>
|
||||
订单排序
|
||||
<image src='/static/images/sort1.png'></image>
|
||||
<image src="/static/images/sort1.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("orderCount", "desc")'
|
||||
v-else-if="sort === 'orderCountASC'">订单排序
|
||||
<image src='/static/images/sort3.png'></image>
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('orderCount', 'desc')"
|
||||
v-else-if="sort === 'orderCountASC'"
|
||||
>
|
||||
订单排序
|
||||
<image src="/static/images/sort3.png" />
|
||||
</view>
|
||||
<view class="sortItem" @click='setSort("orderCount","desc")' v-else>订单排序
|
||||
<image src='/static/images/sort2.png'></image>
|
||||
<view class="sortItem" @click="setSort('orderCount', 'desc')" v-else>
|
||||
订单排序
|
||||
<image src="/static/images/sort2.png" />
|
||||
</view>
|
||||
</view>
|
||||
<block v-for="(item,index) in state.pagination.data" :key="index">
|
||||
<view class='item acea-row row-between-wrapper' style="display: flex;">
|
||||
<view class="picTxt acea-row row-between-wrapper" style="display: flex;align-items: center;">
|
||||
<view class='pictrue'>
|
||||
<image :src='item.avatar'></image>
|
||||
<block v-for="(item, index) in state.pagination.list" :key="index">
|
||||
<view class="item acea-row row-between-wrapper" style="display: flex">
|
||||
<view
|
||||
class="picTxt acea-row row-between-wrapper"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="item.avatar" />
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='name line1'>{{item.nickname}}</view>
|
||||
<view>加入时间: {{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
|
||||
<view class="text">
|
||||
<view class="name line1">{{ item.nickname }}</view>
|
||||
<view>
|
||||
加入时间:
|
||||
{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right" style='justify-content:center;flex-direction: column;display: flex;margin-left: auto;'>
|
||||
<view><text class='num font-color'>{{ item.brokerageUserCount || 0}}</text>人
|
||||
</view>
|
||||
<view><text class="num">{{ item.orderCount|| 0}}</text>单</view>
|
||||
<view><text class="num">{{ item.brokeragePrice || 0 }}</text>元</view>
|
||||
<view
|
||||
class="right"
|
||||
style="
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
"
|
||||
>
|
||||
<view>
|
||||
<text class="num font-color">{{ item.brokerageUserCount || 0 }} </text>人
|
||||
</view>
|
||||
<view>
|
||||
<text class="num">{{ item.orderCount || 0 }}</text
|
||||
>单</view
|
||||
>
|
||||
<view>
|
||||
<text class="num">{{ item.brokeragePrice || 0 }}</text
|
||||
>元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="state.pagination.data.length == 0">
|
||||
<view style='text-align: center;'>暂无推广人数</view>
|
||||
<block v-if="state.pagination.list.length === 0">
|
||||
<view style="text-align: center">暂无推广人数</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -111,17 +177,17 @@
|
|||
<view class="total-item">
|
||||
<view class="item-title">团队总人数(人)</view>
|
||||
<view class="total-num">
|
||||
{{ (state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}
|
||||
{{ (state.summary.firstBrokerageUserCount+ state.summary.secondBrokerageUserCount)|| 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级成员</view>
|
||||
<view class="category-num">{{ state.getSummary.firstBrokerageUserCount || 0 }}</view>
|
||||
<view class="category-num">{{ state.summary.firstBrokerageUserCount || 0 }}</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级成员</view>
|
||||
<view class="category-num">{{ state.getSummary.secondBrokerageUserCount || 0 }}</view>
|
||||
<view class="category-num">{{ state.summary.secondBrokerageUserCount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -167,54 +233,38 @@
|
|||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
onLoad,
|
||||
onReachBottom
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import {
|
||||
onPageScroll
|
||||
} from '@dcloudio/uni-app';
|
||||
|
||||
|
||||
|
||||
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
// const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||
|
||||
onPageScroll((e) => {
|
||||
if (e.scrollTop > 100) {
|
||||
state.scrollTop = false;
|
||||
} else {
|
||||
state.scrollTop = true;
|
||||
}
|
||||
state.scrollTop = e.scrollTop <= 100;
|
||||
});
|
||||
|
||||
let sort = ref();
|
||||
const state = reactive({
|
||||
getSummary: {},
|
||||
summary: {},
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
list: [],
|
||||
total: 0,
|
||||
},
|
||||
loadStatus: '',
|
||||
// ↓ 新 ui 逻辑
|
||||
level: 1,
|
||||
nickname: ref(''),
|
||||
sortKey: '',
|
||||
isAsc:''
|
||||
isAsc: '',
|
||||
});
|
||||
|
||||
|
||||
function filterUserNum(num) {
|
||||
if (_.isNil(num)) {
|
||||
return '';
|
||||
|
@ -223,66 +273,61 @@
|
|||
}
|
||||
|
||||
function submitForm() {
|
||||
state.pagination.data = []
|
||||
state.pagination.list = [];
|
||||
getTeamList();
|
||||
}
|
||||
async function getTeamList(page = 1, list_rows = 8) {
|
||||
|
||||
async function getTeamList() {
|
||||
state.loadStatus = 'loading';
|
||||
// nickname: this.nickname,
|
||||
|
||||
|
||||
let res = await sheep.$api.commission.team({
|
||||
pageSize: list_rows,
|
||||
pageNo: page,
|
||||
let { code, data } = await BrokerageApi.getBrokerageUserChildSummaryPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
level: state.level,
|
||||
'sortingField.order': 'desc',
|
||||
'sortingField.field': 'userCount',
|
||||
nickname: state.nickname
|
||||
'sortingField.order': state.isAsc,
|
||||
'sortingField.field': state.sortKey,
|
||||
nickname: state.nickname,
|
||||
});
|
||||
console.log(res, '分销团队列表');
|
||||
if (res.code === 0) {
|
||||
let orderList = _.concat(state.pagination.data, res.data.list);
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: orderList,
|
||||
};
|
||||
if (state.pagination.data.length < state.pagination.total) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
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';
|
||||
}
|
||||
|
||||
function setType(e) {
|
||||
state.pagination.data = []
|
||||
state.pagination.list = [];
|
||||
state.level = e + '';
|
||||
getTeamList( )
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
function setSort(sortKey, isAsc) {
|
||||
state.pagination.data = []
|
||||
state.pagination.list = [];
|
||||
sort = sortKey + isAsc.toUpperCase();
|
||||
state.isAsc = isAsc;
|
||||
state.sortKey = sortKey;
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
onLoad(async () => {
|
||||
getTeamList();
|
||||
let res = await sheep.$api.commission.getSummary();
|
||||
state.getSummary = res.data;
|
||||
await getTeamList();
|
||||
// 概要数据
|
||||
let { data } = await BrokerageApi.getBrokerageUserSummary();
|
||||
state.summary = data;
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadmore() {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getTeamList(state.pagination.current_page + 1);
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadmore();
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import request from '@/sheep/request';
|
||||
|
||||
export default {
|
||||
// 我的团队
|
||||
team: (params) =>
|
||||
request({
|
||||
url: '/app-api/trade/brokerage-user/child-summary-page',
|
||||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
getSummary: (data) =>
|
||||
request({
|
||||
url: '/app-api/trade/brokerage-user/get-summary',
|
||||
method: 'GET',
|
||||
})
|
||||
};
|
|
@ -74,6 +74,14 @@ const BrokerageApi = {
|
|||
method: 'GET',
|
||||
});
|
||||
},
|
||||
// 获得下级分销统计分页
|
||||
getBrokerageUserChildSummaryPage: (params) => {
|
||||
return request({
|
||||
url: '/app-api/trade/brokerage-user/child-summary-page',
|
||||
method: 'GET',
|
||||
params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default BrokerageApi
|
||||
|
|
Loading…
Reference in New Issue