feat: 球局详情管理 未完
This commit is contained in:
@@ -50,7 +50,7 @@ function generateTimeMsg(game_info) {
|
||||
: startTime.format("YYYY-MM-DD")}
|
||||
</Text>
|
||||
<Text>({DayOfWeekMap.get(dayofWeek)})</Text>
|
||||
<Text>{startTime.format('ah')}点</Text>
|
||||
<Text>{startTime.format("ah")}点</Text>
|
||||
<Text>{gameLength}</Text>
|
||||
</>
|
||||
);
|
||||
@@ -59,7 +59,7 @@ function generateTimeMsg(game_info) {
|
||||
const OrderList = () => {
|
||||
const [list, setList] = useState<any[][]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const refundRef = useRef(null)
|
||||
const refundRef = useRef(null);
|
||||
|
||||
const end = list.length * PAGESIZE >= total;
|
||||
|
||||
@@ -78,7 +78,7 @@ const OrderList = () => {
|
||||
setTotal(res.data.count);
|
||||
setList((prev) => {
|
||||
const newList = [...prev];
|
||||
const index = page - 1
|
||||
const index = page - 1;
|
||||
newList.splice(
|
||||
index,
|
||||
clear ? newList.length - index : 1,
|
||||
@@ -121,53 +121,49 @@ const OrderList = () => {
|
||||
}
|
||||
|
||||
async function handleDeleteOrder(item) {
|
||||
const { id: order_id } = item
|
||||
const { id: order_id } = item;
|
||||
// TODO:删除订单,刷新这一页,然后后面的全清除掉
|
||||
const onCancel = () => {
|
||||
Dialog.close("cancelOrder");
|
||||
};
|
||||
const onConfirm = async () => {
|
||||
try {
|
||||
const deleteRes = await orderService.deleteOrder({
|
||||
order_id,
|
||||
});
|
||||
if (deleteRes.code !== 0) {
|
||||
throw new Error(deleteRes.message);
|
||||
}
|
||||
getOrders(item.page);
|
||||
Taro.showToast({
|
||||
title: "删除成功",
|
||||
icon: "none",
|
||||
})
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.message,
|
||||
icon: "error",
|
||||
});
|
||||
} finally {
|
||||
Dialog.close("cancelOrder");
|
||||
Dialog.close("cancelOrder");
|
||||
};
|
||||
const onConfirm = async () => {
|
||||
try {
|
||||
const deleteRes = await orderService.deleteOrder({
|
||||
order_id,
|
||||
});
|
||||
if (deleteRes.code !== 0) {
|
||||
throw new Error(deleteRes.message);
|
||||
}
|
||||
};
|
||||
getOrders(item.page);
|
||||
Taro.showToast({
|
||||
title: "删除成功",
|
||||
icon: "none",
|
||||
});
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.message,
|
||||
icon: "error",
|
||||
});
|
||||
} finally {
|
||||
Dialog.close("cancelOrder");
|
||||
}
|
||||
};
|
||||
Dialog.open("cancelOrder", {
|
||||
title: "确定删除订单吗?",
|
||||
content: "删除订单后,您将无法恢复订单。请确认是否继续取消?",
|
||||
footer: (
|
||||
<View className={styles.dialogFooter}>
|
||||
<Button className={styles.cancel} onClick={onCancel}>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
className={styles.confirm}
|
||||
type="primary"
|
||||
onClick={onConfirm}
|
||||
>
|
||||
确认
|
||||
</Button>
|
||||
</View>
|
||||
),
|
||||
onConfirm,
|
||||
onCancel,
|
||||
})
|
||||
footer: (
|
||||
<View className={styles.dialogFooter}>
|
||||
<Button className={styles.cancel} onClick={onCancel}>
|
||||
取消
|
||||
</Button>
|
||||
<Button className={styles.confirm} type="primary" onClick={onConfirm}>
|
||||
确认
|
||||
</Button>
|
||||
</View>
|
||||
),
|
||||
onConfirm,
|
||||
onCancel,
|
||||
});
|
||||
}
|
||||
|
||||
async function handleCancelOrder(item) {
|
||||
@@ -188,7 +184,7 @@ const OrderList = () => {
|
||||
Taro.showToast({
|
||||
title: "取消成功",
|
||||
icon: "none",
|
||||
})
|
||||
});
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.message,
|
||||
@@ -206,11 +202,7 @@ const OrderList = () => {
|
||||
<Button className={styles.cancel} onClick={onCancel}>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
className={styles.confirm}
|
||||
type="primary"
|
||||
onClick={onConfirm}
|
||||
>
|
||||
<Button className={styles.confirm} type="primary" onClick={onConfirm}>
|
||||
确认
|
||||
</Button>
|
||||
</View>
|
||||
@@ -220,13 +212,13 @@ const OrderList = () => {
|
||||
});
|
||||
}
|
||||
|
||||
function handleQuit (item) {
|
||||
function handleQuit(item) {
|
||||
if (refundRef.current) {
|
||||
refundRef.current.show(item, (result) => {
|
||||
if (result) {
|
||||
getOrders(item.page)
|
||||
getOrders(item.page);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +241,9 @@ const OrderList = () => {
|
||||
>
|
||||
{/* <View className={styles.bg} /> */}
|
||||
{list.flat().map((item) => {
|
||||
const unPay = item.order_status === OrderStatus.PENDING && item.cancel_type === CancelType.NONE;
|
||||
const unPay =
|
||||
item.order_status === OrderStatus.PENDING &&
|
||||
item.cancel_type === CancelType.NONE;
|
||||
|
||||
const {
|
||||
game_info: {
|
||||
|
||||
Reference in New Issue
Block a user