<template>
    <div class="flex1 ov-hd">
        <vxe-table :loading="loading" border :data="list">
            <vxe-column type="seq" width="60" title="序号" align="center" />
            <vxe-column title="订单号" field="id" min-width="100" :formatter="colNoData" />
            <vxe-column title="企业名称" field="cpyName" min-width="100" :formatter="colNoData" />
            <vxe-column title="会员级别" field="vipLevelName" width="100" :formatter="colNoData" />
            <vxe-column title="缴费金额" width="120" :formatter="colNoData">
                <template #default="{ row }">{{ row.totalAmount }}元</template>
            </vxe-column>
            <vxe-column title="邮箱" field="email" min-width="100" :formatter="colNoData" />
            <vxe-column title="缴费人" field="createName" min-width="100" :formatter="colNoData" />
            <vxe-column title="缴费时间" field="createTime" width="170" :formatter="colNoData" />
            <vxe-column title="订单状态" width="100" fixed="right">
                <template #default="{ row }">
                    <div class="c-primary">{{ selectDictLabel(test_order_status_bg, row?.status) }}</div>
                </template>
            </vxe-column>
        </vxe-table>
    </div>
    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</template>
<script setup name="Pay-log" lang="ts">
import { colNoData } from '@/utils/noData';
import { testOrderList } from '@/api/cdt/orders';
const { query }: any = useRoute()
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { dm_package_type, dm_permit_type, vip_level, test_order_status_bg } = toRefs<any>(proxy?.useDict('dm_package_type', 'dm_permit_type', 'vip_level', 'test_order_status_bg'));
const list = ref<any[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const showInvoice = ref(false);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const data = reactive<any>({
    queryParams: {
        pageNum: 1,
        pageSize: 10,
    }
});
const { queryParams } = toRefs(data);
/** 点击行上传发票 */
const rowInfo = ref<any>({});
const clickRowEdit = (row: any) => {
    rowInfo.value = row;
    showInvoice.value = true;
};
/** 查询会员信息列表 */
const getList = async () => {
    loading.value = true;
    const res = await testOrderList({ ...queryParams.value, packageId: query?.id });
    list.value = res.rows;
    total.value = res.total;
    loading.value = false;
};

/** 搜索按钮操作 */
const handleQuery = (level?: any) => {
    queryParams.value.pageNum = 1;
    getList();
};

/** 重置按钮操作 */
const resetQuery = () => {
    queryFormRef.value?.resetFields();
    queryParams.value.startDate = '';
    queryParams.value.endDate = '';
    handleQuery();
};


onMounted(() => {
    getList();
});
</script>
