348 lines
7.7 KiB
Vue
348 lines
7.7 KiB
Vue
<template>
|
|
<s-pages title="收支明细" :blue_bg="true" navPreset="float">
|
|
<view class="page" @click="filterOpen = false">
|
|
<view class="hero-card">
|
|
<view class="hero-left">
|
|
<view class="hero-title">未行权金额</view>
|
|
<view class="hero-amount">{{ $fen2yuan(totalAmount) }}</view>
|
|
</view>
|
|
<image class="hero-illustration" src="/static/icon/mingxi.svg" mode="aspectFit" />
|
|
</view>
|
|
|
|
<view class="detail-card">
|
|
<view class="detail-header">
|
|
<view class="detail-title">收支明细</view>
|
|
<view class="detail-filter" @click.stop="filterOpen = !filterOpen">
|
|
{{ filterOptions[filterIndex]?.text || '全部' }}
|
|
<text class="detail-arrow">▼</text>
|
|
</view>
|
|
<view class="detail-filter-menu" v-if="filterOpen" @click.stop>
|
|
<view
|
|
class="detail-filter-item"
|
|
v-for="(opt, i) in filterOptions"
|
|
:key="opt.value"
|
|
@click.stop="onFilterChange(i)"
|
|
>
|
|
{{ opt.text }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-if="isIncomeFilter" class="income-tabs" @click.stop>
|
|
<view
|
|
v-for="tab in incomeTabs"
|
|
:key="tab.value"
|
|
class="income-tab"
|
|
:class="{ active: incomeTabValue === tab.value }"
|
|
@click.stop="onIncomeTabChange(tab.value)"
|
|
>
|
|
{{ tab.text }}
|
|
</view>
|
|
</view>
|
|
<card_mescroll ref="cardPages" @upCallback="getList" :height="listHeight">
|
|
<view class="detail-item" v-for="(item, index) in detailList" :key="index">
|
|
<view class="detail-main">
|
|
<view class="detail-name">{{ getItemTitle(item) }}</view>
|
|
<view class="detail-time">{{ formatDate(item.createTime) }}</view>
|
|
</view>
|
|
<view class="detail-amount">
|
|
{{ getItemAmount(item) > 0 ? '+' : '' }}{{ $fen2yuan(getItemAmount(item)) }}
|
|
</view>
|
|
</view>
|
|
</card_mescroll>
|
|
</view>
|
|
</view>
|
|
</s-pages>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue';
|
|
import { onShow } from '@dcloudio/uni-app';
|
|
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
|
import * as api from '@/sheep/api/home/pay';
|
|
import { formatDate, sourceTypeObj } from '@/sheep/helper/utils';
|
|
|
|
const totalAmount = ref(0);
|
|
const detailList = ref([]);
|
|
const cardPages = ref(null);
|
|
const filterOpen = ref(false);
|
|
const filterIndex = ref(0);
|
|
const incomeTabValue = ref(null);
|
|
const filterOptions = [
|
|
// {
|
|
// value: 0,
|
|
// text: '全部',
|
|
// },
|
|
{
|
|
value: 1,
|
|
text: '佣金',
|
|
},
|
|
{
|
|
value: 2,
|
|
text: '收益',
|
|
},
|
|
{
|
|
value: 3,
|
|
text: '分红',
|
|
},
|
|
];
|
|
|
|
const incomeTabs = [
|
|
{ value: 4, text: '店长收益' },
|
|
{ value: 5, text: '权益收益' },
|
|
{ value: 6, text: '代理收益' },
|
|
];
|
|
|
|
const isIncomeFilter = ref(false);
|
|
|
|
const syncIncomeFilterFlag = () => {
|
|
const opt = filterOptions[filterIndex.value];
|
|
isIncomeFilter.value = Number(opt?.value) === 2;
|
|
};
|
|
|
|
const sysInfo = uni.getSystemInfoSync();
|
|
const listHeight =
|
|
sysInfo.windowHeight -
|
|
sysInfo.statusBarHeight -
|
|
uni.upx2px(88) -
|
|
uni.upx2px(280) -
|
|
uni.upx2px(32) -
|
|
uni.upx2px(40) +
|
|
'px';
|
|
|
|
const getHeaderData = async () => {
|
|
const res = await api.agentEarningsTrendNew({}).catch(() => ({ code: -1 }));
|
|
if (res.code === 0) {
|
|
totalAmount.value = res.data?.remainingEarningAll || 0;
|
|
}
|
|
};
|
|
|
|
const getList = async (mescroll) => {
|
|
const opt = filterOptions[filterIndex.value] || filterOptions[0];
|
|
const transactionType =
|
|
isIncomeFilter.value && incomeTabValue.value ? incomeTabValue.value : opt.value;
|
|
const res = await api
|
|
.agentEarningsIncomeDetailsPage({
|
|
pageNo: mescroll.num,
|
|
pageSize: mescroll.size,
|
|
...(transactionType ? { transactionType } : {}),
|
|
})
|
|
.catch(() => ({ code: -1 }));
|
|
|
|
if (res.code === 0) {
|
|
const list = res.data?.list || [];
|
|
if (mescroll.num === 1) detailList.value = [];
|
|
detailList.value = detailList.value.concat(list);
|
|
cardPages.value?.getState(true, list.length, res.data?.total);
|
|
return;
|
|
}
|
|
|
|
cardPages.value?.getState(false);
|
|
};
|
|
|
|
const getItemTitle = (item) => {
|
|
const incomeSourceTypeLabelMap = {
|
|
4: '店长收益',
|
|
5: '权益收益',
|
|
6: '代理收益',
|
|
};
|
|
const sourceType = Number(item?.sourceType);
|
|
return (
|
|
item?.remark ||
|
|
item?.title ||
|
|
incomeSourceTypeLabelMap[sourceType] ||
|
|
sourceTypeObj[sourceType || 1] ||
|
|
'未行权金额'
|
|
);
|
|
};
|
|
|
|
const getItemAmount = (item) => {
|
|
const raw = item?.totalEarnings ?? item?.amount ?? item?.price ?? item?.remainingEarning ?? 0;
|
|
const n = Number(raw);
|
|
return Number.isFinite(n) ? n : 0;
|
|
};
|
|
|
|
const onFilterChange = (i) => {
|
|
filterIndex.value = i;
|
|
filterOpen.value = false;
|
|
incomeTabValue.value = null;
|
|
syncIncomeFilterFlag();
|
|
cardPages.value?.mescrollTrigger();
|
|
};
|
|
|
|
const onIncomeTabChange = (val) => {
|
|
const next = Number(val);
|
|
incomeTabValue.value = incomeTabValue.value === next ? null : next;
|
|
cardPages.value?.mescrollTrigger();
|
|
};
|
|
|
|
onShow(() => {
|
|
getHeaderData();
|
|
syncIncomeFilterFlag();
|
|
cardPages.value?.mescrollTrigger();
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.page {
|
|
padding: 32rpx 40rpx 0;
|
|
}
|
|
|
|
.hero-card {
|
|
height: 220rpx;
|
|
border-radius: 16rpx;
|
|
padding: 36rpx 32rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
// background: url("https://sycbuck.oss-cn-hangzhou.aliyuncs.com/app/home/agency2.png")
|
|
// center / 100% 100% no-repeat;
|
|
background: linear-gradient(135deg, #ffc6e6 0%, #fb7f33 100%);
|
|
margin-bottom: 32rpx;
|
|
}
|
|
|
|
.hero-left {
|
|
color: #ffffff;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 36rpx;
|
|
line-height: 50rpx;
|
|
font-weight: 500;
|
|
// opacity: 0.75;
|
|
}
|
|
|
|
.hero-amount {
|
|
margin-top: 18rpx;
|
|
font-size: 68rpx;
|
|
line-height: 82rpx;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.hero-illustration {
|
|
width: 220rpx;
|
|
height: 136rpx;
|
|
flex-shrink: 0;
|
|
filter: brightness(0) invert(1);
|
|
}
|
|
|
|
.detail-card {
|
|
background: rgba(255, 255, 255, 0.98);
|
|
border-radius: 24rpx 24rpx 0 0;
|
|
padding: 0 24rpx;
|
|
}
|
|
|
|
.detail-title {
|
|
font-size: 32rpx;
|
|
line-height: 110rpx;
|
|
color: #111111;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.detail-header {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 110rpx;
|
|
}
|
|
|
|
.detail-filter {
|
|
height: 52rpx;
|
|
line-height: 52rpx;
|
|
padding: 0 18rpx;
|
|
background: #f2f4f7;
|
|
border-radius: 16rpx;
|
|
font-size: 24rpx;
|
|
color: #111111;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.detail-arrow {
|
|
margin-left: 10rpx;
|
|
font-size: 22rpx;
|
|
}
|
|
|
|
.detail-filter-menu {
|
|
position: absolute;
|
|
right: 0;
|
|
top: 110rpx;
|
|
width: 160rpx;
|
|
background: #f2f4f7;
|
|
border-radius: 16rpx;
|
|
z-index: 10;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.income-tabs {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-start;
|
|
gap: 12rpx;
|
|
}
|
|
|
|
.income-tab {
|
|
width: 132rpx;
|
|
padding: 5rpx 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: #fff;
|
|
border-radius: 14rpx;
|
|
overflow: hidden;
|
|
font-size: 22rpx;
|
|
color: #111111;
|
|
border: 2rpx solid #d9d9d9;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
|
|
|
|
.income-tab.active {
|
|
color: #fb4d32;
|
|
background: #ffefe5;
|
|
border-color: transparent;
|
|
}
|
|
|
|
.detail-filter-item {
|
|
text-align: center;
|
|
line-height: 72rpx;
|
|
font-size: 26rpx;
|
|
color: #111111;
|
|
}
|
|
|
|
.detail-item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 32rpx 0;
|
|
border-bottom: 2rpx solid #f1f2f5;
|
|
}
|
|
|
|
.detail-main {
|
|
flex: 1;
|
|
padding-right: 24rpx;
|
|
}
|
|
|
|
.detail-name {
|
|
font-size: 28rpx;
|
|
line-height: 40rpx;
|
|
color: #111111;
|
|
}
|
|
|
|
.detail-time {
|
|
margin-top: 10rpx;
|
|
font-size: 24rpx;
|
|
line-height: 34rpx;
|
|
color: #999999;
|
|
}
|
|
|
|
.detail-amount {
|
|
flex-shrink: 0;
|
|
font-size: 32rpx;
|
|
line-height: 46rpx;
|
|
color: #ee0a24;
|
|
font-weight: 500;
|
|
}
|
|
</style>
|