feat(admin): 从文章详情页面改为文章管理页面

- 修改页面配置,设置新的导航栏标题和样式
- 重新设计页面布局,增加搜索栏、文章列表和操作按钮
- 添加文章搜索、分页加载和删除功能
- 优化文章列表项的样式和交互
- 新增礼品卡相关API和组件
- 更新优惠券组件,增加到期提醒和筛选功能
This commit is contained in:
2025-08-13 10:11:57 +08:00
parent 0e457f66d8
commit a1cacc04e8
67 changed files with 6278 additions and 2816 deletions

View File

@@ -79,13 +79,41 @@ const CouponCard: React.FC<CouponCardProps> = ({
// 获取使用条件文本
const getConditionText = () => {
if (type === 3) return '无门槛'
if (type === 3) return '免费使用' // 免费券
if (minAmount && minAmount > 0) {
return `${minAmount}可用`
return `${minAmount}可用`
}
return '无门槛'
}
// 格式化有效期显示
const formatValidityPeriod = () => {
if (!startTime || !endTime) return ''
const start = new Date(startTime)
const end = new Date(endTime)
const now = new Date()
// 如果还未开始
if (now < start) {
return `${start.getMonth() + 1}.${start.getDate()} 开始生效`
}
// 计算剩余天数
const diffTime = end.getTime() - now.getTime()
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))
if (diffDays <= 0) {
return '已过期'
} else if (diffDays <= 3) {
return `${diffDays}天后过期`
} else {
return `${end.getMonth() + 1}.${end.getDate()} 过期`
}
}
// 格式化日期
const formatDate = (dateStr?: string) => {
if (!dateStr) return ''
@@ -108,8 +136,8 @@ const CouponCard: React.FC<CouponCardProps> = ({
{/* 左侧金额区域 */}
<View className={`coupon-left ${themeClass}`}>
<View className="amount-wrapper">
<Text className="currency">¥</Text>
<Text className="amount">{amount}</Text>
{type !== 3 && <Text className="currency">¥</Text>}
<Text className="amount">{formatAmount()}</Text>
</View>
<View className="condition">
{getConditionText()}
@@ -130,7 +158,7 @@ const CouponCard: React.FC<CouponCardProps> = ({
{title || (type === 1 ? '满减券' : type === 2 ? '折扣券' : '免费券')}
</View>
<View className="coupon-validity">
{getValidityText()}
{formatValidityPeriod()}
</View>
</View>
@@ -151,7 +179,7 @@ const CouponCard: React.FC<CouponCardProps> = ({
size="small"
onClick={onUse}
>
使
使
</Button>
)}
{status !== 0 && (