diff --git a/src/stores/Invoice.js b/src/stores/Invoice.js index 5f0526f..c8b0872 100644 --- a/src/stores/Invoice.js +++ b/src/stores/Invoice.js @@ -1,6 +1,6 @@ import { makeAutoObservable,runInAction } from "mobx"; import { fetchJSON } from "@/utils/request"; -import { prepareUrl } from '@/utils/commons'; +import { prepareUrl,isNotEmpty } from '@/utils/commons'; import { HT_HOST } from "@/config"; class Invoice { @@ -13,21 +13,21 @@ class Invoice { - fetchInvoiceList(PageIndex,OrderType,GroupNo,DateStart,DateEnd,Orderbytype,TimeType,limitmarket,mddgroup,SecuryGroup){ - this.invoicePage.current=PageIndex; - const totalNum = PageIndex == 1 ? 0 : this.invoicePage.total; + fetchInvoiceList(current,OrderType,GroupNo,DateStart,DateEnd,Orderbytype){ + this.invoicePage.current=current; + const totalNum = current == 1 ? 0 : this.invoicePage.total; //组合param const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTSearchGMBPageList') - .append('VEI_SN', this.root.authStore.login.travelAgencyId) + .append('VEI_SN', '628') //this.root.authStore.login.travelAgencyId .append('OrderType',OrderType) .append('GroupNo',GroupNo) .append('DateStart',DateStart) .append('DateEnd',DateEnd) .append('Orderbytype',Orderbytype) - .append('TimeType',TimeType) - .append('limitmarket',limitmarket) - .append('mddgroup',mddgroup) - .append('SecuryGroup',SecuryGroup) + .append('TimeType',0) + .append('limitmarket',"") + .append('mddgroup',"") + .append('SecuryGroup',"") .append('TotalNum', totalNum) .append('PageSize', this.invoicePage.size) .append('PageIndex', this.invoicePage.current) @@ -37,27 +37,30 @@ class Invoice { .then(json => { runInAction(()=>{ if (json.errcode==0){ - this.invoiceList = json.result.map((data,index)=>{ - return{ - key:GSMSN, - gmd_gri_sn : data.gmd_gri_sn, - gmd_vei_sn : data.gmd_vei_sn, - GetDate : data.GetDate, - GMD_FillWorkers_SN : data.GMD_FillWorkers_SN, - GMD_FWks_LastEditTime : data.GMD_FWks_LastEditTime, - GMD_VerifyUser_SN : data.GMD_VerifyUser_SN, - GMD_Dealed : data.GMD_Dealed, - GMD_VRequestVerify : data.GMD_VRequestVerify, - LeftGDate : data.LeftGDate, - GMD_FillWorkers_Name : data.GMD_FillWorkers_Name, - GroupName : data.GroupName, - AllMoney : data.AllMoney, - PersonNum : data.PersonNum, - VName : data.VName - } - - }); - this.invoicePage.total = json.result[0].TotalCount; + if (isNotEmpty(json.Result)){ + 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, + GetGDate : data.GetGDate, + GMD_FillWorkers_SN : data.GMD_FillWorkers_SN, + GMD_FWks_LastEditTime : data.GMD_FWks_LastEditTime, + GMD_VerifyUser_SN : data.GMD_VerifyUser_SN, + GMD_Dealed : data.GMD_Dealed, + GMD_VRequestVerify : data.GMD_VRequestVerify, + LeftGDate : data.LeftGDate, + GMD_FillWorkers_Name : data.GMD_FillWorkers_Name, + GroupName : data.GroupName, + AllMoney : data.AllMoney, + PersonNum : data.PersonNum, + VName : data.VName + } + + }); + this.invoicePage.total = json.Result[0].TotalCount; + } + }else{ throw new Error(json.errmsg + ': ' + json.errcode); } diff --git a/src/stores/Root.js b/src/stores/Root.js index 4398819..59704d9 100644 --- a/src/stores/Root.js +++ b/src/stores/Root.js @@ -9,7 +9,7 @@ class Root { this.reservationStore = new Reservation(this); this.feedbackStore = new Feedback(this); this.authStore = new Auth(this); - //this.invoice = new Invoice(this); + this.invoiceStore = new Invoice(this); makeAutoObservable(this); } } diff --git a/src/views/invoice/Index.jsx b/src/views/invoice/Index.jsx index 8d53ea3..a243c74 100644 --- a/src/views/invoice/Index.jsx +++ b/src/views/invoice/Index.jsx @@ -2,19 +2,146 @@ import { NavLink } from "react-router-dom"; import { useEffect, useState } from "react"; import { observer } from "mobx-react"; import { toJS } from "mobx"; -import { Row, Col, Space, Button, Table, Input, DatePicker } from "antd"; +import { Row, Col, Space, Button, Table, Input, DatePicker,Typography,App } from "antd"; import { useStore } from "@/stores/StoreContext.js"; import * as config from "@/config"; +import { formatDate,isNotEmpty } from "@/utils/commons"; + +const { Title } = Typography; function Index() { - + + const { invoiceStore } = useStore(); + const { invoiceList ,invoicePage } = invoiceStore; + const [groupNo, onGroupNoChange] = useState(''); + const [arrivalDateRange, onDateRangeChange] = useState([]); + const [dataLoading, setDataLoading] = useState(false); + const { notification } = App.useApp(); + + + const invoiceListColumns = [ + { + title: '团名', + dataIndex: 'GroupName', + key: 'GroupName', + //render: (text, record) => {text}, + }, + { + title: '离团时间', + dataIndex: 'GetGDate', + key: 'GetGDate', + render:(text,record) =>formatDate(new Date(text)) + }, + { + title: '接团时间', + key: 'LeftGDate', + dataIndex: 'LeftGDate' + }, + { + title: '人数', + key: 'PersonNum', + dataIndex: 'PersonNum' + }, + { + title: '团总额', + key: 'AllMoney', + dataIndex: 'AllMoney' + }, + { + title: '填表时间', + key: 'GMD_FWks_LastEditTime', + dataIndex: 'GMD_FWks_LastEditTime', + render:(text,record) => isNotEmpty(text)?formatDate(new Date(text)):"" + }, + { + title: '填表人', + key: 'GMD_FillWorkers_Name', + dataIndex: 'GMD_FillWorkers_Name' + }, + { + title: '账单状态', + key: 'status', + render:BillStatus + }, + { + title: 'Action', + // key: 'action', + // render: actionRender + } + ]; + + function BillStatus(text,record){ + if (record.GMD_Dealed){ + return "已审核"; + }else if (record.GMDFillworkers_SN<1){ + return "未填写"; + }else if (record.VRequestVerify){ + return "未审核"; + }else{ + return "未提交"; + } + } + + const onSearchClick = (current = 1) => { + setDataLoading(true); + invoiceStore.fetchInvoiceList(current, 0, groupNo, arrivalDateRange[0], arrivalDateRange[1], 1) + .catch(ex => { + notification.error({ + message: `Notification`, + description: ex.message, + placement: 'top', + duration: 4, + }); + }) + .finally(() => { + setDataLoading(false); + }); + } + return ( -

"账单列表!"

- + + 账单管理 + + + { onGroupNoChange(e.target.value) }} /> + + + + Date + { onDateRangeChange(dateRange) }} + /> + + + + + + + + + {onSearchClick(pagination.current);}} + columns={invoiceListColumns} dataSource={toJS(invoiceList)} + /> + + + + ) - -} +} export default observer(Index);