fix: 修复退出活动弹窗文案展示
This commit is contained in:
@@ -13,7 +13,7 @@ import orderService from "@/services/orderService";
|
||||
import styles from "./index.module.scss";
|
||||
import closeIcon from "@/static/order/orderListClose.svg";
|
||||
|
||||
function genRefundNotice(refund_policy) {
|
||||
function genRefundNotice(refund_policy, order_amount) {
|
||||
if (refund_policy.length === 0) {
|
||||
return {};
|
||||
}
|
||||
@@ -23,8 +23,7 @@ function genRefundNotice(refund_policy) {
|
||||
if (matchPolicyIndex === -1) {
|
||||
matchPolicyIndex = refund_policy.length - 1;
|
||||
}
|
||||
const { deadline_formatted, price, refund_rate } =
|
||||
refund_policy[matchPolicyIndex];
|
||||
const { time_range, price, refund_rate } = refund_policy[matchPolicyIndex];
|
||||
if (refund_rate === 1) {
|
||||
return {
|
||||
refundPrice: price,
|
||||
@@ -36,17 +35,15 @@ function genRefundNotice(refund_policy) {
|
||||
notice: `当前退出不可退款,后续流程未明确,@麻真瑜`,
|
||||
};
|
||||
}
|
||||
const refundPrice = Number(Math.ceil(price * refund_rate * 100) / 100);
|
||||
const leftHours = dayjs(deadline_formatted).diff(dayjs(), "hour");
|
||||
// const refundPrice = Number(Math.ceil(price * refund_rate * 100) / 100);
|
||||
// const leftHours = dayjs(deadline_formatted).diff(dayjs(), "hour");
|
||||
return {
|
||||
refundPrice,
|
||||
notice: `距活动开始已不足${leftHours}h,当前退出您需扣除${
|
||||
Math.floor((price - refundPrice) * 100) / 100
|
||||
}元`,
|
||||
refundPrice: price,
|
||||
notice: `活动开始${time_range},当前退出需扣除您${Math.ceil((order_amount - price) * 100) / 100}元`,
|
||||
};
|
||||
}
|
||||
|
||||
function renderCancelContent(refund_policy = []) {
|
||||
function renderCancelContent(refund_policy = [], amount) {
|
||||
const current = dayjs();
|
||||
const policyList = [
|
||||
{
|
||||
@@ -65,7 +62,7 @@ function renderCancelContent(refund_policy = []) {
|
||||
}),
|
||||
];
|
||||
const targetIndex = policyList.findIndex((item) => item.beforeCurrent);
|
||||
const { notice } = genRefundNotice(refund_policy);
|
||||
const { notice } = genRefundNotice(refund_policy, amount);
|
||||
return (
|
||||
<View className={styles.refundPolicy}>
|
||||
{/* <View className={styles.moduleTitle}>
|
||||
@@ -80,7 +77,7 @@ function renderCancelContent(refund_policy = []) {
|
||||
className={classnames(
|
||||
styles.policyItem,
|
||||
targetIndex > index && index !== 0 ? styles.pastItem : "",
|
||||
targetIndex === index ? styles.currentItem : ""
|
||||
targetIndex === index ? styles.currentItem : "",
|
||||
)}
|
||||
>
|
||||
<View className={styles.time}>
|
||||
@@ -169,7 +166,7 @@ export default forwardRef<RefundRef>(function RefundPopup(_props, ref) {
|
||||
onClick={onClose}
|
||||
/>
|
||||
</View>
|
||||
{renderCancelContent(refundPolicy)}
|
||||
{renderCancelContent(refundPolicy, orderData.amount)}
|
||||
<Button className={styles.action} onClick={handleConfirmQuit}>
|
||||
确认并退出
|
||||
</Button>
|
||||
|
||||
@@ -10,6 +10,7 @@ import orderService, {
|
||||
GameOrderRes,
|
||||
OrderStatus,
|
||||
refundTextMap,
|
||||
RefundStatus,
|
||||
} from "@/services/orderService";
|
||||
import { debounce } from "@tarojs/runtime";
|
||||
import {
|
||||
@@ -76,7 +77,7 @@ function genGameNotice(order_status, start_time) {
|
||||
|
||||
function GameInfo(props) {
|
||||
const { detail, currentLocation, orderDetail, init } = props;
|
||||
const { order_status, refund_status, amount } = orderDetail;
|
||||
const { order_status, refund_status, amount, refund_amount } = orderDetail;
|
||||
const {
|
||||
latitude,
|
||||
longitude,
|
||||
@@ -111,7 +112,7 @@ function GameInfo(props) {
|
||||
const startTime = dayjs(start_time);
|
||||
const endTime = dayjs(end_time);
|
||||
const game_length = Number(
|
||||
(endTime.diff(startTime, "minutes") / 60).toFixed()
|
||||
(endTime.diff(startTime, "minutes") / 60).toFixed(),
|
||||
);
|
||||
|
||||
const startMonth = startTime.format("M");
|
||||
@@ -244,7 +245,10 @@ function GameInfo(props) {
|
||||
<View className={styles.gameInfoContainer}>
|
||||
{["refund", "progress", "expired"].includes(orderStatus) && (
|
||||
<View className={styles.paidInfo}>
|
||||
{refundTextMap.get(refund_status)} ¥ {amount}
|
||||
{refundTextMap.get(refund_status)} ¥{" "}
|
||||
{[RefundStatus.PENDING, RefundStatus.SUCCESS].includes(refund_status)
|
||||
? refund_amount
|
||||
: amount}
|
||||
</View>
|
||||
)}
|
||||
{["progress", "expired"].includes(orderStatus) &&
|
||||
@@ -344,7 +348,7 @@ function GameInfo(props) {
|
||||
handlePayNow: () => {},
|
||||
handleViewGame,
|
||||
},
|
||||
"detail"
|
||||
"detail",
|
||||
)?.map((obj) => (
|
||||
<View className={classnames(styles.button, styles[obj.className])}>
|
||||
<Text className={styles.buttonText}>{obj.text}</Text>
|
||||
@@ -504,7 +508,7 @@ function RefundPolicy(props) {
|
||||
const theTimeObj = dayjs(
|
||||
isLast
|
||||
? refund_policy.at(-2).deadline_formatted
|
||||
: item.deadline_formatted
|
||||
: item.deadline_formatted,
|
||||
);
|
||||
const year = theTimeObj.format("YYYY");
|
||||
const month = theTimeObj.format("M");
|
||||
@@ -531,7 +535,7 @@ function RefundPolicy(props) {
|
||||
className={classnames(
|
||||
styles.policyItem,
|
||||
targetIndex > index && index !== 0 ? styles.pastItem : "",
|
||||
targetIndex === index ? styles.currentItem : ""
|
||||
targetIndex === index ? styles.currentItem : "",
|
||||
)}
|
||||
>
|
||||
<View className={styles.time}>
|
||||
|
||||
Reference in New Issue
Block a user