船员公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.4 KiB

3 months ago
<template>
<view class="team">
<view class="team-member" v-for="(a,index) in list" :key="index">
<view class="l">
<image v-if="a.avatar" :src="a.avatar"></image>
<image v-else :src="staticUrl('/static/avater.png')"></image>
<view class="name">
{{a.nickname}}
</view>
</view>
<view class="amount">带来收益<view class="num"><text>{{a.commission_price}}</text></view>
</view>
</view>
<view class="empty" style="margin-top: 250rpx;" v-if="total == 0">
<u-empty mode="data" text="暂无相关信息">
</u-empty>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isShow: false,
page: 1,
total: 1,
list: []
}
},
mounted() {
this.getTeamList();
},
methods: {
//获取列表
async getTeamList() {
uni.showLoading({
title: "加载中"
})
const { code, data, msg } = await this.$api.teamList({
page: this.page
})
if (code == 200) {
uni.hideLoading()
this.list = this.arrayUnique(this.list.concat(data.list),'id');
this.total = data.total;
} else {
uni.hideLoading()
uni.showToast({
icon: "none",
title: msg
})
}
},
//数组对象去重
arrayUnique(arr, name) {
    var hash = {};
    return arr.reduce(function (item, next) {
        hash[next[name]]
            ? ""
            : (hash[next[name]] = true && item.push(next));
        return item;
    }, []);
},
},
onReachBottom() {
if(this.list.length <= this.total){
this.page ++
this.getTeamList();
}
}
}
</script>
<style lang="scss" scoped>
.team {
width: 100%;
padding: 0 25rpx 25rpx;
overflow: hidden;
box-sizing: border-box;
&-member {
width: 90%;
margin: 20rpx auto 0;
padding: 30rpx;
background: #FFFFFF;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
.l {
image {
float: left;
width: 90rpx;
height: 90rpx;
margin-right: 20rpx;
}
.name {
float: left;
margin: 20rpx 0;
font-size: 30rpx;
color: #222222;
line-height: 50rpx;
}
}
.amount {
font-size: 26rpx;
color: #999999;
.num {
display: flex;
font-size: 30rpx;
color: #FFA633;
align-items: center;
text {
font-size: 36rpx;
}
}
}
}
}
</style>