<template>
  <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
    <div v-if="remarkList.length>0">
      <div v-for="item in remarkList" :key="item.id + 'remarks'" class="info">
        <div class="clearfix">
          <span class="title">{{ item.sysUserName + '【' + item.no + '】' }}</span>
          <time class="time">{{ new Date(item.createDate) | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</time>
        </div>
        <p class="content">{{ item.remarks }}</p>
      </div>
    </div>
    <div v-else class="info">
      <p class="title">暂无备注信息可供查看！</p>
    </div>
    <!--<el-form label-position="left" label-width="100px">
      <el-form-item label="备注" prop="remark">
        <el-input v-model="remark" type="textarea" />
      </el-form-item>
    </el-form>-->
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">关闭</el-button>
      <!--<el-button type="primary" @click="submitRemark">确认</el-button>-->
    </div>
  </el-dialog>
</template>

<script>
import { saveRemarks } from '@/api/order'
export default {
  props: {
    dialogTitle: {
      type: String,
      default: '备注'
    },
    isVisible: {
      type: Boolean,
      default: false
    },
    orderId: {
      type: Number,
      default: 0
    },
    remarkList: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data: function() {
    return {
      listLoading: true,
      remark: ''
    }
  },
  computed: {
    dialogFormVisible: {
      get() {
        return this.isVisible
      },
      set(val) {
        this.$emit('update:isVisible', val)
      }
    }
  },
  created() {

  },
  methods: {
    submitRemark() {
      if (this.remark) {
        saveRemarks({ remarks: this.remark, orderID: this.orderId }).then(response => {
          this.$message({ message: response.msg, type: 'success', center: true, duration: 2000 })
          this.dialogFormVisible = false
        })
      } else {
        this.dialogFormVisible = false
      }
    }
  }
}
</script>

<style scoped>
  .clearfix:before,
  .clearfix:after {
      display: table;
      content: "";
  }
  .clearfix:after {
      clear: both
  }
  .info{
    margin-bottom: 20px;
    border-bottom: 1px dashed #DCDFE6;
  }
  .time {
    font-size: 13px;
    color: #999;
    float: right;
  }
  .title {
    line-height: 12px;
    color: blue;
  }
  .content{
    margin-top: 13px;
  }
</style>
