|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { createContext, useContext, useEffect, useState } from 'react';
|
|
|
|
|
import { Link, useLocation, } from 'react-router-dom';
|
|
|
|
|
import { Button, Collapse, Table, Tabs, Typography, Space, } from 'antd';
|
|
|
|
|
import { useProductsTypes } from '@/hooks/useProductsSets';
|
|
|
|
|
import { useProductsTypes, useProductsAuditStatesMapVal, useProductsAuditStates } from '@/hooks/useProductsSets';
|
|
|
|
|
import SecondHeaderWrapper from '@/components/SecondHeaderWrapper';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import useProductsStore from '@/stores/Products/Index';
|
|
|
|
@ -21,26 +21,10 @@ const Header = ({title, ...props}) => {
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const TypesTabs = () => {
|
|
|
|
|
const productsTypes = useProductsTypes();
|
|
|
|
|
return (
|
|
|
|
|
<Tabs items={productsTypes} type='card' />
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const subjectComponents = {
|
|
|
|
|
// 'sum_profit': ProfitTable,
|
|
|
|
|
// 'in_order_count': Count,
|
|
|
|
|
// 'confirm_order_count': Count,
|
|
|
|
|
// 'depart_order_count': Count,
|
|
|
|
|
// 'confirm_rates': Rates,
|
|
|
|
|
// 'praise_rates': Rates,
|
|
|
|
|
// 'sum_person_num': Count,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const PriceTable = ({dataSource}) => {
|
|
|
|
|
const PriceTable = ({dataSource, loading}) => {
|
|
|
|
|
const { t } = useTranslation('products');
|
|
|
|
|
// console.log(dataSource, );
|
|
|
|
|
const stateMapVal = useProductsAuditStatesMapVal();
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{ key: 'title', dataIndex: ['info', 'title'], title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }) },
|
|
|
|
|
{ key: 'value', title: t('Quotation'), render: (_, { value, currency, unit }) => `${value} ${currency} / ${unit}` },
|
|
|
|
@ -52,23 +36,29 @@ const PriceTable = ({dataSource}) => {
|
|
|
|
|
key: 'groupSize',
|
|
|
|
|
dataIndex: ['group_size_min'],
|
|
|
|
|
title: t('GroupSize'),
|
|
|
|
|
render: (_, { group_size_min, group_size_max} ) => `${group_size_min} - ${group_size_max}`,
|
|
|
|
|
render: (_, { group_size_min, group_size_max }) => `${group_size_min} - ${group_size_max}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
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 }) => `${use_dates_start} ~ ${use_dates_end}`,
|
|
|
|
|
},
|
|
|
|
|
{ key: 'weekdays', dataIndex: ['weekdays'], title: t('Weekdays') },
|
|
|
|
|
{
|
|
|
|
|
key: 'state',
|
|
|
|
|
title: t('State'),
|
|
|
|
|
render: (_, r) => {
|
|
|
|
|
return stateMapVal[`${r.info.audit_state}`]?.label;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{ key: 'weekdays', dataIndex: ['weekdays'], title: t('Weekdays'), },
|
|
|
|
|
{key: 'status', title: t('Status'), render: () => '已通过'},
|
|
|
|
|
{
|
|
|
|
|
title: '',
|
|
|
|
|
key: 'action',
|
|
|
|
|
render: () => (
|
|
|
|
|
<Space>
|
|
|
|
|
<Button >✔</Button>
|
|
|
|
|
<Button >✖</Button>
|
|
|
|
|
<Button>✔</Button>
|
|
|
|
|
<Button>✖</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
@ -90,7 +80,7 @@ const TypesPanels = () => {
|
|
|
|
|
const hasDataTypes = Object.keys(agencyProducts);
|
|
|
|
|
const _show = productsTypes
|
|
|
|
|
.filter((kk) => hasDataTypes.includes(kk.value))
|
|
|
|
|
.map((ele) => ({ ...ele, children: <PriceTable dataSource={agencyProducts[ele.value].reduce((r, c) => r.concat(c.quotation.map((q, i) => ({ ...q, info: c.info, rowSpan: i=== 0 ? c.quotation.length : 0 }))), [])} /> }));
|
|
|
|
|
.map((ele) => ({ ...ele, children: <PriceTable loading={loading} dataSource={agencyProducts[ele.value].reduce((r, c) => r.concat(c.quotation.map((q, i) => ({ ...q, info: c.info, rowSpan: i=== 0 ? c.quotation.length : 0 }))), [])} /> }));
|
|
|
|
|
setShowTypes(_show);
|
|
|
|
|
|
|
|
|
|
setActiveKey(isEmpty(_show) ? [] : [_show[0].key]);
|
|
|
|
|