feat: 申请加入、退款政策、支付倒计时、详情页发布者信息展示
This commit is contained in:
@@ -6,6 +6,7 @@ import React, {
|
||||
} from "react";
|
||||
import { View, Text, Button, Image } from "@tarojs/components";
|
||||
import Taro from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
import dayjs from "dayjs";
|
||||
import { CommonPopup } from "@/components";
|
||||
import orderService from "@/services/orderService";
|
||||
@@ -47,18 +48,25 @@ function genRefundNotice(refund_policy) {
|
||||
|
||||
function renderCancelContent(checkOrderInfo) {
|
||||
const { refund_policy = [] } = checkOrderInfo;
|
||||
const current = dayjs();
|
||||
const policyList = [
|
||||
{
|
||||
time: "申请退款时间",
|
||||
rule: "退款规则",
|
||||
},
|
||||
...refund_policy.map((item) => {
|
||||
...refund_policy.map((item, index) => {
|
||||
const isLast = index === refund_policy.length - 1;
|
||||
return {
|
||||
time: item.application_time,
|
||||
rule: item.refund_rule,
|
||||
beforeCurrent: isLast
|
||||
? true
|
||||
: current.isBefore(dayjs(item.deadline_formatted)),
|
||||
};
|
||||
}),
|
||||
];
|
||||
console.log("policyList", policyList);
|
||||
const targetIndex = policyList.findIndex((item) => item.beforeCurrent);
|
||||
const { notice } = genRefundNotice(refund_policy);
|
||||
return (
|
||||
<View className={styles.refundPolicy}>
|
||||
@@ -69,8 +77,22 @@ function renderCancelContent(checkOrderInfo) {
|
||||
{/* 订单信息摘要 */}
|
||||
<View className={styles.policyList}>
|
||||
{policyList.map((item, index) => (
|
||||
<View key={index} className={styles.policyItem}>
|
||||
<View className={styles.time}>{item.time}</View>
|
||||
<View
|
||||
key={index}
|
||||
className={classnames(
|
||||
styles.policyItem,
|
||||
targetIndex > index && index !== 0 ? styles.pastItem : "",
|
||||
targetIndex === index ? styles.currentItem : ""
|
||||
)}
|
||||
>
|
||||
<View className={styles.time}>
|
||||
{targetIndex === index && (
|
||||
<View className={styles.currentTag}>
|
||||
<Text>当前时间段</Text>
|
||||
</View>
|
||||
)}
|
||||
<Text>{item.time}</Text>
|
||||
</View>
|
||||
<View className={styles.rule}>{item.rule}</View>
|
||||
</View>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user