feat(theme): 实现主题切换系统并优化经销商相关页面

- 新增主题切换系统,支持智能主题和手动选择
- 更新经销商首页、团队、订单、提现等页面样式
- 添加主题相关的Hook和样式工具函数
- 优化部分组件样式以适配新主题
This commit is contained in:
2025-08-19 00:08:26 +08:00
parent 8efeb9a5bd
commit 9d9762ef17
23 changed files with 739 additions and 264 deletions

View File

@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import { View, Text } from '@tarojs/components'
import { Button, Popup, Radio, RadioGroup, Divider } from '@nutui/nutui-react-taro'
import { Filter, Close } from '@nutui/icons-react-taro'
import React, {useState} from 'react'
import {View, Text} from '@tarojs/components'
import {Button, Popup, Radio, RadioGroup, Divider} from '@nutui/nutui-react-taro'
import {Filter, Close} from '@nutui/icons-react-taro'
export interface CouponFilterProps {
/** 是否显示筛选器 */
@@ -20,41 +20,41 @@ export interface CouponFilterProps {
}
const CouponFilter: React.FC<CouponFilterProps> = ({
visible,
filters,
onFiltersChange,
onClose
}) => {
visible,
filters,
onFiltersChange,
onClose
}) => {
const [tempFilters, setTempFilters] = useState(filters)
// 优惠券类型选项
const typeOptions = [
{ label: '全部类型', value: '' },
{ label: '满减券', value: '10' },
{ label: '折扣券', value: '20' },
{ label: '免费券', value: '30' }
{label: '全部类型', value: ''},
{label: '满减券', value: '10'},
{label: '折扣券', value: '20'},
{label: '免费券', value: '30'}
]
// 最低金额选项
const minAmountOptions = [
{ label: '不限', value: '' },
{ label: '10元以上', value: '10' },
{ label: '50元以上', value: '50' },
{ label: '100元以上', value: '100' },
{ label: '200元以上', value: '200' }
{label: '不限', value: ''},
{label: '10元以上', value: '10'},
{label: '50元以上', value: '50'},
{label: '100元以上', value: '100'},
{label: '200元以上', value: '200'}
]
// 排序选项
const sortOptions = [
{ label: '创建时间', value: 'createTime' },
{ label: '优惠金额', value: 'amount' },
{ label: '到期时间', value: 'expireTime' }
{label: '创建时间', value: 'createTime'},
{label: '优惠金额', value: 'amount'},
{label: '到期时间', value: 'expireTime'}
]
// 排序方向选项
const sortOrderOptions = [
{ label: '升序', value: 'asc' },
{ label: '降序', value: 'desc' }
{label: '升序', value: 'asc'},
{label: '降序', value: 'desc'}
]
// 重置筛选条件
@@ -86,17 +86,17 @@ const CouponFilter: React.FC<CouponFilterProps> = ({
<Popup
visible={visible}
position="right"
style={{ width: '80%', height: '100%' }}
style={{width: '80%', height: '100%'}}
>
<View className="h-full flex flex-col">
{/* 头部 */}
<View className="flex items-center justify-between p-4 border-b border-gray-100">
<View className="flex items-center">
<Filter size="20" className="text-gray-600 mr-2" />
<Filter size="20" className="text-gray-600 mr-2"/>
<Text className="text-lg font-semibold"></Text>
</View>
<View onClick={onClose}>
<Close size="20" className="text-gray-600" />
<Close size="20" className="text-gray-600"/>
</View>
</View>
@@ -109,7 +109,7 @@ const CouponFilter: React.FC<CouponFilterProps> = ({
</Text>
<RadioGroup
value={tempFilters.type?.[0]?.toString() || ''}
onChange={(value) => {
onChange={(value: any) => {
updateTempFilters('type', value ? [parseInt(value)] : [])
}}
>
@@ -121,7 +121,7 @@ const CouponFilter: React.FC<CouponFilterProps> = ({
</RadioGroup>
</View>
<Divider />
<Divider/>
{/* 最低消费金额 */}
<View className="mb-6">
@@ -130,7 +130,7 @@ const CouponFilter: React.FC<CouponFilterProps> = ({
</Text>
<RadioGroup
value={tempFilters.minAmount?.toString() || ''}
onChange={(value) => {
onChange={(value: any) => {
updateTempFilters('minAmount', value ? parseInt(value) : undefined)
}}
>
@@ -142,7 +142,7 @@ const CouponFilter: React.FC<CouponFilterProps> = ({
</RadioGroup>
</View>
<Divider />
<Divider/>
{/* 排序方式 */}
<View className="mb-6">
@@ -161,7 +161,7 @@ const CouponFilter: React.FC<CouponFilterProps> = ({
</RadioGroup>
</View>
<Divider />
<Divider/>
{/* 排序方向 */}
<View className="mb-6">

View File

@@ -77,9 +77,6 @@ const CouponList: React.FC<CouponListProps> = ({
scrollX
className="flex p-4 gap-2 overflow-x-auto"
showScrollbar={false}
style={{
WebkitOverflowScrolling: 'touch'
}}
>
{coupons.map((coupon, index) => (
<View

View File

@@ -7,9 +7,10 @@ interface FixedButtonProps {
onClick?: () => void;
icon?: React.ReactNode;
disabled?: boolean;
background?: string;
}
function FixedButton({text, onClick, icon, disabled}: FixedButtonProps) {
function FixedButton({text, onClick, icon, disabled, background}: FixedButtonProps) {
return (
<>
{/* 底部安全区域占位 */}
@@ -17,7 +18,10 @@ function FixedButton({text, onClick, icon, disabled}: FixedButtonProps) {
<View
className="fixed z-50 bottom-0 left-0 right-0 bg-white border-t border-gray-200 px-4 py-3 safe-area-bottom">
<Button
type="success"
type="primary"
style={{
background
}}
size="large"
block
icon={icon}

View File

@@ -46,7 +46,7 @@ const GradientThemeSelector: React.FC<GradientThemeSelectorProps> = ({
}}
>
<View className="w-full h-full flex items-center justify-center">
<Text className="text-white text-xs font-bold drop-shadow-sm">
<Text className="text-white text-xs font-bold">
</Text>
</View>