<template>
    <el-dialog title="报表" :visible.sync="show" center width="500px">
        <el-table :data="reports" ref="table">
            <el-table-column prop="name" label="时间"></el-table-column>
            <el-table-column prop="likes" label="点赞数"></el-table-column>
            <el-table-column prop="bad" label="差评数"></el-table-column>
            <el-table-column prop="sale" label="销量"></el-table-column>
            <el-table-column prop="income" label="收入"></el-table-column>

        </el-table>
    </el-dialog>
</template>

<script>
    export default {
        name: "ReportDialog",
        props: {
            visible: {
                required: true,
            },
        },
        created() {
            this.show = this.visible;
            this.$http
                .get('/sales/report', {
                    mid: this.$route.query.mid
                })
                .then(res => {
                    this.reports = res;
                })
                .catch(e => {
                    console.log(e);
                });
        },
        data() {
            return {
                show: false,
                reports: [{
                    name: '',
                    like: '',
                    bad: '',
                    sale: '',
                    income: ''
                }],
            }
        },
        methods: {

        },
        watch: {
            visible(val) {
                this.show = val;
            },
            show(val) {
                this.$emit("update:visible", val);
            },
        }
    }
</script>

<style scoped>

</style>