2025.10.17
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
</view>
|
||||
|
||||
<view class="product-intro">
|
||||
产品简介:{{item.introduction}}
|
||||
产品简介:{{item.introduction }}
|
||||
</view>
|
||||
<view class="product-detail-link" @click="handleproduction" >
|
||||
查看详情
|
||||
@@ -44,13 +44,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, getCurrentInstance, onMounted } from 'vue';
|
||||
import {
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import { onReady as onUniReady, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import { onReady, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import { financeAPI } from '../../api/finnancial';
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const height = ref(0)
|
||||
const scrollHeight = ref(0)
|
||||
|
||||
@@ -58,64 +55,60 @@
|
||||
uni.getSystemInfo({
|
||||
success(res) {
|
||||
let screenHeight = res.screenHeight
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
|
||||
uni.createSelectorQuery().in(instance?.proxy).select("#tabbarId").boundingClientRect((data: any) => {
|
||||
height.value = screenHeight - data.height
|
||||
}).exec()
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#searchFilterId").boundingClientRect((data : any) => {
|
||||
uni.createSelectorQuery().in(instance?.proxy).select("#searchFilterId").boundingClientRect((data: any) => {
|
||||
scrollHeight.value = height.value - data.height
|
||||
}).exec()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 列表
|
||||
const productList = ref([
|
||||
{
|
||||
id: 1,
|
||||
name: '理财产品名称',
|
||||
rate: '3.5',
|
||||
introduction: '这是一款稳健型理财产品,适合中长期投资,风险较低,收益稳定。'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '理财产品名称',
|
||||
rate: '4.2',
|
||||
introduction: '这是一款成长型理财产品,适合有一定风险承受能力的投资者。'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '理财产品名称',
|
||||
rate: '2.8',
|
||||
introduction: '这是一款保本型理财产品,适合保守型投资者,资金安全有保障。'
|
||||
}
|
||||
])
|
||||
const defaultSize = 5
|
||||
// 产品列表
|
||||
const productList = ref<any[]>([])
|
||||
const defaultSize = 10
|
||||
const params = ref({
|
||||
page: 1,
|
||||
size: defaultSize,
|
||||
keyword: ''
|
||||
})
|
||||
const status = ref('loadmore')
|
||||
const maxPage = ref()
|
||||
|
||||
// 加载数据
|
||||
const loadData = () => {
|
||||
if (status.value == 'nomore') return
|
||||
// 模拟API调用
|
||||
setTimeout(() => {
|
||||
|
||||
financeAPI.getList(params.value).then(res => {
|
||||
console.log('API返回数据:', res)
|
||||
|
||||
if (res.data && res.data.list) {
|
||||
// 检查数据结构并映射字段
|
||||
const mappedList = res.data.list.map((item: any) => ({
|
||||
name: item.productName || item.name || '未知产品',
|
||||
rate: item.interestRate || item.rate || '0',
|
||||
introduction: item.desc || item.introduction || item.productDesc || '暂无简介'
|
||||
}))
|
||||
|
||||
productList.value = productList.value.concat(mappedList)
|
||||
console.log('当前产品列表:', productList.value)
|
||||
}
|
||||
|
||||
status.value = 'nomore'
|
||||
uni.stopPullDownRefresh()
|
||||
}, 500)
|
||||
}).catch(err => {
|
||||
console.error('API调用失败:', err)
|
||||
status.value = 'nomore'
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleproduction = () =>{
|
||||
const handleproduction = (item: any) => {
|
||||
console.log('查看产品详情:', item)
|
||||
uni.navigateTo({
|
||||
url: '/pages/finance/production'
|
||||
});
|
||||
url: `/pages/finance/production?name=${encodeURIComponent(item.name)}&rate=${item.rate}&intro=${encodeURIComponent(item.introduction)}`
|
||||
})
|
||||
}
|
||||
|
||||
// 查询
|
||||
@@ -131,7 +124,6 @@
|
||||
|
||||
// 刷新
|
||||
onPullDownRefresh(async () => {
|
||||
// 全局刷新
|
||||
params.value = {
|
||||
page: 1,
|
||||
size: defaultSize,
|
||||
@@ -145,7 +137,7 @@
|
||||
loadData()
|
||||
})
|
||||
|
||||
onUniReady(() => {
|
||||
onReady(() => {
|
||||
loadHeight()
|
||||
})
|
||||
</script>
|
||||
@@ -222,4 +214,4 @@
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user