Merge branch 'main' of github.com:hainatravel/GHHub

release
Jimmy Liow 2 years ago
commit 58e6500d12

@ -14,6 +14,7 @@ class Invoice {
invoicekImages = []; //图片列表
invoiceGroupInfo= {}; //账单详细
invocieProductList=[];//账单细项
invocieCurrencyList=[];//币种
@ -64,10 +65,12 @@ class Invoice {
});
this.invoicePage.total = json.Result[0].TotalCount;
}else{
this.invoiceList=[];
this.invoicePage.total=0;
}
// else{
// this.invoiceList=[];
// this.invoicePage.total=0;
// }
}else{
throw new Error(json.errmsg + ': ' + json.errcode);
@ -96,6 +99,7 @@ class Invoice {
if(json.errcode==0){
this.invoiceGroupInfo = json.GroupInfo[0];
this.invocieProductList = json.ProductList;
this.invocieCurrencyList = json.CurrencyList;
}else{
throw new Error(json.errmsg + ': ' + json.errcode);
}
@ -114,7 +118,7 @@ class Invoice {
.then(json => {
console.log(json);
runInAction(() => {
this.feedbackImages = json.result.map((data, index) => {
this.invoicekImages = json.result.map((data, index) => {
return {
uid: -index, //用负数,防止添加删除的时候错误
name: data.file_name,
@ -130,6 +134,21 @@ class Invoice {
}
removeFeedbackImages(fileurl) {
let url = `/service-fileServer/FileDelete`;
url += `?fileurl=${fileurl}`;
return fetch(config.HT_HOST + url)
.then(response => response.json())
.then(json => {
console.log(json);
return json.Result;
})
.catch(error => {
console.log("fetch data failed", error);
});
}
invoicePage = {
current:1,
size:10,

@ -2,7 +2,7 @@ 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} from "antd";
import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select } from "antd";
import { useStore } from "@/stores/StoreContext.js";
import { PlusOutlined } from "@ant-design/icons";
import * as config from "@/config";
@ -10,134 +10,175 @@ const { Title } = Typography;
function Detail() {
const navigate = useNavigate();
const {GMDSN,GSN} = useParams();
const { GMDSN, GSN } = useParams();
const { invoiceStore, authStore } = useStore();
const { invoicekImages ,invoiceGroupInfo,invocieProductList} = invoiceStore;
const { invoicekImages, invoiceGroupInfo, invocieProductList, invocieCurrencyList } = invoiceStore;
const [form] = Form.useForm();
const [dataLoading, setDataLoading] = useState(false);
const { formDate, onDateChange } = useState();
const { formCurrency, onCurrencyChange } = useState();
useEffect(() => {
console.info("Detail.useEffect: " + GMDSN+"/"+GSN);
console.info("Detail.useEffect: " + GMDSN + "/" + GSN);
setDataLoading(true);
invoiceStore.fetchInvoiceDetail(GMDSN,GSN)
.catch(ex => {
notification.error({
message: `Notification`,
description: ex.message,
placement: 'top',
duration: 4,
invoiceStore.fetchInvoiceDetail(GMDSN, GSN)
.catch(ex => {
notification.error({
message: `Notification`,
description: ex.message,
placement: 'top',
duration: 4,
});
})
.finally(() => {
setDataLoading(false);
});
})
.finally(() => {
setDataLoading(false);
});
},[GMDSN,GSN]);
}, [GMDSN, GSN]);
const fileList = toJS(invoicekImages);
const onFinish = values => {
console.log("Success:", values);
if (values) {
alert(values);
}
};
const fieldVaule = {
...values,
'info_date': values['info_date'].format('YYYY-MM-DD'),
'info_images': fileList,
}
console.log("Success:", fieldVaule);
};
const handleChange = info => {
console.log(info);
let newFileList = [...info.fileList];
newFileList = newFileList.map(file => {
if (file.response && file.response.result) {
file.url = file.response.result.file_url;
}
return file;
});
runInAction(() => {
invoiceStore.invoicekImages = newFileList;
});
};
const handRemove = info => {
console.log(info);
invoiceStore.removeFeedbackImages(info.url);
return true;
};
console.log(info);
let newFileList = [...info.fileList];
newFileList = newFileList.map(file => {
if (file.response && file.response.result) {
file.url = file.response.result.file_url;
}
return file;
});
runInAction(() => {
invoiceStore.invoicekImages = newFileList;
});
};
const handRemove = info => {
console.log(info);
invoiceStore.removeFeedbackImages(info.url);
return true;
};
function bindCurrency() {
let arr = [];
arr = invocieCurrencyList.map((data, index) => {
return {
value: data.CRI_Code,
label: data.CRI_Name
};
// (<Option value="data.CRI_Code">data.CRI_Name</Option>);
});
return arr;
}
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
</Button>
</Col>
</Row>
<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}>
<Row gutter={16} style={{ backgroundColor: "#f6f7f9", width: "100%", padding: "20px 40px" }} >
<Col span={8}>
<Card title="组 团" bordered={false}>
<p>CHINA HIGHLIGHTS</p>
<p>CHINA HIGHLIGHTS</p>
</Card>
</Col>
<Col span={8}>
</Col>
<Col span={8}>
<Card title="组团人" bordered={false}>
<p>{invoiceGroupInfo.WLFirstName} {invoiceGroupInfo.WLLastName} &nbsp;&nbsp; Email: {invoiceGroupInfo.WLEmail}</p>
<p>{invoiceGroupInfo.WLFirstName} {invoiceGroupInfo.WLLastName} &nbsp;&nbsp; Email: {invoiceGroupInfo.WLEmail}</p>
</Card>
</Col>
<Col span={8}>
</Col>
<Col span={8}>
<Card title="客人国籍" bordered={false}>
<p>{invoiceGroupInfo.County}</p>
<p>{invoiceGroupInfo.County}</p>
</Card>
</Col>
</Row>
</Col>
</Row>
<Title level={5}>报账信息</Title>
<Row gutter={16} style={{ backgroundColor:"#f6f7f9",width:"100%",padding:"20px 40px"}} >
<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>
<Upload
name="ghhfile"
accept="image/*"
multiple={true}
action={config.HT_HOST + `/service-fileServer/FileUpload?GRI_SN=${GSN}&VEI_SN=${authStore.login.travelAgencyId}`}
fileList={fileList}
listType="picture-card"
onChange={handleChange}
onRemove={handRemove}>
<div>
<PlusOutlined />
<div style={{ marginTop: 8 }}>Click to Upload</div>
</div>
</Upload>
name="ghhfile"
accept="image/*"
multiple={true}
action={config.HT_HOST + `/service-fileServer/FileUpload?GRI_SN=${GSN}&VEI_SN=${authStore.login.travelAgencyId}`}
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>
<Input addonBefore="报账总额:" defaultValue="0.00" />
</Form.Item>
<Form.Item>
<Input addonBefore="币种选择:" defaultValue="0.00" />
</Form.Item>
<Form.Item
name="info_content"
rules={[
{
required: true,
message: "Please input your messages!",
},
]}
>
<Input addonBefore="付款日期:" defaultValue="0.00" />
</Form.Item>
<Row gutter={16}>
<Col span={8}> <Form.Item
name="info_money"
label="报账总额:"
rules={[
{
required: true,
message: "Please input your money!",
},
]}
>
<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>
Submit
</Button>
</Form.Item>
</Form>
</Col>
@ -149,7 +190,7 @@ function Detail() {
}

Loading…
Cancel
Save