From 0c49bdcf6c3a890386a22af5ebce23e367b7f2ce Mon Sep 17 00:00:00 2001 From: YCC Date: Wed, 14 Aug 2024 17:36:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E7=A5=A8=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/common.json | 2 + public/locales/zh/common.json | 2 + src/hooks/useDatePresets.js | 8 ++ src/stores/Airticket.js | 14 ++ src/views/airticket/Plan.jsx | 233 +++++++++++++++++++++------------- 5 files changed, 174 insertions(+), 85 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 0b75042..a8a131c 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -65,6 +65,8 @@ "thisMonth": "This Month", "lastMonth": "Last Month", "lastThreeMonth": "Last Three Month", + "firstHalfYear": "First Half Year", + "latterHalfYear": "Latter Half Year", "thisYear": "This Year" }, "weekdays": { diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index 851fe85..977f98f 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -65,6 +65,8 @@ "thisMonth": "本月", "lastMonth": "上月", "lastThreeMonth": "前三个月", + "firstHalfYear": "上半年", + "latterHalfYear": "下半年", "thisYear": "今年" }, "weekdays": { diff --git a/src/hooks/useDatePresets.js b/src/hooks/useDatePresets.js index 2eb4c7d..05e251c 100644 --- a/src/hooks/useDatePresets.js +++ b/src/hooks/useDatePresets.js @@ -29,6 +29,14 @@ export const useDatePresets = () => { label: t("datetime.lastThreeMonth"), value: [dayjs().subtract(2, "M").startOf("M"), dayjs().endOf("M")], }, + { + label: t("datetime.firstHalfYear"), + value: [dayjs().startOf("y"), dayjs().endOf("y").subtract(6, "M")], + }, + { + label: t("datetime.latterHalfYear"), + value: [dayjs().startOf("y").add(6,"M"), dayjs().endOf("y")], + }, { label: t("datetime.thisYear"), value: [dayjs().startOf("y"), dayjs().endOf("y")], diff --git a/src/stores/Airticket.js b/src/stores/Airticket.js index 9ec94a8..cd8ada5 100644 --- a/src/stores/Airticket.js +++ b/src/stores/Airticket.js @@ -77,6 +77,20 @@ const airTicketStore = create((set, get) => ({ // console.log(_result); // return _result; // }, + async postFlightCost(values) { + const formData = new FormData(); + for (const [key, value] of Object.entries(values)) { + formData.append(key, value); //先用原始数据填充一遍,确保复制了全部数据到新表 + } + const postUrl = HT_HOST + "/Service_BaseInfoWeb/edit_or_new_flight_cost"; + return postForm(postUrl, formData).then(json => { + if (json.errcode == 0) { + return json; + } else { + throw new Error(json.errmsg + ": " + json.errcode); + } + }); + }, })); export default airTicketStore; diff --git a/src/views/airticket/Plan.jsx b/src/views/airticket/Plan.jsx index 3799ab0..71a07c6 100644 --- a/src/views/airticket/Plan.jsx +++ b/src/views/airticket/Plan.jsx @@ -11,7 +11,7 @@ import { usingStorage } from "@/hooks/usingStorage"; const AirticketPlan = props => { const { coli_sn, gri_sn } = useParams(); const { travelAgencyId, loginToken } = usingStorage(); - const [getPlanDetail, planDetail, getGuestList, guestList, loading, postFlightDetail, getFlightCostList] = airTicketStore(state => [ + const [getPlanDetail, planDetail, getGuestList, guestList, loading, postFlightDetail, getFlightCostList, postFlightCost] = airTicketStore(state => [ state.getPlanDetail, state.planDetail, state.getGuestList, @@ -19,8 +19,9 @@ const AirticketPlan = props => { state.loading, state.postFlightDetail, state.getFlightCostList, + state.postFlightCost, ]); - const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${coli_sn}&VEI_SN=${travelAgencyId}`; + const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${gri_sn}&VEI_SN=${travelAgencyId}`; const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl); const [form] = Form.useForm(); const { notification } = App.useApp(); @@ -115,7 +116,7 @@ const AirticketPlan = props => { dataIndex: "CostType", }, { - title: "金额", + title: "手续费/费用", key: "Cost", dataIndex: "Cost", }, @@ -123,41 +124,42 @@ const AirticketPlan = props => { title: "PNR", key: "PNR", dataIndex: "PNR", + render: (text, record) => (record.CostType == "出票" ? text : "-"), }, { - title: "FlightCost", + title: "票号", key: "FlightCost", dataIndex: "FlightCost", + render: (text, record) => (record.CostType == "出票" ? text : "-"), }, { - title: "Discount", - key: "Discount", - dataIndex: "Discount", - }, - { - title: "ServiceFee", - key: "ServiceFee", - dataIndex: "ServiceFee", + title: "机票类型", + key: "FlightType", + dataIndex: "FlightType", + render: (text, record) => (record.CostType == "出票" ? text : "-"), }, { - title: "DateTime", - key: "DateTime", - dataIndex: "DateTime", + title: "机票价格", + key: "FlightCost", + dataIndex: "FlightCost", + render: (text, record) => (record.CostType == "出票" ? text : "-"), }, { - title: "FlightType", - key: "FlightType", - dataIndex: "FlightType", + title: "折扣", + key: "Discount", + dataIndex: "Discount", + render: (text, record) => (record.CostType == "出票" ? text : "-"), }, { - title: "Memo", + title: "备注", key: "Memo", dataIndex: "Memo", }, { title: "编辑", key: "CLF_SN", - dataIndex: "CLF_SN", //GRI_SN VEI_SN + dataIndex: "CLF_SN", + render: (text, record) => showModal(record)}>编辑, }, ]; @@ -168,6 +170,7 @@ const AirticketPlan = props => { + 航班信息
{ - + @@ -238,7 +241,7 @@ const AirticketPlan = props => { - + @@ -273,7 +276,9 @@ const AirticketPlan = props => { - + @@ -304,10 +309,12 @@ const AirticketPlan = props => { // 机票信息编辑表单 begin const [isModalOpen, setIsModalOpen] = useState(false); + const [isTicketType, setisTicketType] = useState(true); const [ticket_form] = Form.useForm(); const showModal = ticket => { setIsModalOpen(true); + ticket.CostType == "出票" ? setisTicketType(true) : setisTicketType(false);//如果是出票类型,显示票号、折扣等选项 ticket_form.setFieldsValue(ticket); }; @@ -317,6 +324,26 @@ const AirticketPlan = props => { .then(values => { // 在这里处理表单提交逻辑,例如发送数据到服务器 console.log("Received values of form: ", values); + postFlightCost(values) + .then(() => { + notification.success({ + message: `成功`, + description: "保存成功!", + placement: "top", + duration: 4, + icon: , + }); + getPlanDetail(travelAgencyId, gri_sn); + }) + .catch(() => { + notification.error({ + message: `错误`, + description: "保存失败", + placement: "top", + duration: 4, + icon: , + }); + }); ticket_form.resetFields(); setIsModalOpen(false); }) @@ -331,7 +358,11 @@ const AirticketPlan = props => { }; const onChangeType = value => { - console.log(value); + if (value == "出票") { + setisTicketType(true); + } else { + setisTicketType(false); + } }; const TicketModal = () => { @@ -343,97 +374,129 @@ const AirticketPlan = props => { labelCol={{ span: 5, }}> - + + console.log("dsads")} - options={[ - { - value: "jack", - label: "成人", - }, - { - value: "lucy", - label: "儿童", - }, - { - value: "Yiminghe", - label: "婴儿", - }, - ]} /> + {isTicketType && ( + <> + + + + + + + + - - - - - - - + + + + + + - - + + + - - - - - + + @@ -452,7 +515,7 @@ const AirticketPlan = props => { - {/* */} +