fix(web): order history
This commit is contained in:
@@ -9,7 +9,7 @@ import { getOrderDetail } from '@/api/order'
|
||||
import { STATUS } from '../index';
|
||||
|
||||
|
||||
const OrderDetail = forwardRef<OrderDetailRef>((_props, ref) => {
|
||||
const OrderDetail = forwardRef<OrderDetailRef, { getProductType: (type: string) => void; }>(({ getProductType }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [data, setData] = useState({})
|
||||
@@ -38,7 +38,7 @@ const OrderDetail = forwardRef<OrderDetailRef>((_props, ref) => {
|
||||
: key === 'status' && value
|
||||
? t(`pricing.${STATUS[value as keyof typeof STATUS].key}`)
|
||||
: key === 'product_type' && value
|
||||
? t(`pricing.${value.toLowerCase()}.type`)
|
||||
? t(`pricing.${getProductType(value)}.type`)
|
||||
: value
|
||||
}
|
||||
})
|
||||
|
||||
@@ -51,10 +51,10 @@ const OrderHistory: React.FC = () => {
|
||||
]
|
||||
const productTypeOptions = [
|
||||
{ label: t('pricing.allType'), value: null },
|
||||
...PRICE_LIST.map(vo => ({
|
||||
label: t(`pricing.${vo.type}.type`),
|
||||
value: vo.type
|
||||
}))
|
||||
{ label: t('pricing.personal.type'), value: 'FREE' },
|
||||
{ label: t('pricing.team.type'), value: 'TEAM' },
|
||||
{ label: t('pricing.biz.type'), value: 'ENTERPRISE' },
|
||||
{ label: t('pricing.commerce.type'), value: 'OEM' },
|
||||
]
|
||||
|
||||
const handleView = (order: Order) => {
|
||||
@@ -128,6 +128,16 @@ const OrderHistory: React.FC = () => {
|
||||
end_time
|
||||
}))
|
||||
}
|
||||
|
||||
const getProductType = (type: string) => {
|
||||
const typeMap: Record<string, string> = {
|
||||
'FREE': 'personal',
|
||||
'TEAM': 'team',
|
||||
'ENTERPRISE': 'biz',
|
||||
'OEM': 'commerce'
|
||||
};
|
||||
return typeMap[type] || 'ENTERPRISE';
|
||||
};
|
||||
// 表格列配置
|
||||
const columns: ColumnsType = [
|
||||
{
|
||||
@@ -140,7 +150,7 @@ const OrderHistory: React.FC = () => {
|
||||
title: t('pricing.product_type'),
|
||||
dataIndex: 'product_type',
|
||||
key: 'product_type',
|
||||
render: (type) => t(`pricing.${type.toLowerCase()}.type`)
|
||||
render: (type) => t(`pricing.${getProductType(type)}.type`)
|
||||
},
|
||||
{
|
||||
title: t('pricing.payable_amount'),
|
||||
@@ -219,7 +229,7 @@ const OrderHistory: React.FC = () => {
|
||||
isScroll={true}
|
||||
/>
|
||||
|
||||
<OrderDetail ref={orderDetailRef} />
|
||||
<OrderDetail ref={orderDetailRef} getProductType={getProductType} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user