Files
messi 4810dc79e3 fix
2024-08-19 17:17:46 +08:00

237 lines
6.2 KiB
Vue

<template>
<view class="container" v-if="!isLoading">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ use: false }" :up="upOption"
@up="upCallback">
<!-- 团队总人数 -->
<view class="widget-people f-28 col-9">
<text>司机列表({{total}})</text>
<!-- <u-button type="primary" size="mini">添加</u-button> -->
</view>
<!-- 列表数据 -->
<view class="widget-list b-f">
<view class="widget__detail dis-flex flex-x-between" v-for="(item, index) in list" :key="index">
<view class="detail__left dis-flex flex-y-center">
<avatar-image class="user-avatar" :url="item.user.avatar_url" :width="100" :borderWidth="4"
:borderColor="`#fff`" />
<view class="user-info dis-flex flex-dir-column flex-x-center">
<view class="user-nickName f-28">{{ item.real_name }}</view>
<view class="user-time col-9 f-24">{{ item.mobile }}</view>
</view>
</view>
<!-- <view class="detail__right dis-flex flex-dir-column flex-x-center flex-y-center">
<view class="detail__money">
<text class="f-24"></text>
<text class="f-34">{{ item.user.expend_money }}</text>
</view>
<view class="detail__member f-22" v-if="item.subDealer">
{{ item.subDealer.first_num + item.subDealer.second_num + item.subDealer.third_num }}个成员
</view>
</view> -->
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import AvatarImage from '@/components/avatar-image'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import * as Api from '@/api/shop/clerk'
import * as DealerApi from '@/api/dealer'
import SettingModel from '@/common/model/dealer/Setting'
const pageSize = 15
export default {
components: {
MescrollBody,
AvatarImage
},
mixins: [MescrollMixin],
data() {
return {
// 选项卡列表
tabList: [],
// 当前选项
curTab: 0,
// 列表数据
list: getEmptyPaginateObj(),
total: 0,
// 上拉加载配置
upOption: {
// 首次自动执行
auto: true,
// 每页数据的数量; 默认10
page: { size: pageSize },
// 数量要大于12条才显示无更多数据
noMoreSize: 12,
// 空布局
empty: {
tip: '亲,暂无相关数据'
}
},
// 正在加载
isLoading: true,
// 文字设置
words: undefined,
// 团队总人数
teamTotal: undefined
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const app = this
app.isLoading = true
Promise.all([app.getSetting(), app.getDealerUser()])
.then(result => {
const setting = result[0]
const dealer = result[1]
// app.setTabList(setting, dealer)
})
.finally(() => app.isLoading = false)
},
methods: {
// 获取分销设置
getSetting() {
const app = this
return new Promise((resolve, reject) => {
SettingModel.data()
.then(setting => {
app.words = setting.words.team.words
resolve(setting)
})
.catch(reject)
})
},
// 获取分销用户信息
getDealerUser() {
const app = this
const { shopId } = uni.getStorageSync('shopInfo')
Api.list({shopId}).then((result) => {
app.list = result.data.list
app.total = result.data.total
})
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
upCallback(page) {
const app = this
// 设置列表数据
app.getList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
// 获取提现列表
getList(pageNo = 1) {
const app = this
return new Promise((resolve, reject) => {
Api.list({ level: app.getTabValue(), page: pageNo })
.then(result => {
// 合并新数据
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
resolve(newList)
})
})
},
// 获取当前标签项的值
getTabValue() {
const app = this
if (app.tabList.length) {
return app.tabList[app.curTab].value
}
return 1
},
// 切换标签项
onChangeTab(index) {
const app = this
// 设置当前选中的标签
app.curTab = index
// 刷新订单列表
app.onRefreshList()
},
// 刷新列表数据
onRefreshList() {
this.list = getEmptyPaginateObj()
setTimeout(() => {
this.mescroll.resetUpScroll()
}, 120)
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
// 团队人数
.widget-people {
padding: 0 25rpx;
height: 80rpx;
line-height: 60rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
background: #f7f7f7;
}
// 列表内容
.widget-list {
padding: 10rpx 20rpx 40rpx 20rpx;
box-sizing: border-box;
}
.widget__detail {
padding: 20rpx 15rpx;
box-sizing: border-box;
font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7;
.user-avatar {
margin-right: 16rpx;
}
.user-info {
height: 100%;
}
.user-nickName {
margin-bottom: 8rpx;
}
.detail__member {
background-color: #786cff;
color: #fff;
padding: 2rpx 15rpx;
border-radius: 6rpx;
margin-top: 10rpx;
}
}
</style>