<template>
  <el-dialog visible :before-close="closeDialog" :close-on-click-modal="false" width="1000px">
    <el-row style="text-align: center; font-size: 22px">
      {{ $t('控货日志') }}
    </el-row>
    <el-table style="margin-top: 30px" :data="logData">
      <el-table-column prop="createTime" :label="$t('操作时间')" align="center" header-align="center">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="creatorName" :label="$t('操作人')" align="center" header-align="center" />
      <el-table-column prop="userType" :label="$t('操作人类型')" align="center" header-align="center">
        <template slot-scope="{ row }">
          {{ type[row.userType] }}
        </template>
      </el-table-column>
      <el-table-column prop="type" :label="$t('操作类型')" align="center" header-align="center" />
      <el-table-column prop="msg" :label="$t('备注')" align="center" header-align="center" />
    </el-table>
  </el-dialog>
</template>

<script>
import { controlLog } from '@/api/order'
import { parseTime } from '@/utils'
export default {
  props: ['orderId'],
  data() {
    return {
      parseTime,
      logData: [],
      type: ['', this.$t('会员'), this.$t('管理员')]
    }
  },
  created() {
    controlLog(this.orderId).then((res) => {
      this.logData = res.data
    })
  },
  methods: {
    closeDialog() {
      this.$emit('close')
    }
  }
}
</script>

<style>
::v-deep .el-table__header .el-table__cell {
  background-color: #27417c;
  font-size: 13px;
  height: 48px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
}
</style>
