diff --git a/src/main.jsx b/src/main.jsx index ec6f14b..b2062c1 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -68,7 +68,7 @@ const initRouter = async () => { { path: 'invoice/paid',element:}, { path: 'invoice/paid/detail/:flid', element: }, { path: 'airticket',element: }, - { path: 'airticket/plan/:coli_sn',element:}, + { path: 'airticket/plan/:coli_sn/:gri_sn',element:}, { path: "products",element: }, { path: "products/:travel_agency_id/:use_year/:audit_state/audit",element:}, { path: "products/:travel_agency_id/:use_year/:audit_state/edit",element:}, diff --git a/src/stores/Airticket.js b/src/stores/Airticket.js index e73711a..9ec94a8 100644 --- a/src/stores/Airticket.js +++ b/src/stores/Airticket.js @@ -1,5 +1,5 @@ import { create } from "zustand"; -import { fetchJSON } from "@/utils/request"; +import { fetchJSON, postForm } from "@/utils/request"; import { prepareUrl, isNotEmpty } from "@/utils/commons"; import { HT_HOST, DATE_FORMAT } from "@/config"; import dayjs from "dayjs"; @@ -15,7 +15,7 @@ const airTicketStore = create((set, get) => ({ const { setLoading, setPlanList } = get(); setLoading(true); const searchParams = { - vei_sn: 4272, //vei_sn, + vei_sn: vei_sn, FlightDate1: TimeStart, FlightDate2: TimeEnd, GRI_Name: GRI_Name, @@ -30,23 +30,53 @@ const airTicketStore = create((set, get) => ({ async getPlanDetail(vei_sn, gri_sn) { const { setPlanDetail } = get(); const searchParams = { - vei_sn: 4272, //vei_sn, - gri_sn: 372928, //gri_sn + vei_sn: vei_sn, + gri_sn: gri_sn, }; const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/GetFlightPlanDetail`, searchParams); const _result = errcode !== 0 ? [] : result; setPlanDetail(_result); }, + + async postFlightDetail(CLF_SN, GRI_SN, VEI_SN, original_values, info_object) { + const formData = new FormData(); + formData.append("CLF_SN", CLF_SN ? CLF_SN : ""); + formData.append("GRI_SN", GRI_SN); + formData.append("VEI_SN", VEI_SN); + for (const [key, value] of Object.entries(original_values)) { + formData.append(key, value); //先用原始数据填充一遍,确保复制了全部数据到新表 + } + for (const [key, value] of Object.entries(info_object)) { + formData.set(key, value); //再用新值覆盖 + } + const postUrl = HT_HOST + "/Service_BaseInfoWeb/edit_or_new_flight_info"; + return postForm(postUrl, formData).then(json => { + if (json.errcode == 0) { + return json; + } else { + throw new Error(json.errmsg + ": " + json.errcode); + } + }); + }, + async getGuestList(coli_sn) { const { setGuestList } = get(); const searchParams = { - COLI_SN: 1097829, //coli_sn, + COLI_SN: coli_sn, }; const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/GetFlightGuestInfo`, searchParams); const _result = errcode !== 0 ? [] : result; setGuestList(_result); }, - + // async getFlightCostList(CLF_SN) { + // const searchParams = { + // CLF_SN: CLF_SN, + // }; + // const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/Get_flight_cost`, searchParams); + // const _result = errcode !== 0 ? [] : result; + // console.log(_result); + // return _result; + // }, })); export default airTicketStore; diff --git a/src/stores/Auth.js b/src/stores/Auth.js index d880476..3f3808b 100644 --- a/src/stores/Auth.js +++ b/src/stores/Auth.js @@ -43,7 +43,7 @@ async function fetchLastRequet() { const initialState = { tokenInterval: null, - tokenTimeout: true, + tokenTimeout: false,// 开发时候用false,正式环境true, loginStatus: 0, defaltRoute: '', currentUser: { diff --git a/src/views/airticket/Index.jsx b/src/views/airticket/Index.jsx index 32a84a5..09b0d87 100644 --- a/src/views/airticket/Index.jsx +++ b/src/views/airticket/Index.jsx @@ -46,33 +46,33 @@ const planListColumns = [ dataIndex: "ToCity", }, { - title: "航空", + title: "航班", key: "FlightNo", dataIndex: "FlightNo", }, { title: "起飞时间", - key: "FlightTimeStart", - dataIndex: "FlightTimeStart", + key: "FlightStart", + dataIndex: "FlightStart", render: text => formatColonTime(text), }, { title: "落地时间", - key: "FlightTimeEnd", - dataIndex: "FlightTimeEnd", + key: "FlightEnd", + dataIndex: "FlightEnd", render: text => formatColonTime(text), }, { title: "是否出票", - key: "COLD_PlanVEI_SN", - dataIndex: "COLD_PlanVEI_SN", + key: "CLF_SN", + dataIndex: "CLF_SN", render: (text, record) => "否", }, { title: "操作", key: "FlightInfo", dataIndex: "FlightInfo", - render: (text, record) => {"编辑"}, + render: (text, record) => {"编辑"}, }, ]; diff --git a/src/views/airticket/Plan.jsx b/src/views/airticket/Plan.jsx index ea193fa..3799ab0 100644 --- a/src/views/airticket/Plan.jsx +++ b/src/views/airticket/Plan.jsx @@ -1,6 +1,6 @@ import { useState, useEffect } from "react"; -import { Grid, Divider, Layout, Modal, Form, Input, Col, Row, Space, Collapse, Table, Button, Select, InputNumber, Typography } from "antd"; -import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined, ArrowUpOutlined, ArrowDownOutlined } from "@ant-design/icons"; +import { Grid, Divider, Layout, Modal, Form, Input, Col, Row, Space, Collapse, Table, Button, Select, App, Typography } from "antd"; +import { PhoneOutlined, FrownTwoTone, LikeTwoTone, ArrowUpOutlined, ArrowDownOutlined } from "@ant-design/icons"; import { useParams, useHref, useNavigate, NavLink } from "react-router-dom"; import { isEmpty, formatColonTime } from "@/utils/commons"; import { OFFICEWEBVIEWERURL } from "@/config"; @@ -9,13 +9,22 @@ import airTicketStore from "@/stores/Airticket"; import { usingStorage } from "@/hooks/usingStorage"; const AirticketPlan = props => { - const { coli_sn } = useParams(); + const { coli_sn, gri_sn } = useParams(); const { travelAgencyId, loginToken } = usingStorage(); - const [getPlanDetail, planDetail, getGuestList, guestList, loading] = airTicketStore(state => [state.getPlanDetail, state.planDetail, state.getGuestList, state.guestList, state.loading]); + const [getPlanDetail, planDetail, getGuestList, guestList, loading, postFlightDetail, getFlightCostList] = airTicketStore(state => [ + state.getPlanDetail, + state.planDetail, + state.getGuestList, + state.guestList, + state.loading, + state.postFlightDetail, + state.getFlightCostList, + ]); const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${coli_sn}&VEI_SN=${travelAgencyId}`; const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl); - - // console.log(reservationPreviewUrl); + const [form] = Form.useForm(); + const { notification } = App.useApp(); + //console.log(reservationPreviewUrl); //乘客列表 const guestListColumns = [ @@ -98,79 +107,185 @@ const AirticketPlan = props => { }, ]; + //费用列表 + const costListColumns = [ + { + title: "费用类型", + key: "CostType", + dataIndex: "CostType", + }, + { + title: "金额", + key: "Cost", + dataIndex: "Cost", + }, + { + title: "PNR", + key: "PNR", + dataIndex: "PNR", + }, + { + title: "FlightCost", + key: "FlightCost", + dataIndex: "FlightCost", + }, + { + title: "Discount", + key: "Discount", + dataIndex: "Discount", + }, + { + title: "ServiceFee", + key: "ServiceFee", + dataIndex: "ServiceFee", + }, + { + title: "DateTime", + key: "DateTime", + dataIndex: "DateTime", + }, + { + title: "FlightType", + key: "FlightType", + dataIndex: "FlightType", + }, + { + title: "Memo", + key: "Memo", + dataIndex: "Memo", + }, + { + title: "编辑", + key: "CLF_SN", + dataIndex: "CLF_SN", //GRI_SN VEI_SN + }, + ]; + const Airticket_form = props => { - const aitInfo = props.airInfo; + const airInfo = props.airInfo; return ( <> -
- - - } value={aitInfo.FromCity} /> - } value={aitInfo.ToCity} /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + { + postFlightDetail(airInfo.CLF_SN, airInfo.GRI_SN, airInfo.VEI_SN, airInfo, values) + .then(() => { + notification.success({ + message: `成功`, + description: "机票信息保存成功!", + placement: "top", + duration: 4, + icon: , + }); + }) + .catch(() => { + notification.error({ + message: `错误`, + description: "保存失败", + placement: "top", + duration: 4, + icon: , + }); + }); + }} + autoComplete="off"> + + + + } /> + + + } /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 费用列表 - - + + + + + + + + + + + + + 费用列表 +
+ + ); }; @@ -180,7 +295,7 @@ const AirticketPlan = props => { ? planDetail.map(item => { return { key: item.id, - label: `${item.StartDate} 计划: ${item.FlightInfo}`, + label: `${item.StartDate}`, children: , }; }) @@ -222,7 +337,7 @@ const AirticketPlan = props => { const TicketModal = () => { return ( <> - +
{ // 机票信息编辑表单 end useEffect(() => { - getPlanDetail(travelAgencyId, coli_sn); + getPlanDetail(travelAgencyId, gri_sn); getGuestList(travelAgencyId, coli_sn); - console.log(detail_items()); }, []); return (