<template>
  <div>
    <Modal draggable :width="60"  :fullscreen='fullScreen' title="订单日志" :value.sync="isShow" @on-visible-change="$emit('update:isShow',$event)"
       >
<!--       <template v-slot:header>
         <div>
         订单日志
         <a class="ivu-modal-close" @click="closeshowChange"><i class="ivu-icon ivu-icon-ios-close"></i></a>
         <a class="ivu-modal-screen" @click="fullScreen=!fullScreen"><i :class="fullScreen?'el-icon-aim':'el-icon-full-screen'"></i></a>
         </div>
       </template> -->
      <xy-table :is-page="false" :list="list" :table-item="table" :height="300">
        <template v-slot:btns>
          <div></div>
        </template>
      </xy-table>
    </Modal>
  </div>
</template>

<script>
import {getItemLogs} from "@/api/order"
import {parseTime} from '@/utils'

export default {
  props:{
    id:Number,
    isShow:{
      type:Boolean,
      default:false
    }
  },
  data() {
    return {
      list:[],
      fullScreen:false,
      table:[
        {
          label:'用户',
          prop:'operator.name',
          width: 120
        },
        {
          label:'时间',
          prop:'created_at',
          width: 160,
          formatter:(cell,data,value) => {
            return parseTime(new Date(value),'{y}-{m}-{d}')
          }
        },
        {
          label:'下次跟进时间',
          prop:'next_follow_time',
          width: 160
        },
        {
          label:'操作',
          prop:'operate_name',
          width: 120
        },
        {
          label:'备注',
          prop:'remark',
          align:'left',
          sortable:false
        }
      ],
    }
  },
  methods: {
    async getLog(){
      const res = await getItemLogs({
        item_id:this.id
      })
      this.list = res.data
    },
    closeshowChange(){
      this.isShow = false
    }
  },
  watch:{
    isShow(newVal){
      if(newVal){
        this.getLog()
      }
    }
  }

}
</script>

<style scoped>
  /deep/ .ivu-modal{
      width:100%!important;

  }
  /deep/ .ivu-modal-content{
   /*  */
  }
/*  /deep/ .ivu-modal-content{
    width:100%!important
  } */
</style>
