<template>
    <div class="unqualified-service-provider">
        <bs-table v-bind="tableOptions">

        </bs-table>
    </div>
</template>
<script setup lang="jsx">
import { ref, reactive } from "vue"
import { message } from "ant-design-vue";
import { useRouter } from "vue-router";

import BsTable, { useBsTable } from '/@/components/BsUi/Table/index.js';
import { DISPLAY_STATE } from '/@/components/BsUi/constant.js';
import useBsDict from "/@/utils/dict.js";
const router = useRouter()
const {
    tableOptions,
    setTablePropsValue: setValue,
    getTablePropsValue: getValue,
} = useBsTable({
    tableOptions: {
        url: '/supports/provider/queryPage',
        gridOptions: {
            loading: false,
            columns: [
                {
                    type: 'seq',
                    width: 80,
                },
                {
                    field: 'storeStatus',
                    title: '状态',
                    slots: {
                        default: ({ row }) => {
                            if (row.storeStatus === 0) {
                                return <span style={{ color: '#ed8a94' }}>已认证</span>
                            } else if (row.storeStatus === 1) {
                                return <span style={{ color: '#dc861f' }}>不合格</span>
                            } 
                        }
                    }
                },
                {
                    field: '',
                    title: '流水号',
                },
                {
                    field: 'providerName',
                    title: '服务商名称',
                },
                {
                    field: 'id',
                    title: '服务商ID',
                },
                {
                    field: 'address',
                    title: '服务商地址',
                },
                {
                    field: 'countryRegion',
                    title: '归属区域',
                },
                {
                    field: 'providerType',
                    title: '服务商类型',
                    cellRender: {
                        name: 'CellDict',
                    },
                },
                {
                    field: 'storeSource',
                    title: '注册来源',
                },
                {
                    field: 'createTime',
                    title: '注册时间',
                },
                {
                    field: 'name',
                    title: '归属营销人员',
                },
                {
                    // fixed: 'right',
                    cellRender: {
                        name: 'CellOption',
                        extraProps: {
                            buttons: [
                                {
                                    title: '查看详情',
                                    code: 'view',
                                    display: ({ row }) => {
                                        return DISPLAY_STATE.VISIBLE;
                                    },
                                    disabled({ row }) {
                                        return false;
                                    },
                                    onClick({ row }) {
                                        router.push('/market-manage/service-provider-manage/detail?id=' + row.id);
                                     },
                                    extraProps: {},
                                },
                                {
                                    title: '重新发起',
                                    code: 'view',
                                    display: ({ row }) => {
                                        return row.auditStatus === 1 ? DISPLAY_STATE.VISIBLE : DISPLAY_STATE.HIDDEN;
                                    },
                                    disabled({ row }) {
                                        return false;
                                    },
                                    onClick({ row }) { },
                                    extraProps: {},
                                },
                            ],
                        },
                    },
                },
            ],
        },
        searchConfig: {
            enabled: true,
            fieldSpan: 4,
            fields: [
                {
                    field: 'providerName',
                    label: '服务商名称',
                    component: 'a-input',
                    componentProps: {
                        placeholder: '请输入服务商名称',
                    },
                },
                {
                    field: 'address',
                    label: '服务商地址',
                    component: 'a-input',
                    componentProps: {
                        placeholder: '请输入服务商地址',
                    },
                },
                {
                    field: 'providerType',
                    label: '服务商类型',
                    component: 'a-select',
                    componentProps: {
                        options: useBsDict.getDictList('BLINK_PROVIDER_TYPE'),
                        placeholder: '请输入服务商类型',
                    },
                },
            ],
        },
        pagerConfig: {
            enabled: true,
            pageSize: 10,
            pageNum: 1,
            total: 0,
            // isFixed: false
        },
        toolbarConfig: {

        },
        tableSearchBeforeBiz() {
            const searchParams = getValue('searchConfig.data');
            setValue('searchConfig.data', { ...searchParams, bizModel: 'STORE-1' });
        },
    },
});
</script>
<style lang="scss" scoped></style>
