loanBill.vue 3.11 KB
<template>
    <div class="bill_wrap">
        <el-tabs v-model="state.activeName" @tab-click="getBill" class="con_bill">
            <el-tab-pane label="待还账单" class="bill_dh" name="noFinish">
                <el-empty v-if="state.billList && state.billList.length == 0" description="暂无数据" />
                <div v-else class="back_wrap" v-for="item in state.billList">
                    <div class="back_title">
                        <div class="borrow_date">借款日期:{{item.createTime && item.createTime.substring(0, 10)}}</div>
                        <!--<div :class="item.borrowStatus == '0' ? 'borrow_status' : 'borrow_status later'">{{item.borrowStatus == '0' ? '待还款':'已逾期'}}</div>-->
                        <div class="borrow_status">{{item.loanStatus}}</div>
                    </div>
                    <div class="back_con">借款金额:{{item.capitalAmount}}</div>
                    <div class="back_con">账单编号:{{item.statementCode}}</div>
                    <div class="back_con">产品名称:{{item.productName}}</div>
                    <div class="detail_btn" @click="linkTo('/billDetail/'+item.id)">详情</div>
                </div>
            </el-tab-pane>
            <el-tab-pane label="历史账单" class="bill_dh" name="finish">
                <el-empty v-if="state.noBillList && state.noBillList.length == 0" description="暂无数据" />
                <div v-else class="back_wrap" v-for="item in state.noBillList">
                    <div class="back_title">
                        <div class="borrow_date">借款日期:{{item.createTime && item.createTime.substring(0, 10)}}</div>
                        <div class="borrow_status finish">已还款</div>
                    </div>
                    <div class="back_con">借款金额:{{item.capitalAmount}}</div>
                    <div class="back_con">账单编号:{{item.statementCode}}</div>
                    <div class="back_con">产品名称:{{item.productName}}</div>
                    <div class="detail_btn" @click="linkTo('/billDetail/'+item.id)">详情</div>
                </div>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script setup lang="ts">
    import getImage from './../../assets/getImage'
    import './../../assets/css/loanBill.scss'
    import router from "../../router/index";
    import * as api from "./../../interface/api"
    import { loginMain } from './../../store/index'
    import { storeToRefs } from 'pinia';
    let loginAct = loginMain()
    let { getActiveName } = storeToRefs(loginAct)

    let getBill = (tab: TabsPaneContext) => {
        loginAct.setActiveName(tab.paneName)
    }

    let state = reactive({
        activeName: getActiveName,
        billList : [],
        noBillList : [],
    })

    let linkTo = (url: string) => {
        router.push(url)
    }

    api.getWaitStatementList().then(res=> {
        state.billList = res.data
    })

    api.getHistoryStatementList().then(res=> {
        state.noBillList = res.data
    })

    const arrowPath = ref("/mine")
    defineExpose({arrowPath})
</script>

<style scoped lang="scss">
</style>