feat: 订单问题修复

This commit is contained in:
2025-09-18 16:35:27 +08:00
parent 4f255ea0ee
commit 545604d537
5 changed files with 114 additions and 31 deletions

View File

@@ -8,11 +8,12 @@ import classnames from "classnames";
import orderService, { OrderStatus, CancelType } from "@/services/orderService";
import { withAuth, RefundPopup } from "@/components";
import { payOrder, generateOrderActions } from "@/utils";
import emptyContent from "@/static/emptyStatus/publish-empty.png";
import styles from "./index.module.scss";
dayjs.locale("zh-cn");
const PAGESIZE = 20;
const PAGESIZE = 100;
// 将·作为连接符插入到标签文本之间
function insertDotInTags(tags: string[]) {
@@ -99,7 +100,7 @@ const OrderList = () => {
async function handlePayNow(item) {
try {
const unPaidRes = await orderService.getUnpaidOrder(item.game_info.id);
const unPaidRes = await orderService.getUnpaidOrder(item.game_info?.id);
if (unPaidRes.code === 0 && unPaidRes.data.has_unpaid_order) {
await payOrder(unPaidRes.data.payment_params);
getOrders(item.page, false);
@@ -116,6 +117,10 @@ const OrderList = () => {
}
function handleViewGame(gameId) {
if (!gameId) {
Taro.showToast({ title: "球局未找到", icon: "error" });
return;
}
Taro.navigateTo({
url: `/game_pages/detail/index?id=${gameId}&from=orderList`,
});
@@ -253,19 +258,18 @@ const OrderList = () => {
const unPay =
item.order_status === OrderStatus.PENDING &&
item.cancel_type === CancelType.NONE;
const { game_info } = item;
const {
game_info: {
skill_level_max,
skill_level_min,
play_type,
participants,
location_name,
current_players,
max_players,
court_type,
},
} = item;
skill_level_max,
skill_level_min,
play_type,
participants,
location_name,
current_players,
max_players,
court_type,
} = game_info || {};
return (
<View key={item.id} className={styles.orderItem}>
@@ -286,7 +290,7 @@ const OrderList = () => {
</View>
</View>
<View className={styles.gameTime}>
{generateTimeMsg(item.game_info)}
{generateTimeMsg(item.game_info || {})}
</View>
<View className={styles.address}>
{insertDotInTags([location_name, court_type, "3.5km"]).map(
@@ -296,7 +300,7 @@ const OrderList = () => {
)}
</View>
<View className={styles.gameOtherInfo}>
{participants.length >= 0 ? (
{participants?.length >= 0 ? (
<View className={styles.avatarCards}>
{
/* participants */ [
@@ -382,7 +386,15 @@ const OrderList = () => {
</View>
);
})}
{end && <View className={styles.endTips}></View>}
{list.length > 0 && end && (
<View className={styles.endTips}></View>
)}
{list.length === 0 && (
<View className={styles.emptyNotice}>
<Image src={emptyContent} />
<Text className={styles.emptyTip}></Text>
</View>
)}
</ScrollView>
<Dialog id="cancelOrder" />
<RefundPopup ref={refundRef} />