<template>
    <div class="p-3">
        <div class="bg-fff flex1 ov-hd d-flex flex-cln">
            <div class="pd-16">
                <div class="f-s-20 c-333 f-w-7">折扣维护</div>
            </div>
            <div class="flex1 ov-hd mr-16 ml-16">
                <vxe-table :loading="loading" border :data="list" min-height="0" max-height="100%">
                    <!-- 序号 -->
                    <vxe-column type="seq" width="60" title="序号" align="center" />
                    <vxe-column title="会员级别" align="center" field="name" min-width="100" :formatter="colNoData" />
                    <vxe-column title="折扣标准" align="center" min-width="100">
                        <template #default="{ row }">{{ NP.times(row?.discount, 10) }}折</template>
                    </vxe-column>
                    <vxe-column title="创建人" align="center" field="createByName" min-width="100" :formatter="colNoData" />
                    <vxe-column title="创建时间" align="center" field="createTime" min-width="100" :formatter="colNoData" />
                </vxe-table>
            </div>
            <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
            <div class="pd-5"></div>
        </div>
    </div>
</template>
<script setup name="Discount" lang="ts">
import { vipDiscountList } from '@/api/cdt/discount';
import { colNoData } from '@/utils/noData';
import NP from 'number-precision';
const queryParams = ref<any>({
    pageNum: 1,
    pageSize: 10,
});
const loading = ref(false);
const total = ref(0);
const list = ref<any>([]);
const getList = async () => {
    loading.value = true;
    const res = await vipDiscountList(queryParams.value);
    if (!res || res.code !== 200) return;
    list.value = res.rows;
    total.value = res.total;
    loading.value = false;
};
const handleQuery = () => {
    queryParams.value.pageNum = 1;
    getList();
};
onMounted(() => {
    getList();
});
</script>
