323 lines
8.8 KiB
Vue
323 lines
8.8 KiB
Vue
<template>
|
|
<s-layout :navbar="navBar" title="金种子">
|
|
<view class="pages w100" :style="{ marginTop: -height + 'px' }">
|
|
<view class="w100">
|
|
<image class="w100" :src="$url + 'home/seed_1.png'" mode="widthFix" />
|
|
</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"> 我的金种子 </view>
|
|
<view 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 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="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>
|
|
</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>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</s-layout>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { ref, reactive, 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 chartOption = reactive({
|
|
// 添加grid配置,实现间距自适应
|
|
grid: {
|
|
left: '3%',
|
|
right: '4%',
|
|
bottom: '3%',
|
|
top: '0',
|
|
height: 150,
|
|
},
|
|
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',
|
|
},
|
|
},
|
|
},
|
|
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',
|
|
},
|
|
},
|
|
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' },
|
|
]),
|
|
},
|
|
emphasis: {
|
|
itemStyle: {
|
|
opacity: 1,
|
|
},
|
|
},
|
|
data: [123, 60, 25, 18, 12, 123, 60, 25],
|
|
z: 10,
|
|
},
|
|
],
|
|
});
|
|
let load = ref(false);
|
|
const getData = () => {
|
|
api.goldSeedIndex().then((res) => {
|
|
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;
|
|
}
|
|
});
|
|
};
|
|
onShow(() => {
|
|
getData();
|
|
});
|
|
let height = ref(0);
|
|
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.pages {
|
|
// position: relative;
|
|
|
|
.content {
|
|
// position: absolute;
|
|
width: 100%;
|
|
}
|
|
.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%);
|
|
}
|
|
}
|
|
</style>
|