<template>
    <div class="main_box">
        <navbar title="签约产品"></navbar>
        <div class="main">
            <div class="item" v-if="nextType == 'deposit'">
                <div class="item_left" v-if="this.baseInfo.deposit.currdeposFlag">活期储蓄存款</div>
            </div>
            <div class="item" v-if="nextType == 'loan'">
                <div class="item_left" v-if="this.baseInfo.loan.hatflowcostbookFlag">随心花</div>
            </div>
            <div class="item" v-if="nextType == 'loan'">
                <div class="item_left" v-if="this.baseInfo.loan.zheliloanFlag">浙里贷</div>
            </div>
            <div class="item" v-if="nextType == 'loan'">
                <div class="item_left" v-if="this.baseInfo.loan.phmortgloanFlag">个人住房按揭贷款</div>
            </div>
            <div class="item" v-if="nextType == 'wealth'">
                <div class="item_left" v-if="this.baseInfo.wealth.bondbookFlag">债券业务签约</div>
            </div>
            <div class="item" v-if="nextType == 'wealth'">
                <div class="item_left" v-if="this.baseInfo.wealth.financialbookFlag">理财业务签约</div>
            </div>
            <div class="item" v-if="nextType == 'wealth'">
                <div class="item_left" v-if="this.baseInfo.wealth.fundbookFlag">基金业务签约</div>
            </div>
            <div class="item" v-if="nextType == 'wealth'">
                <div class="item_left" v-if="this.baseInfo.wealth.frcdFlag">大额存单</div>
            </div>
            <div class="item" v-if="nextType == 'wealth'">
                <div class="item_left" v-if="this.baseInfo.wealth.insurbookFlag">保险业务签约</div>
            </div>
            <div class="item" v-if="nextType == 'intermediate'">
                <div class="item_left" v-if="this.baseInfo.intermediate.elefeeWhcFlag">电费代扣签约</div>
            </div>
            <div class="item" v-if="nextType == 'intermediate'">
                <div class="item_left" v-if="this.baseInfo.intermediate.gasfeeWhcFlag">燃气费代扣签约</div>
            </div>
            <div class="item" v-if="nextType == 'intermediate'">
                <div class="item_left" v-if="this.baseInfo.intermediate.watfeeWhcFlag">水费代扣签约</div>
            </div>
            <div class="item" v-if="nextType == 'intermediate'">
                <div class="item_left" v-if="this.baseInfo.intermediate.etcFlag">etc</div>
            </div>
        </div>
    </div>
</template>
<script>
import navbar from '../../components/navbar/navbar.vue';
import { getBusinessInfo, getPersonInfo, getMerchantInfo } from "@/service/api/custome";
import { Icon } from 'vant';//button组件
export default {
    data() {
        return {
            baseInfo: {
                deposit: {},
                loan: {},
                wealth: {},
                intermediate: {},
            },
            nextType: ''
        }
    },
    components: {
        navbar: navbar,
        VanIcon: Icon
    },
    created() {
        this.nextType = sessionStorage.getItem('nextType')
        this.init()
    },
    methods: {
        init() {
            let productType = sessionStorage.getItem('productType')
            let custId = sessionStorage.getItem('custId')
            if (productType == '1') {
                getBusinessInfo(custId).then(res => {
                    if (res.code == 200) {
                        if (res.code == 200) {
                            this.baseInfo.deposit = res.data.signedProducts.deposit ? res.data.signedProducts.deposit : null
                            this.baseInfo.loan = res.data.signedProducts.loan ? res.data.signedProducts.loan : null
                            this.baseInfo.wealth = res.data.signedProducts.wealth ? res.data.signedProducts.wealth : null
                            this.baseInfo.intermediate = res.data.signedProducts.intermediate ? res.data.signedProducts.intermediate : null
                        }
                    }
                })
            } else if (productType == '2') {
                getPersonInfo(custId).then(res => {
                    if (res.code == 200) {
                        this.baseInfo.deposit = res.data.signedProducts.deposit ? res.data.signedProducts.deposit : null
                        this.baseInfo.loan = res.data.signedProducts.loan ? res.data.signedProducts.loan : null
                        this.baseInfo.wealth = res.data.signedProducts.wealth ? res.data.signedProducts.wealth : null
                        this.baseInfo.intermediate = res.data.signedProducts.intermediate ? res.data.signedProducts.intermediate : null
                    }
                })
            } else if (productType == '3') {
                getMerchantInfo(custId).then(res => {
                    if (res.code == 200) {
                        this.baseInfo.deposit = res.data.signedProducts.deposit ? res.data.signedProducts.deposit : null
                        this.baseInfo.loan = res.data.signedProducts.loan ? res.data.signedProducts.loan : null
                        this.baseInfo.wealth = res.data.signedProducts.wealth ? res.data.signedProducts.wealth : null
                        this.baseInfo.intermediate = res.data.signedProducts.intermediate ? res.data.signedProducts.intermediate : null
                    }
                })
            }


        },
    }
}
</script>
<style lang="less" scoped>
.main {
    padding-top: 46px;
    min-height: 100vh;
    font-size: 16px;
    padding-bottom: 60px;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #ffffff;
    margin-top: 2px;
    color: rgb(22, 13, 13);
}

.main_title {
    margin-left: 15px;
    font-size: 16px;
}
</style>