<template>
    <div>
        <navbar title="资产负债情况"></navbar>
        <div class="wrapper">
            <div class="wrapper_main">
                <van-tabs @change="tabChange()" v-model="activeTab" class="content">
                    <van-tab title="资产信息">
                        <div class="title">企业资产</div>
                        <div class="mian">
                            <div class="main_item">
                                <div class="main_item_left">资产小计</div>
                                <div class="main_item_middle">{{ baseInfo.assetAmt }}万元人民币</div>
                                <div class="main_item_right"></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('存款现金')">
                                <div class="main_item_left">存款现金</div>
                                <div class="main_item_middle">{{ baseInfo.cashDeposit }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('应收账款')">
                                <div class="main_item_left">应收账款</div>
                                <div class="main_item_middle">{{ baseInfo.receivables }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('预付账款')">
                                <div class="main_item_left">预付账款</div>
                                <div class="main_item_middle">{{ baseInfo.prepayment }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('应收票据')">
                                <div class="main_item_left">应收票据</div>
                                <div class="main_item_middle">{{ baseInfo.notesReceivable }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('其他应收款')">
                                <div class="main_item_left">其他应收款</div>
                                <div class="main_item_middle">{{ baseInfo.otherReceivables }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('原材料')">
                                <div class="main_item_left">原材料</div>
                                <div class="main_item_middle">{{ baseInfo.rawMaterial }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('产成品')">
                                <div class="main_item_left">产成品</div>
                                <div class="main_item_middle">{{ baseInfo.finishProduct }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('投资类资产')">
                                <div class="main_item_left">投资类资产</div>
                                <div class="main_item_middle">{{ baseInfo.assetInvest }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('房产类资产')">
                                <div class="main_item_left">房产类资产</div>
                                <div class="main_item_middle">{{ baseInfo.assetHouse }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('设备类资产')">
                                <div class="main_item_left">设备类资产</div>
                                <div class="main_item_middle">{{ baseInfo.assetEquip }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>

                            <div class="main_item" @click="handleFirmDialog('交通类资产')">
                                <div class="main_item_left">交通类资产</div>
                                <div class="main_item_middle">{{ baseInfo.assetTraffic }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('无形资产')">
                                <div class="main_item_left">无形资产</div>
                                <div class="main_item_middle">{{ baseInfo.assetIntangible }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('长期待摊费用')">
                                <div class="main_item_left">长期待摊费用</div>
                                <div class="main_item_middle">{{ baseInfo.unamortizedExpenses }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>


                            <div class="title">个人及家庭资产</div>
                            <div class="main_item">
                                <div class="main_item_left">资产小计</div>
                                <div class="main_item_middle">{{ baseInfo.familyAssetAmt }}万元人民币</div>
                                <div class="main_item_right"></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('存款现金(个人及家庭)')">
                                <div class="main_item_left">存款现金</div>
                                <div class="main_item_middle">{{ baseInfo.familyCashDeposit }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('股票理财')">
                                <div class="main_item_left">股票理财</div>
                                <div class="main_item_middle">{{ baseInfo.stockFinance }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('住宅及商品')">
                                <div class="main_item_left">住宅及商品</div>
                                <div class="main_item_middle">{{ baseInfo.dwellingGoods }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('车辆')">
                                <div class="main_item_left">车辆</div>
                                <div class="main_item_middle">{{ baseInfo.car }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                            <div class="main_item" @click="handleFirmDialog('资产其他')">
                                <div class="main_item_left">其他</div>
                                <div class="main_item_middle">{{ baseInfo.otherAsset }}万元人民币</div>
                                <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                            </div>
                        </div>
                    </van-tab>
                    <van-tab title="负债信息">
                        <div class="title">企业负债</div>
                        <div class="main_item">
                            <div class="main_item_left">负债小计</div>
                            <div class="main_item_middle">{{ baseInfo.debtAmt }}万元人民币</div>
                            <div class="main_item_right"></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('应付票据')">
                            <div class="main_item_left">应付票据</div>
                            <div class="main_item_middle">{{ baseInfo.notesPayable }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('应付账款')">
                            <div class="main_item_left">应付账款</div>
                            <div class="main_item_middle">{{ baseInfo.accountsPayable }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('其他应付款')">
                            <div class="main_item_left">其他应付款</div>
                            <div class="main_item_middle">{{ baseInfo.otherAccountsPayable }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('预收账款')">
                            <div class="main_item_left">预收账款</div>
                            <div class="main_item_middle">{{ baseInfo.depositReceived }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('我行贷款')">
                            <div class="main_item_left">我行贷款</div>
                            <div class="main_item_middle">{{ baseInfo.bankLoan }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('他行贷款')">
                            <div class="main_item_left">他行贷款</div>
                            <div class="main_item_middle">{{ baseInfo.otherBankLoan }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="title">个人及家庭负债</div>
                        <div class="main_item">
                            <div class="main_item_left">负债小计</div>
                            <div class="main_item_middle">{{ baseInfo.familyDebtAmt }}万元人民币</div>
                            <div class="main_item_right"></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('我行贷款(不含按揭)')">
                            <div class="main_item_left">我行贷款</div>
                            <div class="main_item_middle">{{ baseInfo.familyBankLoan }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('他行贷款(不含按揭)')">
                            <div class="main_item_left">他行贷款</div>
                            <div class="main_item_middle">{{ baseInfo.familyOtherLoan }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('房产按揭')">
                            <div class="main_item_left">房产按揭</div>
                            <div class="main_item_middle">{{ baseInfo.mortgageHouse }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('汽车按揭')">
                            <div class="main_item_left">汽车按揭</div>
                            <div class="main_item_middle">{{ baseInfo.mortgageCar }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('信用卡')">
                            <div class="main_item_left">信用卡</div>
                            <div class="main_item_middle">{{ baseInfo.creditCard }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>
                        <div class="main_item" @click="handleFirmDialog('负债其他')">
                            <div class="main_item_left">其他</div>
                            <div class="main_item_middle">{{ baseInfo.mortgageOther }}万元人民币</div>
                            <div class="main_item_right"><van-icon name="arrow" class="header_icon" /></div>
                        </div>

                    </van-tab>
                    <van-tab title="分析信息">
                        <div class="main_item mg_top">
                            <van-cell title="报告期" :value="baseInfo.reportTime" @click="onDisplay"></van-cell>
                            <van-calendar v-model:show="show" @confirm="onConfirm"></van-calendar>
                        </div>
                        <div class="jine">
                            <van-field v-model="baseInfo.assetTotal" label-width="8.2rem" label="企业资产合计" placeholder="请输入"
                                readonly></van-field>
                            <span class="danwei" v-if="baseInfo.assetTotal">万元人民币</span>
                        </div>
                        <div class="jine">
                            <van-field v-model="baseInfo.debtTotal" label-width="8.2rem" label="企业负债合计" placeholder="请输入"
                                readonly></van-field>
                            <span class="danwei" v-if="baseInfo.debtTotal">万元人民币</span>
                        </div>
                        <div class="jine">
                            <van-field v-model="baseInfo.ownerRigth" label-width="8.2rem" label="所有者权益" placeholder="请输入"
                                readonly></van-field>
                            <span class="danwei" v-if="baseInfo.ownerRigth">万元人民币</span>
                        </div>


                        <div class="main_item">
                            <van-field v-model="baseInfo.enterDebtRatio" label-width="8.2rem" label="企业资产负债率(%)"
                                placeholder="请输入" readonly></van-field>
                        </div>
                        <div class="main_item">
                            <van-field v-model="baseInfo.familyDebtRatio" label-width="8.2rem" label="家庭资产负债率(%)"
                                placeholder="请输入" readonly></van-field>
                        </div>
                        <div class="jine mg_top">
                            <van-field v-model="baseInfo.guarAmt" label-width="8.2rem" label="担保金额" placeholder="请输入"
                                type="number" @change="changeGuarAmt"></van-field>
                            <span class="danwei" v-if="baseInfo.guarAmt">万元人民币</span>
                        </div>

                        <div class="main_item">
                            <van-field v-model="baseInfo.guarAssetRatio" label-width="8.2rem" label="担保净资产比率(%)"
                                placeholder="请输入" readonly></van-field>
                        </div>
                    </van-tab>
                </van-tabs>
            </div>

            <div class="footer">
                <van-button type="primary" class="btn" @click="handleCommit">保存</van-button>
            </div>
        </div>
        <van-popup v-model="colTotShow" class='popDialog'>
            <div class="dialog-title-box">{{ dialogTitle }}</div>
            <div class="dialog-label-box">{{ dialogLabel }}</div>
            <van-field v-model="dialogValue" placeholder="请输入" class="dialogField" type="number"></van-field>
            <div class="dialog-label-box">备注</div>
            <van-field v-model="dialogRemark" placeholder="请输入" type="textarea" :row="2" class="dialogField"></van-field>
            <div class="dialog-footer-box">
                <div class="cancel-btn" @click="handleDialogCancel">取消</div>
                <div class="ok-btn" @click="handleDialogCommit">确定</div>
            </div>
        </van-popup>
    </div>
</template>
<script>
import { queryAssetDebt, addAssetDebt, updateAssetDebt } from "@/service/api/report";
import navbar from '../../../components/navbar/navbar.vue';
import {
    Icon,
    Field,
    Form,
    Button,
    Tab,
    Tabs,
    Popup,
    Calendar,
    Toast
} from 'vant';
export default {
    components: {
        navbar: navbar,
        VanIcon: Icon,
        VanForm: Form,
        VanField: Field,
        VanButton: Button,
        VanTab: Tab,
        VanTabs: Tabs,
        VanPopup: Popup,
        VanCalendar: Calendar
    },
    data() {
        return {
            activeTab: 0,
            baseInfo: {
                companyId: '',
                assetAmt: '',
                cashDeposit: '',
                cashDepositDescr: '',
                receivables: '',
                receivablesDescr: '',
                prepayment: '',
                prepaymentDescr: '',
                notesReceivable: '',
                notesReceivableDescr: '',
                otherReceivables: '',
                otherReceivableseDescr: '',
                rawMaterial: '',
                rawMaterialDescr: '',
                finishProduct: '',
                finishProductDescr: '',
                assetInvest: '',
                assetInvestDescr: '',
                assetHouse: '',
                assetHouseDescr: '',
                assetEquip: '',
                assetEquipDescr: '',
                assetTraffic: '',
                assetTrafficDescr: '',
                assetIntangible: '',
                assetIntangibleDescr: '',
                unamortizedExpenses: '',
                unamortizedExpensesDescr: '',
                familyAssetAmt: '',
                familyCashDeposit: '',
                familyCashDepositDescr: '',
                stockFinance: '',
                stockFinanceDescr: '',
                dwellingGoods: '',
                dwellingGoodsDescr: '',
                car: '',
                carDescr: '',
                otherAsset: '',
                otherAssetDescr: '',
                debtAmt: '',
                notesPayable: '',
                notesPayableDescr: '',
                accountsPayable: '',
                accountsPayableDescr: '',
                otherAccountsPayable: '',
                otherAccountsPayableDescr: '',
                depositReceived: '',
                depositReceivedDescr: '',
                bankLoan: '',
                bankLoanDescr: '',
                familyDebtAmt: '',
                otherBankLoan: '',
                otherBankLoanDescr: '',
                familyBankLoan: '',
                familyBankLoanDescr: '',
                familyOtherLoan: '',
                familyOtherLoanDescr: '',
                mortgageHouse: '',
                mortgageHouseDescr: '',
                mortgageCar: '',
                mortgageCarDescr: '',
                creditCard: '',
                creditCardDescr: '',
                mortgageOther: '',
                mortgageOtherDescr: '',
                assetTotal: '',
                debtTotal: '',
                ownerRigth: '',
                enterDebtRatio: '',
                familyDebtRatio: '',
                guarAmt: '',
                guarAssetRatio: '',
                reportTime: ''
            },
            colTotShow: false,
            dialogTitle: '',
            dialogLabel: '',
            dialogValue: '',
            dialogRemark: '',
            dialogKey: '',
            date: '',
            show: false,
            status: ''
        }
    },
    created() {
        this.baseInfo.companyId = sessionStorage.getItem('companyId')
        this.initQueryAssetDebt()
    },
    methods: {
        async initQueryAssetDebt() {
            const params = {
                companyId: sessionStorage.getItem('companyId'),
            }
            let result = await queryAssetDebt(params);
            console.log(result, 'result')
            if (result) {
                this.baseInfo = result
                this.status = 2
            } else {
                this.status = 1
            }
        },
        tabChange() { },
        handleFirmDialog(item) {
            console.log(item, 'item')
            this.colTotShow = true
            this.dialogTitle = item
            this.dialogLabel = item
            switch (this.dialogTitle) {
                case '存款现金': this.dialogValue = this.baseInfo.cashDeposit
                    this.dialogRemark = this.baseInfo.cashDepositDescr;
                    break
                case '应收账款': this.dialogValue = this.baseInfo.receivables
                    this.dialogRemark = this.baseInfo.receivablesDescr;
                    break
                case '预付账款': this.dialogValue = this.baseInfo.prepayment
                    this.dialogRemark = this.baseInfo.prepaymentDescr;
                    break
                case '应收票据': this.dialogValue = this.baseInfo.notesReceivable
                    this.dialogRemark = this.baseInfo.notesReceivableDescr;
                    break
                case '其他应收款': this.dialogValue = this.baseInfo.otherReceivables
                    this.dialogRemark = this.baseInfo.otherReceivableseDescr;
                    break
                case '原材料': this.dialogValue = this.baseInfo.rawMaterial
                    this.dialogRemark = this.baseInfo.rawMaterialDescr;
                    break
                case '产成品': this.dialogValue = this.baseInfo.finishProduct
                    this.dialogRemark = this.baseInfo.finishProductDescr;
                    break
                case '投资类资产': this.dialogValue = this.baseInfo.assetInvest
                    this.dialogRemark = this.baseInfo.assetInvestDescr;
                    break
                case '房产类资产': this.dialogValue = this.baseInfo.assetHouse
                    this.dialogRemark = this.baseInfo.assetHouseDescr;
                    break
                case '设备类资产': this.dialogValue = this.baseInfo.assetEquip
                    this.dialogRemark = this.baseInfo.assetEquipDescr;
                    break
                case '交通类资产': this.dialogValue = this.baseInfo.assetTraffic
                    this.dialogRemark = this.baseInfo.assetTrafficDescr;
                    break
                case '无形资产': this.dialogValue = this.baseInfo.assetIntangible
                    this.dialogRemark = this.baseInfo.assetIntangibleDescr;
                    break
                case '长期待摊费用': this.dialogValue = this.baseInfo.unamortizedExpenses
                    this.dialogRemark = this.baseInfo.unamortizedExpensesDescr;
                    break
                case '存款现金(个人及家庭)': this.dialogValue = this.baseInfo.familyCashDeposit
                    this.dialogRemark = this.baseInfo.familyCashDepositDescr;
                    break
                case '股票理财': this.dialogValue = this.baseInfo.stockFinance
                    this.dialogRemark = this.baseInfo.stockFinanceDescr;
                    break
                case '住宅及商品': this.dialogValue = this.baseInfo.dwellingGoods
                    this.dialogRemark = this.baseInfo.dwellingGoodsDescr;
                    break
                case '车辆': this.dialogValue = this.baseInfo.car
                    this.dialogRemark = this.baseInfo.carDescr;
                    break
                case '资产其他': this.dialogValue = this.baseInfo.otherAsset
                    this.dialogRemark = this.baseInfo.otherAssetDescr;
                    break
                case '应付票据': this.dialogValue = this.baseInfo.notesPayable
                    this.dialogRemark = this.baseInfo.notesPayableDescr;
                    break
                case '应付账款': this.dialogValue = this.baseInfo.accountsPayable
                    this.dialogRemark = this.baseInfo.accountsPayableDescr;
                    break
                case '其他应付款': this.dialogValue = this.baseInfo.otherAccountsPayable
                    this.dialogRemark = this.baseInfo.otherAccountsPayableDescr;
                    break
                case '预收账款': this.dialogValue = this.baseInfo.depositReceived
                    this.dialogRemark = this.baseInfo.depositReceivedDescr;
                    break
                case '我行贷款': this.dialogValue = this.baseInfo.bankLoan
                    this.dialogRemark = this.baseInfo.bankLoanDescr;
                    break
                case '他行贷款': this.dialogValue = this.baseInfo.otherBankLoan
                    this.dialogRemark = this.baseInfo.otherBankLoanDescr;
                    break
                case '我行贷款(不含按揭)': this.dialogValue = this.baseInfo.familyBankLoan
                    this.dialogRemark = this.baseInfo.familyBankLoanDescr;
                    break
                case '他行贷款(不含按揭)': this.dialogValue = this.baseInfo.familyOtherLoan
                    this.dialogRemark = this.baseInfo.familyOtherLoanDescr;
                    break
                case '房产按揭': this.dialogValue = this.baseInfo.mortgageHouse
                    this.dialogRemark = this.baseInfo.mortgageHouseDescr;
                    break
                case '汽车按揭': this.dialogValue = this.baseInfo.mortgageCar
                    this.dialogRemark = this.baseInfo.mortgageCarDescr;
                    break
                case '信用卡': this.dialogValue = this.baseInfo.creditCard
                    this.dialogRemark = this.baseInfo.creditCardDescr;
                    break
                case '负债其他': this.dialogValue = this.baseInfo.mortgageOther
                    this.dialogRemark = this.baseInfo.mortgageOtherDescr;
                    break
            }

        },
        handleDialogCommit() {
            switch (this.dialogTitle) {
                case '存款现金': this.baseInfo.cashDeposit = this.dialogValue
                    this.baseInfo.cashDepositDescr = this.dialogRemark;
                    break
                case '应收账款': this.baseInfo.receivables = this.dialogValue
                    this.baseInfo.receivablesDescr = this.dialogRemark;
                    break
                case '预付账款': this.baseInfo.prepayment = this.dialogValue
                    this.baseInfo.prepaymentDescr = this.dialogRemark;
                    break
                case '应收票据': this.baseInfo.notesReceivable = this.dialogValue;
                    this.baseInfo.notesReceivableDescr = this.dialogRemark;
                    break
                case '其他应收款': this.baseInfo.otherReceivables = this.dialogValue;
                    this.baseInfo.otherReceivableseDescr = this.dialogRemark;
                    break
                case '原材料': this.baseInfo.rawMaterial = this.dialogValue;
                    this.baseInfo.rawMaterialDescr = this.dialogRemark;
                    break
                case '产成品': this.baseInfo.finishProduct = this.dialogValue;
                    this.baseInfo.finishProductDescr = this.dialogRemark;
                    break
                case '投资类资产': this.baseInfo.assetInvest = this.dialogValue;
                    this.baseInfo.assetInvestDescr = this.dialogRemark;
                    break
                case '房产类资产': this.baseInfo.assetHouse = this.dialogValue;
                    this.baseInfo.assetHouseDescr = this.dialogRemark;
                    break
                case '设备类资产': this.baseInfo.assetEquip = this.dialogValue;
                    this.baseInfo.assetEquipDescr = this.dialogRemark;
                    break
                case '交通类资产': this.baseInfo.assetTraffic = this.dialogValue;
                    this.baseInfo.assetTrafficDescr = this.dialogRemark;
                    break
                case '无形资产': this.baseInfo.assetIntangible = this.dialogValue
                    this.baseInfo.assetIntangibleDescr = this.dialogRemark;
                    break
                case '长期待摊费用': this.baseInfo.unamortizedExpenses = this.dialogValue
                    this.baseInfo.unamortizedExpensesDescr = this.dialogRemark;
                    break
                case '存款现金(个人及家庭)': this.baseInfo.familyCashDeposit = this.dialogValue;
                    this.baseInfo.familyCashDepositDescr = this.dialogRemark;
                    break
                case '股票理财': this.baseInfo.stockFinance = this.dialogValue;
                    this.baseInfo.stockFinanceDescr = this.dialogRemark;
                    break
                case '住宅及商品': this.baseInfo.dwellingGoods = this.dialogValue;
                    this.baseInfo.dwellingGoodsDescr = this.dialogRemark;
                    break
                case '车辆': this.baseInfo.car = this.dialogValue;
                    this.baseInfo.carDescr = this.dialogRemark;
                    break
                case '资产其他': this.baseInfo.otherAsset = this.dialogValue;
                    this.baseInfo.otherAssetDescr = this.dialogRemark;
                    break
                case '应付票据': this.baseInfo.notesPayable = this.dialogValue;
                    this.baseInfo.notesPayableDescr = this.dialogRemark;
                    break
                case '应付账款': this.baseInfo.accountsPayable = this.dialogValue;
                    this.baseInfo.accountsPayableDescr = this.dialogRemark;
                    break
                case '其他应付款': this.baseInfo.otherAccountsPayable = this.dialogValue;
                    this.baseInfo.otherAccountsPayableDescr = this.dialogRemark;
                    break
                case '预收账款': this.baseInfo.depositReceived = this.dialogValue;
                    this.baseInfo.depositReceivedDescr = this.dialogRemark;
                    break
                case '我行贷款': this.baseInfo.bankLoan = this.dialogValue;
                    this.baseInfo.bankLoanDescr = this.dialogRemark;
                    break
                case '他行贷款': this.baseInfo.otherBankLoan = this.dialogValue;
                    this.baseInfo.otherBankLoanDescr = this.dialogRemark;
                    break
                case '我行贷款(不含按揭)': this.baseInfo.familyBankLoan = this.dialogValue;
                    this.baseInfo.familyBankLoanDescr = this.dialogRemark;
                    break
                case '他行贷款(不含按揭)': this.baseInfo.familyOtherLoan = this.dialogValue;
                    this.baseInfo.familyOtherLoanDescr = this.dialogRemark;
                    break
                case '房产按揭': this.baseInfo.mortgageHouse = this.dialogValue;
                    this.baseInfo.mortgageHouseDescr = this.dialogRemark;
                    break
                case '汽车按揭': this.baseInfo.mortgageCar = this.dialogValue;
                    this.baseInfo.mortgageCarDescr = this.dialogRemark;
                    break
                case '信用卡': this.baseInfo.creditCard = this.dialogValue;
                    this.baseInfo.creditCardDescr = this.dialogRemark;
                    break
                case '负债其他': this.baseInfo.mortgageOther = this.dialogValue;
                    this.baseInfo.mortgageOtherDescr = this.dialogRemark;
                    break
            }
            this.colTotShow = false
            this.dialogValue = ''
            this.dialogRemark = ''
            this.baseInfo.assetAmt = Number(this.baseInfo.cashDeposit) + Number(this.baseInfo.receivables) + Number(this.baseInfo.prepayment)
                + Number(this.baseInfo.notesReceivable) + Number(this.baseInfo.otherReceivables) + Number(this.baseInfo.rawMaterial) + Number(this.baseInfo.finishProduct)
                + Number(this.baseInfo.assetInvest) + Number(this.baseInfo.assetHouse) + Number(this.baseInfo.assetEquip) + Number(this.baseInfo.assetTraffic)
                + Number(this.baseInfo.assetIntangible) + Number(this.baseInfo.unamortizedExpenses);
            this.baseInfo.familyAssetAmt = Number(this.baseInfo.familyCashDeposit) + Number(this.baseInfo.stockFinance) + Number(this.baseInfo.dwellingGoods)
                + Number(this.baseInfo.car) + Number(this.baseInfo.otherAsset);
            this.baseInfo.debtAmt = Number(this.baseInfo.notesPayable) + Number(this.baseInfo.accountsPayable) + Number(this.baseInfo.otherAccountsPayable) + Number(this.baseInfo.depositReceived)
                + Number(this.baseInfo.bankLoan) + Number(this.baseInfo.otherBankLoan);
            this.baseInfo.familyDebtAmt = Number(this.baseInfo.familyBankLoan) + Number(this.baseInfo.familyOtherLoan) + Number(this.baseInfo.mortgageHouse) + Number(this.baseInfo.mortgageCar)
                + Number(this.baseInfo.creditCard) + Number(this.baseInfo.mortgageOther)


            this.baseInfo.assetTotal = Number(this.baseInfo.assetAmt) + Number(this.baseInfo.familyAssetAmt)
            this.baseInfo.debtTotal = Number(this.baseInfo.debtAmt) + Number(this.baseInfo.familyDebtAmt)
            this.baseInfo.ownerRigth = Number(this.baseInfo.assetTotal) - Number(this.baseInfo.debtTotal)
            if (Number(this.baseInfo.assetAmt) == 0) {
                this.baseInfo.enterDebtRatio = 0
            } else {
                this.baseInfo.enterDebtRatio = (Number(this.baseInfo.debtAmt) / Number(this.baseInfo.assetAmt)).toFixed(4)*100
            }
            if (Number(this.baseInfo.familyAssetAmt) == 0) {
                this.baseInfo.familyDebtRatio = 0
            } else {
                this.baseInfo.familyDebtRatio = (Number(this.baseInfo.familyDebtAmt) / Number(this.baseInfo.familyAssetAmt)).toFixed(4)*100
            }
        },
        changeGuarAmt() {
            if(Number(this.baseInfo.ownerRigth) == 0){
                this.baseInfo.guarAssetRatio = 0
            }else{
                this.baseInfo.guarAssetRatio = (Number(this.baseInfo.guarAmt) / Number(this.baseInfo.ownerRigth)).toFixed(4)*100
            }
        },
        onDisplay() {
            this.show = true

        },
        onClose() {
            this.show = false
        },
        formatDate(date) {
            date = new Date(date)
            return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
        },
        onConfirm(date) {
            console.log(date)
            this.show = false
            this.baseInfo.reportTime = this.formatDate(date)
        },
        handleDialogCancel() {
            this.colTotShow = false;
            this.dialogValue = ''
            this.dialogRemark = ''
        },
        async handleCommit() {
            if (this.status == 1) {
                let result = await addAssetDebt(this.baseInfo);
                if (result) {
                    Toast.success('新增成功');
                    this.$router.go(-1)
                }
            } else {
                let result = await updateAssetDebt(this.baseInfo);
                if (result) {
                    Toast.success('更新成功');
                    this.$router.go(-1)
                }
            }

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

.title {
    line-height: 45px;
    padding: 5px 15px;
    color: rgb(89, 89, 89);
}

.wrapper_main {
    padding-bottom: 30px;
}

.main_item {
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    color: rgb(89, 89, 89);
    line-height: 45px;
    margin-top: 1px;
}

.main_item_left {
    width: 35%;
    text-align: left;
}

.main_item_middle {
    text-align: left;
}

.popDialog {
    width: 300px;
    padding: 10px;

}

.dialog-title-box {
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
    margin: 16px 0 20px;
}

.dialog-label-box {
    color: rgb(140, 140, 140);
    font-size: 14px;
}

.dialogField {
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 5px;
    padding: 5px 16px;
}

.dialog-footer-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    border-top: solid 1px #dddddd;
    margin-top: 20px;
}

.dialog-footer-box .cancel-btn {
    font-size: 0.9rem;
    color: #999999;
    border-right: solid 1px #dddddd;
    text-align: center;
    width: 50%;
}


.dialog-footer-box .ok-btn {
    width: 50%;
    font-size: 0.9rem;
    color: #2372EB;
    text-align: center;
}

.footer {
    text-align: center;
    position: fixed;
    bottom: 0;
    width: 100%;

}

.btn {
    width: 100%;
}

.small_title {
    font-size: 12px;
}

.mg_top {
    margin-top: 15px;
}

.jine {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding-left: 16px;

    /deep/ .van-cell {
        width: 60%;
    }
}

.danwei {
    font-size: 14px;
}</style>