diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index b113807..dd10cb2 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -54,6 +54,24 @@
"lastThreeMonth": "Last Three Month",
"thisYear": "This Year"
},
+ "weekdays": {
+ "1": "Monday",
+ "2": "Tuesday",
+ "3": "Wednesday",
+ "4": "Thursday",
+ "5": "Friday",
+ "6": "Saturday",
+ "7": "Sunday"
+ },
+ "weekdaysShort": {
+ "1": "Mon",
+ "2": "Tue",
+ "3": "Wed",
+ "4": "Thu",
+ "5": "Fri",
+ "6": "Sat",
+ "7": "Sun"
+ },
"menu": {
"Reservation": "Reservation",
"Invoice": "Invoice",
diff --git a/public/locales/en/products.json b/public/locales/en/products.json
index b5e7694..7808b34 100644
--- a/public/locales/en/products.json
+++ b/public/locales/en/products.json
@@ -41,7 +41,10 @@
"Unit": "Unit",
"GroupSize": "Group Size",
"UseDates": "Use Dates",
+
"Weekdays": "Weekdays",
+ "OnWeekdays": "On Weekdays: ",
+ "Unlimited": "Unlimited",
"UseYear": "Use Year",
diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json
index a170faa..05a7e38 100644
--- a/public/locales/zh/common.json
+++ b/public/locales/zh/common.json
@@ -54,6 +54,24 @@
"lastThreeMonth": "前三个月",
"thisYear": "今年"
},
+ "weekdays": {
+ "1": "一",
+ "2": "二",
+ "3": "三",
+ "4": "四",
+ "5": "五",
+ "6": "六",
+ "7": "日"
+ },
+ "weekdaysShort": {
+ "1": "一",
+ "2": "二",
+ "3": "三",
+ "4": "四",
+ "5": "五",
+ "6": "六",
+ "7": "日"
+ },
"menu": {
"Reservation": "团预订",
"Invoice": "账单",
diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json
index 9f1f8b6..7eb1c16 100644
--- a/public/locales/zh/products.json
+++ b/public/locales/zh/products.json
@@ -40,7 +40,10 @@
"Unit": "单位",
"GroupSize": "人等",
"UseDates": "使用日期",
+
"Weekdays": "有效日/周X",
+ "OnWeekdays": "周: ",
+ "Unlimited": "不限",
"UseYear": "年份",
diff --git a/src/components/SecondHeaderWrapper.jsx b/src/components/SecondHeaderWrapper.jsx
index 097b0d4..41cec6a 100644
--- a/src/components/SecondHeaderWrapper.jsx
+++ b/src/components/SecondHeaderWrapper.jsx
@@ -1,9 +1,9 @@
import { Outlet, useNavigate } from 'react-router-dom';
-import { Layout, Flex, theme } from 'antd';
+import { Layout, Flex, theme, Spin } from 'antd';
import BackBtn from './BackBtn';
const { Content, Header } = Layout;
-const HeaderWrapper = ({ children, header, ...props }) => {
+const HeaderWrapper = ({ children, header, loading, ...props }) => {
const navigate = useNavigate();
const {
token: { colorBgContainer },
@@ -11,6 +11,7 @@ const HeaderWrapper = ({ children, header, ...props }) => {
return (
<>
+
{/* {header} */}
@@ -21,6 +22,7 @@ const HeaderWrapper = ({ children, header, ...props }) => {
{children || }
+
>
);
diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js
index 6749ede..0dd63f7 100644
--- a/src/hooks/useProductsSets.js
+++ b/src/hooks/useProductsSets.js
@@ -49,7 +49,7 @@ export const useProductsTypes = () => {
{ label: t('products:type.Overtravel'), value: 'B', key: 'B' },
{ label: t('products:type.Car'), value: 'J', key: 'J' },
{ label: t('products:type.Guide'), value: 'Q', key: 'Q' },
- { label: t('products:type.Package'), value: 'D', key: 'D' },
+ { label: t('products:type.Package'), value: 'D', key: 'D' }, // 包价线路
{ label: t('products:type.Attractions'), value: '7', key: '7' },
{ label: t('products:type.Meals'), value: 'C', key: 'C' },
{ label: t('products:type.Extras'), value: '8', key: '8' },
@@ -67,11 +67,11 @@ export const useProductsAuditStates = () => {
useEffect(() => {
const newData = [
- { key: '-1', value: '-1', label: t('products:auditState.New') },
- { key: '0', value: '0', label: t('products:auditState.Pending') },
- { key: '2', value: '2', label: t('products:auditState.Approved') },
- { key: '3', value: '3', label: t('products:auditState.Rejected') },
- { key: '1', value: '1', label: t('products:auditState.Published') },
+ { key: '-1', value: '-1', label: t('products:auditState.New'), color: 'gray-500' },
+ { key: '0', value: '0', label: t('products:auditState.Pending'), color: '' },
+ { key: '2', value: '2', label: t('products:auditState.Approved'), color: 'primary' },
+ { key: '3', value: '3', label: t('products:auditState.Rejected'), color: 'red-500' },
+ { key: '1', value: '1', label: t('products:auditState.Published'), color: 'primary' },
// ELSE 未知
];
setTypes(newData);
diff --git a/src/views/products/Audit.jsx b/src/views/products/Audit.jsx
index e055cc3..4e30330 100644
--- a/src/views/products/Audit.jsx
+++ b/src/views/products/Audit.jsx
@@ -1,18 +1,20 @@
import { useEffect, useState } from 'react';
-import { useParams, } from 'react-router-dom';
-import { App, Button, Collapse, Table, Space, } from 'antd';
+import { useParams } from 'react-router-dom';
+import { App, Button, Collapse, Table, Space, Divider } from 'antd';
import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets';
import SecondHeaderWrapper from '@/components/SecondHeaderWrapper';
import { useTranslation } from 'react-i18next';
import useProductsStore, { postProductsQuoteAudit } from '@/stores/Products/Index';
import { isEmpty } from '@/utils/commons';
+// import PrintContractPDF from './PrintContractPDF';
-const Header = ({ title, agency, refresh, ...props}) => {
+const Header = ({ title, agency, refresh, ...props }) => {
+ const { use_year, } = useParams();
const { t } = useTranslation();
- const [activeAgency, ] = useProductsStore((state) => [state.activeAgency, ]);
+ const [activeAgency] = useProductsStore((state) => [state.activeAgency]);
const { message, notification } = App.useApp();
const handleAuditItem = (state, row) => {
- postProductsQuoteAudit(state, {id: row.id, travel_agency_id: activeAgency.travel_agency_id})
+ postProductsQuoteAudit(state, { id: row.id, travel_agency_id: activeAgency.travel_agency_id })
.then((json) => {
if (json.errcode === 0) {
message.success(json.errmsg);
@@ -33,7 +35,7 @@ const Header = ({ title, agency, refresh, ...props}) => {
return (
-
{title}
+ {title} {use_year}
{/*
*/}
{/*
*/}
@@ -46,20 +48,21 @@ const Header = ({ title, agency, refresh, ...props}) => {
- {/* todo: export */}
-
+ {/* todo: export, 审核完成之后才能导出 */}
+
+ {/*
*/}
);
};
-const PriceTable = ({dataSource,refresh}) => {
+const PriceTable = ({ dataSource, refresh }) => {
const { t } = useTranslation('products');
- const [loading, activeAgency, ] = useProductsStore((state) => [state.loading, state.activeAgency, ]);
+ const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]);
const { message, notification } = App.useApp();
const stateMapVal = useProductsAuditStatesMapVal();
const handleAuditPriceItem = (state, row) => {
- postProductsQuoteAudit(state, {id: row.id, travel_agency_id: activeAgency.travel_agency_id})
+ postProductsQuoteAudit(state, { id: row.id, travel_agency_id: activeAgency.travel_agency_id })
.then((json) => {
if (json.errcode === 0) {
message.success(json.errmsg);
@@ -79,7 +82,7 @@ const PriceTable = ({dataSource,refresh}) => {
};
const columns = [
- { key: 'title', dataIndex: ['info', 'title'], title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }) },
+ { key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }) },
{ key: 'adult', title: t('AgeType.Adult'), render: (_, { value, currency, unit_name }) => `${value} ${currency} / ${unit_name}` },
{ key: 'child', title: t('AgeType.Child'), render: (_, { value, currency, unit_name }) => `${value} ${currency} / ${unit_name}` },
// {key: 'price', title: t('Currency'), },
@@ -95,35 +98,37 @@ const PriceTable = ({dataSource,refresh}) => {
key: 'useDates',
dataIndex: ['use_dates_start'],
title: t('UseDates'),
- render: (_, { use_dates_start, use_dates_end }) => `${use_dates_start} ~ ${use_dates_end}`,
+ render: (_, { use_dates_start, use_dates_end, weekdays }) => `${use_dates_start} ~ ${use_dates_end}`, // + (weekdays ? `, ${t('OnWeekdays')}${weekdays}` : ''),
},
- { key: 'weekdays', dataIndex: ['weekdays'], title: t('Weekdays') },
+ { key: 'weekdays', dataIndex: ['weekdays'], title: t('Weekdays'), render: (text, r) => text || t('Unlimited') },
{
key: 'state',
title: t('State'),
render: (_, r) => {
- return stateMapVal[`${r.audit_state_id}`]?.label;
+ return {stateMapVal[`${r.audit_state_id}`]?.label};
},
},
{
title: '价格审核',
key: 'action',
- render: (_, r) => r.audit_state_id <= 0 ?(
-
-
-
-
- ) : null,
+ render: (_, r) =>
+ r.audit_state_id <= 0 ? (
+
+
+
+
+ ) : null,
},
];
- return r.id} />;
-}
+ return r.id} />;
+};
/**
*
*/
const TypesPanels = (props) => {
- const [loading, agencyProducts, ] = useProductsStore((state) => [state.loading, state.agencyProducts]);
+ const { t } = useTranslation();
+ const [loading, agencyProducts] = useProductsStore((state) => [state.loading, state.agencyProducts]);
// console.log(agencyProducts);
const productsTypes = useProductsTypes();
const [activeKey, setActiveKey] = useState([]);
@@ -138,7 +143,7 @@ const TypesPanels = (props) => {
children: (
r.concat(c.quotation.map((q, i) => ({ ...q, info: c.info, rowSpan: i === 0 ? c.quotation.length : 0 }))), [])}
+ dataSource={agencyProducts[ele.value].reduce((r, c) => r.concat(c.quotation.map((q, i) => ({ ...q, weekdays: q.weekdays.split(',').filter(Boolean).map(w => t(`weekdaysShort.${w}`)).join(', '), info: c.info, rowSpan: i === 0 ? c.quotation.length : 0 }))), [])}
refresh={props.refresh}
/>
),
@@ -151,31 +156,33 @@ const TypesPanels = (props) => {
}, [productsTypes, agencyProducts]);
const onCollapseChange = (_activeKey) => {
- setActiveKey(_activeKey)
- }
- return (
-
- )
-}
+ setActiveKey(_activeKey);
+ };
+ return ;
+};
const Audit = ({ ...props }) => {
const { travel_agency_id, use_year, audit_state } = useParams();
- const [activeAgency, getAgencyProducts] = useProductsStore((state) => [state.activeAgency, state.getAgencyProducts]);
+ const [loading, activeAgency, getAgencyProducts] = useProductsStore((state) => [state.loading, state.activeAgency, state.getAgencyProducts]);
const handleGetAgencyProducts = () => {
getAgencyProducts({ travel_agency_id, use_year, audit_state });
- }
+ };
useEffect(() => {
handleGetAgencyProducts();
return () => {};
- }, [travel_agency_id])
+ }, [travel_agency_id]);
return (
<>
- }>
+ } loading={loading} >
+ {/* */}
+ {/* debug: 0 */}
+ {/* */}
+
>
diff --git a/src/views/products/Index.jsx b/src/views/products/Index.jsx
index d1b1495..400db96 100644
--- a/src/views/products/Index.jsx
+++ b/src/views/products/Index.jsx
@@ -16,7 +16,7 @@ function Index() {
const handleSearchAgency = (formVal = undefined) => {
const { starttime, endtime, ...param } = formVal || formValuesToSub;
- const searchParam = objectMapper(param, { agency: 'travel_agency_ids', startdate: 'edit_date1', enddate: 'edit_date2' });
+ const searchParam = objectMapper(param, { agency: 'travel_agency_ids', startdate: 'edit_date1', enddate: 'edit_date2', year: 'use_year' });
setSearchValues(searchParam);
searchAgency(searchParam);
}
@@ -39,8 +39,8 @@ function Index() {
key: 'action',
render: (_, r) => (
- {t('Edit')}
- {t('Audit')}
+ {t('Edit')}
+ {t('Audit')}
),
},