feat: 产品审核: 拒绝的价格: 查询`原价格`即`已发布的`

main
Lei OT 2 months ago
parent 522b0abf4a
commit 47047ffeb0

@ -102,7 +102,7 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
onCell: (r, index) => ({ rowSpan: r.rowSpan, }),
render: (_, r) => {
const showPublicBtn = null; // r.pendingQuotation ? <Popover title='' trigger={['click']}> <Button size='small' className='ml-2' onClick={() => { }}></Button></Popover> : null;
const btn2 = r.pendingQuotation ? (
const btn2 = r.showPublicBtn ? (
<ProductQuotationLogPopover
method={'published'}
{...{ travel_agency_id, product_id: r.info.id, price_id: r.id, use_year }}
@ -160,7 +160,7 @@ const TypesPanels = (props) => {
lgc_details: c.lgc_details.reduce((rlgc, clgc) => ({...rlgc, [clgc.lgc]: clgc}), {}),
rowSpan: i === 0 ? c.quotation.length : 0,
rowSpanI: [ri, i],
pendingQuotation: c.quotation.findIndex(q2 => q2.audit_state_id===0) !== -1 ,
showPublicBtn: c.quotation.some(q2 => [0, 3].includes(q2.audit_state_id)),
}))
),
[]

@ -147,14 +147,16 @@ const useLogMethod = (method) => {
const { t } = useTranslation('products');
const methodMap = {
'history': {
title: t('versionHistory'),
title: '📑' + t('versionHistory'),
btnText: t('versionHistory'),
fetchData: async (params) => {
const data = await getPPLogAction(params);
return data;
},
},
'published': {
title: t('versionPublished'),
title: '✅' + t('versionPublished'),
btnText: t('versionPublished'),
fetchData: async (params) => {
const { travel_agency_id, product_id, price_id, use_year } = params;
const data = await getPPRunningAction({ travel_agency_id, product_id_list: product_id, use_year });
@ -189,13 +191,17 @@ const ProductQuotationLogPopover = ({ method, triggerProps = {}, onOpenChange, .
const [open, setOpen] = useState(false);
const [logData, setLogData] = useState([]);
const { title, fetchData } = useLogMethod(method);
const { title, btnText: methodBtnText, fetchData } = useLogMethod(method);
const tablePagination = useMemo(() => method === 'history' ? { pageSize: 5, position: ['bottomLeft']} : { pageSize: 10, position: ['bottomLeft']}, [method]);
const [loading, setLoading] = useState(false);
const getData = async () => {
setLoading(true);
const data = await fetchData({ travel_agency_id, product_id, price_id, use_year });
setLogData(data);
invokeOpenChange(true);
setLoading(false);
};
const invokeOpenChange = (_open) => {
@ -226,7 +232,7 @@ const ProductQuotationLogPopover = ({ method, triggerProps = {}, onOpenChange, .
}
content={
<>
<Table columns={columns} dataSource={logData} rowKey={'id'} size='small' pagination={tablePagination} />
<Table columns={columns} dataSource={logData} rowKey={'id'} size='small' loading={loading} pagination={tablePagination} />
</>
}
trigger={['click']}
@ -236,7 +242,7 @@ const ProductQuotationLogPopover = ({ method, triggerProps = {}, onOpenChange, .
invokeOpenChange(v);
}}>
<Button {...triggerProps} onClick={getData} title={title}>
{title}
{props.btnText || methodBtnText}
</Button>
</Popover>
);

Loading…
Cancel
Save