feat:性能优化
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCascadeJunior, getJuniorSummary } from '@/api/team.js';
|
||||
import { getCascadeJunior, getJuniorSummary } from '@/pages/mine_package/api/team.js';
|
||||
import { getUserInfo } from '@/api/auth.js';
|
||||
import Header from '@/components/common/header.vue';
|
||||
import TopSafe from '@/components/common/top-safe.nvue'
|
||||
|
||||
@@ -1,415 +0,0 @@
|
||||
<template>
|
||||
<view class="my_team_list">
|
||||
<Header :leftTitle="$t('mine.my.team.title')" left-path-type="navigateTo" :leftPath="leftPath" />
|
||||
<view class="my_team_list_content">
|
||||
<view class="team_list_card">
|
||||
<view class="amount_">{{ (juniorSummaryData && juniorSummaryData.teamAmount) || 0 }}</view>
|
||||
<view class="amount_sum">总订单金额</view>
|
||||
<view class="comm_fg"></view>
|
||||
<view class="people_number">
|
||||
<view class="people_number_item">
|
||||
<view class="title_">总人数</view>
|
||||
<view class="value_">{{ (juniorSummaryData && juniorSummaryData.teamCount) || 0 }}</view>
|
||||
</view>
|
||||
<view class="comm_fg_s"></view>
|
||||
<view class="people_number_item">
|
||||
<view class="title_">推广人数</view>
|
||||
<view class="value_">{{ (juniorSummaryData && juniorSummaryData.ztCount) || 0 }}</view>
|
||||
</view>
|
||||
<!-- <view class="comm_fg_s"></view>
|
||||
<view class="people_number_item">
|
||||
<view class="title_">间推人数</view>
|
||||
<view class="value_">{{ (juniorSummaryData && juniorSummaryData.jtCount) || 0 }}</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="current_user_id" v-if="form.userId">当前用户ID:{{ form.userId }}</view>
|
||||
<view class="current_user_tips">
|
||||
<up-image src="/static/common/tips_b.png" width="20" height="20" bgColor="#f1f6ff00"
|
||||
@click="openTcShow = true;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="team_list_remarks">
|
||||
<view>注:所有数据均截至到进入页面的时间为止,返回再进入页面数据会更新</view>
|
||||
<view style="margin-left: 40rpx;">总订单金额统计的为所有已支付的订单金额</view>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" @scrolltolower="loadMore" :style="{ 'height': 'calc(100vh - 500rpx)' }">
|
||||
<view class="team_item" v-for="(item, index) in listData" :key="item.id" v-if="listData && listData.length">
|
||||
<view class="team_header" @click="queryLowerFun(item, index)">
|
||||
<view class="header_left_">
|
||||
<view style="margin-top: 10rpx;">
|
||||
<up-image :src="item.userUrl || '/static/logo.png'" width="50" height="50" bgColor="#f1f6ff00"
|
||||
shape="circle" radius='16'></up-image>
|
||||
</view>
|
||||
<view class="right_data">
|
||||
<view class="name_">{{ item.userName || '信任桥优品用户' }}({{ item.gradeName }})</view>
|
||||
<view class="msg_">
|
||||
ID:{{ item.userId }}
|
||||
</view>
|
||||
<view class="msg_">
|
||||
注册时间:{{ formatDate(item.registTime) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<up-image src="/static/common/right_x.png" width="20" height="20" bgColor="#f1f6ff00" radius='16'
|
||||
v-if="!item.isOpen"></up-image>
|
||||
<up-image src="/static/common/buttom_x.png" width="20" height="20" bgColor="#f1f6ff00" radius='16'
|
||||
v-else></up-image>
|
||||
</view>
|
||||
</view>
|
||||
<view style="padding: 10rpx;" v-if="item.isOpen && item.lowerData">
|
||||
<view class="team_lower">
|
||||
<view class="team_lower_item">
|
||||
<view class="title_">总订单金额</view>
|
||||
<view class="val_">{{ item.lowerData.teamAmount }}</view>
|
||||
</view>
|
||||
<view class="team_lower_fg"></view>
|
||||
<view class="team_lower_item">
|
||||
<view class="title_">直推人数</view>
|
||||
<view class="val_">{{ item.lowerData.ztCount }}</view>
|
||||
</view>
|
||||
<view class="team_lower_fg"></view>
|
||||
<view class="team_lower_item">
|
||||
<view class="title_">间推人数</view>
|
||||
<view class="val_">{{ item.lowerData.jtCount }}</view>
|
||||
</view>
|
||||
<view class="team_lower_fg"></view>
|
||||
<view class="team_lower_item">
|
||||
<view class="title_">总人数</view>
|
||||
<view class="val_">{{ item.lowerData.teamCount }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="not_order_warp">
|
||||
<up-image src="https://static.tbmall.xin/static/not_order.png" width="80" height="80"
|
||||
bgColor="#f1f6ff00"></up-image>
|
||||
<view class="not_order_msg_warp">暂无数据</view>
|
||||
</view>
|
||||
<view v-if="royaltyLoading" style="text-align: center;">加载中...</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<!-- 提成统计 -->
|
||||
<up-modal :show="openTcShow" :showConfirmButton="false">
|
||||
<view class="slot-content">
|
||||
<view class="close_warp" @click="openTcShow = false;">
|
||||
<up-image src="/static/common/close.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
<view class="content_">
|
||||
<view class="content_1">温馨提示</view>
|
||||
<view class="content_2">1、页面数据截至到进入该页面的时间统计</view>
|
||||
<view class="content_2">2、当前页面数据为主用户的数据</view>
|
||||
<view class="content_2">3、下方显示为全部的直推用户,点击后可跳转他/她的团队数据页,查看他/她的直推数据(也就是我的间推)</view>
|
||||
</view>
|
||||
<view class="but_">
|
||||
<view class="but_copy" @click="openTcShow = false;">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCascadeJunior, getJuniorSummary } from '@/api/team.js';
|
||||
import { formatDate } from '@/utils/index.js';
|
||||
import Header from '@/components/header.vue';
|
||||
|
||||
export default {
|
||||
components: { Header },
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
userId: 0,
|
||||
page: 1,
|
||||
pageSize: 15,
|
||||
},
|
||||
loading: false,
|
||||
listData: [],
|
||||
juniorSummaryData: {},// 统计
|
||||
leftPath: "/pages/mine_package/mine_my_team_list/mine_my_team_list",
|
||||
openTcShow: false,
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
const id = option.id;
|
||||
if (id && id !== "null") {
|
||||
this.form.userId = id;
|
||||
} else {
|
||||
this.leftPath = '/pages/mine_package/mine_my_team/mine_my_team';
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadData();
|
||||
this.getJuniorSummary();
|
||||
},
|
||||
methods: {
|
||||
formatDate,
|
||||
jumpNextLevel(item) {
|
||||
const path = "/pages/mine_package/mine_my_team_list/mine_my_team_list?id=" + item.userId;
|
||||
this.leftPath = path;
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 查询统计数据
|
||||
*/
|
||||
async getJuniorSummary() {
|
||||
const resp = await getJuniorSummary();
|
||||
console.log("getJuniorSummary", resp);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.juniorSummaryData = resp.data;
|
||||
}
|
||||
},
|
||||
|
||||
// 加载数据的方法
|
||||
async loadData() {
|
||||
if (this.loading) return; // 如果正在加载,则不重复加载
|
||||
this.loading = true; // 设置加载状态为true
|
||||
try {
|
||||
// 模拟异步获取数据,实际应用中应该替换为你的数据获取逻辑,例如API调用
|
||||
const newData = await this.fetchData();
|
||||
if (newData.entitys && newData.entitys.length !== 0) {
|
||||
const data = newData.entitys.map(item => ({ ...item, isOpen: false }));
|
||||
this.listData = [...this.listData, ...data]; // 将新数据添加到列表中
|
||||
this.form.page++; // 页码加1
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
} finally {
|
||||
this.loading = false; // 设置加载状态为false
|
||||
}
|
||||
},
|
||||
// 模拟获取数据的方法,实际应用中应该替换为你的数据获取逻辑,例如从服务器获取数据
|
||||
async fetchData() {
|
||||
const params = {
|
||||
...this.form,
|
||||
}
|
||||
const data = await getCascadeJunior(params);
|
||||
if (data && data.bizcode === 100 && data.data) {
|
||||
return data.data
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 当滚动到底部时触发的方法
|
||||
loadMore() {
|
||||
this.loadData(); // 加载更多数据
|
||||
},
|
||||
/**
|
||||
* 查询团队下级数据
|
||||
* @param {Object} item
|
||||
* @param {Object} index
|
||||
*/
|
||||
async queryLowerFun(item, index) {
|
||||
const data = this.listData[index];
|
||||
const type = !data.isOpen
|
||||
if (type) {
|
||||
const params = {
|
||||
userId: item.userId,
|
||||
}
|
||||
const resp = await getJuniorSummary(params);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
data.lowerData = resp.data;
|
||||
}
|
||||
}
|
||||
data.isOpen = type;
|
||||
this.listData[index] = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my_team_list {
|
||||
// height: calc(100vh - 58rpx);
|
||||
// overflow: auto;
|
||||
background-color: $app-bj;
|
||||
|
||||
.my_team_list_content {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.team_list_card {
|
||||
background-color: $app-bt-bj;
|
||||
text-align: center;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
padding: 40rpx;
|
||||
border-radius: 15rpx;
|
||||
margin-bottom: 20rpx;
|
||||
position: relative;
|
||||
|
||||
.current_user_id {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: #33333340;
|
||||
padding: 10rpx;
|
||||
font-size: 22rpx;
|
||||
border-radius: 10rpx 0;
|
||||
}
|
||||
|
||||
.current_user_tips {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
.amount_ {
|
||||
font-weight: 500;
|
||||
font-size: 58rpx;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.amount_sum {
|
||||
font-size: 23rpx;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
|
||||
.comm_fg {
|
||||
border: 2rpx dashed rgba(255, 255, 255, 0.55);
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
.comm_fg_s {
|
||||
width: 1rpx;
|
||||
height: 35rpx;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.people_number {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.people_number_item {
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
|
||||
.title_ {
|
||||
font-size: 23rpx;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
line-height: 33rpx;
|
||||
}
|
||||
|
||||
.value_ {
|
||||
font-size: 38rpx;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
line-height: 54rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.team_list_remarks {
|
||||
font-size: 20rpx;
|
||||
color: #9E9E9E;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.team_item {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.team_header {
|
||||
display: flex;
|
||||
align-content: center;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-radius: 8rpx;
|
||||
background: #FFFFFF;
|
||||
padding: 20rpx;
|
||||
|
||||
.header_left_ {
|
||||
display: flex;
|
||||
align-items: inherit;
|
||||
width: calc(100% - 70rpx);
|
||||
}
|
||||
|
||||
.right_data {
|
||||
margin-left: 10rpx;
|
||||
// display: grid;
|
||||
}
|
||||
|
||||
.name_ {
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.msg_ {
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.team_lower {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #E9E9E9;
|
||||
border-radius: 4px;
|
||||
padding: 30rpx 20rpx;
|
||||
|
||||
.team_lower_fg {
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.26);
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.team_lower_item {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title_ {
|
||||
font-size: 10px;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.val_ {
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.team_content {
|
||||
border-top: 1rpx solid #EEEEEE;
|
||||
padding: 20rpx 0 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.team_content_item {
|
||||
width: 50%;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.team_content2_item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title_ {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.content_ {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.content_1 {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.content_2 {
|
||||
text-align: left;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user