完成报价历史分页和复制链接

dev/mobile
Jimmy Liow 2 years ago
parent 83056e76fd
commit d0d6ba30bf

@ -15,6 +15,7 @@ const useOrderStore = create((set, get) => ({
quotationList: [],
fetchOrderDetail: async (colisn) => {
const { orderDetail, updateQuotation } = get()
const json = await fetchJSON(`${API_HOST}/getorderinfo`, { colisn })
if (json.errcode === 0 && json.result.length > 0) {
const orderResult = json.result[0]

@ -17,11 +17,6 @@ const CustomerProfile = (() => {
useEffect(() => {
fetchOrderDetail(order_sn)
}, [order_sn])
const paginationProps = {
showLessItems: true,
showTotal: (total) => { return `总数:${total}` }
}
let regularText = ''
if (orderDetail.buytime > 0) regularText = '(R' + orderDetail.buytime + ')'
@ -84,24 +79,8 @@ const CustomerProfile = (() => {
<Typography.Text strong>最新报价</Typography.Text>
<p className='m-0 py-2 line-clamp-2 '><a target='_blank' href={lastQuotation.letterurl}>{lastQuotation.lettertitle}<LinkOutlined /></a></p>
<Flex justify={'space-between'} >
<QuotesHistory />
<QuotesHistory dataSource={quotationList} />
</Flex>
<List
itemLayout="vertical"
pagination={paginationProps}
dataSource={quotationList}
renderItem={(item) => (
<List.Item
key={item.letterid}
>
<List.Item.Meta
title={<a href={item.letterurl}>{item.lettertitle}</a>}
description={item.letterdate}
/>
</List.Item>
)}
/>
</Flex>
<p className='p-2 shadow-inner overflow-auto max-h-72 m-0 break-words whitespace-pre-wrap ' dangerouslySetInnerHTML={{__html: orderDetail.order_detail}}></p>
</div>

@ -1,49 +1,46 @@
import { createContext, useContext, useEffect, useState } from 'react';
import { Popover, Flex, Button, List, Popconfirm } from 'antd';
// import { useConversationState } from '@/stores/ConversationContext';
import { useState } from 'react'
import { Popover, Flex, Button, List, Popconfirm } from 'antd'
const QuotesHistory = ((props) => {
// const { customerOrderProfile: orderInfo } = useConversationState();
const { quotes, ...order } = {} // orderInfo;
const [open, setOpen] = useState(false);
const [open, setOpen] = useState(false)
const handleOpenChange = (newOpen) => {
setOpen(newOpen);
};
setOpen(newOpen)
}
const onSend = () => {
setOpen(false);
setOpen(false)
// todo: send
};
}
return (
<>
<Popover
// content={<a onClick={hide}>Close</a>}
content={
<List
className='w-96 h-4/6 overflow-y-auto text-slate-900'
itemLayout='horizontal'
dataSource={quotes}
pagination={{
pageSize: 5,
showLessItems: true,
showTotal: (total) => { return `总数:${total}` }
}}
dataSource={props.dataSource}
renderItem={(item, index) => (
<List.Item className='' key={item.letterid} >
<List.Item.Meta
className=' text-neutral-800'
title={item.lettertitle}
className='text-neutral-800'
title={<a target='_blank' href={item.letterurl}>{item.lettertitle}</a>}
description={
<Flex justify='space-between'>
<Button onClick={onSend} size={'small'} type='link' key={'send'}>
详细报价
</Button>
<span>{item.letterdate}</span>
<Flex gap={8}>
<Popconfirm title='删除报价信' description='确认要删除报价信吗?' onConfirm={() => {}} onCancel={onSend} okText='Yes' cancelText='No'>
<Button size={'small'} type='link' danger key={'send'}>
删除
</Button>
</Popconfirm>
<Button onClick={onSend} size={'small'} type='link' key={'send'}>
复制
</Button>
</Flex>
<Button onClick={() => {
navigator.clipboard.writeText(item.letterurl)
setOpen(false)
}} size={'small'} type='link' key={'send'}>
复制
</Button>
</Flex>
}
/>
@ -59,6 +56,7 @@ const QuotesHistory = ((props) => {
<Button size={'small'}>报价历史</Button>
</Popover>
</>
);
});
export default QuotesHistory;
)
})
export default QuotesHistory

Loading…
Cancel
Save