<!--合约信息-->
<template>
  <div>
    <tags :data="tagsData" v-if="tagsData && tagsData.length > 0"></tags>
    <div class="userInfoPanel mt10">
      <el-row class="userInfo" v-if="data && data.length > 0" v-for="(item,index) in data" :key="index">
        <el-col :span="12">
          <span class="name">保险单号</span>
          <span class="value">{{item.policyno}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">保险期限</span>
          <span class="value">{{item.security}}天</span>
        </el-col>
        <el-col :span="12">
          <span class="name">承保分公司</span>
          <span class="value">{{item.pwcomp}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">起保日期</span>
          <span class="value">{{parseTime(item.pindate,'{yy}-{mm}-{dd}')}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">终保日期</span>
          <span class="value">{{parseTime(item.pmdate,'{yy}-{mm}-{dd}')}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">签单日期</span>
          <span class="value">{{parseTime(item.pisdate,'{yy}-{mm}-{dd}')}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">投保日期</span>
          <span class="value">{{parseTime(item.padate,'{yy}-{mm}-{dd}')}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">续保日期</span>
          <span class="value" v-if="item.norenewal != item.payendyear">{{parseTime(item.renewaldate,'{yy}-{mm}-{dd}')}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">已缴期数</span>
          <span class="value">{{item.norenewal}}次</span>
        </el-col>
        <el-col :span="12">
          <span class="name">缴费年期</span>
          <span class="value" v-if="item.payment != '趸缴'">{{item.payendyear}}年</span>
        </el-col>
        <el-col :span="12">
          <span class="name">销售渠道</span>
          <span class="value" v-if="item.schannel==1">团险渠道</span>
          <span class="value" v-if="item.schannel==2">个人营销</span>
          <span class="value" v-if="item.schannel==3">银行代理</span>
          <span class="value" v-if="item.schannel==4">中介渠道</span>
          <span class="value" v-if="item.schannel==5">网销渠道</span>
        </el-col>
        <el-col :span="12">
          <span class="name">保单状态</span>
          <span class="value">{{item.policystate}}</span>
<!--          <span class="value" v-if="item.PolicyState=='0'">未承保</span>-->
<!--          <span class="value" v-if="item.PolicyState=='1'">承保</span>-->
<!--          <span class="value" v-if="item.PolicyState=='2'">新增附加险</span>-->
<!--          <span class="value" v-if="item.PolicyState=='4'">终止</span>-->
<!--          <span class="value" v-if="item.PolicyState=='9'">续保</span>-->
<!--          <span class="value" v-if="item.PolicyState=='B'">未对账</span>-->
<!--          <span class="value" v-if="item.PolicyState=='F'">对账失败</span>-->
        </el-col><el-col :span="12">
        <span class="name">缴费方式</span>
        <span class="value">{{item.payment}}</span>
      </el-col>
        <el-col :span="12">
          <span class="name">保单保额</span>
          <span class="value">{{item.risk}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">保单保费</span>
          <span class="value">{{item.prem}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">下次缴费日期</span>
          <span class="value" v-if="isShowJFRQ(item)">{{parseTime(item.npdate,'{yy}-{mm}-{dd}')}}</span>
        </el-col>
<!--        <el-col :span="12">-->
<!--          <span class="name">被保人数</span>-->
<!--          <span class="value">{{item.soinsured}}人</span>-->
<!--        </el-col>-->
<!--        <el-col :span="12">-->
<!--          <span class="name">基本保额</span>-->
<!--          <span class="value">{{item.bsinsured}}</span>-->
<!--        </el-col>-->
<!--        <el-col :span="12">-->
<!--          <span class="name">保单价值</span>-->
<!--          <span class="value">{{item.insurvalue}}</span>-->
<!--        </el-col>-->
        <el-col :span="12">
          <span class="name">主被保险人名称</span>
          <span class="value">{{item.insname}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">险种名称</span>
          <span class="value">{{item.productname}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">业务员</span>
          <span class="value">{{item.salesperson}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">业绩归属</span>
          <span class="value">{{policybelongText(item.policybelong)}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">代理渠道</span>
          <span class="value">{{item.agentchannel}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">代理机构</span>
          <span class="value">{{item.agentorg}}</span>
        </el-col>
        <el-col :span="12">
          <span class="name">是否保全</span>
          <span class="value" v-if="item.poservice == 'Y'">是</span>
          <span class="value" v-else>否</span>
        </el-col>
        <el-col :span="24">
          <div class="line" v-if="index != (data.length-1)"></div>
        </el-col>
      </el-row>

      <el-row class="userInfo" v-if="data.length == 0">
        <div class="noData">暂无数据</div>
      </el-row>
    </div>
  </div>
</template>
<script>
  import tags from './tags'
  export default {
    components: {
      tags
    },
    props: {
      data: {
        type: Array,
        default: function (){
          return [];
        }
      },
      tagsData: {
        type: Array,
        default: function (){
          return [];
        }
      },
    },
    data() {
      return {

      };
    },
    mounted() {

    },
    methods: {
      policybelongText(val){
        let text = '';
        if(val){
          switch (val){
            case '00':
              text = '总部团险个单业务';
              break;
            case '01':
              text = '上分团险个单业务';
              break;
            case '02':
              text = '个险渠道';
              break;
            case '03':
              text = '银保渠道';
              break;
            case '05':
              text = '网销渠道';
              break;
            case '06':
              text = '健康险事业部';
              break;
          }
          return text;
        }
      },
      isShowJFRQ(obj){
        if(obj.payment == '趸缴' || obj.norenewal == obj.payendyear){
          return false;
        }else{
          return true;
        }
      }
    }
  };
</script>
<style lang="scss">
  .noData{
    color: #303133;
    text-align: center;
    padding: 20px 0;
  }
  .line{
    width: 100%;
    height: 1px;
    border-bottom: 1px dashed #dedede;
    padding-top: 20px;
  }
</style>

