<template>
  <el-dialog :visible.sync="visible" v-bind="modalOptions" append-to-body>
    <div>
      <div>
        <el-table
          v-loading="reviewListLoading" height="60vh" element-loading-text="正在查询中。。。" :data="reviewDataList"
          v-bind="{ stripe: true, size: 'small', border: true, fit: true, highlightCurrentRow: true }"
        >
          <el-table-column label="动态" width="220">
            <template slot-scope="scope">
              {{ scope.row.operationDescribtion }}
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="时间" />
          <el-table-column prop="name" label="操作人" />
          <el-table-column prop="remark" label="其他信息" />
        </el-table>
      </div>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button size="mini" @click="handleClose">关 闭</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
import { activeGetExamines } from '@/api/active'

export default {
  name: 'ActivityReview',
  data() {
    return {
      modalOptions: {
        closeOnClickModal: false,
        width: '920px',
        title: '店铺的活动审核记录'
      },
      visible: false,
      formData: {
        shopId: '',
        composeId: '',
        signId: ''
      },
      reviewDataList: [],
      reviewListLoading: true,
      reviewListQuery: {
        only: ''
      }
    }
  },
  methods: {
    handleClose() {
      this.visible = false
    },
    async initList() {
      this.reviewListQuery = { only: `${this.formData.shopId}-${this.formData.composeId}-${this.formData.signId}` }
      this.getActivityReviewList()
    },
    handleOpen(params = {}) {
      this.formData = Object.assign(this.$options.data().formData, params)
      this.initList()
      if (params.shopId) {
        // this.getInfo(params.shopId)
      }
      this.visible = true
    },
    async getInfo(id) {
      const loading = this.$loading({ text: '加载中' })
      try {
        const res = await xxx({ id })
        this.formData = Object.assign(this.$options.data().formData, res.data, {
          shopId: res.data.shopId || ''
        })
      } finally {
        loading.close()
      }
    },
    handleSubmit() {
    },

    async getActivityReviewList() {
      this.reviewListLoading = true
      try {
        const res = await activeGetExamines(this.reviewListQuery)
        this.reviewDataList = res.data
      } finally {
        this.reviewListLoading = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.small-padding {
	.cell {
		padding-left: 5px;
		padding-right: 5px;
	}
}

.fixed-width {
	.el-button--mini {
		padding: 7px 10px;
	}
}
</style>
