|
|
|
@ -2,27 +2,37 @@ import { useParams, useNavigate } from "react-router-dom";
|
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
|
import { toJS, runInAction } from "mobx";
|
|
|
|
|
import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select } from "antd";
|
|
|
|
|
import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select, App, Modal } from "antd";
|
|
|
|
|
import { useStore } from "@/stores/StoreContext.js";
|
|
|
|
|
import { PlusOutlined } from "@ant-design/icons";
|
|
|
|
|
import { isNotEmpty } from "@/utils/commons";
|
|
|
|
|
import * as config from "@/config";
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
|
|
|
|
|
const { Title } = Typography;
|
|
|
|
|
const { TextArea } = Input;
|
|
|
|
|
|
|
|
|
|
function Detail() {
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const { GMDSN, GSN } = useParams();
|
|
|
|
|
const { invoiceStore, authStore } = useStore();
|
|
|
|
|
const { invoicekImages, invoiceGroupInfo, invocieProductList, invocieCurrencyList } = invoiceStore;
|
|
|
|
|
const { invoicekImages, invoiceGroupInfo, invoiceProductList, invoiceCurrencyList, invoiceZDDetail, invoicePicList } = invoiceStore;
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
const [dataLoading, setDataLoading] = useState(false);
|
|
|
|
|
const { formDate, onDateChange } = useState();
|
|
|
|
|
const { formCurrency, onCurrencyChange } = useState();
|
|
|
|
|
const { notification } = App.useApp();
|
|
|
|
|
|
|
|
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
|
|
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
console.info("Detail.useEffect: " + GMDSN + "/" + GSN);
|
|
|
|
|
setDataLoading(true);
|
|
|
|
|
invoiceStore.fetchInvoiceDetail(GMDSN, GSN)
|
|
|
|
|
.then(() => {
|
|
|
|
|
form.setFieldsValue(invoiceStore.invoiceFormData); //{'info_money':'111','info_Currency':'THB','info_date':''}
|
|
|
|
|
})
|
|
|
|
|
.catch(ex => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: `Notification`,
|
|
|
|
@ -38,13 +48,34 @@ function Detail() {
|
|
|
|
|
}, [GMDSN, GSN]);
|
|
|
|
|
|
|
|
|
|
const fileList = toJS(invoicekImages);
|
|
|
|
|
//图片列表
|
|
|
|
|
let arrimg = [];
|
|
|
|
|
if (isNotEmpty(fileList)) {
|
|
|
|
|
arrimg = fileList.map((data, index) => {
|
|
|
|
|
return {
|
|
|
|
|
url: data.url
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const onFinish = values => {
|
|
|
|
|
const fieldVaule = {
|
|
|
|
|
...values,
|
|
|
|
|
'info_date': values['info_date'].format('YYYY-MM-DD'),
|
|
|
|
|
'info_images': fileList,
|
|
|
|
|
'info_date': isNotEmpty(values['info_date']) ? values['info_date'].format('YYYY-MM-DD') : null,
|
|
|
|
|
'info_images': JSON.stringify(arrimg),
|
|
|
|
|
}
|
|
|
|
|
console.log("Success:", fieldVaule);
|
|
|
|
|
//入库
|
|
|
|
|
if (fieldVaule) {
|
|
|
|
|
invoiceStore.postEditInvoiceDetail(GMDSN, fieldVaule.info_Currency, fieldVaule.info_money, fieldVaule.info_date, fieldVaule.info_images, "").then((data) => {
|
|
|
|
|
console.log(data);
|
|
|
|
|
runInAction(() => {
|
|
|
|
|
let param = { 'info_money': fieldVaule.info_money, 'info_Currency': fieldVaule.info_Currency, 'info_date': fieldVaule.info_date };
|
|
|
|
|
invoiceStore.invoiceFormData = param;
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
const handleChange = info => {
|
|
|
|
|
console.log(info);
|
|
|
|
@ -66,126 +97,301 @@ function Detail() {
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//币种
|
|
|
|
|
function bindCurrency() {
|
|
|
|
|
let arr = [];
|
|
|
|
|
arr = invocieCurrencyList.map((data, index) => {
|
|
|
|
|
arr = invoiceCurrencyList.map((data, index) => {
|
|
|
|
|
return {
|
|
|
|
|
value: data.CRI_Code,
|
|
|
|
|
label: data.CRI_Name
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// (<Option value="data.CRI_Code">data.CRI_Name</Option>);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addButton(check) {
|
|
|
|
|
if (check) {
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Space direction="vertical" style={{ width: "100%" }}>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col span={20}>
|
|
|
|
|
<Title level={4}>Reference Number: {invoiceGroupInfo.VGroupInfo}</Title>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}>
|
|
|
|
|
<Button type="link" onClick={() => navigate("/invoice")}>
|
|
|
|
|
Back
|
|
|
|
|
<Row>
|
|
|
|
|
<Divider orientation="left"></Divider>
|
|
|
|
|
<Button type="primary" block onClick={() => showConfirmModal(confirm)}>
|
|
|
|
|
ADD New Invoice
|
|
|
|
|
</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Title level={5}>基础信息</Title>
|
|
|
|
|
<Row gutter={16} style={{ backgroundColor: "#f6f7f9", width: "100%", padding: "20px 40px" }} >
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Card title="组 团" bordered={false}>
|
|
|
|
|
<p>CHINA HIGHLIGHTS</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Card title="组团人" bordered={false}>
|
|
|
|
|
<p>{invoiceGroupInfo.WLFirstName} {invoiceGroupInfo.WLLastName} Email: {invoiceGroupInfo.WLEmail}</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Card title="客人国籍" bordered={false}>
|
|
|
|
|
<p>{invoiceGroupInfo.County}</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Title level={5}>报账信息</Title>
|
|
|
|
|
<Row gutter={16} style={{ backgroundColor: "#f6f7f9", width: "100%", padding: "20px 40px" }} >
|
|
|
|
|
<Col span={4}></Col>
|
|
|
|
|
<Col span={18}>
|
|
|
|
|
<Form name="invoice_submit" onFinish={onFinish} labelCol={{ span: 5 }} form={form}>
|
|
|
|
|
<Divider orientation="left">上传照片</Divider>
|
|
|
|
|
<Form.Item>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//循环生成多次报账信息
|
|
|
|
|
function bindSubmitForm() {
|
|
|
|
|
let submitForm = invoiceZDDetail.map((data, index) => {
|
|
|
|
|
if (data.GMD_Dealed) { //已审核的直接显示信息即可,无需表单
|
|
|
|
|
return (
|
|
|
|
|
<Row key={data.GMD_SN} gutter={16} style={{ backgroundColor: "#f6f7f9", width: "100%", padding: "20px 40px" }} >
|
|
|
|
|
<Col span={4}></Col>
|
|
|
|
|
<Col span={18} >
|
|
|
|
|
<Divider orientation="left">第 {index + 1} 次报账</Divider>
|
|
|
|
|
<Upload
|
|
|
|
|
name="ghhfile"
|
|
|
|
|
accept="image/*"
|
|
|
|
|
multiple={true}
|
|
|
|
|
action={config.HT_HOST + `/service-fileServer/FileUpload?GRI_SN=${GSN}&VEI_SN=${authStore.login.travelAgencyId}`}
|
|
|
|
|
fileList={fileList}
|
|
|
|
|
action={config.HT_HOST + `/service-fileServer/FileUpload?GRI_SN=${GSN}&VEI_SN=${authStore.login.travelAgencyId}&FilePathName=invoice`}
|
|
|
|
|
fileList={invoiceStore.invoicePicList[index]}
|
|
|
|
|
listType="picture-card"
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
onRemove={handRemove}>
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<PlusOutlined />
|
|
|
|
|
<div style={{ marginTop: 8 }}>Click to Upload</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Upload>
|
|
|
|
|
<Divider orientation="left">提交信息</Divider>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Input addonBefore="报账总额:" value={data.GMD_Cost} />
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
金额币种: <Select
|
|
|
|
|
placeholder="Select Currency type"
|
|
|
|
|
allowClear
|
|
|
|
|
options={bindCurrency()}
|
|
|
|
|
value={data.GMD_Currency}
|
|
|
|
|
>
|
|
|
|
|
</Select>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Input addonBefore="最迟付款日期:" value={data.GMD_PayDate} />
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
{addButton(index + 1 == invoiceZDDetail.length)}
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}></Col>
|
|
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
// 一个团只能有一个未审核的账单记录
|
|
|
|
|
return (
|
|
|
|
|
<Row key={data.GMD_SN} gutter={16} style={{ backgroundColor: "#f6f7f9", width: "100%", padding: "20px 40px" }} >
|
|
|
|
|
<Col span={4}></Col>
|
|
|
|
|
<Col span={18} >
|
|
|
|
|
<Form name="invoice_submit" onFinish={onFinish} labelCol={{ span: 5 }} form={form}>
|
|
|
|
|
<Divider orientation="left">上传照片</Divider>
|
|
|
|
|
<Form.Item>
|
|
|
|
|
<Upload
|
|
|
|
|
name="ghhfile"
|
|
|
|
|
accept="image/*"
|
|
|
|
|
multiple={true}
|
|
|
|
|
action={config.HT_HOST + `/service-fileServer/FileUpload?GRI_SN=${GSN}&VEI_SN=${authStore.login.travelAgencyId}&FilePathName=invoice`}
|
|
|
|
|
fileList={fileList}
|
|
|
|
|
listType="picture-card"
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
onRemove={handRemove}>
|
|
|
|
|
<div>
|
|
|
|
|
<PlusOutlined />
|
|
|
|
|
<div style={{ marginTop: 8 }}>Click to Upload</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Upload>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Divider orientation="left">提交信息</Divider>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
|
|
|
|
|
<Col span={8}> <Form.Item
|
|
|
|
|
name="info_money"
|
|
|
|
|
label="报账总额:"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "Please input your money!",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item></Col>
|
|
|
|
|
<Col span={8}><Form.Item
|
|
|
|
|
name="info_Currency"
|
|
|
|
|
label="金额币种:"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "Please select Currency type!",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Select
|
|
|
|
|
placeholder="Select Currency type"
|
|
|
|
|
onChange={onCurrencyChange}
|
|
|
|
|
allowClear
|
|
|
|
|
options={bindCurrency()}
|
|
|
|
|
>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item></Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name="info_date"
|
|
|
|
|
label="最迟付款日期: "
|
|
|
|
|
>
|
|
|
|
|
<DatePicker />
|
|
|
|
|
</Form.Item></Col>
|
|
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
<Form.Item>
|
|
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
|
|
Submit
|
|
|
|
|
</Button>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}></Col>
|
|
|
|
|
</Row>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// console.info(invoiceStore.invoiceFormData)
|
|
|
|
|
|
|
|
|
|
return submitForm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region Modal
|
|
|
|
|
const showConfirmModal = (confirm) => {
|
|
|
|
|
setIsModalOpen(true);
|
|
|
|
|
// setConfirmText(confirm.PCI_ConfirmText);
|
|
|
|
|
//reservationStore.editConfirmation(confirm);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleOk = () => {
|
|
|
|
|
setConfirmLoading(true);
|
|
|
|
|
// reservationStore.submitConfirmation(confirmText)
|
|
|
|
|
// .finally(() => {
|
|
|
|
|
// setIsModalOpen(false);
|
|
|
|
|
// setConfirmLoading(false);
|
|
|
|
|
// });
|
|
|
|
|
};
|
|
|
|
|
const handleCancel = () => {
|
|
|
|
|
setIsModalOpen(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Modal
|
|
|
|
|
centered
|
|
|
|
|
confirmLoading={confirmLoading}
|
|
|
|
|
open={isModalOpen} onOk={handleOk} onCancel={handleCancel}
|
|
|
|
|
width={1000}
|
|
|
|
|
>
|
|
|
|
|
<Title level={4}>Add New Invoice</Title>
|
|
|
|
|
<Form name="invoice_submit" onFinish={onFinish} labelCol={{ span: 5 }} form={form}>
|
|
|
|
|
<Divider orientation="left">上传照片</Divider>
|
|
|
|
|
<Form.Item
|
|
|
|
|
labelCol={{
|
|
|
|
|
span: 8,
|
|
|
|
|
}}
|
|
|
|
|
wrapperCol={{
|
|
|
|
|
span: 16,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Upload
|
|
|
|
|
name="ghhfile"
|
|
|
|
|
accept="image/*"
|
|
|
|
|
multiple={true}
|
|
|
|
|
action={config.HT_HOST + `/service-fileServer/FileUpload?GRI_SN=${GSN}&VEI_SN=${authStore.login.travelAgencyId}&FilePathName=invoice`}
|
|
|
|
|
fileList={fileList}
|
|
|
|
|
listType="picture-card"
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
onRemove={handRemove}>
|
|
|
|
|
<div>
|
|
|
|
|
<PlusOutlined />
|
|
|
|
|
<div style={{ marginTop: 8 }}>Click to Upload</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Upload>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Divider orientation="left">提交信息</Divider>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
|
name="info_money"
|
|
|
|
|
label="报账总额:"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "Please input your money!",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Divider orientation="left">提交信息</Divider>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
|
|
|
|
|
<Col span={8}> <Form.Item
|
|
|
|
|
name="info_money"
|
|
|
|
|
label="报账总额:"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "Please input your money!",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
<Form.Item
|
|
|
|
|
name="info_Currency"
|
|
|
|
|
label="金额币种:"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "Please select Currency type!",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Select
|
|
|
|
|
placeholder="Select Currency type"
|
|
|
|
|
onChange={onCurrencyChange}
|
|
|
|
|
allowClear
|
|
|
|
|
options={bindCurrency()}
|
|
|
|
|
>
|
|
|
|
|
<Input defaultValue="0.00" />
|
|
|
|
|
</Form.Item></Col>
|
|
|
|
|
<Col span={8}><Form.Item
|
|
|
|
|
name="info_Currency"
|
|
|
|
|
label="金额币种:"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "Please select Currency type!",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Select
|
|
|
|
|
placeholder="Select Currency type"
|
|
|
|
|
onChange={onCurrencyChange}
|
|
|
|
|
allowClear
|
|
|
|
|
options={bindCurrency()}
|
|
|
|
|
>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item></Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name="info_date"
|
|
|
|
|
label="最迟付款日期: "
|
|
|
|
|
>
|
|
|
|
|
<DatePicker />
|
|
|
|
|
</Form.Item></Col>
|
|
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
<Form.Item>
|
|
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
|
|
Submit
|
|
|
|
|
</Button>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}></Col>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
|
name="info_date"
|
|
|
|
|
label="最迟付款日期: "
|
|
|
|
|
>
|
|
|
|
|
<DatePicker />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
</Space>
|
|
|
|
|
</Form>
|
|
|
|
|
</Modal>
|
|
|
|
|
<Space direction="vertical" style={{ width: "100%" }}>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col span={20}>
|
|
|
|
|
<Title level={4}>Reference Number: {invoiceGroupInfo.VGroupInfo}</Title>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}>
|
|
|
|
|
<Button type="link" onClick={() => navigate("/invoice")}>
|
|
|
|
|
Back
|
|
|
|
|
</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Title level={5}>基础信息</Title>
|
|
|
|
|
<Row gutter={16} style={{ backgroundColor: "#f6f7f9", width: "100%", padding: "20px 40px" }} >
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Card title="组 团" bordered={false}>
|
|
|
|
|
<p>CHINA HIGHLIGHTS</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Card title="组团人" bordered={false}>
|
|
|
|
|
<p>{invoiceGroupInfo.WLFirstName} {invoiceGroupInfo.WLLastName} Email: {invoiceGroupInfo.WLEmail}</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
<Card title="客人国籍" bordered={false}>
|
|
|
|
|
<p>{invoiceGroupInfo.County}</p>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Title level={5}>报账信息</Title>
|
|
|
|
|
{bindSubmitForm()}
|
|
|
|
|
</Space>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|