<template>
    <div class="conent">
        <div class="table" style="margin-top: 10px">
            <el-table v-loading="loading" :data="tableData" style="width: 100%">
                <el-table-column prop="name" label="店铺名称"></el-table-column>
                <el-table-column prop="ship.expires_at" label="授权过期时间点"></el-table-column>
                <el-table-column prop="ship.owner_id" label="商家店铺id"></el-table-column>
                <el-table-column prop="ship.owner_name" label="商家账号名称"></el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button type="danger" v-if="scope.row.status === '未授权'" size="small"><a :href="scope.row.authUrl"
                                target="_blank" rel="noopener noreferrer">授权</a>
                        </el-button>

                        <div v-if="scope.row.status === '已授权'">
                            <el-button type="success" :disabled="true" size="small">{{ scope.row.status }}</el-button>
                        </div>
                        <div v-if="scope.row.status === '重新授权'">
                            <el-button type="danger" target="_blank" size="small">
                                <a :href="scope.row.authUrl" rel="noopener noreferrer">重新授权</a>
                            </el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
import { shipList } from "../../api/shop";
export default {
    data() {
        return {
            storeId: [],
            loading: true,
            tableData: [],
        };
    },
    mounted() {
        this.getShipList();
    },
    methods: {
        getShipList() {
            shipList().then((res) => {
                this.tableData = res.data.data;
            });
            this.loading = false
        },
    },
};
</script>

<style lang="scss" scoped>
a {
    text-decoration: none;
    color: white;
}

.block {
    margin-top: 20px;
}
</style>
