1053 lines
30 KiB
Vue
1053 lines
30 KiB
Vue
<template>
|
||
<s-layout :navbar="navBar" title="金种子" navPreset="float">
|
||
<view class="pages w100" :style="{ marginTop: -height + 'px' }">
|
||
<view class="seed-hero w100">
|
||
<image class="seed-hero__bg" src="/static/jinzhongzi_bg.png" mode="widthFix" />
|
||
<view class="seed-hero__text">
|
||
<view class="seed-hero__title">资产概览</view>
|
||
<view class="seed-hero__sub">更新于 {{ getUpdateDateText() }}</view>
|
||
</view>
|
||
</view>
|
||
<view class="content" :style="{ marginTop: -top + 'px' }">
|
||
<view class="con">
|
||
<view class="conBox" v-if="load">
|
||
<view class="conBg"> </view>
|
||
<view class="p-x-20 p-y-40">
|
||
<view class="size32" v-if="false"> 我的金种子 </view>
|
||
<view v-if="false" class="flex ju-between al-flex-end m-b-44">
|
||
<view class="c_primary size80 weight_900">{{ dataObj.myCount || 0 }}</view>
|
||
<view class="flex-center">
|
||
<view class="fang"></view>
|
||
<view class="size28"
|
||
><span class="m-r-4">当日价格</span>
|
||
{{ dataObj.todayPrice || 0 }}
|
||
</view
|
||
>
|
||
</view>
|
||
</view>
|
||
<view v-if="false" class="flex-row m-b-30" style="flex-wrap: wrap">
|
||
<view
|
||
class="m-b-34 flex-row al-flex-end"
|
||
style="width: 50%"
|
||
v-for="(v, i) in arr"
|
||
:key="i"
|
||
>
|
||
<view class="flex-center ju-flex-start">
|
||
<view class="icon m-r-8">
|
||
<image class="w100" :src="$url + v.icon" mode="widthFix" />
|
||
</view>
|
||
<view>
|
||
<view class="size24 c32">{{ v.title }}</view>
|
||
<view class="size36">{{ dataObj[v.value] || 0 }}</view>
|
||
</view>
|
||
</view>
|
||
<view
|
||
class="w_96 h_44 c32 size24 flex-center radius22"
|
||
v-if="v.url"
|
||
@click="utils.go(v.url)"
|
||
style="background-color: #ffe8e5"
|
||
>去兑换</view
|
||
>
|
||
</view>
|
||
</view>
|
||
<view class="seed-card seed-card--summary m-b-50">
|
||
<view class="seed-summary__top">
|
||
<view class="seed-summary__label">当前价格</view>
|
||
<view class="seed-summary__price">
|
||
{{ formatSeedPrice(dataObj.todayPrice) }}
|
||
<!-- **.**** -->
|
||
</view>
|
||
</view>
|
||
<view class="seed-summary__divider"></view>
|
||
<view class="seed-summary__bottom">
|
||
<view class="seed-summary__item">
|
||
<view class="seed-summary__item-label">持有数量</view>
|
||
<view class="seed-summary__item-value">{{ dataObj.myCount || 0 }}</view>
|
||
</view>
|
||
<view class="seed-summary__v-divider"></view>
|
||
<view class="seed-summary__item">
|
||
<view class="seed-summary__item-label">已核销</view>
|
||
<view class="seed-summary__item-value">{{ dataObj.writeOffCount || 0 }}</view>
|
||
</view>
|
||
<view class="seed-summary__v-divider"></view>
|
||
<view class="seed-summary__item">
|
||
<view class="seed-summary__item-label">累计分红</view>
|
||
<view class="seed-summary__item-value seed-summary__item-value--accent">¥{{ dataObj.dividendCount || 0 }}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<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 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">{{
|
||
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--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>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</s-layout>
|
||
</template>
|
||
<script setup lang="ts">
|
||
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';
|
||
import * as api from '@/sheep/api/home/index.js';
|
||
import { onPageScroll } from '@dcloudio/uni-app';
|
||
let navBar = ref('inner');
|
||
let scrollTop = ref(0);
|
||
onPageScroll((e) => {
|
||
//console.log(e)
|
||
scrollTop.value = e.scrollTop;
|
||
if (e.scrollTop > 20) {
|
||
navBar.value = 'normal';
|
||
} else {
|
||
navBar.value = 'inner';
|
||
}
|
||
});
|
||
let { proxy } = getCurrentInstance();
|
||
let dataObj = reactive({});
|
||
let sysInfo = uni.getSystemInfoSync();
|
||
let top = ref(0);
|
||
top.value = `${sysInfo.statusBarHeight + 44 + uni.upx2px(295)}`;
|
||
// sysInfo.statusBarHeight
|
||
let arr = ref([
|
||
{
|
||
icon: 'home/seed1_1.png',
|
||
title: '核销数量',
|
||
value: 'writeOffCount',
|
||
},
|
||
{
|
||
icon: 'home/seed2_1.png',
|
||
title: '绿色积分',
|
||
value: 'exchangeCount',
|
||
url: '/pages/home/pay/seed',
|
||
},
|
||
{
|
||
icon: 'home/seed3_1.png',
|
||
title: '分红',
|
||
value: 'dividendCount',
|
||
},
|
||
{
|
||
icon: 'home/seed5_1.png',
|
||
title: '增量积分',
|
||
value: 'incrementPoint',
|
||
url: '/pages/home/pay/seed?type=1',
|
||
},
|
||
]);
|
||
|
||
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 formatSeedPrice = (val) => {
|
||
const n = Number(val);
|
||
return Number.isFinite(n) ? n.toFixed(4) : '0.0000';
|
||
};
|
||
|
||
const formatYmd = (val: any) => {
|
||
const formatDate = (d: Date) => {
|
||
const y = d.getFullYear();
|
||
const m = pad2(d.getMonth() + 1);
|
||
const day = pad2(d.getDate());
|
||
return `${y}年${m}月${day}日`;
|
||
};
|
||
if (val instanceof Date) return formatDate(val);
|
||
if (typeof val === 'number') {
|
||
const d = new Date(val);
|
||
return Number.isFinite(d.getTime()) ? formatDate(d) : '';
|
||
}
|
||
const s = String(val ?? '').trim();
|
||
if (!s) return '';
|
||
const m = s.match(/^(\d{4})-(\d{2})-(\d{2})/);
|
||
if (m) return `${m[1]}年${m[2]}月${m[3]}日`;
|
||
const d = new Date(s);
|
||
return Number.isFinite(d.getTime()) ? formatDate(d) : '';
|
||
};
|
||
|
||
const getUpdateDateText = () => {
|
||
return (
|
||
formatYmd(dataObj?.updateTime || dataObj?.updateDate || dataObj?.updateAt) ||
|
||
formatYmd(new Date())
|
||
);
|
||
};
|
||
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: '10%',
|
||
right: '10%',
|
||
bottom: '16%',
|
||
top: '12%',
|
||
containLabel: true,
|
||
},
|
||
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: '价格',
|
||
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)' },
|
||
]),
|
||
},
|
||
},
|
||
],
|
||
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 () => {
|
||
// return
|
||
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: ['#FF4E00', '#4260FA'],
|
||
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: [],
|
||
itemStyle: { color: '#4260FA' },
|
||
lineStyle: { color: 'transparent', width: 2 },
|
||
areaStyle: {
|
||
opacity: 1,
|
||
color: new echarts.graphic.LinearGradient(0, 0, 1, 1, [
|
||
{ offset: 0, color: '#2E8DFA' },
|
||
{ offset: 1, color: '#4260FA' },
|
||
]),
|
||
},
|
||
},
|
||
{
|
||
name: '分红池',
|
||
type: 'line',
|
||
stack: 'total',
|
||
smooth: true,
|
||
symbol: 'none',
|
||
data: [],
|
||
itemStyle: { color: '#FF4E00' },
|
||
lineStyle: { color: 'transparent', width: 2 },
|
||
areaStyle: {
|
||
opacity: 1,
|
||
color: new echarts.graphic.LinearGradient(0, 0, 1, 1, [
|
||
{ offset: 0, color: '#FD9D72' },
|
||
{ offset: 1, color: '#FF4E00' },
|
||
]),
|
||
},
|
||
},
|
||
],
|
||
touchMoveThreshold: 10,
|
||
roam: false,
|
||
});
|
||
|
||
const poolGrowthData = ref(null);
|
||
const poolTotalText = computed(() => {
|
||
const v = poolGrowthData.value?.totalPool;
|
||
if (v === null || v === undefined || v === '') return '-';
|
||
return String(v);
|
||
});
|
||
const poolTodayIncText = computed(() => {
|
||
const v = poolGrowthData.value?.todayIncrement;
|
||
if (v === null || v === undefined || v === '') return '-';
|
||
return String(v);
|
||
});
|
||
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 () => {
|
||
// return
|
||
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 () => {
|
||
// return
|
||
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: any) => {
|
||
load.value = true;
|
||
if (res.code === 0) {
|
||
dataObj = res.data;
|
||
fetchTrend();
|
||
}
|
||
});
|
||
};
|
||
onShow(() => {
|
||
getData();
|
||
fetchPoolGrowth();
|
||
fetchFluctuation();
|
||
});
|
||
let height = ref(0);
|
||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
.pages {
|
||
// position: relative;
|
||
box-sizing: border-box;
|
||
.seed-hero {
|
||
position: relative;
|
||
width: 100%;
|
||
}
|
||
|
||
.seed-hero__bg {
|
||
width: 100%;
|
||
display: block;
|
||
}
|
||
|
||
.seed-hero__text {
|
||
position: absolute;
|
||
left: 60rpx;
|
||
top: calc(env(safe-area-inset-top) + 120rpx);
|
||
z-index: 2;
|
||
}
|
||
|
||
.seed-hero__title {
|
||
font-size: 44rpx;
|
||
line-height: 52rpx;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
}
|
||
|
||
.seed-hero__sub {
|
||
margin-top: 10rpx;
|
||
font-size: 26rpx;
|
||
line-height: 34rpx;
|
||
color: rgba(255, 255, 255, 0.88);
|
||
}
|
||
.content {
|
||
// position: absolute;
|
||
width: 100%;
|
||
padding-top: 200rpx;
|
||
}
|
||
.con {
|
||
padding: 0 40rpx;
|
||
padding-bottom: 100rpx;
|
||
box-sizing: border-box;
|
||
overflow-y: auto;
|
||
}
|
||
.conBox {
|
||
// background: #ffffff;
|
||
// backdrop-filter: blur(32px);
|
||
border-radius: 8rpx;
|
||
overflow: hidden;
|
||
position: relative;
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
// height: 100%;
|
||
.conBg {
|
||
position: absolute;
|
||
top: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
z-index: -1;
|
||
image {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.icon {
|
||
width: 68rpx;
|
||
height: 68rpx;
|
||
}
|
||
.wrap {
|
||
height: 350rpx;
|
||
width: 100%;
|
||
}
|
||
.color_585654 {
|
||
color: #585654;
|
||
}
|
||
.weight_900 {
|
||
font-weight: 900;
|
||
}
|
||
|
||
.fang {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
background: linear-gradient(127deg, #f7772e 18%, #ee0a24 122%);
|
||
margin-right: 4rpx;
|
||
}
|
||
.title {
|
||
position: relative;
|
||
padding-left: 16rpx;
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
top: 15%;
|
||
left: 0;
|
||
width: 4rpx;
|
||
height: 70%;
|
||
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
|
||
}
|
||
}
|
||
|
||
.seed-card {
|
||
background: #ffffff;
|
||
border-radius: 28rpx;
|
||
overflow: hidden;
|
||
padding: 24rpx 20rpx 18rpx;
|
||
box-sizing: border-box;
|
||
position: relative;
|
||
box-shadow: 0 8rpx 22rpx rgba(38, 107, 246, 0.55);
|
||
}
|
||
|
||
.seed-card--summary {
|
||
padding: 28rpx 26rpx 22rpx;
|
||
}
|
||
|
||
.seed-summary__top {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 10rpx;
|
||
}
|
||
|
||
.seed-summary__label {
|
||
font-size: 24rpx;
|
||
color: #585654;
|
||
opacity: 0.9;
|
||
}
|
||
|
||
.seed-summary__price {
|
||
font-size: 64rpx;
|
||
font-weight: 800;
|
||
color: #111111;
|
||
line-height: 1.1;
|
||
}
|
||
|
||
.seed-summary__divider {
|
||
height: 1rpx;
|
||
background: rgba(0, 0, 0, 0.08);
|
||
margin: 18rpx 0;
|
||
}
|
||
|
||
.seed-summary__bottom {
|
||
display: flex;
|
||
align-items: stretch;
|
||
}
|
||
|
||
.seed-summary__item {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8rpx;
|
||
}
|
||
|
||
.seed-summary__item-label {
|
||
font-size: 24rpx;
|
||
color: #585654;
|
||
opacity: 0.9;
|
||
}
|
||
|
||
.seed-summary__item-value {
|
||
font-size: 30rpx;
|
||
font-weight: 800;
|
||
color: #111111;
|
||
line-height: 1.1;
|
||
}
|
||
|
||
.seed-summary__item-value--accent {
|
||
color: #e54035;
|
||
}
|
||
|
||
.seed-summary__v-divider {
|
||
width: 1rpx;
|
||
background: rgba(0, 0, 0, 0.08);
|
||
margin: 0 22rpx;
|
||
}
|
||
|
||
.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: 25rpx;
|
||
font-weight: bold;
|
||
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 {
|
||
width: 70%;
|
||
margin: 18rpx auto;
|
||
padding: 8rpx 0rpx;
|
||
background: linear-gradient(to bottom right, #2c8cfa 0%, #3d5efb 100%);
|
||
border-radius: 12rpx;
|
||
font-size: 30rpx;
|
||
color: #ffffff;
|
||
display: flex;
|
||
align-items: baseline;
|
||
justify-content: center;
|
||
flex-wrap: wrap;
|
||
gap: 6rpx;
|
||
}
|
||
|
||
.valuation-formula__v {
|
||
font-weight: 800;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.valuation-formula__sub {
|
||
font-size: 22rpx;
|
||
color: rgba(255, 255, 255, 0.85);
|
||
margin-right: 6rpx;
|
||
}
|
||
|
||
.valuation-formula__eq {
|
||
font-weight: 700;
|
||
color: rgba(255, 255, 255, 0.95);
|
||
}
|
||
|
||
.valuation-desc {
|
||
margin-top: 14rpx;
|
||
padding-left: 40rpx;
|
||
font-size: 20rpx;
|
||
color: #5d5b5b;
|
||
line-height: 1.5;
|
||
}
|
||
</style>
|