Merge branch 'feat/liujie'

This commit is contained in:
2025-09-18 16:35:40 +08:00
5 changed files with 114 additions and 31 deletions

View File

@@ -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 {

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

View File

@@ -366,3 +366,22 @@
font-weight: 400;
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;
}
}

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} />

View File

@@ -46,7 +46,7 @@ export function generateOrderActions(orderData, actions, scene) {
const gameDetail = {
text: '球局详情',
className: 'gameDetail',
action: handleViewGame.bind(null, orderData.game_info.id),
action: handleViewGame.bind(null, orderData.game_info?.id),
}
const key = getOrderStatus(orderData)