<!-- 跟进 -->
<template>
  <div class="context">
    <div style="text-align: right;margin-bottom: 20px;">
      <!-- <el-button type="primary" @click="newfollow = !newfollow">
        新增合同
      </el-button>  -->
      <el-button type="primary" @click="examine_click">
        跟进审核
      </el-button> 
    </div>
    <el-divider></el-divider>
    <div v-for="item in list">
      <div class="top_border">
        <div style="flex: 1;">
          <el-avatar :size="50" :src="circleUrl"></el-avatar>
        </div>
        <div style="flex: 12;">
          <span>马文强</span><br/>
          <span>{{getTime(item.time)}}</span><br/>
          <span v-html="item.desc"></span>
        </div>
        <div style="flex: 1;">
          <el-button type="text" @click="opendele(item)">删除</el-button>
        </div>
      </div>
      <el-divider></el-divider>
    </div>

     <!-- 弹窗 -->
     <div>
      <!-- 新增 -->
      <el-dialog
        title="新增跟进"
        :visible.sync="newfollow"
        :modal-append-to-body="false"
        width="60%"
        >
        <div style="height: 50vh;overflow: overlay;">
          <!-- <keep-alive> -->
            <editor ref="editor"
                    id="editor"
                    style="width: 100%"
                    v-bind:r_content="content">
            </editor>
          <!-- </keep-alive> -->
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="newfollow = false">取 消</el-button>
          <el-button type="primary" @click="newfollow = false">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 查看 -->
      
    </div>
  </div>
</template>

<script>
import Editor from '@/components/Editor'
import{getfollowlist,getfollowcheck} from '../../../api/index'
import { uParseTime } from "@/utils/tools"
export default{
  props:{
    Message:Object
  },
  data(){
    return{
      input:'',
      circleUrl:'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
      newfollow:false,
      content:'2222',
      list:[],
      examine_id:'',
    }
  },
  components:{
    Editor
  },
  created(){
    this.getlist()
    // console.log('33333跟进',this.Message);
  },
  methods:{
    getlist(){
      getfollowlist().then(res =>{
        const list = res.data.list
        console.log('11111跟进',list);
        const table =[]
        this.examine_id=list[0].custom_id
        list.forEach((item,index) => {
          const arr = {
            id:item.id,
            desc:item.desc,
            time:item.ctime,
          }
          table.unshift(arr)
        });
        this.list = table
      })
    },
    examine_click(){
      // const data ={
      //   id:this.Message.id,
      //   account:window.sessionStorage.getItem('username'),
      //   password:window.sessionStorage.getItem('password')
      // }
      getfollowcheck(this.examine_id).then(res =>{
        console.log('跟进',res);
      })
    },
    // 转换时间
    getTime(val) {
      if(val < 0){
        return ""
      }
      if(val == ""){
        return ""
      }else {
        return uParseTime(val, '{y}-{m}-{d} {h}:{i}:{s}')
      }
    },
  }
}
</script>
<style lang="scss" scoped>
.context{
  padding: 20px;
  .top_border{
    display: flex;
    /* border: 1px solid gray;*/
  }
}

</style>