From cc2bf23bf5d4c0344afa6a3b765e1d158356bd7c Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 27 Jun 2024 11:14:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:?= =?UTF-8?q?=20`=E9=A4=90`=20=E7=B1=BB=E5=9E=8B=E4=BD=BF=E7=94=A8`R`=20;=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=A1=E6=A0=B8=E9=A1=B5=E9=9D=A2=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E8=A1=A8;=20=E9=99=84=E5=8A=A0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=A1=A8=E6=98=BE=E7=A4=BA=E7=B1=BB=E5=9E=8B;=20=E8=B6=85?= =?UTF-8?q?=E5=85=AC=E9=87=8CUltra=20Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/products.json | 10 ++-- public/locales/zh/products.json | 10 ++-- src/hooks/useProductsSets.js | 78 +++++++++++++++------------- src/views/products/Audit.jsx | 8 ++- src/views/products/Detail/Extras.jsx | 5 +- 5 files changed, 62 insertions(+), 49 deletions(-) diff --git a/public/locales/en/products.json b/public/locales/en/products.json index 2a07ae5..0e90423 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -1,5 +1,5 @@ { - "ProductType": "ProductType", + "ProductType": "Product Type", "type": { "Experience": "Experience", "Car": "Transport Services", @@ -8,8 +8,7 @@ "Attractions": "Attractions", "Meals": "Meals", "Extras": "Extras", - "Overtravel": "超公里", - "Special": "Special" + "UltraService": "Ultra Service" }, "EditComponents": { "info": "Product Information", @@ -30,6 +29,11 @@ "Rejected": "Reject", "Published": "Publish" }, + "PriceUnit": { + "0": "Person", + "1": "Group", + "title": "Price Unit" + }, "Status": "Status", "State": "State", diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json index 1e1083b..8c592fb 100644 --- a/public/locales/zh/products.json +++ b/public/locales/zh/products.json @@ -3,13 +3,12 @@ "type": { "Experience": "综费", "Car": "车费", - "Guide": "导服", + "Guide": "导游", "Package": "包价线路", "Attractions": "景点", "Meals": "餐费", "Extras": "附加项目", - "Overtravel": "超公里", - "Special": "特殊项目" + "UltraService": "超公里" }, "EditComponents": { "info": "产品信息", @@ -30,6 +29,11 @@ "Rejected": "审核拒绝", "Published": "审核发布" }, + "PriceUnit": { + "0": "每人", + "1": "每团", + "title": "报价单位" + }, "Status": "状态", "State": "状态", diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index 5ee66d3..015fa8a 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -6,39 +6,39 @@ import { PERM_OVERSEA, PERM_AIR_TICKET, PERM_PRODUCTS_MANAGEMENT } from '@/confi /** * 产品管理 相关的预设数据 * 项目类型 -酒店预定 1 -火车 2 -飞机票务 3 -游船 4 -快巴 5 -旅行社(综费) 6 -景点 7 -特殊项目 8 -其他 9 -酒店 A -超公里 B -餐费 C -小包价 D -站 X -购物 S -餐 R -娱乐 E -精华线路 T -客人testimonial F -线路订单 O -省 P -信息 I -国家 G -城市 K -图片 H -地图 M -包价线路 L -节日节庆 V -火车站 N -手机租赁 Z - * * webht 类型, 20240624 新增HT类型 -Q 导游 -J 车费 + * * 酒店预定 1 + * * 火车 2 + * * 飞机票务 3 + * * 游船 4 + * * 快巴 5 + * * 旅行社(综费) 6 + * * 景点 7 + * * 特殊项目 8 + * * 其他 9 + * * 酒店 A + * * 超公里 B + * * 餐费 C + * * 小包价 D + * * 站 X + * * 购物 S + * * 餐 R (餐厅) + * * 娱乐 E + * * 精华线路 T + * * 客人testimonial F + * * 线路订单 O + * * 省 P + * * 信息 I + * * 国家 G + * * 城市 K + * * 图片 H + * * 地图 M + * * 包价线路 L (已废弃) + * * 节日节庆 V + * * 火车站 N + * * 手机租赁 Z + * * ---- webht 类型, 20240624 新增HT类型 ---- + * * 导游 Q + * * 车费 J */ export const useProductsTypes = () => { @@ -48,20 +48,24 @@ export const useProductsTypes = () => { useEffect(() => { const newData = [ { label: t('products:type.Experience'), value: '6', key: '6' }, - { label: t('products:type.Overtravel'), value: 'B', key: 'B' }, + { label: t('products:type.UltraService'), 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.Attractions'), value: '7', key: '7' }, - { label: t('products:type.Meals'), value: 'C', key: 'C' }, + { label: t('products:type.Meals'), value: 'R', key: 'R' }, { label: t('products:type.Extras'), value: '8', key: '8' }, - // { label: t('products:type.Special'), value: 'Special', key: 'Special' }, ]; setTypes(newData); }, [i18n.language]); return types; }; +export const useProductsTypesMapVal = (value) => { + const stateSets = useProductsTypes(); + const stateMapVal = stateSets.reduce((r, c) => ({ ...r, [`${c.value}`]: c }), {}); + return stateMapVal; +}; export const useProductsAuditStates = () => { const [types, setTypes] = useState([]); @@ -102,7 +106,7 @@ export const useProductsTypesFieldsets = (type) => { 'Q': [['city_id', 'duration', ], ['description',]], 'D': [['city_id', 'recommends_rate','duration',], ['description',]], '7': [['city_id', 'recommends_rate', 'duration', 'display_to_c', 'open_weekdays'], ['description',]], // todo: 怎么是2个图 - 'C': [['city_id',], ['description',]], + 'R': [['city_id',], ['description',]], '8': [[],[]], // todo: ? }; const thisTypeFieldset = (_type) => { diff --git a/src/views/products/Audit.jsx b/src/views/products/Audit.jsx index ca38cfd..9a23e0d 100644 --- a/src/views/products/Audit.jsx +++ b/src/views/products/Audit.jsx @@ -85,11 +85,9 @@ const PriceTable = ({ dataSource, refresh }) => { }; const columns = [ - { key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }), render: (text, r) => text || r.lgc_details?.['2']?.title || '' }, - { key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_name }) => `${adult_cost} ${currency} / ${unit_name}` }, - { key: 'child', title: t('AgeType.Child'), render: (_, { child_cost, currency, unit_name }) => `${child_cost} ${currency} / ${unit_name}` }, - // {key: 'price', title: t('Currency'), }, - // {key: 'currency', title: t('Currency'), }, + { key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }), render: (text, r) => text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '' }, + { key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_id, unit_name }) => `${adult_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` }, + { key: 'child', title: t('AgeType.Child'), render: (_, { child_cost, currency, unit_id, unit_name }) => `${child_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` }, // {key: 'unit', title: t('Unit'), }, { key: 'groupSize', diff --git a/src/views/products/Detail/Extras.jsx b/src/views/products/Detail/Extras.jsx index c22a2fb..2ee8587 100644 --- a/src/views/products/Detail/Extras.jsx +++ b/src/views/products/Detail/Extras.jsx @@ -8,12 +8,15 @@ import SearchForm from '@/components/SearchForm'; import RequireAuth from '@/components/RequireAuth'; import { PERM_PRODUCTS_MANAGEMENT } from '@/config'; +import { useProductsTypesMapVal } from '@/hooks/useProductsSets'; const NewAddonModal = ({ onPick, ...props }) => { const { travel_agency_id, use_year } = useParams(); const { t } = useTranslation(); const { notification, message } = App.useApp(); + const productsTypesMapVal = useProductsTypesMapVal(); + const [open, setOpen] = useState(false); const [loading, setLoading] = useState(false); // bind loading const [searchLoading, setSearchLoading] = useState(false); @@ -37,7 +40,7 @@ const NewAddonModal = ({ onPick, ...props }) => { // todo: 如何显示价格表 const searchResultColumns = [ - { key: 'ptype', dataIndex: ['info', 'product_type_name'], width: '6rem', title: t('products:ProductType') }, + { key: 'ptype', dataIndex: ['info', 'product_type_id'], width: '6rem', title: t('products:ProductType'), render: (text, r) => productsTypesMapVal[text].label }, { key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('products:Title') }, { title: t('products:price'),