zyejMAll-mobile/pages/commission/components/commission-log.vue

182 lines
4.3 KiB
Vue
Raw Normal View History

2024-08-07 10:31:42 +08:00
<!-- 分销首页明细列表 -->
<template>
2024-08-07 21:40:27 +08:00
<view class="distribution-log-wrap">
<view class="header-box">
2024-09-30 19:00:13 +08:00
<image class="header-bg" src="https://zysc.fjptzykj.com:3000/shangcheng/e5caf4c1869d7af8ea254a0e403848c453375bcb22f414db52a2c93a345e1e36.png" />
2024-08-07 21:40:27 +08:00
<view class="ss-flex header-title">
<view class="title">实时动态</view>
<text class="cicon-forward" />
</view>
</view>
<scroll-view
scroll-y="true"
@scrolltolower="loadmore"
class="scroll-box log-scroll"
scroll-with-animation="true"
>
<view v-if="state.pagination.list">
<view
class="log-item-box ss-flex ss-row-between"
v-for="item in state.pagination.list"
:key="item.id"
>
<view class="log-item-wrap">
<view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
<view class="ss-flex ss-col-center">
<image
class="log-img"
2024-09-30 19:00:13 +08:00
src="https://zysc.fjptzykj.com:3000/shangcheng/c4bf2f61c013c7413121274b3b75a068d992727459ba89623cc68d3521a199fe.png"
2024-08-07 21:40:27 +08:00
mode="aspectFill"
/>
</view>
<view class="log-text ss-ellipsis-1">
2024-08-07 10:31:42 +08:00
{{ item.title }} {{ fen2yuan(item.price) }}
</view>
2024-08-07 21:40:27 +08:00
</view>
</view>
<text class="log-time">{{ dayjs(item.createTime).fromNow() }}</text>
</view>
</view>
<!-- 加载更多 -->
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
color="#333333"
@tap="loadmore"
/>
</scroll-view>
</view>
2024-08-07 10:31:42 +08:00
</template>
<script setup>
2024-08-07 21:40:27 +08:00
import sheep from '@/sheep';
import { reactive } from 'vue';
import _ from 'lodash';
import dayjs from 'dayjs';
2024-08-07 10:31:42 +08:00
import BrokerageApi from '@/sheep/api/trade/brokerage';
import { fen2yuan } from '../../../sheep/hooks/useGoods';
2024-08-07 21:40:27 +08:00
const state = reactive({
loadStatus: '',
pagination: {
2024-08-07 10:31:42 +08:00
list: [],
total: 0,
pageNo: 1,
2024-11-04 11:13:41 +08:00
pageSize: 8,
2024-08-07 21:40:27 +08:00
},
});
2024-08-07 10:31:42 +08:00
2024-08-07 21:40:27 +08:00
async function getLog() {
2024-08-07 10:31:42 +08:00
state.loadStatus = 'loading';
const { code, data } = await BrokerageApi.getBrokerageRecordPage({
pageNo: state.pagination.pageNo,
2024-08-07 21:40:27 +08:00
pageSize: state.pagination.pageSize,
});
2024-08-07 10:31:42 +08:00
if (code !== 0) {
return;
}
state.pagination.list = _.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
2024-08-07 21:40:27 +08:00
}
2024-08-07 10:31:42 +08:00
2024-08-07 21:40:27 +08:00
getLog();
2024-08-07 10:31:42 +08:00
2024-08-07 21:40:27 +08:00
// 加载更多
function loadmore() {
2024-08-07 10:31:42 +08:00
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getLog();
}
</script>
<style lang="scss" scoped>
2024-08-07 21:40:27 +08:00
.distribution-log-wrap {
width: 690rpx;
margin: 0 auto;
margin-bottom: 20rpx;
border-radius: 12rpx;
z-index: 3;
position: relative;
.header-box {
width: 690rpx;
height: 76rpx;
position: relative;
.header-bg {
width: 690rpx;
height: 76rpx;
}
.header-title {
position: absolute;
left: 20rpx;
top: 24rpx;
}
.title {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: 30rpx;
}
.cicon-forward {
font-size: 30rpx;
font-weight: 400;
color: #ffffff;
line-height: 30rpx;
}
}
.log-scroll {
height: 600rpx;
background: #fdfae9;
padding: 10rpx 20rpx 0;
box-sizing: border-box;
border-radius: 0 0 12rpx 12rpx;
.log-item-box {
margin-bottom: 20rpx;
.log-time {
// margin-left: 30rpx;
text-align: right;
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 400;
color: #c4c4c4;
}
}
.loadmore-wrap {
// line-height: 80rpx;
}
.log-item {
// background: rgba(#ffffff, 0.2);
border-radius: 24rpx;
padding: 6rpx 20rpx 6rpx 12rpx;
.log-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.log-text {
max-width: 480rpx;
font-size: 24rpx;
font-weight: 500;
color: #333333;
}
}
}
}
</style>