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