77 lines
2.7 KiB
TypeScript

import {BillList} from "@/components/bill/list.tsx";
import {Button, Modal, Space} from "@douyinfe/semi-ui";
import {GeneratePdf} from "@/service/generate-pdf.ts";
import {useState} from "react";
import {clone} from "lodash";
import dayjs from "dayjs";
import SearchForm from "@/components/bill/search-form.tsx";
import BillDetail from "@/components/bill/detail.tsx";
const mockBill: BillModel = {
actual_payment_amount: 110,
amount: 110,
application_no: "123123",
apply_status: "pending",
bill_status: "pending",
created_at: new Date(),
currency: "HKD",
department: "经管学院",
expiration_time: dayjs().add(30, "minute").toDate(),
id: 1123123,
paid_area: "HongKong,China",
paid_at: new Date(),
pay_amount: 110,
pay_method: "WechatHk",
payment_channel: "AsiaPay",
program_id: 123123,
service_charge: 0,
student_en_name: "SanF Chung",
student_no: "123123",
student_sc_name: "张三丰",
student_semester: "1",
student_tc_name: "张三丰",
student_year: "2024",
updated_at: "",
detail: [
{amount: 55, bill_id: 1123123, id: 1, type: "APPLICATION FEE"},
{amount: 50, bill_id: 1123123, id: 1, type: "TUITION FEE"},
{amount: 5, bill_id: 1123123, id: 1, type: "VISA FEE"},
]
}
const BillQuery = () => {
const [data, ] = useState<RecordList<BillModel>>({
list: Array(10).fill(mockBill).map((it, i) => {
const s = clone(it);
s.id = i;
if (i % 2 == 0) s.service_charge = 10
return s;
}),
pagination: {current: 1, pageSize: 10, total: 250,recordTotal:213123}
});
const [showBill,setShowBill] = useState<BillModel>()
const operation = (_record:BillModel)=>{
return (<Space>
<Button size={'small'} theme={'solid'} type={'primary'}></Button>
<Button onClick={()=>setShowBill(_record)} size={'small'} theme={'solid'} type={'primary'}></Button>
<Button onClick={()=>GeneratePdf('111.pdf')} size={'small'} theme={'solid'} type={'primary'}></Button>
</Space>)
}
return (<div>
<SearchForm showApply />
<BillList type={'query'} operationRender={operation} source={data} onPageChange={function (): void {
throw new Error("Function not implemented.");
}} />
<Modal
title="View QR code"
visible={!!showBill}
onOk={()=>{}}
onCancel={()=>setShowBill(undefined)} //>=1.16.0
closeOnEsc={true}
footerFill={true}
>
{showBill && <BillDetail bill={showBill} />}
</Modal>
</div>)
}
export default BillQuery