|
|
@ -1,7 +1,6 @@ |
|
|
|
import {useState} from "react"; |
|
|
|
import Taro, {useDidShow} from '@tarojs/taro' |
|
|
|
import { |
|
|
|
Button, |
|
|
|
Empty, |
|
|
|
ConfigProvider, |
|
|
|
InfiniteLoading, |
|
|
@ -10,7 +9,6 @@ import { |
|
|
|
Tabs, |
|
|
|
TabPane |
|
|
|
} from '@nutui/nutui-react-taro' |
|
|
|
import {Gift} from '@nutui/icons-react-taro' |
|
|
|
import {View} from '@tarojs/components' |
|
|
|
import {ShopCoupon} from "@/api/shop/shopCoupon/model"; |
|
|
|
import {pageShopCoupon} from "@/api/shop/shopCoupon"; |
|
|
@ -279,7 +277,7 @@ const CouponReceiveCenter = () => { |
|
|
|
}); |
|
|
|
|
|
|
|
return ( |
|
|
|
<ConfigProvider className={'pt-3'}> |
|
|
|
<ConfigProvider className="h-screen flex flex-col"> |
|
|
|
{/* Tab切换 */} |
|
|
|
<View className="bg-white hidden"> |
|
|
|
<Tabs value={activeTab} onChange={handleTabChange}> |
|
|
@ -294,63 +292,60 @@ const CouponReceiveCenter = () => { |
|
|
|
</Tabs> |
|
|
|
</View> |
|
|
|
|
|
|
|
{/* 优惠券列表 */} |
|
|
|
<PullToRefresh |
|
|
|
onRefresh={handleRefresh} |
|
|
|
headHeight={60} |
|
|
|
> |
|
|
|
<View style={{ height: '600px', overflowY: 'auto' }} id="coupon-scroll"> |
|
|
|
{list.length === 0 && !loading ? ( |
|
|
|
<View className="flex flex-col justify-center items-center" style={{height: '500px'}}> |
|
|
|
<Empty |
|
|
|
description="暂无可领取的优惠券" |
|
|
|
style={{backgroundColor: 'transparent'}} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
) : ( |
|
|
|
<InfiniteLoading |
|
|
|
target="coupon-scroll" |
|
|
|
hasMore={hasMore} |
|
|
|
onLoadMore={loadMore} |
|
|
|
loadingText={ |
|
|
|
<View className="flex justify-center items-center py-4"> |
|
|
|
<Loading /> |
|
|
|
<View className="ml-2">加载中...</View> |
|
|
|
</View> |
|
|
|
} |
|
|
|
loadMoreText={ |
|
|
|
<View className="text-center py-4 text-gray-500"> |
|
|
|
{list.length === 0 ? "暂无数据" : "没有更多了"} |
|
|
|
</View> |
|
|
|
} |
|
|
|
{/* 优惠券列表 - 占满剩余空间 */} |
|
|
|
<View className="flex-1 overflow-hidden"> |
|
|
|
<PullToRefresh |
|
|
|
onRefresh={handleRefresh} |
|
|
|
headHeight={60} |
|
|
|
> |
|
|
|
<View |
|
|
|
style={{ |
|
|
|
height: 'calc(100vh - 60px)', |
|
|
|
overflowY: 'auto', |
|
|
|
paddingTop: '24px', |
|
|
|
paddingBottom: '32px' |
|
|
|
}} |
|
|
|
id="coupon-scroll" |
|
|
|
> |
|
|
|
<CouponList |
|
|
|
coupons={list.map(transformCouponData)} |
|
|
|
showEmpty={false} |
|
|
|
/> |
|
|
|
</InfiniteLoading> |
|
|
|
)} |
|
|
|
</View> |
|
|
|
</PullToRefresh> |
|
|
|
|
|
|
|
{/* 底部提示 */} |
|
|
|
{list.length === 0 && !loading && ( |
|
|
|
<View className="text-center py-8"> |
|
|
|
<View className="text-gray-400 mb-4"> |
|
|
|
<Gift size="48" /> |
|
|
|
</View> |
|
|
|
<View className="text-gray-500 mb-2">暂无可领取的优惠券</View> |
|
|
|
<View className="flex gap-2 justify-center"> |
|
|
|
<Button |
|
|
|
size="small" |
|
|
|
type="primary" |
|
|
|
onClick={handleViewMyCoupons} |
|
|
|
> |
|
|
|
查看我的优惠券 |
|
|
|
</Button> |
|
|
|
{list.length === 0 && !loading ? ( |
|
|
|
<View className="flex flex-col justify-center items-center h-full"> |
|
|
|
<Empty |
|
|
|
description="暂无可领取的优惠券" |
|
|
|
style={{backgroundColor: 'transparent'}} |
|
|
|
actions={[ |
|
|
|
{ |
|
|
|
text: '查看我的优惠券', |
|
|
|
onClick: handleViewMyCoupons |
|
|
|
} |
|
|
|
]} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
) : ( |
|
|
|
<InfiniteLoading |
|
|
|
target="coupon-scroll" |
|
|
|
hasMore={hasMore} |
|
|
|
onLoadMore={loadMore} |
|
|
|
loadingText={ |
|
|
|
<View className="flex justify-center items-center py-4"> |
|
|
|
<Loading /> |
|
|
|
<View className="ml-2">加载中...</View> |
|
|
|
</View> |
|
|
|
} |
|
|
|
loadMoreText={ |
|
|
|
<View className="text-center py-4 text-gray-500"> |
|
|
|
{list.length === 0 ? "暂无数据" : "没有更多了"} |
|
|
|
</View> |
|
|
|
} |
|
|
|
> |
|
|
|
<CouponList |
|
|
|
coupons={list.map(transformCouponData)} |
|
|
|
showEmpty={false} |
|
|
|
/> |
|
|
|
</InfiniteLoading> |
|
|
|
)} |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
</PullToRefresh> |
|
|
|
</View> |
|
|
|
|
|
|
|
{/* 使用指南弹窗 */} |
|
|
|
<CouponGuide |
|
|
|