204 行
5.1 KiB
Vue
204 行
5.1 KiB
Vue
<!-- 分销明细实时动态 -->
|
|
<template>
|
|
<view class="distribution-log-wrap">
|
|
<!-- 头部栏 -->
|
|
<view class="log-header ss-flex ss-row-between ss-col-center">
|
|
<view class="header-left ss-flex ss-col-center">
|
|
<view class="title-bar"></view>
|
|
<text class="title">实时动态</text>
|
|
</view>
|
|
<text class="sub-hint">团队实时变动</text>
|
|
</view>
|
|
|
|
<!-- 滚动列表 -->
|
|
<scroll-view
|
|
scroll-y="true"
|
|
@scrolltolower="loadmore"
|
|
class="scroll-box log-scroll"
|
|
scroll-with-animation="true"
|
|
>
|
|
<view v-if="state.pagination.data && state.pagination.data.length > 0">
|
|
<view
|
|
class="log-item-box ss-flex ss-row-between ss-col-center"
|
|
v-for="item in state.pagination.data"
|
|
:key="item.id"
|
|
>
|
|
<view class="log-item-left ss-flex ss-col-center ss-flex-1 ss-line-1">
|
|
<image
|
|
v-if="item.oper_type === 'user'"
|
|
class="log-img"
|
|
:src="sheep.$url.cdn(item.oper?.avatar)"
|
|
mode="aspectFill"
|
|
></image>
|
|
<image
|
|
v-else-if="item.oper_type === 'admin'"
|
|
class="log-img"
|
|
:src="sheep.$url.static('/assets/addons/shopro/uniapp/avatar/default_user.png')"
|
|
mode="aspectFill"
|
|
></image>
|
|
<image
|
|
v-else
|
|
class="log-img"
|
|
:src="sheep.$url.static('/assets/addons/shopro/uniapp/avatar/notice.png')"
|
|
mode="aspectFill"
|
|
></image>
|
|
<text class="log-text ss-line-1">{{ item.remark }}</text>
|
|
</view>
|
|
<text class="log-time ss-m-l-16">{{ dayjs(item.createtime).fromNow() }}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view v-else class="empty-wrap ss-flex ss-row-center ss-col-center">
|
|
<text class="empty-text">暂无团队实时动态</text>
|
|
</view>
|
|
|
|
<!-- 加载更多 -->
|
|
<uni-load-more
|
|
v-if="state.pagination.total > 0"
|
|
:status="state.loadStatus"
|
|
color="#999999"
|
|
@tap="loadmore"
|
|
/>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import sheep from '@/sheep';
|
|
import { reactive } from 'vue';
|
|
import _ from 'lodash';
|
|
import dayjs from 'dayjs';
|
|
|
|
const state = reactive({
|
|
loadStatus: '',
|
|
pagination: {
|
|
data: [],
|
|
current_page: 1,
|
|
total: 1,
|
|
last_page: 1,
|
|
},
|
|
});
|
|
|
|
async function getLog(page = 1) {
|
|
const res = await sheep.$api.commission.log({
|
|
page,
|
|
});
|
|
if (res.code === 1) {
|
|
let list = _.concat(state.pagination.data, res.data.data);
|
|
state.pagination = {
|
|
...res.data,
|
|
data: list,
|
|
};
|
|
if (state.pagination.current_page < state.pagination.last_page) {
|
|
state.loadStatus = 'more';
|
|
} else {
|
|
state.loadStatus = 'noMore';
|
|
}
|
|
}
|
|
}
|
|
|
|
getLog();
|
|
|
|
// 加载更多
|
|
function loadmore() {
|
|
if (state.loadStatus !== 'noMore') {
|
|
getLog(state.pagination.current_page + 1);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.distribution-log-wrap {
|
|
width: 694rpx;
|
|
margin: 0 auto 30rpx;
|
|
background: #ffffff;
|
|
border-radius: 20rpx;
|
|
border: 1rpx solid rgba(224, 185, 130, 0.3);
|
|
box-shadow: 0 6rpx 20rpx rgba(105, 46, 4, 0.05);
|
|
z-index: 3;
|
|
position: relative;
|
|
overflow: hidden;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.log-header {
|
|
padding: 22rpx 28rpx 18rpx 28rpx;
|
|
background: linear-gradient(180deg, #fffcf6 0%, #ffffff 100%);
|
|
border-bottom: 1rpx solid #f6f0e4;
|
|
|
|
.header-left {
|
|
.title-bar {
|
|
width: 6rpx;
|
|
height: 24rpx;
|
|
border-radius: 4rpx;
|
|
background: linear-gradient(180deg, #ff6000 0%, #ff9500 100%);
|
|
margin-right: 12rpx;
|
|
}
|
|
|
|
.title {
|
|
font-size: 26rpx;
|
|
font-weight: 700;
|
|
color: #522703;
|
|
line-height: 32rpx;
|
|
}
|
|
}
|
|
|
|
.sub-hint {
|
|
font-size: 22rpx;
|
|
color: #b5906a;
|
|
font-weight: 500;
|
|
}
|
|
}
|
|
|
|
.log-scroll {
|
|
max-height: 520rpx;
|
|
background: #ffffff;
|
|
padding: 8rpx 28rpx 20rpx;
|
|
box-sizing: border-box;
|
|
|
|
.log-item-box {
|
|
padding: 20rpx 0;
|
|
border-bottom: 1rpx solid #faf6f0;
|
|
|
|
&:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.log-item-left {
|
|
.log-img {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
border-radius: 50%;
|
|
margin-right: 14rpx;
|
|
flex-shrink: 0;
|
|
background: #f5f5f5;
|
|
}
|
|
|
|
.log-text {
|
|
font-size: 24rpx;
|
|
color: #333333;
|
|
font-weight: 500;
|
|
line-height: 34rpx;
|
|
}
|
|
}
|
|
|
|
.log-time {
|
|
font-size: 22rpx;
|
|
font-family: OPPOSANS, sans-serif;
|
|
color: #a1a1aa;
|
|
white-space: nowrap;
|
|
flex-shrink: 0;
|
|
}
|
|
}
|
|
|
|
.empty-wrap {
|
|
padding: 60rpx 0;
|
|
|
|
.empty-text {
|
|
font-size: 24rpx;
|
|
color: #c4c4c4;
|
|
}
|
|
}
|
|
}
|
|
</style>
|