<template>
  <div>
    <div class="popTitle font-bold font-16">客户资信概况</div>
    <div class="cwnInfo">
      <van-row>
        <van-col span="9">客户信息：</van-col>
        <van-col span="15">{{clientId}}/({{info.partyOpcode}}){{info.clientName}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">实际余额：</van-col>
        <van-col span="15">{{info.sjYe | toFix(2) |separator('',' 元')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">资信可用额度：</van-col>
        <van-col span="15" class="red-tips">{{info.kyYe | toFix(2) |separator('',' 元')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">客户当前账期：</van-col>
        <van-col span="15">{{info.ts |separator('',' 天')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">客户滚动帐期：</van-col>
        <van-col span="15">{{info.tsEnd |separator('',' 天')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">当日回笼：</van-col>
        <van-col span="15">{{info.totalGathering | toFix(2) |separator('',' 元')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">当月回笼：</van-col>
        <van-col span="15">{{info.monthRtl | toFix(2) |separator('',' 元')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">年度累计回笼：</van-col>
        <van-col span="15">{{info.yearRtl | toFix(2) |separator('',' 元')}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">是否超期：</van-col>
        <van-col span="15">{{info.sign}}</van-col>
      </van-row>
      <van-row>
        <van-col span="9">是否超额：</van-col>
        <van-col span="15">{{info.sign1}}</van-col>
      </van-row>
    </div>
  </div>
</template>

<script>
import {getCWNData} from '../../../api/saleSituation'

export default {
  name: 'Creditworthiness',
  data() {
    return {
      info: {}
    }
  },
  props: {
    clientId: {
      type: Number,
      default: 0
    },
    orgId: {
      type: String,
      default: ''
    },
    dbName: {
      type: String,
      default: ''
    }
  },
  watch: {
    clientId: {
      handler(data) {
        this.getData()
      }
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    getData() {
      let param = {'attr': {'clientId': this.clientId, 'orgId': this.orgId}, 'dbName': this.dbName}
      getCWNData(param).then(rt => {
        if (rt.code === '1' || rt.code === 1) {
          this.info = rt.data[0]
        }
      }).catch(e => {

      })
    }
  }
}
</script>

<style lang="scss" scoped>
  .cwnInfo{
    padding-left: 7px;
    padding-right: 7px;
    overflow: scroll;
    background: white;
    height: calc(100vh - 46px);
    /deep/ .van-row {
      padding-top: 6px;
      padding-bottom: 6px;
      .van-col {
        font-size: 14px;
      }
      .van-col--9 {
        color: #677282;
      }
    }
  }

  .popTitle{
    width: 100%;
    height: 46px;
    line-height: 46px;
    text-align: center;
    color: #23262A;
    font-weight: bold;
    margin: 0;
    border-bottom: 1px solid #f7f8fa;
  }

  .red-tips {
    color: $bc4;
  }
</style>
