优化订单查询功能
This commit is contained in:
parent
67f0daefed
commit
f2b2f52c7f
|
@ -43,8 +43,8 @@ export default function OrdersQuerry() {
|
|||
render: (data) => {
|
||||
return (
|
||||
<div>
|
||||
{data.coins && <p>{data.coins}</p>}
|
||||
{data.money && <p>{data.money}</p>}
|
||||
{data.coins && <p>{data.coins}金币</p>}
|
||||
{data.money && <p>¥{data.money / 100}</p>}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
@ -104,11 +104,12 @@ export default function OrdersQuerry() {
|
|||
order_id: item.order_id,
|
||||
order_status_desc: item.order_status_desc,
|
||||
ct: new Date(item.ct * 1000).toLocaleString(),
|
||||
ct_origion: item.ct,
|
||||
},
|
||||
product: item.product_name,
|
||||
cost: {
|
||||
coins: `${item?.coins}金币`,
|
||||
money: `¥${item?.money / 100}`,
|
||||
coins: item?.coins,
|
||||
money: item?.money,
|
||||
},
|
||||
userAndStreamer: {
|
||||
user_user_id: item?.user_user_id,
|
||||
|
@ -121,9 +122,24 @@ export default function OrdersQuerry() {
|
|||
console.error(error);
|
||||
}
|
||||
};
|
||||
let result = await ordersQuerry("coin_order_list");
|
||||
if (!result) result = await ordersQuerry("order_list");
|
||||
setData(result);
|
||||
const coinOrderResult = await ordersQuerry("coin_order_list");
|
||||
const orderResult = await ordersQuerry("order_list");
|
||||
//合并查询结果,并按时间排序
|
||||
if (!coinOrderResult) {
|
||||
setData(orderResult);
|
||||
return;
|
||||
}
|
||||
if (!orderResult) {
|
||||
setData(coinOrderResult);
|
||||
return;
|
||||
}
|
||||
if (coinOrderResult && orderResult) {
|
||||
const allResult = [...coinOrderResult, ...orderResult];
|
||||
const finalResult = allResult.sort(
|
||||
(a, b) => b.base.ct_origion - a.base.ct_origion
|
||||
);
|
||||
setData(finalResult);
|
||||
}
|
||||
};
|
||||
|
||||
//表单提交失败
|
||||
|
|
Loading…
Reference in New Issue