diff --git a/src/stores/Invoice.js b/src/stores/Invoice.js index ef0a956..4c0b2a7 100644 --- a/src/stores/Invoice.js +++ b/src/stores/Invoice.js @@ -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, diff --git a/src/views/invoice/Detail.jsx b/src/views/invoice/Detail.jsx index d487922..54ee211 100644 --- a/src/views/invoice/Detail.jsx +++ b/src/views/invoice/Detail.jsx @@ -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 + }; + + // (); + }); + + return arr; + } return ( - - Reference Number: {invoiceGroupInfo.VGroupInfo} - - - - - + + Reference Number: {invoiceGroupInfo.VGroupInfo} + + + + + 基础信息 - - + + -

CHINA HIGHLIGHTS

+

CHINA HIGHLIGHTS

- - + + -

{invoiceGroupInfo.WLFirstName} {invoiceGroupInfo.WLLastName}    Email: {invoiceGroupInfo.WLEmail}

+

{invoiceGroupInfo.WLFirstName} {invoiceGroupInfo.WLLastName}    Email: {invoiceGroupInfo.WLEmail}

- - + + -

{invoiceGroupInfo.County}

+

{invoiceGroupInfo.County}

- -
+ +
报账信息 - +
上传照片 -
- -
Click to 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}> +
+ +
Click to Upload
+
+
提交信息 - - - - - - - - - - + + + + + + + + + + + + + + + Submit +
@@ -149,7 +190,7 @@ function Detail() { - + }