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>
|
||||
|
||||
Reference in New Issue
Block a user