|
@@ -1,48 +1,55 @@
|
|
|
<template>
|
|
|
- <view class="income-main">
|
|
|
- <view class="income-header card-box">
|
|
|
- <text class="income-title" @click="onShows">
|
|
|
- {{ dataYMD }}
|
|
|
- </text>
|
|
|
- <view class="income-header-right">
|
|
|
- <text>收入: ¥{{ data.totalEarning }}</text>
|
|
|
- <text class="income-header-right-right">支出: ¥{{ data.totalExpend }}</text>
|
|
|
+ <scroll-view refresher-enabled :refresher-triggered="isRefreshing" @refresherrefresh="onCustomRefresh"
|
|
|
+ class="scroll-view-class" @scrolltolower="scrolltolower" scroll-y>
|
|
|
+ <view class="income-main">
|
|
|
+ <view class="income-header card-box">
|
|
|
+ <text class="income-title" @click="onShows">
|
|
|
+ {{ dataYMD }}
|
|
|
+ </text>
|
|
|
+ <view class="income-header-right">
|
|
|
+ <text>收入: ¥{{ data.totalEarning }}</text>
|
|
|
+ <text class="income-header-right-right">支出: ¥{{ data.totalExpend }}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
|
- <view v-if="data.clientAccountChangeVOlist && data.clientAccountChangeVOlist.length > 0">
|
|
|
- <view class="card-box icome-item" v-for="item in data.clientAccountChangeVOlist" :key="item.code" @click="onClick(item)">
|
|
|
- <view class="card-left">
|
|
|
- <!-- <img :src="baseUrl" alt="" class="income-img"> -->
|
|
|
- <view class="card-left-text">
|
|
|
- <view class="card-left-name">
|
|
|
- <dict-tag :options="jlzj_client_source_type" :value="item.sourceType" />
|
|
|
- ({{ item.businessTierName }})
|
|
|
+ <view v-if="data.clientAccountChangeVOlist && data.clientAccountChangeVOlist.length > 0">
|
|
|
+ <view class="card-box icome-item" v-for="item in data.clientAccountChangeVOlist" :key="item.code"
|
|
|
+ @click="onClick(item)">
|
|
|
+ <view class="card-left">
|
|
|
+ <!-- <img :src="baseUrl" alt="" class="income-img"> -->
|
|
|
+ <view class="card-left-text">
|
|
|
+ <view class="card-left-name">
|
|
|
+ <dict-tag :options="jlzj_client_source_type" :value="item.sourceType" />
|
|
|
+ ({{ item.businessTierName }})
|
|
|
+ </view>
|
|
|
+ <view class="card-left-date">{{ item.createTime }}</view>
|
|
|
</view>
|
|
|
- <view class="card-left-date">{{ item.createTime }}</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
|
- <view class="card-rigth"
|
|
|
- :style="{ color: item.changeType === '1' ? 'rgba(76, 175, 80, 1)' : 'rgba(244, 67, 54, 1)' }">
|
|
|
- {{ item.changeType === '1' ? '+' : '-' }}{{ item.changeMoney }}
|
|
|
+ <view class="card-rigth"
|
|
|
+ :style="{ color: item.changeType === '1' ? 'rgba(76, 175, 80, 1)' : 'rgba(244, 67, 54, 1)' }">
|
|
|
+ {{ item.changeType === '1' ? '+' : '-' }}{{ item.changeMoney }}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
-
|
|
|
+ <up-loadmore style="margin-top: 40rpx;" :status="loadmoreInfo.status"
|
|
|
+ :loadmoreText="loadmoreInfo.loadingText" :loadingText="loadmoreInfo.loadmoreText"
|
|
|
+ :nomoreText="loadmoreInfo.nomoreText" @loadmore="handleLoadmore" />
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <NoneView value="您还没有相关账单" />
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view v-else>
|
|
|
- <NoneView value="您还没有相关账单" />
|
|
|
- </view>
|
|
|
|
|
|
|
|
|
- <up-datetime-picker :show="show" v-model="datetime" mode="date" ref="uPickerRef" @confirm="confirm"
|
|
|
- @cancel="cancel"></up-datetime-picker>
|
|
|
- </view>
|
|
|
+ <up-datetime-picker :show="show" v-model="datetime" mode="date" ref="uPickerRef" @confirm="confirm"
|
|
|
+ @cancel="cancel"></up-datetime-picker>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, computed } from 'vue'
|
|
|
-import { getAccountChangeList } from "@/api/mine";
|
|
|
+import { getAccountChangeList, getTotalMoney } from "@/api/mine";
|
|
|
import {
|
|
|
onShow
|
|
|
} from '@dcloudio/uni-app';
|
|
@@ -73,42 +80,75 @@ const dataYMD = computed(() => {
|
|
|
})
|
|
|
|
|
|
const uPickerRef = ref(null)
|
|
|
+const isRefreshing = ref(false)
|
|
|
+
|
|
|
+
|
|
|
+const loadmoreInfo = ref({
|
|
|
+ status: 'loadmore',
|
|
|
+ loadingText: '努力加载中...',
|
|
|
+ loadmoreText: '点击加载更多~',
|
|
|
+ nomoreText: '已经到底啦~'
|
|
|
+})
|
|
|
+const pages = ref({
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 0,
|
|
|
+})
|
|
|
const onShows = () => {
|
|
|
show.value = true;
|
|
|
};
|
|
|
|
|
|
const confirm = () => {
|
|
|
- console.log('confirm', datetime.value);
|
|
|
show.value = false;
|
|
|
- init();
|
|
|
+ init('top');
|
|
|
+ totalInit();
|
|
|
};
|
|
|
|
|
|
const cancel = () => {
|
|
|
show.value = false;
|
|
|
};
|
|
|
-const onClick = (record) =>{
|
|
|
+const onClick = (record) => {
|
|
|
record.mainOrderId && uni.navigateTo({
|
|
|
url: `/pages_classify/pages/orderItem/orderdetails?mainOrderId=${record.mainOrderId}`
|
|
|
});
|
|
|
}
|
|
|
+const scrolltolower = () => {
|
|
|
+ init('bottom')
|
|
|
+};
|
|
|
|
|
|
-const init = async () => {
|
|
|
+const onCustomRefresh = () => {
|
|
|
+ isRefreshing.value = true;
|
|
|
+ pages.value.current = 1;
|
|
|
+ // data.value.clientAccountChangeVOlist = [];
|
|
|
+ init('top')
|
|
|
+};
|
|
|
+
|
|
|
+const init = async (type) => {
|
|
|
try {
|
|
|
- uni.showLoading({
|
|
|
- title: '数据加载中...'
|
|
|
- });
|
|
|
|
|
|
- if (userType === 2) {
|
|
|
- // const res = await getVolunteerAccountInfo();
|
|
|
- // data.value =res.data;
|
|
|
- }
|
|
|
- if (userType === 1) {
|
|
|
- const res = await getAccountChangeList({
|
|
|
- createTime: dayjs(datetime.value).format('YYYY-MM-DD')
|
|
|
- });
|
|
|
- console.log(1, res);
|
|
|
- res.data && (data.value = res.data);
|
|
|
+
|
|
|
+ if (type === 'bottom') {
|
|
|
+ if (data.value.clientAccountChangeVOlist.length < pages.value.total) {
|
|
|
+ loadmoreInfo.value.status = 'loading';
|
|
|
+ pages.value.current++;
|
|
|
+ } else {
|
|
|
+ loadmoreInfo.value.status = 'nomore';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '数据加载中...',
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
+ const listApi = userType === 1 ? getAccountChangeList : getAccountChangeList;
|
|
|
+ const res = await listApi({
|
|
|
+ createTime: dayjs(datetime.value).format('YYYY-MM-DD'),
|
|
|
+ pageNum: pages.value.current,
|
|
|
+ pageSize: pages.value.pageSize,
|
|
|
+ });
|
|
|
+ data.value.clientAccountChangeVOlist =type === 'top'? res.rows : [...data.value.clientAccountChangeVOlist, ...res.rows];
|
|
|
+ pages.value.total = res.total;
|
|
|
} catch (error) {
|
|
|
console.log('error', error);
|
|
|
uni.showToast({
|
|
@@ -116,11 +156,33 @@ const init = async () => {
|
|
|
icon: 'error',
|
|
|
});
|
|
|
} finally {
|
|
|
- uni.hideLoading();
|
|
|
+ if (type === 'top') {
|
|
|
+ isRefreshing.value = false;
|
|
|
+ uni.hideLoading();
|
|
|
+ } else {
|
|
|
+ loadmoreInfo.value.status = 'nomore';
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const totalInit = async () => {
|
|
|
+ try {
|
|
|
+ const res = await getTotalMoney({
|
|
|
+ createTime: dayjs(datetime.value).format('YYYY-MM-DD'),
|
|
|
+ });
|
|
|
+ data.value.totalEarning = res.data.totalEarning;
|
|
|
+ data.value.totalExpend = res.data.totalExpend;
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error', error);
|
|
|
+ uni.showToast({
|
|
|
+ title: error.msg,
|
|
|
+ icon: 'error',
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
onShow(() => {
|
|
|
- init();
|
|
|
+ init('top');
|
|
|
+ totalInit();
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -133,14 +195,14 @@ onShow(() => {
|
|
|
}
|
|
|
|
|
|
.income-main {
|
|
|
- position: fixed;
|
|
|
- top: 0px;
|
|
|
- left: 0px;
|
|
|
- right: 0px;
|
|
|
- bottom: 0px;
|
|
|
- background: rgba(245, 245, 245, 1);
|
|
|
+ // position: fixed;
|
|
|
+ // top: 0px;
|
|
|
+ // left: 0px;
|
|
|
+ // right: 0px;
|
|
|
+ // bottom: 0px;
|
|
|
+
|
|
|
padding: 12px;
|
|
|
- overflow: auto;
|
|
|
+ // overflow: auto;
|
|
|
|
|
|
.income-title {
|
|
|
font-size: 16px;
|
|
@@ -220,4 +282,15 @@ onShow(() => {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+.scroll-view-class {
|
|
|
+ // height: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ background: rgba(245, 245, 245, 1);
|
|
|
+ // position: fixed;
|
|
|
+ // top: 0px;
|
|
|
+ // bottom: 0;
|
|
|
+ // left: 0;
|
|
|
+ // right: 0;
|
|
|
+}
|
|
|
</style>
|