Commit ee826c92 authored by GuanHua's avatar GuanHua

fix: 修改商品详情->交易记录数据显示异常的问题

parent 1600b538
......@@ -22,44 +22,50 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
if (productIds && !isEmpty(productIds)) {
fetchRecordsList()
}
}, [productIds])
useEffect(() => {
if (productIds && !isEmpty(productIds)) {
fetchRecordsList()
}
}, [current])
}, [productIds, current])
const fetchRecordsList = () => {
let param = {
const param: any = {
current,
pageSize,
productIds: productIds.toString() // '2339'
}
//@ts-ignore
PublicApi.getOrderTransactionRecordsList(param).then(res => {
if (res.code === 1000) {
setTotalCount(res.data.totalCount)
setRecordList(res.data.data)
initData(res.data.data)
setCount(res.data.totalCount)
}
})
}
const initData = (data) => {
if(!data) {
return
}
const result = data.map((item, index) => {
item.id = current * 10 + index
return item
})
console.log(result, "result")
setRecordList(result)
}
const columns = [
{
title: '买家',
width: '33%',
render: (_, record: any) => {
return (
<div className={styles.columns_item}>
<div className={styles.columns_item_name}>{record.memberName}</div>
{
record.levelTag && <div className={styles.columns_item_member}>{record.levelTag}</div>
}
</div>
)
}
// eslint-disable-next-line react/display-name
render: (_, record: any) => (
<div className={styles.columns_item}>
<div className={styles.columns_item_name}>{record.memberName}</div>
{
record.levelTag && <div className={styles.columns_item_member}>{record.levelTag}</div>
}
</div>
)
},
{
title: '成交数量',
......@@ -85,7 +91,7 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
</div>
<div className={styles.trade_record_container}>
<Table
rowKey="orderId"
rowKey="id"
columns={columns}
dataSource={recordList}
locale={{ emptyText: '暂无交易记录' }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment