添加我的订单搜索条件

This commit is contained in:
xixi 2024-08-30 16:10:27 +08:00
parent 5c0dbf01cc
commit 5e5389a17b

View File

@ -47,6 +47,7 @@ export default function MyOrder() {
// const [orderId, setorderId] = useState('')
// const [orderDetailsModal, setOrderDetailsModal] = useState(false) //详情弹窗
const [keyWords, setKewWords] = useState('')
const [productName, setProductName] = useState('')
const [expandedRowKeys, setExpandedRowKeys] = useState<any[]>([]); //展开项
const getData = () => {
// setDataArray([])
@ -58,6 +59,7 @@ export default function MyOrder() {
page: page,
rows: 20,
keywords: keyWords,
productName: productName
}
},
onBefore() {
@ -263,6 +265,7 @@ export default function MyOrder() {
// console.log(value);
setKewWords(value)
}
const handleChange = (e: any) => {
// console.log(e.target.value);
@ -270,10 +273,20 @@ export default function MyOrder() {
setKewWords('')
}
}
const namehandleSearch = (value: string) => {
setProductName(value)
}
const namehandleChange = (e: any) => {
// console.log(e.target.value);
if (e.target.value == '') {
// setKewWords('')
setProductName('')
}
}
useEffect(() => {
getData();
}, [page, keyWords]);
}, [page, keyWords, productName]);
// useEffect(() => {
// if (orderId) {
// getOrderDetails()
@ -291,11 +304,21 @@ export default function MyOrder() {
onSearch={handleSearch}
onChange={handleChange}
style={{
width: '300px',
width: '220px',
}}
allowClear
/>
<Search placeholder="输入商品名称查询订单"
// value={nowKeyword}
onSearch={namehandleSearch}
onChange={namehandleChange}
style={{
width: '220px',
marginLeft: 10
}}
allowClear
/>
</div>
<Spin tip="加载中..." spinning={isLoading}>
@ -313,7 +336,7 @@ export default function MyOrder() {
expandable={{
expandedRowRender: (record) => {
// setorderId(record.orderId)
return <div style={{ padding: '0px 20px',marginLeft:60 }}>
return <div style={{ padding: '0px 20px', marginLeft: 60 }}>
<div style={{
marginBottom: 10
}}></div>