feat: 订单问题修复
This commit is contained in:
@@ -159,6 +159,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.weather {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
.weatherIcon {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
color: rgba(0, 0, 0, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.temperature {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: rgba(0, 0, 0, 0.8);
|
||||||
|
font-feature-settings:
|
||||||
|
"liga" off,
|
||||||
|
"clig" off;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&Place {
|
&Place {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import {
|
|||||||
getCurrentLocation,
|
getCurrentLocation,
|
||||||
getOrderStatus,
|
getOrderStatus,
|
||||||
generateOrderActions,
|
generateOrderActions,
|
||||||
reloadPage,
|
|
||||||
} from "@/utils";
|
} from "@/utils";
|
||||||
import detailService, { GameData } from "@/services/detailService";
|
import detailService, { GameData } from "@/services/detailService";
|
||||||
import { withAuth, RefundPopup } from "@/components";
|
import { withAuth, RefundPopup } from "@/components";
|
||||||
@@ -70,12 +69,14 @@ function genGameNotice(order_status, start_time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function GameInfo(props) {
|
function GameInfo(props) {
|
||||||
const { detail, currentLocation, orderDetail } = props;
|
const { detail, currentLocation, orderDetail, init } = props;
|
||||||
console.log(orderDetail, "orderDetail");
|
// console.log(orderDetail, "orderDetail");
|
||||||
const { order_status, refund_status } = 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 || {};
|
detail || {};
|
||||||
|
|
||||||
|
const [{ iconDay, tempMax, tempMin }] = weather || [{}];
|
||||||
|
|
||||||
const refundRef = useRef(null);
|
const refundRef = useRef(null);
|
||||||
|
|
||||||
const openMap = () => {
|
const openMap = () => {
|
||||||
@@ -116,7 +117,6 @@ function GameInfo(props) {
|
|||||||
|
|
||||||
async function handleDeleteOrder(item) {
|
async function handleDeleteOrder(item) {
|
||||||
const { order_id } = item;
|
const { order_id } = item;
|
||||||
// TODO:删除订单,刷新这一页,然后后面的全清除掉
|
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
Dialog.close("detailCancelOrder");
|
Dialog.close("detailCancelOrder");
|
||||||
};
|
};
|
||||||
@@ -179,7 +179,7 @@ function GameInfo(props) {
|
|||||||
if (cancelRes.code !== 0) {
|
if (cancelRes.code !== 0) {
|
||||||
throw new Error(cancelRes.message);
|
throw new Error(cancelRes.message);
|
||||||
}
|
}
|
||||||
reloadPage();
|
init();
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "取消成功",
|
title: "取消成功",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
@@ -219,7 +219,7 @@ function GameInfo(props) {
|
|||||||
if (refundRef.current) {
|
if (refundRef.current) {
|
||||||
refundRef.current.show(item, (result) => {
|
refundRef.current.show(item, (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
reloadPage();
|
init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -256,6 +256,21 @@ function GameInfo(props) {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</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>
|
</View>
|
||||||
{/* Place */}
|
{/* Place */}
|
||||||
<View className={styles.gameInfoPlace}>
|
<View className={styles.gameInfoPlace}>
|
||||||
@@ -478,7 +493,11 @@ const OrderCheck = () => {
|
|||||||
const [checkOrderInfo, setCheckOrderInfo] = useState<GameOrderRes | {}>({});
|
const [checkOrderInfo, setCheckOrderInfo] = useState<GameOrderRes | {}>({});
|
||||||
const [orderDetail, setOrderDetail] = useState({});
|
const [orderDetail, setOrderDetail] = useState({});
|
||||||
|
|
||||||
useDidShow(async () => {
|
useDidShow(() => {
|
||||||
|
init()
|
||||||
|
});
|
||||||
|
|
||||||
|
async function init() {
|
||||||
let gameDetail = {};
|
let gameDetail = {};
|
||||||
if (id) {
|
if (id) {
|
||||||
const res = await orderService.getOrderDetail(id);
|
const res = await orderService.getOrderDetail(id);
|
||||||
@@ -496,7 +515,7 @@ const OrderCheck = () => {
|
|||||||
setDetail(gameDetail);
|
setDetail(gameDetail);
|
||||||
onInit(gameDetail.id);
|
onInit(gameDetail.id);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
async function checkOrder(gid) {
|
async function checkOrder(gid) {
|
||||||
const orderRes = await orderService.getCheckOrderInfo(gid);
|
const orderRes = await orderService.getCheckOrderInfo(gid);
|
||||||
@@ -528,28 +547,32 @@ const OrderCheck = () => {
|
|||||||
mask: true,
|
mask: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let payment_params = {}
|
||||||
try {
|
try {
|
||||||
const payment_params = await getPaymentParams();
|
payment_params = await getPaymentParams();
|
||||||
await payOrder(payment_params);
|
await payOrder(payment_params);
|
||||||
Taro.hideLoading();
|
Taro.hideLoading();
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "支付成功",
|
title: "支付成功",
|
||||||
icon: "success",
|
icon: "success",
|
||||||
});
|
});
|
||||||
await delay(1000);
|
// Taro.navigateBack({
|
||||||
Taro.navigateBack({
|
// delta: 1,
|
||||||
delta: 1,
|
// });
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Taro.hideLoading();
|
Taro.hideLoading();
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: error.message,
|
title: error.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
await delay(1000);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
Taro.redirectTo({
|
Taro.redirectTo({
|
||||||
url: `/order_pages/orderDetail/index?id=${payment_params.order_id}`,
|
url: `/order_pages/orderDetail/index?id=${payment_params.order_id}`,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -578,6 +601,7 @@ const OrderCheck = () => {
|
|||||||
detail={detail}
|
detail={detail}
|
||||||
orderDetail={orderDetail}
|
orderDetail={orderDetail}
|
||||||
currentLocation={location}
|
currentLocation={location}
|
||||||
|
init={init}
|
||||||
/>
|
/>
|
||||||
{/* Order message */}
|
{/* Order message */}
|
||||||
<OrderMsg
|
<OrderMsg
|
||||||
|
|||||||
@@ -366,3 +366,22 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.emptyNotice {
|
||||||
|
height: 40vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
.emptyTip {
|
||||||
|
color: rgba(0, 0, 0, 0.85);
|
||||||
|
font-feature-settings: 'liga' off, 'clig' off;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ import classnames from "classnames";
|
|||||||
import orderService, { OrderStatus, CancelType } from "@/services/orderService";
|
import orderService, { OrderStatus, CancelType } from "@/services/orderService";
|
||||||
import { withAuth, RefundPopup } from "@/components";
|
import { withAuth, RefundPopup } from "@/components";
|
||||||
import { payOrder, generateOrderActions } from "@/utils";
|
import { payOrder, generateOrderActions } from "@/utils";
|
||||||
|
import emptyContent from "@/static/emptyStatus/publish-empty.png";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
|
|
||||||
dayjs.locale("zh-cn");
|
dayjs.locale("zh-cn");
|
||||||
|
|
||||||
const PAGESIZE = 20;
|
const PAGESIZE = 100;
|
||||||
|
|
||||||
// 将·作为连接符插入到标签文本之间
|
// 将·作为连接符插入到标签文本之间
|
||||||
function insertDotInTags(tags: string[]) {
|
function insertDotInTags(tags: string[]) {
|
||||||
@@ -99,7 +100,7 @@ const OrderList = () => {
|
|||||||
|
|
||||||
async function handlePayNow(item) {
|
async function handlePayNow(item) {
|
||||||
try {
|
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) {
|
if (unPaidRes.code === 0 && unPaidRes.data.has_unpaid_order) {
|
||||||
await payOrder(unPaidRes.data.payment_params);
|
await payOrder(unPaidRes.data.payment_params);
|
||||||
getOrders(item.page, false);
|
getOrders(item.page, false);
|
||||||
@@ -116,6 +117,10 @@ const OrderList = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleViewGame(gameId) {
|
function handleViewGame(gameId) {
|
||||||
|
if (!gameId) {
|
||||||
|
Taro.showToast({ title: "球局未找到", icon: "error" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/game_pages/detail/index?id=${gameId}&from=orderList`,
|
url: `/game_pages/detail/index?id=${gameId}&from=orderList`,
|
||||||
});
|
});
|
||||||
@@ -253,19 +258,18 @@ const OrderList = () => {
|
|||||||
const unPay =
|
const unPay =
|
||||||
item.order_status === OrderStatus.PENDING &&
|
item.order_status === OrderStatus.PENDING &&
|
||||||
item.cancel_type === CancelType.NONE;
|
item.cancel_type === CancelType.NONE;
|
||||||
|
const { game_info } = item;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
game_info: {
|
skill_level_max,
|
||||||
skill_level_max,
|
skill_level_min,
|
||||||
skill_level_min,
|
play_type,
|
||||||
play_type,
|
participants,
|
||||||
participants,
|
location_name,
|
||||||
location_name,
|
current_players,
|
||||||
current_players,
|
max_players,
|
||||||
max_players,
|
court_type,
|
||||||
court_type,
|
} = game_info || {};
|
||||||
},
|
|
||||||
} = item;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View key={item.id} className={styles.orderItem}>
|
<View key={item.id} className={styles.orderItem}>
|
||||||
@@ -286,7 +290,7 @@ const OrderList = () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.gameTime}>
|
<View className={styles.gameTime}>
|
||||||
{generateTimeMsg(item.game_info)}
|
{generateTimeMsg(item.game_info || {})}
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.address}>
|
<View className={styles.address}>
|
||||||
{insertDotInTags([location_name, court_type, "3.5km"]).map(
|
{insertDotInTags([location_name, court_type, "3.5km"]).map(
|
||||||
@@ -296,7 +300,7 @@ const OrderList = () => {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.gameOtherInfo}>
|
<View className={styles.gameOtherInfo}>
|
||||||
{participants.length >= 0 ? (
|
{participants?.length >= 0 ? (
|
||||||
<View className={styles.avatarCards}>
|
<View className={styles.avatarCards}>
|
||||||
{
|
{
|
||||||
/* participants */ [
|
/* participants */ [
|
||||||
@@ -382,7 +386,15 @@ const OrderList = () => {
|
|||||||
</View>
|
</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>
|
</ScrollView>
|
||||||
<Dialog id="cancelOrder" />
|
<Dialog id="cancelOrder" />
|
||||||
<RefundPopup ref={refundRef} />
|
<RefundPopup ref={refundRef} />
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function generateOrderActions(orderData, actions, scene) {
|
|||||||
const gameDetail = {
|
const gameDetail = {
|
||||||
text: '球局详情',
|
text: '球局详情',
|
||||||
className: 'gameDetail',
|
className: 'gameDetail',
|
||||||
action: handleViewGame.bind(null, orderData.game_info.id),
|
action: handleViewGame.bind(null, orderData.game_info?.id),
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = getOrderStatus(orderData)
|
const key = getOrderStatus(orderData)
|
||||||
|
|||||||
Reference in New Issue
Block a user