<template> <div class="container"> <NavBar title="融资意向" left-arrow @click-left="goBack" /> <section class="list"> <PullRefresh v-model="refreshing" @refresh="getList" class="scroll"> <List :finished="finished" finished-text="没有更多了"> <Empty v-if="!listValue.length" description="无记录" /> <ListItem v-for="item in listValue" :other_title="item.other_title" :title="item.title" :values="item.values" @click="jump(item.intentionId)" /> </List> </PullRefresh> </section> <Plus @click="jump('')" /> </div> </template> <script setup> import { goBack } from "@/utils/globalFun" import { NavBar, List, PullRefresh, Empty } from "vant"; import ListItem from '@/components/ListItem.vue' import Plus from '@/components/Plus.vue' import api from "../api"; import { useRouter } from "vue-router"; import { useIntention } from '../store/index' const formStore = useIntention() const listValue = $ref([]) const getList = async () => { let res = await api.getlist() if (res.result === 'SUCCESS' && res.data.length) { listValue = res.data.map(item => { return { title: item.intentionNumber, other_title: item.creationDate, values: [["合同金额", "状态"], ["¥ " + item.contractAmount, item.intentionStatusN]], intentionId: item.intentionId } }) } else { listValue = [] } refreshing = false; } getList() const refreshing = $ref(true); const finished = $ref(true); const router = useRouter(); const jump = async (intentionId = '') => { if (intentionId) { let res = await api.getDetail({ intentionId: intentionId + '' }) if (res.result === 'SUCCESS' && res.data.length) { formStore.intentionData = res.data[0]; router.push({ name: 'intention-views-intentionForm' }) } } else { router.push({ name: 'intention-views-intentionForm' }) } } </script> <style scoped lang="less"> .list { box-sizing: border-box; height: calc(100vh - var(--van-nav-bar-height)); display: flex; flex-direction: column; justify-content: space-between; padding-top: 8px; padding-bottom: 10px; } .scroll { box-sizing: border-box; height: 100%; overflow-y: auto; } </style> <route> { meta: { title: '融资意向' } } </route>