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

@@ -18,7 +18,6 @@ import {
getCurrentLocation,
getOrderStatus,
generateOrderActions,
reloadPage,
} from "@/utils";
import detailService, { GameData } from "@/services/detailService";
import { withAuth, RefundPopup } from "@/components";
@@ -70,12 +69,14 @@ function genGameNotice(order_status, start_time) {
}
function GameInfo(props) {
const { detail, currentLocation, orderDetail } = props;
console.log(orderDetail, "orderDetail");
const { detail, currentLocation, orderDetail, init } = props;
// console.log(orderDetail, "orderDetail");
const { order_status, refund_status } = orderDetail;
const { latitude, longitude, location, location_name, start_time, end_time } =
const { latitude, longitude, location, location_name, start_time, end_time, weather } =
detail || {};
const [{ iconDay, tempMax, tempMin }] = weather || [{}];
const refundRef = useRef(null);
const openMap = () => {
@@ -116,7 +117,6 @@ function GameInfo(props) {
async function handleDeleteOrder(item) {
const { order_id } = item;
// TODO删除订单,刷新这一页,然后后面的全清除掉
const onCancel = () => {
Dialog.close("detailCancelOrder");
};
@@ -179,7 +179,7 @@ function GameInfo(props) {
if (cancelRes.code !== 0) {
throw new Error(cancelRes.message);
}
reloadPage();
init();
Taro.showToast({
title: "取消成功",
icon: "none",
@@ -219,7 +219,7 @@ function GameInfo(props) {
if (refundRef.current) {
refundRef.current.show(item, (result) => {
if (result) {
reloadPage();
init();
}
});
}
@@ -256,6 +256,21 @@ function GameInfo(props) {
</View>
</View>
</View>
<View className={styles.weather}>
{/* Weather icon */}
<View className={styles.weatherIcon}>
{/*<Image className="weather-icon" src={img.ICON_WEATHER_SUN} />*/}
<i className={`qi-${iconDay}`}></i>
</View>
{/* Weather text and temperature */}
<View className={styles.temperature}>
{tempMin && tempMax && (
<Text>
{tempMin} - {tempMax}
</Text>
)}
</View>
</View>
</View>
{/* Place */}
<View className={styles.gameInfoPlace}>
@@ -478,7 +493,11 @@ const OrderCheck = () => {
const [checkOrderInfo, setCheckOrderInfo] = useState<GameOrderRes | {}>({});
const [orderDetail, setOrderDetail] = useState({});
useDidShow(async () => {
useDidShow(() => {
init()
});
async function init() {
let gameDetail = {};
if (id) {
const res = await orderService.getOrderDetail(id);
@@ -496,7 +515,7 @@ const OrderCheck = () => {
setDetail(gameDetail);
onInit(gameDetail.id);
}
});
}
async function checkOrder(gid) {
const orderRes = await orderService.getCheckOrderInfo(gid);
@@ -528,28 +547,32 @@ const OrderCheck = () => {
mask: true,
});
let payment_params = {}
try {
const payment_params = await getPaymentParams();
payment_params = await getPaymentParams();
await payOrder(payment_params);
Taro.hideLoading();
Taro.showToast({
title: "支付成功",
icon: "success",
});
await delay(1000);
Taro.navigateBack({
delta: 1,
});
// Taro.navigateBack({
// delta: 1,
// });
} catch (error) {
Taro.hideLoading();
Taro.showToast({
title: error.message,
icon: "none",
});
} finally {
await delay(1000);
if (!id) {
Taro.redirectTo({
url: `/order_pages/orderDetail/index?id=${payment_params.order_id}`,
});
} else {
init()
}
}
};
@@ -578,6 +601,7 @@ const OrderCheck = () => {
detail={detail}
orderDetail={orderDetail}
currentLocation={location}
init={init}
/>
{/* Order message */}
<OrderMsg