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

release
Jimmy Liow 2 years ago
commit 7a9dc9e0bb

@ -57,8 +57,8 @@ class Invoice {
this.invoiceList = json.Result.map((data, index) => {
return {
key: data.GMDSN,
gmd_gri_sn: data.gmd_gri_sn,
gmd_vei_sn: data.gmd_vei_sn,
gmd_gri_sn: data.GMD_GRI_SN,
gmd_vei_sn: data.GMD_VEI_SN,
GetGDate: data.GetGDate,
GMD_FillWorkers_SN: data.GMD_FillWorkers_SN,
GMD_FWks_LastEditTime: data.GMD_FWks_LastEditTime,
@ -70,11 +70,11 @@ class Invoice {
GroupName: data.GroupName,
AllMoney: data.AllMoney,
PersonNum: data.PersonNum,
GMD_Currency: data.GMD_Currency,
VName: data.VName,
FKState: data.FKState,
};
});
this.invoicePage.total = json.Result[0].TotalCount;
} else {
this.invoiceList = [];
}
@ -177,6 +177,7 @@ class Invoice {
removeFeedbackImages(fileurl) {
let url = `/service-fileServer/FileDelete`;
url += `?fileurl=${fileurl}`;
url += `&token=${this.root.authStore.login.token}`;
return fetch(config.HT_HOST + url)
.then(response => response.json())
.then(json => {
@ -222,12 +223,6 @@ class Invoice {
});
}
invoicePage = {
current: 1,
size: 10,
total: 0,
};
/* 测试数据 */
//账单列表范例数据
testData = [
@ -246,6 +241,7 @@ class Invoice {
GMD_FillWorkers_Name: "",
GroupName: " 中华游230501-CA230402033",
AllMoney: 3539,
GMD_Currency: "",
PersonNum: "1大1小",
VName: "",
},

@ -122,3 +122,11 @@ export function clickUrl(url) {
httpLink.target = "_blank";
httpLink.click();
}
export function escape2Html(str) {
var temp = document.createElement("div");
temp.innerHTML = str;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
}

@ -31,6 +31,7 @@ const feedbackListColumns = [
{
title: "Post Survey",
dataIndex: "Average",
render: (text, record) => (text ? text : ""),//0
sorter: (a, b) => b.Average - a.Average,
},
{
@ -47,8 +48,7 @@ function Index() {
const showTotal = total => `Total ${feedbackList.length} items`;
useEffect(() => {
feedbackStore.searchFeedbackList(authStore.login.travelAgencyId, referenceNo, search_date_start.format(config.DATE_FORMAT), search_date_end.format(config.DATE_FORMAT) + " 23:59")
.catch(ex => {
feedbackStore.searchFeedbackList(authStore.login.travelAgencyId, referenceNo, search_date_start.format(config.DATE_FORMAT), search_date_end.format(config.DATE_FORMAT) + " 23:59").catch(ex => {
// notification.error({
// message: `Error`,
// description: ex.message,

@ -1,8 +1,8 @@
import { useParams, useNavigate } from "react-router-dom";
import { useParams, useNavigate, NavLink } from "react-router-dom";
import { useEffect, useState, useRef } 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, App, Modal } from "antd";
import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select, App, Descriptions } from "antd";
import { useStore } from "@/stores/StoreContext.js";
import { PlusOutlined } from "@ant-design/icons";
import { isNotEmpty } from "@/utils/commons";
@ -22,31 +22,27 @@ function Detail() {
const { formCurrency, onCurrencyChange } = useState();
const { notification } = App.useApp();
const [isModalOpen, setIsModalOpen] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const [invoicePicList, setInvoicePicList] = useState([]);
useEffect(() => {
console.info("Detail.useEffect: " + GMDSN + "/" + GSN);
defaultShow();
}, [GMDSN, GSN]);
function defaultShow() {
setDataLoading(true);
invoiceStore.fetchInvoiceDetail(GMDSN, GSN)
.then((json) => {
invoiceStore
.fetchInvoiceDetail(GMDSN, GSN)
.then(json => {
let ZDDetail = json.ZDDetail;
let arrLen = ZDDetail.length;
const formData = ZDDetail.map((data, index) => {
if (data.GMD_Dealed == false && arrLen == (index+1)){ //
if (data.GMD_Dealed == false && arrLen == index + 1) {
//
runInAction(() => {
invoiceStore.invoiceFormData = {'info_money':data.GMD_Cost,'info_Currency':data.GMD_Currency,'info_date':isNotEmpty(data.GMD_PayDate)?dayjs(data.GMD_PayDate):'','info_gmdsn':data.GMD_SN};
invoiceStore.invoiceFormData = { info_money: data.GMD_Cost, info_Currency: data.GMD_Currency, info_date: isNotEmpty(data.GMD_PayDate) ? dayjs(data.GMD_PayDate) : "", info_gmdsn: data.GMD_SN };
});
return {'info_money':data.GMD_Cost,'info_Currency':data.GMD_Currency,'info_date':isNotEmpty(data.GMD_PayDate)?dayjs(data.GMD_PayDate):'','info_gmdsn':data.GMD_SN};
return { info_money: data.GMD_Cost, info_Currency: data.GMD_Currency, info_date: isNotEmpty(data.GMD_PayDate) ? dayjs(data.GMD_PayDate) : "", info_gmdsn: data.GMD_SN };
}
});
@ -54,37 +50,35 @@ function Detail() {
form.setFieldsValue(formData[arrLen - 1]); //{'info_money':'111','info_Currency':'THB','info_date':''}
}
//
let arrPicList = ZDDetail.map((data, index) => {
const GMD_Pic = data.GMD_Pic;
let picList = [];
if (isNotEmpty(GMD_Pic)) {
let js_Pic = JSON.parse(GMD_Pic)
let js_Pic = JSON.parse(GMD_Pic);
picList = js_Pic.map((picData, pic_Index) => {
return {
uid: -pic_Index, //
name: '',
name: "",
status: "done",
url: picData.url,
}
};
});
}
if (data.GMD_Dealed == false && arrLen == (index+1)){
if (data.GMD_Dealed == false && arrLen == index + 1) {
runInAction(() => {
invoiceStore.invoicekImages = picList;
});
}
return picList;
})
});
setInvoicePicList(arrPicList);
})
.catch(ex => {
notification.error({
message: `Notification`,
description: ex.message,
placement: 'top',
placement: "top",
duration: 4,
});
})
@ -99,25 +93,25 @@ function Detail() {
if (isNotEmpty(fileList)) {
arrimg = fileList.map((data, index) => {
return {
url: data.url
}
url: data.url,
};
});
}
const onFinish = values => {
const fieldVaule = {
...values,
'info_date': isNotEmpty(values['info_date']) ? values['info_date'].format('YYYY-MM-DD') : null,
'info_images': JSON.stringify(arrimg),
}
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(fieldVaule.info_gmdsn, fieldVaule.info_Currency, fieldVaule.info_money, fieldVaule.info_date, fieldVaule.info_images, "").then((data) => {
invoiceStore.postEditInvoiceDetail(fieldVaule.info_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 };
let param = { info_money: fieldVaule.info_money, info_Currency: fieldVaule.info_Currency, info_date: fieldVaule.info_date };
invoiceStore.invoiceFormData = param;
})
});
if (data.errcode == 0) {
notification.success({
message: `Notification`,
@ -128,41 +122,8 @@ function Detail() {
}
});
}
};
const onAddFinish = values => {
const fieldVaule = {
...values,
'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.postAddInvoice(GSN, fieldVaule.info_Currency, fieldVaule.info_money, fieldVaule.info_date, fieldVaule.info_images, "").then((data) => {
console.log("return:",data);
runInAction(() => {
let param = { 'info_money': fieldVaule.info_money, 'info_Currency': fieldVaule.info_Currency, 'info_date': fieldVaule.info_date };
invoiceStore.invoiceFormData = param;
})
if (data.errcode == 0 ){
// notification.success({
// message: `Notification`,
// description: "Success Submit!",
// placement: "top",
// duration: 4,
// });
setIsModalOpen(false);
}
});
}
};
const handleChange = info => {
console.log(info);
let newFileList = [...info.fileList];
@ -189,7 +150,7 @@ function Detail() {
arr = invoiceCurrencyList.map((data, index) => {
return {
value: data.CRI_Code,
label: data.CRI_Name
label: data.CRI_Name,
};
});
@ -197,78 +158,55 @@ function Detail() {
}
function addInvoice() {
invoiceStore.postAddInvoice(GSN, "", 0, "", "[]", "").then((data) => {
runInAction(() => {
invoiceStore.invoiceFormData = {'info_money':0,'info_Currency':'','info_date':'','info_gmdsn':GMDSN};
});
}).finally(()=>{
invoiceStore
.postAddInvoice(GSN, "", 0, "", "[]", "")
.then(data => {})
.finally(() => {
defaultShow();
})
});
}
function addButton(check) {
if (check) {
return (
<Row>
<Divider orientation="left"></Divider>
<Button type="primary" block onClick={() => addInvoice(confirm)}>
ADD New Invoice
</Button>
</Row>
)
);
}
}
//
function bindSubmitForm() {
let submitForm = invoiceZDDetail.map((data, index) => {
if (data.GMD_Dealed) { //
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>
<Divider orientation="left">Invoice {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}&FilePathName=invoice&token=${authStore.login.token}`}
fileList={invoicePicList[index]}
listType="picture-card"
>
<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>
listType="picture-card"></Upload>
<Descriptions title={"Detail"}>
<Descriptions.Item label="Amount">{data.GMD_Cost}</Descriptions.Item>
<Descriptions.Item label="Currency">{data.GMD_Currency}</Descriptions.Item>
<Descriptions.Item label="Due Dat">{data.GMD_PayDate}</Descriptions.Item>
</Descriptions>
{addButton(index + 1 == invoiceZDDetail.length)}
</Col>
<Col span={4}></Col>
</Row>
)
);
} else {
//
return (
@ -276,7 +214,7 @@ function Detail() {
<Col span={4}></Col>
<Col span={18}>
<Form name="invoice_submit" onFinish={onFinish} labelCol={{ span: 5 }} form={form} style={{ backgroundColor: "#fff", padding: "20px" }}>
<Divider orientation="left">上传照片</Divider>
<Divider orientation="left">Invoice {index + 1}</Divider>
<Form.Item>
<Upload
name="ghhfile"
@ -293,52 +231,42 @@ function Detail() {
</div>
</Upload>
</Form.Item>
<Divider orientation="left">提交信息</Divider>
<Divider orientation="left">Details</Divider>
<Row gutter={16}>
<Col span={8}> <Form.Item
<Col span={8}>
{" "}
<Form.Item
name="info_money"
label="报账总额"
label="Amount"
rules={[
{
required: true,
message: "Please input your money!",
},
]}
>
]}>
<Input />
</Form.Item></Col>
<Col span={8}><Form.Item
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="info_Currency"
label="金额币种:"
label="Currency"
rules={[
{
required: true,
message: "Please select Currency type!",
},
]}
>
<Select
placeholder="Select Currency type"
onChange={onCurrencyChange}
allowClear
options={bindCurrency()}
>
</Select>
</Form.Item></Col>
]}>
<Select placeholder="Select Currency type" onChange={onCurrencyChange} options={bindCurrency()}></Select>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
name="info_date"
label="最迟付款日期: "
>
<Form.Item name="info_date" label="Due Date: ">
<DatePicker />
</Form.Item></Col>
</Form.Item>
</Col>
</Row>
<Form.Item
name="info_gmdsn"
hidden={true}
>
<Form.Item name="info_gmdsn" hidden={true}>
<input />
</Form.Item>
<Form.Item>
@ -346,120 +274,22 @@ function Detail() {
Submit
</Button>
</Form.Item>
<p>
Our Finance Dept makes payment during the last week in each month. So due date can only the last day of each month. If there's urgent payment, please contact the travel advisor and send invoice
separately.
</p>
</Form>
</Col>
<Col span={4}></Col>
</Row>
)
);
}
})
});
return submitForm;
}
//#region Modal
const showConfirmModal = (confirm) => {
setIsModalOpen(true);
};
const fromRef = useRef()
const handleOk = () => {
setConfirmLoading(true);
try{
fromRef.current?.submit();
//onAddFinish;
//setIsModalOpen(false);
} finally{
setConfirmLoading(false);
navigate("/invoice/detail/"+GMDSN+"/"+GSN)
}
};
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_add" onFinish={onAddFinish} labelCol={{ span: 5 }} form={form} ref={fromRef}>
<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&token=${authStore.login.token}`}
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>
<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>
<Form.Item
name="info_date"
label="最迟付款日期: "
>
<DatePicker />
</Form.Item>
</Form>
</Modal> */}
<Space direction="vertical" style={{ width: "100%" }}>
<Row gutter={16}>
<Col span={20}>
@ -471,35 +301,11 @@ function Detail() {
</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} &nbsp;&nbsp; Email: {invoiceGroupInfo.WLEmail}</p>
</Card>
</Col>
<Col span={8}>
<Card title="客人国籍" bordered={false}>
<p>{invoiceGroupInfo.County}</p>
</Card>
</Col>
</Row>
<Title level={5}>报账信息</Title>
<Title level={5}></Title>
{bindSubmitForm()}
</Space>
</>
);
}
export default observer(Detail);

@ -12,10 +12,8 @@ const { Title } = Typography;
function Index() {
const { authStore, invoiceStore } = useStore();
const { invoiceList, invoicePage, search_date_start, search_date_end } = invoiceStore;
const { invoiceList, search_date_start, search_date_end } = invoiceStore;
const [groupNo, onGroupNoChange] = useState("");
const [arrivalDateRange, onDateRangeChange] = useState([]);
const [dataLoading, setDataLoading] = useState(false);
const { notification } = App.useApp();
const showTotal = total => `Total ${invoiceList.length} items`;
@ -28,37 +26,24 @@ function Index() {
},
{
title: "Arrival Date",
key: "LeftGDate",
dataIndex: "LeftGDate",
key: "GetGDate",
dataIndex: "GetGDate",
render: (text, record) => (isNotEmpty(text) ? formatDate(new Date(text)) : ""),
},
{
title: "人数",
key: "PersonNum",
dataIndex: "PersonNum",
},
{
title: "团总额",
title: "Total Amount",
key: "AllMoney",
dataIndex: "AllMoney",
render: (text, record) => (isNotEmpty(record.GMD_Currency) ? record.GMD_Currency + " " + text : text),
},
{
title: "账单状态",
title: "Status",
key: "status",
render: BillStatus,
},
];
function BillStatus(text, record) {
// if (record.GMD_Dealed){
// return "";
// }else if (record.GMDFillworkers_SN<1){
// return "";
// }else if (record.VRequestVerify){
// return "";
// }else{
// return "";
// }
let FKState = record.FKState - 1;
return (
<Steps
@ -66,23 +51,19 @@ function Index() {
initial={1}
items={[
{
title: "提交",
//status: 'finish',
title: "Submitted",
icon: <EditOutlined />,
},
{
title: "顾问",
// status: 'finish',
title: "Travel Advisor",
icon: <SolutionOutlined />,
},
{
title: "财务",
//status: 'process',
title: "Finance Dept",
icon: <AuditOutlined />,
},
{
title: "Done",
//status: 'wait',
title: "Paid",
icon: <SmileOutlined />,
},
]}
@ -119,8 +100,8 @@ function Index() {
</Row>
<Title level={3}></Title>
<Row>
<Col span={24}>
<Table bordered loading={dataLoading} pagination={{ defaultPageSize: 20, showTotal: showTotal }} columns={invoiceListColumns} dataSource={toJS(invoiceList)} />
<Col md={24} lg={24} xxl={12}>
<Table bordered pagination={{ defaultPageSize: 20, showTotal: showTotal }} columns={invoiceListColumns} dataSource={toJS(invoiceList)} />
</Col>
</Row>
</Space>

@ -27,7 +27,9 @@ function Detail() {
<Col span={16}>
<Title level={1}>{noticeInfo.CCP_BLTitle}</Title>
<Divider orientation="right">{noticeInfo.CCP_LastEditTime}</Divider>
<Paragraph>{noticeInfo.CCP_BLContent}</Paragraph>
<Paragraph>
<div dangerouslySetInnerHTML={{ __html: comm.escape2Html(noticeInfo.CCP_BLContent) }}></div>
</Paragraph>
</Col>
<Col span={4}>
<NavLink to="/notice">Back</NavLink>

Loading…
Cancel
Save