虚拟订单更换一个新订单,旧虚拟订单用新页面显示。
parent
7d4b4d3546
commit
102774dd64
@ -0,0 +1,130 @@
|
||||
import { useParams, NavLink, useNavigate } from "react-router-dom";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Row, Col, Space, Table, Image,App } from "antd";
|
||||
import { formatDate, isNotEmpty } from "@/utils/commons";
|
||||
import SearchForm from "@/components/SearchForm";
|
||||
import dayjs from "dayjs";
|
||||
import BackBtn from "@/components/BackBtn";
|
||||
import { fetchInvoiceDetail } from "@/stores/Invoice";
|
||||
import useInvoiceStore from "@/stores/Invoice";
|
||||
import { usingStorage } from "@/hooks/usingStorage";
|
||||
|
||||
function History() {
|
||||
const { travelAgencyId } = usingStorage();
|
||||
const { GMDSN, GSN } = useParams();
|
||||
const [dataLoading, setDataLoading] = useState(false);
|
||||
const [invoiceZDDetail, setInvoiceZDDetail] = useState([]);
|
||||
const { notification } = App.useApp();
|
||||
|
||||
useEffect(() => {
|
||||
defaultShow();
|
||||
}, [GMDSN, GSN]);
|
||||
|
||||
function defaultShow() {
|
||||
setDataLoading(true);
|
||||
|
||||
fetchInvoiceDetail(travelAgencyId, GMDSN, GSN)
|
||||
.then((json) => {
|
||||
//console.log("id:"+travelAgencyId+",gmdsn:"+GMDSN+",GSN:"+GSN+"#13"+json);
|
||||
setInvoiceZDDetail(json.invoiceZDDetail);
|
||||
})
|
||||
.catch((ex) => {
|
||||
notification.error({
|
||||
message: `Notification`,
|
||||
description: ex.message,
|
||||
placement: "top",
|
||||
duration: 4,
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
setDataLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
const invoicePaidColumns = [
|
||||
{
|
||||
title: "ID",
|
||||
dataIndex: "GMD_SN",
|
||||
key: "GMD_SN",
|
||||
},
|
||||
{
|
||||
title: "Due Date",
|
||||
key: "GMD_PayDate",
|
||||
dataIndex: "GMD_PayDate",
|
||||
render: (text, record) =>
|
||||
isNotEmpty(text) ? formatDate(new Date(text)) : "",
|
||||
},
|
||||
{
|
||||
title: "Amount",
|
||||
key: "GMD_Cost",
|
||||
dataIndex: "GMD_Cost",
|
||||
},
|
||||
{
|
||||
title: "Currency",
|
||||
key: "GMD_Currency",
|
||||
dataIndex: "GMD_Currency",
|
||||
},
|
||||
{
|
||||
title: "Status",
|
||||
key: "FKState",
|
||||
dataIndex: "FKState",
|
||||
render: (text, record) => (isNotEmpty(record.FKState) ? invoiceStatus(record.FKState) : text),
|
||||
},
|
||||
{
|
||||
title: "Invoice",
|
||||
key: "GMD_Pic",
|
||||
dataIndex: "GMD_Pic",
|
||||
render: showPIc,
|
||||
},
|
||||
];
|
||||
|
||||
const invoiceStatus = (FKState) => {
|
||||
switch (FKState - 1) {
|
||||
case 1:
|
||||
return "Submitted";
|
||||
case 2:
|
||||
return "Travel Advisor";
|
||||
case 3:
|
||||
return "Finance Dept";
|
||||
case 4:
|
||||
return "Paid";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
function showPIc(text, record) {
|
||||
let strPic = record.GMD_Pic;
|
||||
//console.log(JSON.parse(strPic));
|
||||
if (isNotEmpty(strPic)) {
|
||||
return JSON.parse(strPic).map((item, index) => {
|
||||
return <Image key={index} width={90} src={item.url} />;
|
||||
});
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Row gutter={16}>
|
||||
<Col span={20}></Col>
|
||||
<Col span={4}>
|
||||
<BackBtn />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col md={24} lg={24} xxl={24}>
|
||||
<Table
|
||||
rowKey={"GMD_SN"}
|
||||
bordered
|
||||
columns={invoicePaidColumns}
|
||||
dataSource={invoiceZDDetail}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
||||
export default History;
|
Loading…
Reference in New Issue