|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 产品管理 相关的预设数据
|
|
|
|
* 项目类型
|
|
|
|
1 酒店预定
|
|
|
|
2 火车
|
|
|
|
3 飞机票务
|
|
|
|
4 游船
|
|
|
|
5 快巴
|
|
|
|
6 旅行社(综费) -
|
|
|
|
7 景点 -
|
|
|
|
8 特殊项目 -
|
|
|
|
9 其他
|
|
|
|
A 酒店
|
|
|
|
B 超公里 -
|
|
|
|
C 餐费 -
|
|
|
|
D 包价包
|
|
|
|
X 站
|
|
|
|
*/
|
|
|
|
|
|
|
|
export const useProductsTypes = () => {
|
|
|
|
const [types, setTypes] = useState([]);
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const newData = [
|
|
|
|
{ label: t('products:type.Experience'), value: '6', key: '6' },
|
|
|
|
{ label: t('products:type.Car'), value: 'Car', key: 'Car' },
|
|
|
|
{ label: t('products:type.Guide'), value: 'Guide', key: 'Guide' },
|
|
|
|
{ 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' },
|
|
|
|
// { label: t('products:type.Special'), value: 'Special', key: 'Special' },
|
|
|
|
];
|
|
|
|
setTypes(newData);
|
|
|
|
}, [i18n.language]);
|
|
|
|
|
|
|
|
return types;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const useProductsAuditStates = () => {
|
|
|
|
const [types, setTypes] = useState([]);
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
|
|
|
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') },
|
|
|
|
];
|
|
|
|
setTypes(newData);
|
|
|
|
}, [i18n.language]);
|
|
|
|
|
|
|
|
return types;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const useProductsAuditStatesMapVal = (value) => {
|
|
|
|
const stateSets = useProductsAuditStates();
|
|
|
|
const stateMapVal = stateSets.reduce((r, c) => ({ ...r, [`${c.value}`]: c }), {});
|
|
|
|
return stateMapVal;
|
|
|
|
};
|