123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- <template>
- <view class="promoter-list">
- <!-- 头部背景 -->
- <view class="header">
- <view class="promoter-count">
- <view class="title">推广总人数</view>
- <view class="count">{{ (parseInt(first) || 0) + (parseInt(second) || 0) }}<text class="unit">人</text></view>
- <view class="subtitle">您已成功推广的会员总数</view>
- </view>
- </view>
- <!-- 筛选导航 -->
- <view class="nav acea-row row-around">
- <view class="item" :class="screen.grade == 0 ? 'on' : ''" @click="checkGrade(0)">一级({{ first || '0' }})</view>
- <view class="item" :class="screen.grade == 1 ? 'on' : ''" @click="checkGrade(1)">二级({{ second || '0' }})</view>
- </view>
- <!-- 搜索框 -->
- <view class="search acea-row row-between-wrapper">
- <form @submit.prevent="submitForm">
- <view class="input">
- <input placeholder="点击搜索会员名称" v-model="screen.keyword" />
- <text class="iconfont icon-guanbi" @click="screen.keyword = ''"></text>
- </view>
- </form>
- <view class="iconfont icon-sousuo2"></view>
- </view>
- <!-- 排序导航 -->
- <view class="sortNav acea-row row-middle" :class="fixedState === true ? 'on' : ''">
- <view class="sortItem" @click="sort('childCount')">
- 团队排序
- <image src="../../../static/user/sort1.png" v-if="childCount == 1" />
- <image src="../../../static/user/sort2.png" v-if="childCount == 2" />
- <image src="../../../static/user/sort3.png" v-if="childCount == 3" />
- </view>
- <view class="sortItem" @click="sort('numberCount')">
- 金额排序
- <image src="../../../static/user/sort1.png" v-if="numberCount == 1" />
- <image src="../../../static/user/sort2.png" v-if="numberCount == 2" />
- <image src="../../../static/user/sort3.png" v-if="numberCount == 3" />
- </view>
- <view class="sortItem" @click="sort('orderCount')">
- 订单排序
- <image src="../../../static/user/sort1.png" v-if="orderCount == 1" />
- <image src="../../../static/user/sort2.png" v-if="orderCount == 2" />
- <image src="../../../static/user/sort3.png" v-if="orderCount == 3" />
- </view>
- </view>
- <!-- 列表内容 -->
- <view :class="fixedState === true ? 'sortList' : ''">
- <view class="item acea-row row-between-wrapper" v-for="(val, spreadListIndex) in spreadList" :key="spreadListIndex">
- <view class="picTxt acea-row row-between-wrapper">
- <view class="pictrue">
- <image :src="val.avatar" />
- </view>
- <view class="text">
- <view class="name line1">{{ val.nickname }}</view>
- <view>加入时间: {{ val.time }}</view>
- </view>
- </view>
- <view class="right">
- <view>
- <text class="font-color-red">{{ val.childCount }}</text>人
- </view>
- <view>{{ val.orderCount }} 单</view>
- <view>{{ val.numberCount ? val.numberCount : 0 }} 元</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'PromoterList',
- props: {},
- data: function () {
- return {
- fixedState: false,
- screen: {
- page: 1,
- limit: 15,
- grade: 0,
- keyword: '',
- sort: '',
- },
- childCount: 2,
- numberCount: 2,
- orderCount: 2,
- loaded: false,
- loading: false,
- spreadList: [],
- loadTitle: '',
- first: '',
- second: '',
- }
- },
- mounted: function () {
- this.getSpreadUsers()
- },
- onReachBottom() {
- !this.loading && this.getSpreadUsers()
- },
- watch: {
- 'screen.sort': function () {
- this.screen.page = 0
- this.loaded = false
- this.loading = false
- this.spreadList = []
- this.getSpreadUsers()
- },
- },
- methods: {
- handleScroll: function () {
- // var scrollTop =
- // document.documentElement.scrollTop || document.body.scrollTop;
- // var offsetTop = document.querySelector(".header").clientHeight;
- // if (scrollTop >= offsetTop) {
- // this.fixedState = true;
- // } else {
- // this.fixedState = false;
- // }
- },
- submitForm: function () {
- this.screen.page = 0
- this.loaded = false
- this.loading = false
- this.spreadList = []
- this.getSpreadUsers()
- },
- getSpreadUsers: function () {
- let that = this,
- screen = that.screen
- if (that.loaded || that.loading) return
- that.loading = true
- uni.showLoading({
- title: '加载中...'
- })
- this.$api.request('post', 'user/app/spread/people',screen).then(
- (res) => {
- uni.hideLoading()
- that.loading = false
- that.spreadList.push.apply(that.spreadList, res.data.list)
- that.loaded = res.data.list.length < that.screen.limit
- that.loadTitle = that.loaded ? '人家是有底线的' : '上拉加载更多'
- that.screen.page = that.screen.page + 1
- that.first = res.data.total
- that.second = res.data.totalLevel
- },
- (err) => {
- uni.hideLoading()
- uni.showToast({
- title: err.msg || err.response.data.msg || err.response.data.message,
- icon: 'none',
- duration: 2000,
- })
- },
- 300
- )
- },
- checkGrade: function (val) {
- if (val == this.screen.grade) return
- else {
- this.screen.page = 1
- this.screen.grade = val
- this.loading = false
- this.loaded = false
- this.spreadList = []
- this.getSpreadUsers()
- }
- },
- sort: function (types) {
- let that = this
- switch (types) {
- case 'childCount':
- if (that.childCount == 2) {
- that.childCount = 1
- that.orderCount = 2
- that.numberCount = 2
- that.screen.sort = 'childCount DESC'
- } else if (that.childCount == 1) {
- that.childCount = 3
- that.orderCount = 2
- that.numberCount = 2
- that.screen.sort = 'childCount ASC'
- } else if (that.childCount == 3) {
- that.childCount = 2
- that.orderCount = 2
- that.numberCount = 2
- that.screen.sort = ''
- }
- break
- case 'numberCount':
- if (that.numberCount == 2) {
- that.numberCount = 1
- that.orderCount = 2
- that.childCount = 2
- that.screen.sort = 'numberCount DESC'
- } else if (that.numberCount == 1) {
- that.numberCount = 3
- that.orderCount = 2
- that.childCount = 2
- that.screen.sort = 'numberCount ASC'
- } else if (that.numberCount == 3) {
- that.numberCount = 2
- that.orderCount = 2
- that.childCount = 2
- that.screen.sort = ''
- }
- break
- case 'orderCount':
- if (that.orderCount == 2) {
- that.orderCount = 1
- that.numberCount = 2
- that.childCount = 2
- that.screen.sort = 'orderCount DESC'
- } else if (that.orderCount == 1) {
- that.orderCount = 3
- that.numberCount = 2
- that.childCount = 2
- that.screen.sort = 'orderCount ASC'
- } else if (that.orderCount == 3) {
- that.orderCount = 2
- that.numberCount = 2
- that.childCount = 2
- that.screen.sort = ''
- }
- break
- default:
- that.screen.sort = ''
- }
- },
- },
- }
- </script>
- <style lang="less">
- .promoter-list {
- .header {
- background-image: url('https://kxmalls.oss-cn-hangzhou.aliyuncs.com/bg/bg.png');
- background-repeat: no-repeat;
- background-size: 100% 110%;
- width: 100%;
- height: 300rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- color: #fff;
- .promoter-count {
- text-align: center;
- padding: 50rpx 0;
- .title {
- font-size: 28rpx;
- opacity: 0.9;
- margin-bottom: 10rpx;
- }
- .count {
- font-size: 72rpx;
- font-weight: bold;
- line-height: 1.2;
- font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', sans-serif;
- text-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
- .unit {
- font-size: 36rpx;
- font-weight: normal;
- margin-left: 8rpx;
- }
- }
- .subtitle {
- font-size: 24rpx;
- opacity: 0.8;
- margin-top: 10rpx;
- }
- }
- .name {
- font-size: 30rpx;
- padding-top: 50rpx;
- justify-content: center;
- }
- .num {
- text-align: center;
- font-size: 60rpx;
- margin-top: 20rpx;
- font-family: 'GuildfordProBook 5';
- }
- .profit {
- padding: 0 20rpx;
- font-size: 24rpx;
- margin-top: 30rpx;
- .item {
- min-width: 200rpx;
- text-align: center;
- width: 50%;
- .money {
- font-size: 34rpx;
- margin-top: 10rpx;
- }
- }
- }
- }
- .nav {
- justify-content: space-around;
- display: flex;
- background-color: #fff;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- color: #282828;
- border-bottom: 1px solid #eee;
- .item {
- height: 100%;
- &.on {
- color: #eb3729;
- border-bottom: 5rpx solid #eb3729;
- }
- }
- }
- .search {
- align-items: center;
- display: flex;
- justify-content: space-around;
- background-color: #fff;
- height: 90rpx;
- padding: 0 30rpx;
- border-bottom: 1px solid #eee;
- flex-wrap: wrap;
- border-bottom: 1px solid #eee;
- .input {
- width: 630rpx;
- height: 60rpx;
- border-radius: 50rpx;
- background-color: #f5f5f5;
- position: relative;
- input {
- height: 100%;
- width: 620rpx;
- font-size: 26rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- &::placeholder {
- color: #bbb;
- }
- }
- .iconfont {
- position: absolute;
- right: 28rpx;
- top: 50%;
- transform: translateY(-50%);
- color: #999;
- font-size: 28rpx;
- }
- }
- .iconfont {
- font-size: 40rpx;
- color: #515151;
- }
- }
- .sortNav {
- background-color: #fff;
- height: 80rpx;
- border-bottom: 1px solid #eee;
- color: #333;
- font-size: 28rpx;
- &.on {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 5;
- }
- .sortItem {
- text-align: center;
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- image {
- width: 24rpx;
- height: 24rpx;
- margin-left: 6rpx;
- }
- }
- }
- .sortList {
- margin-top: 80rpx;
- }
- .item {
- background-color: #fff;
- border-bottom: 1px solid #eee;
- height: 160rpx;
- padding: 0 30rpx;
- font-size: 24rpx;
- color: #666;
- .picTxt {
- width: 440rpx;
- .pictrue {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- border-radius: 50%;
- border: 3rpx solid #fff;
- box-shadow: 0 0 7rpx #aaa;
- box-sizing: border-box;
- }
- }
- .text {
- width: 300rpx;
- margin-left: 20rpx;
- .name {
- font-size: 28rpx;
- color: #333;
- margin-bottom: 10rpx;
- }
- }
- }
- .right {
- width: 240rpx;
- text-align: right;
- font-size: 22rpx;
- color: #333;
- .font-color-red {
- color: #eb3729;
- }
- }
- }
- }
- .acea-row {
- display: flex;
- flex-wrap: wrap;
- }
- </style>
|