<template>
  <div class="div_content" @click="onClickDetail">
    <div class="div_title">
      <span :class="classes">{{agreement.contractState}}</span>
      <span class="span_title">{{agreement.contractName}}</span>
    </div>
    <div class="div_content_key_value">
      <span class="span_key">合同编号：</span>
      <span class="span_value">{{agreement.contractNo}}</span>
    </div>
    <div class="div_content_key_value">
      <span class="span_key">签订日期：</span>
      <span class="span_value">正常</span>
    </div>

  </div>
</template>

<script>
  export default {
    name: "providerAgreementItem",
    props:{
      agreement:{
        type:Object
      }
    },
    computed:{
      classes(){
        let classes = {};
        if (this.agreement.contractState === '进行中'){
          classes[this.span_status_normal] = true;
        }
        if (this.agreement.contractState === '已结束'){
          classes[this.span_status_end] = true;
        }
        if (this.agreement.contractState === '未开始'){
          classes[this.span_status_not_start] = true;
        }

        return classes;

      }
    },
    data() {
      return{
        span_status_normal:"span_status_normal",
        span_status_end:"span_status_end",
        span_status_not_start:"span_status_not_start"
      }
    },
    methods:{
      onClickDetail(){
        this.$router.push({
          path:"providerDocumentAgreementDetail",
          query:{
            contractId:this.agreement.contractId
          }
        })
      }
    }
  }
</script>

<style scoped>

  .div_content{
    display: flex;
    flex-direction: column;
    padding: 15px;
    margin: 10px 15px 0;
    background-color: white;
    border-radius: 5px;
  }
  .div_title{
    display: flex;
    flex-direction: row;
    flex-flow: nowrap;
    align-items: center;
  }
  .span_title{
    color: #333333;
    font-size: 16px;
    margin-left: 10px;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
    flex: 1;
  }
  .div_content_key_value{
    width: 100%;
    display: flex;
    flex-direction: row;
    margin-top: 10px;
  }
  .span_key{
    color: #999999;
    font-size: 12px;
    width: 60px;
  }
  .span_value{
    color: #999999;
    font-size: 12px;
    margin-left: 5px;
  }
  .span_status_normal{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 21px;
    padding: 0 10px;
    border-radius: 10px;
    background-color: #78AEF9;
    color: white;

  }
  .span_status_end{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 21px;
    padding: 0 10px;
    border-radius: 10px;
    background-color: #ADB8C8;
    color: white;

  }
  .span_status_not_start{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 21px;
    padding: 0 10px;
    border-radius: 10px;
    background-color: #47BCC8;
    color: white;

  }

</style>
