refactor(components): 重构优惠券组件样式和结构

- 更新 CouponCard 组件样式,优化主题颜色和布局
- 调整 CouponList 组件样式,使用原生样式替代自定义样式
- 修改 orderConfirm 页面中的地址栏样式
- 更新 QuantitySelector 组件样式,统一数量选择器样式
- 删除 Questions 组件代码
This commit is contained in:
2025-08-11 18:15:36 +08:00
parent bcaf8203e4
commit 6f76be4da4
9 changed files with 230 additions and 297 deletions

View File

@@ -44,7 +44,12 @@ const CouponCard: React.FC<CouponCardProps> = ({
onUse,
theme = 'red'
}) => {
// 获取主题颜色类名
const getThemeClass = () => {
return `theme-${theme}`
}
// 格式化优惠券金额显示
// @ts-ignore
const formatAmount = () => {
switch (type) {
case 1: // 满减券
@@ -96,42 +101,44 @@ const CouponCard: React.FC<CouponCardProps> = ({
return ''
}
const themeClass = getThemeClass()
return (
<View className={`coupon-card coupon-card--${theme} ${status !== 0 ? 'coupon-card--disabled' : ''}`}>
<View className={`coupon-card ${status !== 0 ? 'disabled' : ''}`}>
{/* 左侧金额区域 */}
<View className="coupon-card__left">
<View className="coupon-card__amount">
<Text className="coupon-card__currency">¥</Text>
<Text className="coupon-card__value">{amount}</Text>
<View className={`coupon-left ${themeClass}`}>
<View className="amount-wrapper">
<Text className="currency">¥</Text>
<Text className="amount">{amount}</Text>
</View>
<View className="coupon-card__condition">
<View className="condition">
{getConditionText()}
</View>
</View>
{/* 中间分割线 */}
<View className="coupon-card__divider">
<View className="coupon-card__divider-line"></View>
<View className="coupon-card__circle coupon-card__circle--top"></View>
<View className="coupon-card__circle coupon-card__circle--bottom"></View>
<View className="coupon-divider">
<View className="divider-line"></View>
<View className="divider-circle-top"></View>
<View className="divider-circle-bottom"></View>
</View>
{/* 右侧信息区域 */}
<View className="coupon-card__right">
<View className="coupon-card__info">
<View className="coupon-card__title">
<View className="coupon-right">
<View className="coupon-info">
<View className="coupon-title">
{title || (type === 1 ? '满减券' : type === 2 ? '折扣券' : '免费券')}
</View>
<View className="coupon-card__validity">
<View className="coupon-validity">
{getValidityText()}
</View>
</View>
{/* 按钮区域 */}
<View className="coupon-card__action">
<View className="coupon-actions">
{showReceiveBtn && status === 0 && (
<Button
className="coupon-card__btn coupon-card__btn--receive"
className={`coupon-btn ${themeClass}`}
size="small"
onClick={onReceive}
>
@@ -140,7 +147,7 @@ const CouponCard: React.FC<CouponCardProps> = ({
)}
{showUseBtn && status === 0 && (
<Button
className="coupon-card__btn coupon-card__btn--use"
className={`coupon-btn ${themeClass}`}
size="small"
onClick={onUse}
>
@@ -148,7 +155,7 @@ const CouponCard: React.FC<CouponCardProps> = ({
</Button>
)}
{status !== 0 && (
<View className="coupon-card__status">
<View className="status-text">
{getStatusText()}
</View>
)}
@@ -157,8 +164,10 @@ const CouponCard: React.FC<CouponCardProps> = ({
{/* 状态遮罩 */}
{status !== 0 && (
<View className="coupon-card__mask">
<Text className="coupon-card__mask-text">{getStatusText()}</Text>
<View className="status-overlay">
<Text className="status-badge">
{getStatusText()}
</Text>
</View>
)}
</View>