<template>
    <div>
        <div class="pb-16 d-flex j-sb">
            <div>
                <div><searchTabs v-model="queryParams.auditStatus" @change="handleQuery" :list="tabs" key-label="name" key-value="type" key-count="num"></searchTabs></div>
            </div>
            <div>
                <el-button type="primary">全部通过</el-button>
                <el-button type="danger">全部不通过</el-button>
            </div>
        </div>
        <vxe-table :loading="loading" border :data="list">
            <!-- 序号 -->
            <vxe-column type="seq" width="60" title="序号" align="center" />
            <!-- 品名 -->
            <vxe-column title="品名" field="varietyName" min-width="100" :formatter="colNoData" />
            <!-- 规格 -->
            <vxe-column title="规格" field="specification" min-width="100" :formatter="colNoData" />
            <!-- 产地 -->
            <vxe-column title="产地价格（元/kg）" field="price" min-width="100" />
            <vxe-column title="对比近7天价格" min-width="100">
                <template #default="{ row }">{{ row.growthRate }}%</template>
            </vxe-column>
            <vxe-column title="积分" field="points" width="60" :formatter="colNoData" />
            <vxe-column title="上报人" field="createByName" width="100" :formatter="colNoData" />
            <vxe-column title="上报时间" field="createTime" min-width="100" :formatter="colNoData" />
            <vxe-column title="状态" fixed="right" width="110">
                <template #default="{ row }">
                    <div :class="['c-res-' + row?.auditStatus]">{{ selectDictLabel(check_status, row?.auditStatus) }}</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="priceRepordCheck" lang="ts">
import { colNoData } from '@/utils/noData';
import { listVipPayment } from '@/api/dgtmedicine/vipPayment/index';
import { originPriceDetail, priceDetailCount } from '@/api/price/report';
import { searchTabs } from '@/views/models';
const { query }: any = useRoute()
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { check_status } = toRefs<any>(proxy?.useDict('check_status'));
// 字典
const list = ref<any[]>([]);
const loading = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const data = reactive<any>({
    queryParams: {
        pageNum: 1,
        pageSize: 10,
        auditStatus: '0'
    }
});
const { queryParams } = toRefs(data);
/** 点击行上传发票 */

/** 查询会员信息列表 */
const getList = async () => {
    loading.value = true;
    const res = await originPriceDetail({ ...queryParams.value, originPriceId: query?.id, cpyid: query?.cpyid });
    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();
    handleQuery();
};
// tabs count获取
const tabs = ref<any>([]);
const getTabs = async () => {
    const res = await priceDetailCount({ originPriceId: query?.id, cpyid: query?.cpyid });
    if (!res || res.code !== 200) return;
    tabs.value = res.data
};
onMounted(() => {
    getTabs();
    getList();
});
</script>
