<template>
    <div class="view" id="labelPage" v-loading="load">
        <by-table :propConfig="tableConfig" ref="table">
            <template v-slot:ordered="{ row }">
                <span>{{ row.ordered }}</span>
            </template>
        </by-table>
    </div>

</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import { IResponeData, getDistributorOrder } from "@/api/omsOrder";
@Component({ components: {} })
export default class Distributor extends Vue {
    timer: any = null
    isHasOne = false;//是否有一条数据
    userInfo: any = {};
    tool = {
        tools: {
            add: true,
            refresh: true
        },
        audit: {}
    }
    tableConfig: any = {
        attr: {
            size: 'mini',
            seq: true
        },
        columns: [{
            title: '名称',
            field: 'companyName'
        }, {
            title: '分销商编号',
            field: 'channelCompanyId'
        }, {
            title: '创建于',
            field: 'createTime',
            width: 250,
        }]
    }
    time: any;
    timeNum = 0;
    data: Array<any> = []
    load = false;


    async getList() {
        this.load = true;
        const res = await getDistributorOrder({ pageNum: 1, pageSize: 1000 }) as unknown as IResponeData<any>;
        this.load = false;
        if (res.code != 200) {
            return;
        }
        this.isHasOne = res.rows.length > 0;
        (this.$refs.table as any).setValue(res.rows);
    }


    created() {
        this.userInfo = this.$store.getters.userInfo;
    }
    mounted() {
        this.$nextTick(() => {
            this.getList()
        })
    }
    unmounted() {
        clearTimeout(this.timer);
    }
}
</script>

<style lang="scss" scoped>
.view {
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;

    .tool {
        padding-bottom: 16px;
    }
}
</style>