refactor(shop): 重构优惠券和礼品卡相关功能
- 优化了优惠券和礼品卡的搜索功能 - 重新设计了统计卡片的样式和布局- 改进了优惠券和礼品卡的领取和兑换流程 - 统一了图标样式和大小 - 调整了部分组件的显示逻辑
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {useState} from "react";
|
||||
import Taro, {useDidShow} from '@tarojs/taro'
|
||||
import {Button, Empty, ConfigProvider, InfiniteLoading, Loading, PullToRefresh, Tabs, TabPane} from '@nutui/nutui-react-taro'
|
||||
import {Gift, Plus, Board, QrCode} from '@nutui/icons-react-taro'
|
||||
import {Button, Empty, ConfigProvider,SearchBar, InfiniteLoading, Loading, PullToRefresh, Tabs, TabPane} from '@nutui/nutui-react-taro'
|
||||
import {Gift, Retweet, Board, QrCode} from '@nutui/icons-react-taro'
|
||||
import {View} from '@tarojs/components'
|
||||
import {ShopGift} from "@/api/shop/shopGift/model";
|
||||
import {getUserGifts} from "@/api/shop/shopGift";
|
||||
@@ -14,7 +14,7 @@ const GiftCardManage = () => {
|
||||
const [list, setList] = useState<ShopGift[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
// const [searchValue, setSearchValue] = useState('')
|
||||
const [searchValue, setSearchValue] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
// const [total, setTotal] = useState(0)
|
||||
const [activeTab, setActiveTab] = useState('0') // 0-可用 1-已使用 2-已过期
|
||||
@@ -97,10 +97,10 @@ const GiftCardManage = () => {
|
||||
}
|
||||
|
||||
// 搜索功能
|
||||
// const handleSearch = (value: string) => {
|
||||
// setSearchValue(value)
|
||||
// reload(true)
|
||||
// }
|
||||
const handleSearch = (value: string) => {
|
||||
setSearchValue(value)
|
||||
reload(true)
|
||||
}
|
||||
|
||||
// 下拉刷新
|
||||
const handleRefresh = async () => {
|
||||
@@ -272,10 +272,19 @@ const GiftCardManage = () => {
|
||||
{/* 搜索栏和功能入口 */}
|
||||
<View className="bg-white px-4 py-3">
|
||||
<View className="flex items-center justify-between gap-3">
|
||||
<View className="flex-1 hidden">
|
||||
<SearchBar
|
||||
placeholder="搜索"
|
||||
value={searchValue}
|
||||
className={'border'}
|
||||
onChange={setSearchValue}
|
||||
onSearch={handleSearch}
|
||||
/>
|
||||
</View>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon={<Plus />}
|
||||
icon={<Retweet />}
|
||||
onClick={handleRedeemGift}
|
||||
>
|
||||
兑换
|
||||
|
||||
Reference in New Issue
Block a user