Files
jurong_circle_front_app/pages/finance/finance.vue

192 lines
4.4 KiB
Vue
Raw Normal View History

2025-09-12 17:23:03 +08:00
<template>
2025-10-14 14:08:44 +08:00
<view class="finance-container">
2025-10-24 16:44:01 +08:00
<u-navbar :is-back="false" title="金融理财" :border-bottom="false" :background="{ background: 'transparent' }"
title-color="#FFFFFF"></u-navbar>
2025-10-14 14:08:44 +08:00
<!-- 可滚动的内容区域 -->
<view class="content-container" :style="'height:'+height+'px'">
<view class="searchFilter" id="searchFilterId">
<view class="search">
<u-search :show-action="false" placeholder="输入产品名称" v-model="params.keyword" bgColor="#CADBFF"
@search="handleSearch"></u-search>
</view>
</view>
<view class="product-list" :style="'height:'+scrollHeight+'px'">
2025-10-24 16:44:01 +08:00
<scroll-view scroll-y="true" style="height: 100%;" v-if="productList.length!=0"
@scrolltolower="loadData">
<view class="product-item" v-for="item in productList" :key="item.id"
@click="handleproduction(item)">
2025-10-17 17:21:39 +08:00
<view class="product-name">
2025-10-24 16:44:01 +08:00
{{item.productName}}
2025-10-14 14:08:44 +08:00
</view>
2025-10-17 17:21:39 +08:00
<view class="product-rate">
2025-10-24 16:44:01 +08:00
利率{{item.expectedReturnRate}}%
2025-10-17 17:21:39 +08:00
</view>
<view class="product-intro">
2025-10-24 16:44:01 +08:00
公司{{item.company}}
2025-10-14 14:08:44 +08:00
</view>
</view>
<u-loadmore color="#666" :status="status" />
<view class="box-div"></view>
</scroll-view>
<view style="height: 100%;" v-else>
<u-empty></u-empty>
</view>
</view>
</view>
2025-10-17 17:21:39 +08:00
<Tabbar id="tabbarId"></Tabbar>
2025-10-14 14:08:44 +08:00
</view>
2025-09-12 17:23:03 +08:00
</template>
<script setup lang="ts">
2025-10-17 17:21:39 +08:00
import { ref, getCurrentInstance, onMounted } from 'vue';
2025-10-17 14:12:04 +08:00
import { onReady, onPullDownRefresh } from '@dcloudio/uni-app';
import { financeAPI } from '../../api/finnancial';
2025-10-14 14:08:44 +08:00
const instance = getCurrentInstance();
const height = ref(0)
const scrollHeight = ref(0)
const loadHeight = () => {
uni.getSystemInfo({
success(res) {
let screenHeight = res.screenHeight
2025-10-24 16:44:01 +08:00
uni.createSelectorQuery().in(instance?.proxy).select("#tabbarId").boundingClientRect((data : any) => {
2025-10-14 14:08:44 +08:00
height.value = screenHeight - data.height
}).exec()
2025-10-24 16:44:01 +08:00
uni.createSelectorQuery().in(instance?.proxy).select("#searchFilterId").boundingClientRect((data : any) => {
2025-10-14 14:08:44 +08:00
scrollHeight.value = height.value - data.height
}).exec()
}
})
}
2025-10-17 14:12:04 +08:00
// 产品列表
const productList = ref<any[]>([])
const defaultSize = 10
2025-10-14 14:08:44 +08:00
const params = ref({
page: 1,
size: defaultSize,
keyword: ''
})
const status = ref('loadmore')
// 加载数据
const loadData = () => {
if (status.value == 'nomore') return
2025-10-24 16:44:01 +08:00
2025-10-17 14:12:04 +08:00
financeAPI.getList(params.value).then(res => {
if (res.data && res.data.list) {
2025-10-24 16:44:01 +08:00
productList.value = productList.value.concat(res.data.list)
2025-10-17 14:12:04 +08:00
}
2025-10-14 14:08:44 +08:00
status.value = 'nomore'
uni.stopPullDownRefresh()
2025-10-17 14:12:04 +08:00
}).catch(err => {
status.value = 'nomore'
uni.stopPullDownRefresh()
})
2025-10-14 14:08:44 +08:00
}
2025-10-17 17:21:39 +08:00
// 查看详情 - 传递完整产品数据
2025-10-24 16:44:01 +08:00
const handleproduction = (item : any) => {
2025-10-14 14:08:44 +08:00
uni.navigateTo({
2025-10-24 16:44:01 +08:00
url: `/pages/finance/production?id=${item.id}`
2025-10-17 14:12:04 +08:00
})
2025-10-14 14:08:44 +08:00
}
// 查询
const handleSearch = () => {
2025-10-24 16:44:01 +08:00
params.value.page = 1
2025-10-14 14:08:44 +08:00
productList.value = []
2025-10-24 16:44:01 +08:00
status.value = 'loadmore'
2025-10-14 14:08:44 +08:00
loadData()
}
// 刷新
onPullDownRefresh(async () => {
params.value = {
page: 1,
size: defaultSize,
keyword: ''
}
productList.value = []
loadData()
})
onMounted(() => {
loadData()
})
2025-10-17 14:12:04 +08:00
onReady(() => {
2025-10-14 14:08:44 +08:00
loadHeight()
})
2025-09-12 17:23:03 +08:00
</script>
2025-10-14 14:08:44 +08:00
<style lang="scss" scoped>
.finance-container {
width: 100%;
height: 100vh;
background: linear-gradient(270deg, #65A7FF 0%, #458CF9 23.08%, #3F82FF 50%, #458CF9 71.15%, #65A7FF 100%);
/* 内容滚动区域 */
.content-container {
width: 100%;
.searchFilter {
background-color: transparent;
.search {
padding: 20rpx 42rpx 0;
}
}
.product-list {
padding: 20rpx 30rpx;
.product-item {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
2025-10-17 17:21:39 +08:00
.product-name {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 15rpx;
2025-10-14 14:08:44 +08:00
}
2025-10-17 17:21:39 +08:00
.product-rate {
font-size: 28rpx;
color: #333;
font-weight: 500;
2025-10-14 14:08:44 +08:00
margin-bottom: 20rpx;
}
2025-10-17 17:21:39 +08:00
// 移除产品简介显示 */
.product-intro {
2025-10-24 16:44:01 +08:00
font-size: 26rpx;
color: #666;
line-height: 1.5;
margin-bottom: 20rpx;
display: block; // 确保显示
}
2025-10-17 17:21:39 +08:00
2025-10-14 14:08:44 +08:00
.product-detail-link {
font-size: 24rpx;
color: #458cf9;
text-align: right;
2025-10-17 17:21:39 +08:00
padding-top: 10rpx;
2025-10-14 14:08:44 +08:00
}
}
.box-div {
padding: 30rpx 0rpx;
}
}
}
}
2025-10-17 17:21:39 +08:00
</style>