feat: 金种子、邀请页、启动页API、银行卡

This commit is contained in:
2026-05-26 16:26:52 +08:00
parent b0744c8ab6
commit 30fdac8a06
17 changed files with 1756 additions and 346 deletions
+665 -115
View File
@@ -44,16 +44,140 @@
>
</view>
</view>
<view class="m-b-50" v-if="dataObj?.premiumList?.length">
<view class="title c32 f500 m-b-40 size32">金种子溢价表</view>
<view class="wrap">
<card_echart :options="chartOption" />
<view class="seed-card seed-card--trend m-b-50">
<view class="seed-card__header">
<view class="seed-card__left">
<view class="seed-card__icon">
<image
class="seed-card__icon-img"
src="/static/icon/2.svg"
mode="scaleToFill"
/>
</view>
<view class="seed-card__title">价格趋势走势</view>
</view>
<view class="seed-card__tabs">
<view
class="seed-card__tab"
:class="{ active: trendRange === '7D' }"
@click="trendRange = '7D'"
>7D</view
>
<view
class="seed-card__tab"
:class="{ active: trendRange === '1M' }"
@click="trendRange = '1M'"
>1M</view
>
<view
class="seed-card__tab"
:class="{ active: trendRange === '1Y' }"
@click="trendRange = '1Y'"
>1Y</view
>
</view>
</view>
<view class="seed-card__body">
<view class="emptyMask" v-if="!trendHasData">敬请期待</view>
<card_echart :options="chartTrend" />
</view>
</view>
<view v-if="dataObj?.dividendPool?.length">
<view class="title c32 f500 m-b-40 size32">生态分红池</view>
<view class="wrap">
<card_echart :options="chartOption1" />
<view class="seed-card seed-card--pool m-b-50">
<view class="seed-card__header">
<view class="seed-card__left">
<view class="seed-card__icon">
<image
class="seed-card__icon-img"
src="/static/icon/3.svg"
mode="scaleToFill"
/>
</view>
<view>
<view class="seed-card__title">池体量增长动态</view>
<view class="seed-card__sub">近7日资金池规模变动情况</view>
</view>
</view>
<view class="seed-card__badge">{{ poolRateText }}</view>
</view>
<view class="seed-card__stats">
<view class="seed-card__stat">
<view class="seed-card__stat-label">总体量</view>
<view class="seed-card__stat-value">{{ poolTotalText }}</view>
</view>
<view class="seed-card__stat">
<view class="seed-card__stat-label">今日增量</view>
<view class="seed-card__stat-value seed-card__stat-value--up">{{
poolTodayIncText
}}</view>
</view>
<view class="seed-card__stat">
<view class="seed-card__stat-label">活跃占比</view>
<view class="seed-card__stat-value">{{ poolActiveText }}</view>
</view>
</view>
<view class="seed-card__body">
<view class="emptyMask" v-if="!poolHasData">敬请期待</view>
<card_echart :options="chartPool" />
</view>
</view>
<view class="seed-card seed-card--fluctuation m-b-50">
<view class="seed-card__header">
<view class="seed-card__left">
<view class="seed-card__icon">
<image
class="seed-card__icon-img"
src="/static/icon/4.svg"
mode="scaleToFill"
/>
</view>
<view>
<view class="seed-card__title">金种子数量波动</view>
<view class="seed-card__sub">近7日全网总量变动</view>
</view>
</view>
<view class="seed-card__badge">{{ fluctuationRateText }}</view>
</view>
<view class="seed-card__totals">
<view class="seed-card__totals-left">
<view class="seed-card__totals-label">当前全网总量</view>
<view class="seed-card__totals-value">
{{ fluctuationTotalText }}<text class="seed-card__totals-unit">枚</text>
</view>
</view>
<view class="seed-card__totals-right">
<view class="seed-card__totals-label">日变化率</view>
<view class="seed-card__totals-rate" :style="{ color: fluctuationRateColor }">
<text>{{ fluctuationRateText }}</text>
</view>
</view>
</view>
<view class="seed-card__body">
<view class="emptyMask" v-if="!fluctuationHasData">敬请期待</view>
<card_echart :options="chartFluctuation" />
</view>
</view>
<view class="seed-card seed-card--valuation m-b-20">
<view class="seed-card__header">
<view class="seed-card__left">
<uni-icons type="info" size="18" color="#e54035" />
<view class="seed-card__title">单枚综合增值算法</view>
</view>
</view>
<view class="valuation-formula">
<text class="valuation-formula__v">V</text
><text class="valuation-formula__sub">total</text>
<text class="valuation-formula__eq"> = </text>
<text class="valuation-formula__v">V</text
><text class="valuation-formula__sub">base</text>
<text class="valuation-formula__eq"> + </text>
<text class="valuation-formula__v">V</text
><text class="valuation-formula__sub">valuation</text>
</view>
<view class="valuation-desc">
综合增值由底价池增值与企业权益估值共同驱动,按日计算并同步更新。
</view>
</view>
</view>
@@ -64,7 +188,16 @@
</s-layout>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
import {
ref,
reactive,
computed,
onMounted,
onUnmounted,
getCurrentInstance,
watch,
nextTick,
} from 'vue';
import card_echart from '@/components/card_echart/card_echart.vue';
import { onShow } from '@dcloudio/uni-app';
import * as echarts from 'echarts';
@@ -111,140 +244,343 @@
url: '/pages/home/pay/seed?type=1',
},
]);
const chartOption = reactive({
// 添加grid配置,实现间距自适应
const formatCnyShort = (val) => {
const n = Number(val);
if (!Number.isFinite(n)) return '0';
const abs = Math.abs(n);
if (abs >= 1e8) return `${(n / 1e8).toFixed(2)}亿`;
if (abs >= 1e4) return `${(n / 1e4).toFixed(1)}万`;
return String(n);
};
const pad2 = (n) => String(n).padStart(2, '0');
const toLocalDateTime = (d) => {
const y = d.getFullYear();
const m = pad2(d.getMonth() + 1);
const day = pad2(d.getDate());
const hh = pad2(d.getHours());
const mm = pad2(d.getMinutes());
const ss = pad2(d.getSeconds());
return `${y}-${m}-${day}T${hh}:${mm}:${ss}`;
};
const buildTrendParams = () => {
const now = new Date();
const end = new Date(now);
end.setHours(23, 59, 59, 0);
const start = new Date(end);
let granularity = 'DAY';
if (trendRange.value === '7D') {
start.setDate(start.getDate() - 6);
granularity = 'DAY';
} else if (trendRange.value === '1M') {
start.setMonth(start.getMonth() - 1);
granularity = 'MONTH';
} else if (trendRange.value === '1Y') {
start.setFullYear(start.getFullYear() - 1);
granularity = 'YEAR';
}
start.setHours(0, 0, 0, 0);
return {
granularity,
startDateTime: toLocalDateTime(start),
endDateTime: toLocalDateTime(end),
};
};
let trendRange = ref('7D');
const chartTrend = reactive({
tooltip: {
trigger: 'axis',
confine: true,
backgroundColor: 'rgba(0, 0, 0, 0.75)',
borderWidth: 0,
padding: [8, 10],
textStyle: { color: '#ffffff', fontSize: 12 },
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
top: '0',
height: 150,
left: '10%',
right: '10%',
bottom: '16%',
top: '12%',
containLabel: true,
},
xAxis: {
type: 'category',
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
axisLabel: {
color: '#BBBBBB',
interval: 0,
fontSize: 10,
},
axisLine: {
lineStyle: {
color: '#D9D9D9',
type: 'dashed',
},
},
boundaryGap: false,
data: [],
axisTick: { show: false },
axisLine: { show: false },
axisLabel: { color: '#BBBBBB', fontSize: 10, margin: 14, interval: 'auto' },
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#D9D9D9',
type: 'dashed',
},
},
axisLabel: {
color: '#BBBBBB',
show: false,
},
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
smooth: true,
type: 'line',
symbol: 'none', // 不显示数据点
lineStyle: {
color: '#FA7E31',
},
triggerEvent: true, // 确保事件可以被触发
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#FF2B2B' },
{ offset: 1, color: '#FFFFFF' },
]),
},
},
],
// 移动端优化配置
animation: false, // 禁用动画以提高性能
touchMoveThreshold: 10, // 增加触摸移动阈值,避免误触
roam: false, // 禁止缩放和平移
});
const chartOption1 = reactive({
// 添加grid配置,实现间距自适应
grid: {
left: '3%',
right: '4%',
bottom: '6%',
top: '0',
height: 150,
},
xAxis: {
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
axisTick: { show: false },
axisLine: { show: false },
axisLabel: {
color: '#BBBBBB',
interval: 0,
fontSize: 10,
},
},
yAxis: {
splitLine: {
lineStyle: {
color: '#D9D9D9',
type: 'dashed',
},
},
splitLine: { show: false },
axisTick: { show: false },
axisLine: { show: false },
axisLabel: { show: false },
},
color: ['#e54035'],
series: [
{
name: 'hill',
type: 'pictorialBar',
barCategoryGap: '0%',
// symbol: 'path://M0,10 L10,10 L5,0 L0,10 z',
symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 1, 1, [
{ offset: 0, color: '#F7772E' },
{ offset: 1, color: '#EE0A24' },
name: '价格',
data: [],
smooth: true,
connectNulls: true,
type: 'line',
symbol: 'none',
lineStyle: { color: '#EE0A24', width: 3 },
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: 'rgba(238, 10, 36, 0.22)' },
{ offset: 1, color: 'rgba(238, 10, 36, 0.00)' },
]),
},
emphasis: {
itemStyle: {
opacity: 1,
},
},
data: [123, 60, 25, 18, 12, 123, 60, 25],
z: 10,
},
],
touchMoveThreshold: 10,
roam: false,
});
const trendHasData = computed(() => {
const arr = chartTrend?.series?.[0]?.data;
return Array.isArray(arr) && arr.some((v) => v !== null && v !== undefined);
});
const applyTrendData = (list) => {
const arr = Array.isArray(list) ? list : [];
const points = arr.map((item, idx) => {
const label = item?.dateLabel ?? item?.dayOfWeek ?? item?.date ?? item?.time ?? '';
const v = Number(item?.value ?? item?.data ?? item?.price ?? item?.y ?? 0);
return { label: String(label || idx), v: Number.isFinite(v) ? v : 0 };
});
chartTrend.xAxis.data = points.map((p) => p.label);
chartTrend.series[0].data = points.map((p) => p.v);
const singlePoint = points.length === 1;
chartTrend.series[0].symbol = singlePoint ? 'circle' : 'none';
chartTrend.series[0].showSymbol = singlePoint;
chartTrend.series[0].symbolSize = singlePoint ? 6 : 0;
};
const fetchTrend = async () => {
const params = buildTrendParams();
const res: any = await api.goldSeedTrend(params);
if (res?.code !== 0) {
applyTrendData([]);
return;
}
applyTrendData(res?.data);
};
watch(
() => trendRange.value,
() => {
fetchTrend();
},
);
const chartPool = reactive({
grid: {
left: '10%',
right: '10%',
bottom: '26%',
top: '10%',
containLabel: true,
},
tooltip: {
trigger: 'axis',
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } },
},
legend: {
icon: 'roundRect',
itemWidth: 15,
itemHeight: 5,
data: ['分红池', '底价存池'],
},
color: ['rgba(238, 10, 36, 0.55)', 'rgba(247, 119, 46, 0.55)'],
xAxis: {
type: 'category',
boundaryGap: false,
data: [],
axisTick: { show: false },
axisLine: { show: false },
axisLabel: { color: '#BBBBBB', fontSize: 10, margin: 14, interval: 'auto' },
},
yAxis: {
type: 'value',
splitLine: { show: false },
axisTick: { show: false },
axisLine: { show: false },
axisLabel: { show: false },
},
series: [
{
name: '底价存池',
type: 'line',
stack: 'total',
smooth: true,
symbol: 'none',
data: [],
lineStyle: { color: 'transparent', width: 2 },
areaStyle: { color: 'rgba(247, 119, 46, 0.25)' },
},
{
name: '分红池',
type: 'line',
stack: 'total',
smooth: true,
symbol: 'none',
data: [],
lineStyle: { color: 'transparent', width: 2 },
areaStyle: { color: 'rgba(238, 10, 36, 0.18)' },
},
],
touchMoveThreshold: 10,
roam: false,
});
const poolGrowthData = ref(null);
const poolTotalText = computed(() => {
const v = Number(poolGrowthData.value?.totalPool);
return Number.isFinite(v) ? formatCnyShort(v) : '0';
});
const poolTodayIncText = computed(() => {
const n = Number(poolGrowthData.value?.todayIncrement);
if (!Number.isFinite(n)) return '+0';
const sign = n > 0 ? '+' : '';
return `${sign}${formatCnyShort(n)}`;
});
const poolRateText = computed(() => {
const raw = poolGrowthData.value?.weekGrowthRate ?? poolGrowthData.value?.todayGrowthRate;
const n = Number(raw);
if (!Number.isFinite(n)) return '+0.0%';
const sign = n > 0 ? '+' : '';
return `${sign}${n.toFixed(1)}%`;
});
const poolActiveText = computed(() => {
const n = Number(poolGrowthData.value?.activeRate);
if (!Number.isFinite(n)) return '-';
return `${n.toFixed(1)}%`;
});
const poolHasData = computed(() => {
const s0 = chartPool?.series?.[0]?.data;
const s1 = chartPool?.series?.[1]?.data;
const has0 = Array.isArray(s0) && s0.length > 0;
const has1 = Array.isArray(s1) && s1.length > 0;
return has0 || has1;
});
const fetchPoolGrowth = async () => {
const res: any = await api.goldSeedPoolGrowth();
if (res?.code !== 0) {
poolGrowthData.value = null;
chartPool.xAxis.data = [];
chartPool.series[0].data = [];
chartPool.series[1].data = [];
return;
}
poolGrowthData.value = res?.data || {};
const list = Array.isArray(poolGrowthData.value?.dailyDataList)
? poolGrowthData.value.dailyDataList
: [];
const x = list.map((it) => it?.dayOfWeek ?? it?.dateLabel ?? '');
const dividend = list.map((it) => Number(it?.dividendPool) || 0);
const floor = list.map((it) => Number(it?.floorPool) || 0);
chartPool.xAxis.data = x;
chartPool.series[0].data = floor;
chartPool.series[1].data = dividend;
};
const chartFluctuation = reactive({
tooltip: { trigger: 'axis' },
grid: { left: '10%', right: '10%', bottom: '36%', top: '10%' },
xAxis: { type: 'category', boundaryGap: false, data: [] },
yAxis: { type: 'value', show: false },
series: [
{
name: '金种子总量',
type: 'line',
smooth: true,
symbol: 'none',
data: [],
markLine: {
symbol: ['none', 'none'],
lineStyle: { type: 'dashed', width: 1, color: 'rgba(229, 64, 53, 0.55)' },
label: {
formatter: `周均{c}`,
color: '#585654',
fontSize: 10,
position: 'end',
distance: -80,
offset: [0, -5],
},
data: [{ type: 'average', name: 'Avg' }],
},
lineStyle: { color: '#e54035', width: 3 },
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: 'rgba(229, 64, 53, 0.25)' },
{ offset: 1, color: 'rgba(229, 64, 53, 0.05)' },
]),
},
},
],
touchMoveThreshold: 10,
roam: false,
});
const fluctuationData = ref(null);
const fluctuationHasData = computed(() => {
const data = chartFluctuation?.series?.[0]?.data;
return Array.isArray(data) && data.length > 0;
});
const fluctuationTotalText = computed(() => {
const v = Number(fluctuationData.value?.totalCount);
return Number.isFinite(v) ? v.toLocaleString() : '0';
});
const fluctuationRateText = computed(() => {
const raw = fluctuationData.value?.changeRate;
const n = Number(raw);
if (!Number.isFinite(n)) return '+0.0%';
const sign = n >= 0 ? '+' : '';
return `${sign}${n.toFixed(1)}%`;
});
const fluctuationRateColor = computed(() => {
const raw = fluctuationData.value?.changeRate;
const n = Number(raw);
return n >= 0 ? '#e54035' : '#777777';
});
const fetchFluctuation = async () => {
const res: any = await api.goldSeedFluctuation();
if (res?.code !== 0) {
fluctuationData.value = null;
chartFluctuation.xAxis.data = [];
chartFluctuation.series[0].data = [];
return;
}
fluctuationData.value = res?.data || {};
const list = Array.isArray(fluctuationData.value?.dailyDataList)
? fluctuationData.value.dailyDataList
: [];
const xData = list.map((it) => it?.dayOfWeek ?? it?.dateLabel ?? '');
const yData = list.map((it) => Number(it?.goldSeedCount) || 0);
chartFluctuation.xAxis.data = xData;
chartFluctuation.series[0].data = yData;
};
let load = ref(false);
const getData = () => {
api.goldSeedIndex().then((res) => {
api.goldSeedIndex().then((res: any) => {
load.value = true;
if (res.code === 0) {
dataObj = res.data;
let arr = dataObj.premiumList.map((item) => item.month);
let arr1 = dataObj.premiumList.map((item) => item.data);
let arr2 = dataObj.dividendPool.map((item) => item.month);
let arr3 = dataObj.dividendPool.map((item) => item.data);
chartOption.xAxis.data = arr;
chartOption.series[0].data = arr1;
chartOption1.xAxis.data = arr2;
chartOption1.series[0].data = arr3;
fetchTrend();
}
});
};
onShow(() => {
getData();
fetchPoolGrowth();
fetchFluctuation();
});
let height = ref(0);
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
@@ -319,4 +655,218 @@
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
}
}
.seed-card {
background: #ffffff;
border-radius: 8rpx;
overflow: hidden;
padding: 24rpx 20rpx 18rpx;
box-sizing: border-box;
position: relative;
}
.seed-card__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
.seed-card__left {
display: flex;
align-items: center;
gap: 12rpx;
flex: 1;
min-width: 0;
}
.seed-card__icon {
width: 28rpx;
height: 28rpx;
border-radius: 10rpx;
// background: #ffe8e5;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.seed-card__icon--accent {
background: linear-gradient(127deg, #f7772e 18%, #ee0a24 122%);
}
.seed-card__icon-img {
width: 28rpx;
height: 28rpx;
}
.seed-card__title {
font-size: 30rpx;
font-weight: 700;
color: #585654;
line-height: 1.2;
}
.seed-card__sub {
margin-top: 6rpx;
font-size: 22rpx;
color: #bbbbbb;
line-height: 1.2;
}
.seed-card__tabs {
display: flex;
align-items: center;
background: #ffe8e5;
border-radius: 18rpx;
padding: 6rpx;
flex-shrink: 0;
}
.seed-card__tab {
font-size: 22rpx;
color: #585654;
padding: 8rpx 16rpx;
border-radius: 14rpx;
line-height: 1.1;
opacity: 0.8;
}
.seed-card__tab.active {
background: #ffffff;
opacity: 1;
}
.seed-card__badge {
font-size: 22rpx;
color: #e54035;
background: rgba(229, 64, 53, 0.12);
padding: 10rpx 16rpx;
border-radius: 14rpx;
line-height: 1;
font-weight: 700;
flex-shrink: 0;
}
.seed-card__stats {
display: flex;
gap: 14rpx;
margin-top: 18rpx;
}
.seed-card__stat {
flex: 1;
background: #fff6f5;
border-radius: 18rpx;
padding: 16rpx 16rpx 14rpx;
}
.seed-card__stat-label {
font-size: 22rpx;
color: #bbbbbb;
}
.seed-card__stat-value {
margin-top: 10rpx;
font-size: 26rpx;
font-weight: 700;
color: #585654;
}
.seed-card__stat-value--up {
color: #e54035;
}
.seed-card__totals {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20rpx;
margin-top: 18rpx;
}
.seed-card__totals-label {
font-size: 22rpx;
color: #bbbbbb;
}
.seed-card__totals-value {
margin-top: 10rpx;
font-size: 28rpx;
font-weight: 700;
color: #585654;
}
.seed-card__totals-unit {
font-size: 22rpx;
margin-left: 6rpx;
font-weight: 400;
color: #bbbbbb;
}
.seed-card__totals-rate {
margin-top: 10rpx;
font-size: 26rpx;
font-weight: 700;
text-align: right;
}
.seed-card__body {
height: 360rpx;
margin-top: 18rpx;
position: relative;
}
.emptyMask {
background: rgba(0, 0, 0, 0.22);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
z-index: 10;
border-radius: 12rpx;
-webkit-backdrop-filter: blur(2px) saturate(120%);
backdrop-filter: blur(2px) saturate(120%);
}
.valuation-formula {
margin-top: 18rpx;
padding: 18rpx 20rpx;
background: #fff6f5;
border-radius: 8rpx;
font-size: 30rpx;
color: #585654;
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 6rpx;
}
.valuation-formula__v {
font-weight: 800;
color: #e54035;
}
.valuation-formula__sub {
font-size: 22rpx;
color: #bbbbbb;
margin-right: 6rpx;
}
.valuation-formula__eq {
font-weight: 700;
color: #585654;
}
.valuation-desc {
margin-top: 14rpx;
font-size: 24rpx;
color: #bbbbbb;
line-height: 1.5;
}
</style>