<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" inline>
                <el-form-item label="客户名称" prop="name">
                    <el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入客户名称" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none" v-loading="pager.loading" shadow="never">
            <div class="mt-4">
                <el-table :data="pager.lists" @cell-click="handleCurrentChange">
                    <el-table-column label="序号" type="index" />
                    <el-table-column label="收票银行" prop="account_name" show-overflow-tooltip />
                    <el-table-column label="收票账户编码" prop="account" show-overflow-tooltip />
                    <el-table-column label="收票日期" prop="receipt_date" show-overflow-tooltip />
                    <el-table-column label="票据编号" prop="bill_sn" show-overflow-tooltip />

                    <el-table-column label="汇票类型" prop="invoice_amount" show-overflow-tooltip>
                        <template #default="{ row }">
                            <dict-value :options="dictData.bill_type" :value="row.bill_type" />
                        </template>
                    </el-table-column>

                    <el-table-column label="汇票承兑银行" prop="draft_acceptance_bank" show-overflow-tooltip />
                    <el-table-column label="汇票到期日期" prop="bill_due_date" show-overflow-tooltip />

                    <el-table-column label="收款金额大写" prop="receipt_amount_daxie" show-overflow-tooltip />
                    <el-table-column label="收款金额(元)" prop="receipt_amount" show-overflow-tooltip />
                    <el-table-column label="支出金额" prop="tax" show-overflow-tooltip />

                    <el-table-column label="余额" prop="tax" show-overflow-tooltip />
                    <el-table-column label="备注" prop="remark" show-overflow-tooltip />


                </el-table>

            </div>
            <div class="flex mt-4 justify-end">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
    </div>
</template>
  
<script lang="ts" setup>
import { usePaging } from "@/hooks/usePaging"
import { useDictData } from "@/hooks/useDictOptions"
import { acceptancebillLists } from '@/api/acceptance'
import { defineEmits } from "vue"

// 查询条件
const queryParams = reactive({

});

const { dictData } = useDictData('bill_type ')
// 选中数据
const emits = defineEmits(["customEvent"]);

// 选中数据子父传递
const handleCurrentChange = (value: any) => {
    emits("customEvent", value);
};

// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: acceptancebillLists,
    params: queryParams,
});

getLists();
</script>